Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playback 2024: Fix indicator color in EoY 2024 Stories #2368

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ class EndOfYear2023StoriesModel: StoryModel {
var stories = [EndOfYear2023Story]()
var data = EndOfYear2023StoriesData()

var indicatorColor: Color {
.white
}

required init() {}

func populate(with dataManager: DataManager) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ class EndOfYear2024StoriesModel: StoryModel {
var stories = [EndOfYear2024Story]()
var data = EndOfYear2024StoriesData()

var indicatorColor: Color {
.black
}

required init() { }

func populate(with dataManager: DataManager) {
Expand Down
1 change: 1 addition & 0 deletions podcasts/End of Year/EndOfYearStoriesBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,5 @@ protocol StoryModel {
func overlaidShareView() -> AnyView?
/// Shown at the bottom of the story as an additional safe area
func footerShareView() -> AnyView?
var indicatorColor: Color { get }
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ class EndOfYearStoriesDataSource: StoriesDataSource {
func footerShareView() -> AnyView? {
model.footerShareView()
}

var indicatorColor: Color {
model.indicatorColor
}
}

extension Array where Element: CaseIterable & Equatable {
Expand Down
2 changes: 2 additions & 0 deletions podcasts/End of Year/StoriesDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ protocol StoriesDataSource {
func overlaidShareView() -> AnyView?
/// Shown at the bottom of the story as an additional safe area
func footerShareView() -> AnyView?

var indicatorColor: Color { get }
}

extension StoriesDataSource {
Expand Down
4 changes: 4 additions & 0 deletions podcasts/End of Year/StoriesModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ class StoriesModel: ObservableObject {
func footerShareView() -> AnyView? {
dataSource.footerShareView()
}

var indicatorColor: Color {
dataSource.indicatorColor
}
}

private extension StoriesModel {
Expand Down
3 changes: 2 additions & 1 deletion podcasts/End of Year/Views/StoriesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ struct StoriesView: View {
}

header
.foregroundStyle(model.indicatorColor)

// Hide the share button if needed
if model.showShareButton(index: model.currentStoryIndex) && !model.shouldShowUpsell(), let shareView = model.overlaidShareView() {
Expand Down Expand Up @@ -256,8 +257,8 @@ private struct CloseButtonStyle: ButtonStyle {

func makeBody(configuration: Configuration) -> some View {
Image("eoy-close")
.renderingMode(.template)
.font(style: .body, maxSizeCategory: .extraExtraExtraLarge)
.foregroundColor(.white)
.padding(Constants.closeButtonPadding)
.background(showButtonShapes ? Color.white.opacity(0.2) : nil)
.cornerRadius(Constants.closeButtonRadius)
Expand Down
4 changes: 2 additions & 2 deletions podcasts/End of Year/Views/StoryIndicator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ struct StoryIndicator: View {
GeometryReader { geometry in
ZStack(alignment: .leading) {
Rectangle()
.foregroundColor(Color.white.opacity(Constants.storyIndicatorBackgroundOpacity))
.opacity(Constants.storyIndicatorBackgroundOpacity)
.cornerRadius(Constants.storyIndicatorBorderRadius)

Rectangle()
.frame(width: geometry.size.width * (model.progress - CGFloat(index)).clamped(to: 0.0 ..< 1.0), height: nil, alignment: .leading)
.foregroundColor(Color.white.opacity(Constants.storyIndicatorForegroundOpacity))
.opacity(Constants.storyIndicatorForegroundOpacity)
.cornerRadius(Constants.storyIndicatorBorderRadius)
}
}
Expand Down