-
Notifications
You must be signed in to change notification settings - Fork 136
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: add prompt #377
Merged
Merged
Changes from 11 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b90fc4c
Add end of year feature flag
leandroalonso c1c1f16
Add end of year modal
leandroalonso 9eecd98
Show a bottom sheet if the feature flag is enabled
leandroalonso a270300
Move View to views folder
leandroalonso 3142e08
Disable code coverage to fix SwiftUI previews
leandroalonso 501fb85
Add modal content
leandroalonso 1b698e1
Rename showIfAvailable to showPrompt
leandroalonso af1c98f
Fix file name and add method to show stories
leandroalonso 1e0d2a6
Extract EndOfYear to its own var and add method to show stories
leandroalonso e45e882
Add option to navigate to stories
leandroalonso 2b97151
Present full screen VC when tapping on see 2022
leandroalonso d808c5e
Add comment on the end of year feature flag
leandroalonso 6be2e99
Remove double space
leandroalonso File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import SwiftUI | ||
import MaterialComponents.MaterialBottomSheet | ||
|
||
struct EndOfYear { | ||
func showPrompt(in viewController: UIViewController) { | ||
guard FeatureFlag.endOfYear else { | ||
return | ||
} | ||
|
||
let endfOfYearModalViewController = UIHostingController(rootView: EndOfYearModal().environmentObject(Theme.sharedTheme)) | ||
let bottomSheet = MDCBottomSheetController(contentViewController: endfOfYearModalViewController) | ||
viewController.present(bottomSheet, animated: true, completion: nil) | ||
} | ||
|
||
func showStories(in viewController: UIViewController) { | ||
guard FeatureFlag.endOfYear else { | ||
return | ||
} | ||
|
||
let storiesViewController = UIViewController() | ||
storiesViewController.view.backgroundColor = .systemBackground | ||
storiesViewController.modalPresentationStyle = .fullScreen | ||
viewController.present(storiesViewController, animated: true, completion: nil) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import SwiftUI | ||
|
||
struct EndOfYearModal: View { | ||
@EnvironmentObject var theme: Theme | ||
|
||
@Environment(\.presentationMode) var presentationMode | ||
|
||
var body: some View { | ||
VStack(alignment: .center, spacing: 20) { | ||
Text("Your Year in Podcasts").font(.title3) | ||
Text("See your top podcasts, categories, listening stats, and more. Share with friends and shout out your favorite creators!") | ||
.multilineTextAlignment(.center) | ||
|
||
Button(action: { | ||
presentationMode.wrappedValue.dismiss() | ||
NavigationManager.sharedManager.navigateTo(NavigationManager.endOfYearStories, data: nil) | ||
}) { | ||
HStack { | ||
Spacer() | ||
Text("View My 2022") | ||
Spacer() | ||
} | ||
} | ||
.textStyle(RoundedButton()) | ||
.contentShape(Rectangle()) | ||
|
||
|
||
leandroalonso marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Button(action: { | ||
presentationMode.wrappedValue.dismiss() | ||
}) { | ||
HStack { | ||
Spacer() | ||
Text("Not Now") | ||
Spacer() | ||
} | ||
} | ||
.textStyle(RoundedButton()) | ||
.contentShape(Rectangle()) | ||
} | ||
.padding() | ||
.applyDefaultThemeOptions() | ||
} | ||
} | ||
|
||
struct EndOfYearModal_Previews: PreviewProvider { | ||
static var previews: some View { | ||
EndOfYearModal() | ||
.environmentObject(Theme(previewTheme: .light)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to add this to make SwiftUI previews work. π€·
More details on the commit: 3142e08