diff --git a/CHANGELOG.md b/CHANGELOG.md index 6de4a28af..71061e8d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added the Display Name onboarding screen. Currently behind the “New Onboarding Flow” feature flag. [#1597](https://github.com/planetary-social/nos/issues/1597) - Added the Username onboarding screen. Currently behind the “New Onboarding Flow” feature flag. [#1598](https://github.com/planetary-social/nos/issues/1598) - Added the Account Success onboarding screen. Currently behind the “New Onboarding Flow” feature flag. [#1599](https://github.com/planetary-social/nos/issues/1599) +- Updated the Age Verification onboarding screen. Currently behind the “New Onboarding Flow” feature flag. [#1651](https://github.com/planetary-social/nos/issues/1651) ## [0.2.2] - 2024-10-11Z diff --git a/Nos.xcodeproj/project.pbxproj b/Nos.xcodeproj/project.pbxproj index faddbb204..26438ad0c 100644 --- a/Nos.xcodeproj/project.pbxproj +++ b/Nos.xcodeproj/project.pbxproj @@ -100,6 +100,7 @@ 039C96292C48321E00A8EB39 /* long_form_data.json in Resources */ = {isa = PBXBuildFile; fileRef = 039C96282C48321E00A8EB39 /* long_form_data.json */; }; 039F09592CC051FF00FEEC81 /* CreateAccountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 039F09582CC051EE00FEEC81 /* CreateAccountView.swift */; }; 03A241BD2CC2F458007EA31B /* AccountSuccessView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03A241BC2CC2F458007EA31B /* AccountSuccessView.swift */; }; + 03A241D32CC3056F007EA31B /* AgeVerificationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03A241D22CC3056F007EA31B /* AgeVerificationView.swift */; }; 03A3AA3B2C5028FF008FE153 /* PublicKeyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03A3AA3A2C5028FF008FE153 /* PublicKeyTests.swift */; }; 03A743452CC048C700893CAE /* GoToFeedTip.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03A743442CC048C700893CAE /* GoToFeedTip.swift */; }; 03B4E6A22C125CA1006E5F59 /* nostr_build_nip96_upload_response.json in Resources */ = {isa = PBXBuildFile; fileRef = 03B4E6A12C125CA1006E5F59 /* nostr_build_nip96_upload_response.json */; }; @@ -660,6 +661,7 @@ 039C96282C48321E00A8EB39 /* long_form_data.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = long_form_data.json; sourceTree = ""; }; 039F09582CC051EE00FEEC81 /* CreateAccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateAccountView.swift; sourceTree = ""; }; 03A241BC2CC2F458007EA31B /* AccountSuccessView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountSuccessView.swift; sourceTree = ""; }; + 03A241D22CC3056F007EA31B /* AgeVerificationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AgeVerificationView.swift; sourceTree = ""; }; 03A3AA3A2C5028FF008FE153 /* PublicKeyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublicKeyTests.swift; sourceTree = ""; }; 03A743442CC048C700893CAE /* GoToFeedTip.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoToFeedTip.swift; sourceTree = ""; }; 03AB2F7D2BF6609500B73DB1 /* UnitTests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = UnitTests.xctestplan; sourceTree = ""; }; @@ -1485,6 +1487,7 @@ isa = PBXGroup; children = ( 03A241BC2CC2F458007EA31B /* AccountSuccessView.swift */, + 03A241D22CC3056F007EA31B /* AgeVerificationView.swift */, 030FECAA2CB5E0B900820014 /* BuildYourNetworkView.swift */, 039F09582CC051EE00FEEC81 /* CreateAccountView.swift */, 030E570C2CC2A05B00A4A51E /* DisplayNameView.swift */, @@ -2531,6 +2534,7 @@ C9CF23172A38A58B00EBEC31 /* ParseQueue.swift in Sources */, C98A32272A05795E00E3FA13 /* Task+Timeout.swift in Sources */, 030036AB2C5D872B002C71F5 /* NewNotesButton.swift in Sources */, + 03A241D32CC3056F007EA31B /* AgeVerificationView.swift in Sources */, C9B708BB2A13BE41006C613A /* NoteTextEditor.swift in Sources */, C9E37E0F2A1E7C32003D4B0A /* ReportMenuModifier.swift in Sources */, C95D68A5299E6E1E00429F86 /* PlaceholderModifier.swift in Sources */, diff --git a/Nos/Assets/Localization/Localizable.xcstrings b/Nos/Assets/Localization/Localizable.xcstrings index 2a60ef405..356c873ca 100644 --- a/Nos/Assets/Localization/Localizable.xcstrings +++ b/Nos/Assets/Localization/Localizable.xcstrings @@ -1046,6 +1046,30 @@ } } }, + "ageVerificationDescription" : { + "comment" : "description for the age verification screen in onboarding", + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "For legal reasons, we need to make sure you're over this age to use Nos." + } + } + } + }, + "ageVerificationHeadline" : { + "comment" : "headline for the age verification screen in onboarding", + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Are you over 16 years old?" + } + } + } + }, "ageVerificationSubtitle" : { "extractionState" : "manual", "localizations" : { diff --git a/Nos/Views/Onboarding/AgeVerificationView.swift b/Nos/Views/Onboarding/AgeVerificationView.swift new file mode 100644 index 000000000..01253d57e --- /dev/null +++ b/Nos/Views/Onboarding/AgeVerificationView.swift @@ -0,0 +1,56 @@ +import SwiftUI + +/// The Age Verification view in the onboarding. +struct AgeVerificationView: View { + @Environment(OnboardingState.self) private var state + + var body: some View { + ZStack { + Color.appBg + .ignoresSafeArea() + ViewThatFits(in: .vertical) { + ageVerificationStack + + ScrollView { + ageVerificationStack + } + } + } + .navigationBarHidden(true) + } + + var ageVerificationStack: some View { + VStack(alignment: .leading, spacing: 20) { + Text("🪪") + .font(.system(size: 60)) + Text("ageVerificationHeadline") + .font(.clarityBold(.title)) + .foregroundStyle(Color.primaryTxt) + .fixedSize(horizontal: false, vertical: true) + Text("ageVerificationDescription") + .foregroundStyle(Color.secondaryTxt) + .fixedSize(horizontal: false, vertical: true) + Spacer() + HStack { + BigActionButton("no") { + state.step = .notOldEnough + } + Spacer(minLength: 16) + BigActionButton("yes") { @MainActor in + if state.flow == .loginToExistingAccount { + state.step = .login + } else { + state.step = .createAccount + } + } + } + } + .padding(40) + .readabilityPadding() + } +} + +#Preview { + AgeVerificationView() + .environment(OnboardingState()) +} diff --git a/Nos/Views/Onboarding/DisplayNameView.swift b/Nos/Views/Onboarding/DisplayNameView.swift index 946c2a1cc..92af67a85 100644 --- a/Nos/Views/Onboarding/DisplayNameView.swift +++ b/Nos/Views/Onboarding/DisplayNameView.swift @@ -61,6 +61,7 @@ struct DisplayNameView: View { BigActionButton("next") { await save() } + .disabled(displayName.isEmpty) } .padding(40) .readabilityPadding() diff --git a/Nos/Views/Onboarding/OnboardingView.swift b/Nos/Views/Onboarding/OnboardingView.swift index 4b23be2ae..140f0e74e 100644 --- a/Nos/Views/Onboarding/OnboardingView.swift +++ b/Nos/Views/Onboarding/OnboardingView.swift @@ -1,3 +1,4 @@ +import Dependencies import SwiftUI /// The state of onboarding, tracking the flow, steps, and success or failure of a few specific tasks. @@ -44,7 +45,9 @@ enum OnboardingStep { /// The view that initializes the onboarding navigation stack and shows the first view. struct OnboardingView: View { @State var state = OnboardingState() - + + @Dependency(\.featureFlags) private var featureFlags + /// Completion to be called when all onboarding steps are complete let completion: @MainActor () -> Void @@ -58,8 +61,13 @@ struct OnboardingView: View { OnboardingStartView() .environment(state) case .ageVerification: - OnboardingAgeVerificationView() - .environment(state) + if featureFlags.isEnabled(.newOnboardingFlow) { + AgeVerificationView() + .environment(state) + } else { + OnboardingAgeVerificationView() + .environment(state) + } case .notOldEnough: OnboardingNotOldEnoughView() .environment(state)