Skip to content

Commit

Permalink
Merge pull request #1623 from planetary-social/tos-privacy
Browse files Browse the repository at this point in the history
#1593: Update onboarding start screen to new design with TOS and Privacy Policy
  • Loading branch information
joshuatbrown authored Oct 15, 2024
2 parents 58002ca + 11cdd90 commit 5c5854d
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 321 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added a broken link icon that appears when an image fails to load. [#1583](https://github.com/planetary-social/nos/issues/1583)
- Added new translations for the app so you can use it in Korean, Chinese Simplified, Swedish, and more! Thanks to alternative, 안마리 (everyscreennetwork), Andypsl8, Dženan (Dzenan), ObjectifMoon, ra5pvt1n, and everyone else who contributed translations on Crowdin!
- Updated user mentions search functionality to also search relays in the user's relay list. [#1560](https://github.com/planetary-social/nos/issues/1560)
- Updated initial onboarding screen to include links to Terms of Service and Privacy Policy. [#1593](https://github.com/planetary-social/nos/issues/1593)
- Added Build Your Network screen to onboarding to explain how the feed works. [#1600](https://github.com/planetary-social/nos/issues/1600)
- Decreased the opacity on disabled buttons.
- Added a Delete Account button to the Settings screen. [#80](https://github.com/planetary-social/nos/issues/80)
Expand Down
4 changes: 0 additions & 4 deletions Nos.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@
3F30020529C1FDD9003D4F8B /* OnboardingStartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F30020429C1FDD9003D4F8B /* OnboardingStartView.swift */; };
3F30020729C237AB003D4F8B /* OnboardingAgeVerificationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F30020629C237AB003D4F8B /* OnboardingAgeVerificationView.swift */; };
3F30020929C23895003D4F8B /* OnboardingNotOldEnoughView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F30020829C23895003D4F8B /* OnboardingNotOldEnoughView.swift */; };
3F30020B29C361C8003D4F8B /* OnboardingTermsOfServiceView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F30020A29C361C8003D4F8B /* OnboardingTermsOfServiceView.swift */; };
3F30020D29C382EB003D4F8B /* OnboardingLoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F30020C29C382EB003D4F8B /* OnboardingLoginView.swift */; };
3F43C47629A9625700E896A0 /* AuthorReference+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F43C47529A9625700E896A0 /* AuthorReference+CoreDataClass.swift */; };
3F60F42929B27D3E000D62C4 /* ThreadView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F60F42829B27D3E000D62C4 /* ThreadView.swift */; };
Expand Down Expand Up @@ -693,7 +692,6 @@
3F30020429C1FDD9003D4F8B /* OnboardingStartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingStartView.swift; sourceTree = "<group>"; };
3F30020629C237AB003D4F8B /* OnboardingAgeVerificationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingAgeVerificationView.swift; sourceTree = "<group>"; };
3F30020829C23895003D4F8B /* OnboardingNotOldEnoughView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingNotOldEnoughView.swift; sourceTree = "<group>"; };
3F30020A29C361C8003D4F8B /* OnboardingTermsOfServiceView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingTermsOfServiceView.swift; sourceTree = "<group>"; };
3F30020C29C382EB003D4F8B /* OnboardingLoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingLoginView.swift; sourceTree = "<group>"; };
3F43C47529A9625700E896A0 /* AuthorReference+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AuthorReference+CoreDataClass.swift"; sourceTree = "<group>"; };
3F60F42829B27D3E000D62C4 /* ThreadView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreadView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1483,7 +1481,6 @@
3F30020C29C382EB003D4F8B /* OnboardingLoginView.swift */,
3F30020829C23895003D4F8B /* OnboardingNotOldEnoughView.swift */,
3F30020429C1FDD9003D4F8B /* OnboardingStartView.swift */,
3F30020A29C361C8003D4F8B /* OnboardingTermsOfServiceView.swift */,
3FB5E650299D28A200386527 /* OnboardingView.swift */,
);
path = Onboarding;
Expand Down Expand Up @@ -2311,7 +2308,6 @@
C98DC9BB2A795CAD004E5F0F /* ActionBanner.swift in Sources */,
038863DE2C6FF51500B09797 /* ZoomableContainer.swift in Sources */,
C9F204802AE029D90029A858 /* AppDestination.swift in Sources */,
3F30020B29C361C8003D4F8B /* OnboardingTermsOfServiceView.swift in Sources */,
C9C5475B2A4F1D8C006B0741 /* NosNotification+CoreDataProperties.swift in Sources */,
C98B8B4029FBF83B009789C8 /* NotificationCard.swift in Sources */,
5B834F672A83FB5C000C1432 /* ProfileKnownFollowersView.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion Nos/AppController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import Logger
}

func configureCurrentState() {
currentState = currentUser.keyPair == nil ? .onboarding : .loggedIn
Task { @MainActor in
currentState = currentUser.keyPair == nil ? .onboarding : .loggedIn
let signedInAuthor = currentUser.author
if currentState == .loggedIn, let signedInAuthor, signedInAuthor.lastUpdatedContactList == nil {
router.selectedTab = .discover
Expand Down
150 changes: 28 additions & 122 deletions Nos/Assets/Localization/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,18 @@
}
}
},
"acceptTermsAndPrivacy" : {
"comment" : "Text with links for accepting the terms and privacy policy",
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "By proceeding, I accept the [Terms of Service](https://nos.social/terms-of-service) and the [Privacy Policy](https://nos.social/privacy)"
}
}
}
},
"accountsIFollow" : {
"extractionState" : "manual",
"localizations" : {
Expand Down Expand Up @@ -10553,67 +10565,14 @@
}
}
},
"loginWithKey" : {
"logInWithAccount" : {
"comment" : "Button title for logging in with an existing account",
"extractionState" : "manual",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Mit Schlüssel anmelden"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Login with key"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Iniciar sesión con clave"
}
},
"fa" : {
"stringUnit" : {
"state" : "translated",
"value" : "ورود با کلید"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Se connecter avec une clé"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
"value" : "키로 로그인하기"
}
},
"sv" : {
"stringUnit" : {
"state" : "translated",
"value" : "Logga in med nyckel"
}
},
"sw" : {
"stringUnit" : {
"state" : "translated",
"value" : "Ingia na ufunguo"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "使用密钥登录"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "使用密鑰登錄"
"value" : "Log in with my account"
}
}
}
Expand Down Expand Up @@ -12139,6 +12098,18 @@
}
}
},
"newToNostr" : {
"comment" : "Button title for starting the new account flow",
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "I'm new to Nostr"
}
}
}
},
"next" : {
"extractionState" : "manual",
"localizations" : {
Expand Down Expand Up @@ -19838,71 +19809,6 @@
}
}
},
"tryIt" : {
"extractionState" : "manual",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Jetzt ausprobieren"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Try it"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Inténtalo"
}
},
"fa" : {
"stringUnit" : {
"state" : "translated",
"value" : "امتحان کنید"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Essayer"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
"value" : "시도해봐요"
}
},
"sv" : {
"stringUnit" : {
"state" : "translated",
"value" : "Prova det"
}
},
"sw" : {
"stringUnit" : {
"state" : "translated",
"value" : "Ijaribu"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "尝试"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "嘗試"
}
}
}
},
"unfollow" : {
"extractionState" : "manual",
"localizations" : {
Expand Down Expand Up @@ -21896,7 +21802,7 @@
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "es tu nombre universal.\u2028\n\nHemos asociado tu perfil de Nostr con tu nombre universal, y hemos configurado tu nombre universal como nombre de usuario en tu perfil."
"value" : "es tu nombre universal.\n\nHemos asociado tu perfil de Nostr con tu nombre universal, y hemos configurado tu nombre universal como nombre de usuario en tu perfil."
}
},
"fa" : {
Expand Down
18 changes: 8 additions & 10 deletions Nos/Views/Components/Button/BigActionButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,13 @@ struct BigActionButtonStyle: ButtonStyle {
}
}

struct BigGradientButton_Previews: PreviewProvider {
static var previews: some View {
VStack(spacing: 20) {
BigActionButton(title: .localizable.tryIt, action: {})
.frame(width: 268)

BigActionButton(title: .localizable.tryIt, action: {})
.disabled(true)
.frame(width: 268)
}
#Preview {
VStack(spacing: 20) {
BigActionButton(title: .localizable.accept, action: {})
.frame(width: 268)

BigActionButton(title: .localizable.accept, action: {})
.disabled(true)
.frame(width: 268)
}
}
21 changes: 19 additions & 2 deletions Nos/Views/Onboarding/OnboardingAgeVerificationView.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import Dependencies
import SwiftUI

/// The Age Verification view in the onboarding.
struct OnboardingAgeVerificationView: View {
@EnvironmentObject var state: OnboardingState


@Dependency(\.crashReporting) private var crashReporting
@Dependency(\.currentUser) private var currentUser

var body: some View {
VStack {
Text(.localizable.ageVerificationTitle)
Expand All @@ -23,7 +28,19 @@ struct OnboardingAgeVerificationView: View {
}
Spacer(minLength: 15)
BigActionButton(title: .localizable.yes) {
state.step = .termsOfService
if state.flow == .loginToExistingAccount {
state.step = .login
} else {
// temporary; this will eventually move to the Create Account screen
do {
try await currentUser.createAccount()
} catch {
crashReporting.report(error)
}
// end temporary account creation

state.step = .buildYourNetwork
}
}
}
.padding(.horizontal, 24)
Expand Down
71 changes: 46 additions & 25 deletions Nos/Views/Onboarding/OnboardingStartView.swift
Original file line number Diff line number Diff line change
@@ -1,38 +1,59 @@
import SwiftUI
import Dependencies
import SwiftUI

/// The beginning of the Onboarding views which contains buttons to start creating a new account or log in.
struct OnboardingStartView: View {
@EnvironmentObject var state: OnboardingState

@Dependency(\.analytics) private var analytics

var body: some View {
VStack {
Image.nosLogo
.resizable()
.frame(width: 235.45, height: 67.1)
.padding(.top, 155)
.padding(.bottom, 10)
Text(.localizable.onboardingTitle)
.font(.custom("ClarityCity-Bold", size: 25.21))
.fontWeight(.heavy)
.foregroundStyle(LinearGradient.diagonalAccent2.blendMode(.normal))
Spacer()
BigActionButton(title: .localizable.tryIt) {
state.flow = .createAccount
state.step = .ageVerification
}
.padding(.horizontal, 24)
.padding(.bottom)
Button(String(localized: .localizable.loginWithKey)) {
state.flow = .loginToExistingAccount
state.step = .ageVerification
GeometryReader { geometry in
VStack(spacing: 30) {
Image.nosLogo
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 200)
.padding(.bottom, 40)

Image.network
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: geometry.size.width)
Spacer()

Group {
BigActionButton(title: "newToNostr") {
state.flow = .createAccount
state.step = .ageVerification
}

Button("logInWithAccount") {
state.flow = .loginToExistingAccount
state.step = .ageVerification
}
.foregroundStyle(Color.primaryTxt)

Text("acceptTermsAndPrivacy")
.foregroundStyle(Color.secondaryTxt)
.font(.footnote)
.tint(Color.primaryTxt)
.multilineTextAlignment(.center)
}
.padding(.horizontal, 40)
}
.padding(.bottom, 50)
.padding(.vertical, 40)
.background(Color.appBg)
.navigationBarHidden(true)
}
.background(Color.appBg)
.navigationBarHidden(true)
.onAppear {
analytics.startedOnboarding()
}
}
}

#Preview {
OnboardingStartView()
.environmentObject(OnboardingState())
.inject(previewData: PreviewData())
}
Loading

0 comments on commit 5c5854d

Please sign in to comment.