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

End of Year: Fix sharing logo not appearing #568

Merged
merged 2 commits into from
Dec 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion podcasts/End of Year/StoryShareableProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class StoryShareableProvider: UIActivityItemProvider {
return
}

let snapshot = ZStack {
let snapshot = StoryViewContainer {
AnyView(view)
}
.environment(\.renderForSharing, true)
Expand Down
21 changes: 16 additions & 5 deletions podcasts/End of Year/Views/StoriesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,16 @@ struct StoriesView: View {

storiesToPreload

ZStack {
StoryViewContainer {
// Manually set the zIndex order to ensure we can change the order when needed
model.story(index: model.currentStory).zIndex(3)

StoryLogoView().zIndex(4)

// By default the story switcher will appear above the story and override all
// interaction, but if the story contains interactive elements then move the
// switcher to appear behind the view to allow the story override the switcher, or
// allow the story to pass switcher events thru by controlling the allowsHitTesting
storySwitcher.zIndex(model.isInteractiveView(index: model.currentStory) ? 2 : 5)
}
.cornerRadius(Constants.storyCornerRadius)
}.cornerRadius(Constants.storyCornerRadius)

header
}
Expand Down Expand Up @@ -259,6 +256,20 @@ private struct CloseButtonStyle: ButtonStyle {
}
}

struct StoryViewContainer<Content: View>: View {
private var content: () -> Content

init(@ViewBuilder _ content: @escaping () -> Content) {
self.content = content
}
var body: some View {
ZStack {
content()
StoryLogoView().zIndex(4)
}
}
}

// MARK: - Preview Provider

struct StoriesView_Previews: PreviewProvider {
Expand Down