From 2bf43bf09567c9218355147ff2dc1229f2a1a9f8 Mon Sep 17 00:00:00 2001 From: Emily Laguna <793774+emilylaguna@users.noreply.github.com> Date: Sat, 3 Dec 2022 02:34:29 -0500 Subject: [PATCH 1/2] Adds a Story view container that includes the PC logo --- podcasts/End of Year/Views/StoriesView.swift | 21 +++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/podcasts/End of Year/Views/StoriesView.swift b/podcasts/End of Year/Views/StoriesView.swift index 15fb364726..aa75542fa1 100644 --- a/podcasts/End of Year/Views/StoriesView.swift +++ b/podcasts/End of Year/Views/StoriesView.swift @@ -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 } @@ -259,6 +256,20 @@ private struct CloseButtonStyle: ButtonStyle { } } +struct StoryViewContainer: 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 { From 871d45002857c4144f56982c0053392d45477b00 Mon Sep 17 00:00:00 2001 From: Emily Laguna <793774+emilylaguna@users.noreply.github.com> Date: Sat, 3 Dec 2022 02:34:38 -0500 Subject: [PATCH 2/2] Use the story wrapper when sharing --- podcasts/End of Year/StoryShareableProvider.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/podcasts/End of Year/StoryShareableProvider.swift b/podcasts/End of Year/StoryShareableProvider.swift index de1b6bc7e3..1cb343fc0e 100644 --- a/podcasts/End of Year/StoryShareableProvider.swift +++ b/podcasts/End of Year/StoryShareableProvider.swift @@ -37,7 +37,7 @@ class StoryShareableProvider: UIActivityItemProvider { return } - let snapshot = ZStack { + let snapshot = StoryViewContainer { AnyView(view) } .environment(\.renderForSharing, true)