Skip to content

Commit

Permalink
Merge pull request #1668 from planetary-social/onboarding-age-verific…
Browse files Browse the repository at this point in the history
…ation

#1651: Updated Age Verification in Onboarding
  • Loading branch information
joshuatbrown authored Oct 18, 2024
2 parents 8f7b510 + 59893e7 commit 9320fea
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions Nos.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -660,6 +661,7 @@
039C96282C48321E00A8EB39 /* long_form_data.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = long_form_data.json; sourceTree = "<group>"; };
039F09582CC051EE00FEEC81 /* CreateAccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateAccountView.swift; sourceTree = "<group>"; };
03A241BC2CC2F458007EA31B /* AccountSuccessView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountSuccessView.swift; sourceTree = "<group>"; };
03A241D22CC3056F007EA31B /* AgeVerificationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AgeVerificationView.swift; sourceTree = "<group>"; };
03A3AA3A2C5028FF008FE153 /* PublicKeyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublicKeyTests.swift; sourceTree = "<group>"; };
03A743442CC048C700893CAE /* GoToFeedTip.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoToFeedTip.swift; sourceTree = "<group>"; };
03AB2F7D2BF6609500B73DB1 /* UnitTests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = UnitTests.xctestplan; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1485,6 +1487,7 @@
isa = PBXGroup;
children = (
03A241BC2CC2F458007EA31B /* AccountSuccessView.swift */,
03A241D22CC3056F007EA31B /* AgeVerificationView.swift */,
030FECAA2CB5E0B900820014 /* BuildYourNetworkView.swift */,
039F09582CC051EE00FEEC81 /* CreateAccountView.swift */,
030E570C2CC2A05B00A4A51E /* DisplayNameView.swift */,
Expand Down Expand Up @@ -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 */,
Expand Down
24 changes: 24 additions & 0 deletions Nos/Assets/Localization/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -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" : {
Expand Down
56 changes: 56 additions & 0 deletions Nos/Views/Onboarding/AgeVerificationView.swift
Original file line number Diff line number Diff line change
@@ -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())
}
1 change: 1 addition & 0 deletions Nos/Views/Onboarding/DisplayNameView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ struct DisplayNameView: View {
BigActionButton("next") {
await save()
}
.disabled(displayName.isEmpty)
}
.padding(40)
.readabilityPadding()
Expand Down
14 changes: 11 additions & 3 deletions Nos/Views/Onboarding/OnboardingView.swift
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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

Expand All @@ -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)
Expand Down

0 comments on commit 9320fea

Please sign in to comment.