From 9fe275036ab1c36b745eef4ebcd29b256338a9b2 Mon Sep 17 00:00:00 2001 From: Emily Laguna <793774+emilylaguna@users.noreply.github.com> Date: Fri, 18 Nov 2022 12:48:14 -0500 Subject: [PATCH 1/4] Set environment to inform the view it's being rendered for sharing --- podcasts/End of Year/StoryShareableProvider.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/podcasts/End of Year/StoryShareableProvider.swift b/podcasts/End of Year/StoryShareableProvider.swift index 6e74596da..de1b6bc7e 100644 --- a/podcasts/End of Year/StoryShareableProvider.swift +++ b/podcasts/End of Year/StoryShareableProvider.swift @@ -40,6 +40,7 @@ class StoryShareableProvider: UIActivityItemProvider { let snapshot = ZStack { AnyView(view) } + .environment(\.renderForSharing, true) .frame(width: 370, height: 658) .snapshot() @@ -47,3 +48,14 @@ class StoryShareableProvider: UIActivityItemProvider { self.view = nil } } + +extension EnvironmentValues { + var renderForSharing: Bool { + get { self[RenderSharingKey.self] } + set { self[RenderSharingKey.self] = newValue } + } + + private struct RenderSharingKey: EnvironmentKey { + static let defaultValue: Bool = false + } +} From 19e77608eaec173e4020d0fb898b6ff9646b8c1e Mon Sep 17 00:00:00 2001 From: Emily Laguna <793774+emilylaguna@users.noreply.github.com> Date: Fri, 18 Nov 2022 12:48:25 -0500 Subject: [PATCH 2/4] Hide next text on the numbers story --- podcasts/End of Year/Stories/ListenedNumbersStory.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/podcasts/End of Year/Stories/ListenedNumbersStory.swift b/podcasts/End of Year/Stories/ListenedNumbersStory.swift index 30cb2eb16..9fc4a3a5f 100644 --- a/podcasts/End of Year/Stories/ListenedNumbersStory.swift +++ b/podcasts/End of Year/Stories/ListenedNumbersStory.swift @@ -3,6 +3,8 @@ import PocketCastsServer import PocketCastsDataModel struct ListenedNumbersStory: StoryView { + @Environment(\.renderForSharing) var renderForSharing: Bool + var duration: TimeInterval = 5.seconds let identifier: String = "number_of_podcasts_and_episodes_listened" @@ -70,7 +72,7 @@ struct ListenedNumbersStory: StoryView { .multilineTextAlignment(.center) .frame(maxHeight: geometry.size.height * 0.07) .minimumScaleFactor(0.01) - .opacity(0.8) + .opacity(renderForSharing ? 0.0 : 0.8) .padding(.bottom, geometry.size.height * 0.18) } .padding(.trailing, 40) From c2a863dd720212728c60834592f97f16e7a8670a Mon Sep 17 00:00:00 2001 From: Emily Laguna <793774+emilylaguna@users.noreply.github.com> Date: Fri, 18 Nov 2022 12:48:33 -0500 Subject: [PATCH 3/4] Hide next text for the categories story --- podcasts/End of Year/Stories/ListenedCategoriesStory.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/podcasts/End of Year/Stories/ListenedCategoriesStory.swift b/podcasts/End of Year/Stories/ListenedCategoriesStory.swift index 0fbe0c2b3..84f9c5c48 100644 --- a/podcasts/End of Year/Stories/ListenedCategoriesStory.swift +++ b/podcasts/End of Year/Stories/ListenedCategoriesStory.swift @@ -3,6 +3,7 @@ import PocketCastsServer import PocketCastsDataModel struct ListenedCategoriesStory: StoryView { + @Environment(\.renderForSharing) var renderForSharing: Bool var duration: TimeInterval = 5.seconds let listenedCategories: [ListenedCategory] @@ -40,7 +41,7 @@ struct ListenedCategoriesStory: StoryView { .multilineTextAlignment(.center) .frame(maxHeight: geometry.size.height * 0.07) .minimumScaleFactor(0.01) - .opacity(0.8) + .opacity(renderForSharing ? 0.0 : 0.8) } .padding(.trailing, 40) .padding(.leading, 40) From cb78731ecd7785f8e267d77d47b15b0c60df1efe Mon Sep 17 00:00:00 2001 From: Emily Laguna <793774+emilylaguna@users.noreply.github.com> Date: Fri, 18 Nov 2022 12:48:40 -0500 Subject: [PATCH 4/4] Hide replay button on the epilogue --- podcasts/End of Year/Stories/EpilogueStory.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/podcasts/End of Year/Stories/EpilogueStory.swift b/podcasts/End of Year/Stories/EpilogueStory.swift index f87202d26..b97607f5e 100644 --- a/podcasts/End of Year/Stories/EpilogueStory.swift +++ b/podcasts/End of Year/Stories/EpilogueStory.swift @@ -1,6 +1,7 @@ import SwiftUI struct EpilogueStory: StoryView { + @Environment(\.renderForSharing) var renderForSharing: Bool var duration: TimeInterval = 5.seconds var identifier: String = "epilogue" @@ -53,6 +54,7 @@ struct EpilogueStory: StoryView { } .buttonStyle(ReplayButtonStyle()) .padding(.top, 20) + .opacity(renderForSharing ? 0 : 1) } .padding() }