Skip to content

Commit

Permalink
Merge pull request #1656 from planetary-social/onboarding-private-key
Browse files Browse the repository at this point in the history
#1595: Private Key screen in onboarding
  • Loading branch information
joshuatbrown authored Oct 18, 2024
2 parents ad46c33 + d3cc50f commit d4ff40f
Show file tree
Hide file tree
Showing 11 changed files with 258 additions and 21 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added the Create Account onboarding screen. Currently behind the “New Onboarding Flow” feature flag. [#1594](https://github.com/planetary-social/nos/issues/1594)
- Increase build settings timeout in fastlane. [#1662](https://github.com/planetary-social/nos/pull/1662)
- Removed new moderation feature flag. [#1646](https://github.com/planetary-social/nos/issues/1646)
- Added the Private Key onboarding screen. Currently behind the “New Onboarding Flow” feature flag. [#1595](https://github.com/planetary-social/nos/issues/1595)

## [0.2.2] - 2024-10-11Z

Expand Down
8 changes: 8 additions & 0 deletions Nos.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
0383CD842C76799D007DB0E4 /* LinkView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03E181462C754BA300886CC6 /* LinkView.swift */; };
038863DE2C6FF51500B09797 /* ZoomableContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 038863DD2C6FF51500B09797 /* ZoomableContainer.swift */; };
038863DF2C6FF51500B09797 /* ZoomableContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 038863DD2C6FF51500B09797 /* ZoomableContainer.swift */; };
038EF09D2CC16D640031F7F2 /* PrivateKeyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 038EF09C2CC16D640031F7F2 /* PrivateKeyView.swift */; };
039389232CA4985C00698978 /* SDWebImageWebPCoder in Frameworks */ = {isa = PBXBuildFile; productRef = 039389222CA4985C00698978 /* SDWebImageWebPCoder */; };
0393892D2CA4987000698978 /* SDWebImageWebPCoder in Frameworks */ = {isa = PBXBuildFile; productRef = 0393892C2CA4987000698978 /* SDWebImageWebPCoder */; };
0393893D2CA49CE000698978 /* fonts-animated.gif in Resources */ = {isa = PBXBuildFile; fileRef = 0393893C2CA49CE000698978 /* fonts-animated.gif */; };
Expand All @@ -101,6 +102,7 @@
03C49AC02C938A9C00502321 /* SwiftSoup in Frameworks */ = {isa = PBXBuildFile; productRef = 03C49ABF2C938A9C00502321 /* SwiftSoup */; };
03C49AC22C938DE100502321 /* SoupOpenGraphParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03C49AC12C938DE100502321 /* SoupOpenGraphParser.swift */; };
03C49AC32C938DE100502321 /* SoupOpenGraphParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03C49AC12C938DE100502321 /* SoupOpenGraphParser.swift */; };
03C5DBC52CC19044009A9E0E /* LargeNumberView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03C5DBC42CC19044009A9E0E /* LargeNumberView.swift */; };
03C68C522C94D8400037DC59 /* SwiftSoup in Frameworks */ = {isa = PBXBuildFile; productRef = 03C68C512C94D8400037DC59 /* SwiftSoup */; };
03C7E7922CB9C0B30054624C /* WelcomeToFeedTip.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03C7E7912CB9C0AF0054624C /* WelcomeToFeedTip.swift */; };
03C7E7982CB9C16C0054624C /* InlineTipViewStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03C7E7972CB9C1600054624C /* InlineTipViewStyle.swift */; };
Expand Down Expand Up @@ -639,6 +641,7 @@
038196F62CA36797002A94E3 /* elmo-animated.webp */ = {isa = PBXFileReference; lastKnownFileType = file; path = "elmo-animated.webp"; sourceTree = "<group>"; };
038196F82CA367C4002A94E3 /* ImageAnimatedTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageAnimatedTests.swift; sourceTree = "<group>"; };
038863DD2C6FF51500B09797 /* ZoomableContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZoomableContainer.swift; sourceTree = "<group>"; };
038EF09C2CC16D640031F7F2 /* PrivateKeyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrivateKeyView.swift; sourceTree = "<group>"; };
0393893C2CA49CE000698978 /* fonts-animated.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = "fonts-animated.gif"; sourceTree = "<group>"; };
039C961E2C480F4100A8EB39 /* unsupported_kinds.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = unsupported_kinds.json; sourceTree = "<group>"; };
039C96282C48321E00A8EB39 /* long_form_data.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = long_form_data.json; sourceTree = "<group>"; };
Expand All @@ -650,6 +653,7 @@
03B4E6AB2C125D13006E5F59 /* FileStorageUploadResponseJSONTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileStorageUploadResponseJSONTests.swift; sourceTree = "<group>"; };
03B4E6AD2C125D61006E5F59 /* FileStorageUploadResponseJSON.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileStorageUploadResponseJSON.swift; sourceTree = "<group>"; };
03C49AC12C938DE100502321 /* SoupOpenGraphParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoupOpenGraphParser.swift; sourceTree = "<group>"; };
03C5DBC42CC19044009A9E0E /* LargeNumberView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LargeNumberView.swift; sourceTree = "<group>"; };
03C7E7912CB9C0AF0054624C /* WelcomeToFeedTip.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeToFeedTip.swift; sourceTree = "<group>"; };
03C7E7972CB9C1600054624C /* InlineTipViewStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InlineTipViewStyle.swift; sourceTree = "<group>"; };
03C7E7A12CB9CD0B0054624C /* PointDownEmojiTipViewStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PointDownEmojiTipViewStyle.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1459,11 +1463,13 @@
children = (
030FECAA2CB5E0B900820014 /* BuildYourNetworkView.swift */,
039F09582CC051EE00FEEC81 /* CreateAccountView.swift */,
03C5DBC42CC19044009A9E0E /* LargeNumberView.swift */,
3F30020629C237AB003D4F8B /* OnboardingAgeVerificationView.swift */,
3F30020C29C382EB003D4F8B /* OnboardingLoginView.swift */,
3F30020829C23895003D4F8B /* OnboardingNotOldEnoughView.swift */,
3F30020429C1FDD9003D4F8B /* OnboardingStartView.swift */,
3FB5E650299D28A200386527 /* OnboardingView.swift */,
038EF09C2CC16D640031F7F2 /* PrivateKeyView.swift */,
);
path = Onboarding;
sourceTree = "<group>";
Expand Down Expand Up @@ -2418,6 +2424,7 @@
5B6136382C2F408E00ADD9C3 /* RepliesLabel.swift in Sources */,
03C7E7982CB9C16C0054624C /* InlineTipViewStyle.swift in Sources */,
C9ADB13D29929B540075E7F8 /* Bech32.swift in Sources */,
03C5DBC52CC19044009A9E0E /* LargeNumberView.swift in Sources */,
C95D68A1299E6D3E00429F86 /* BioView.swift in Sources */,
5BE281CA2AE2CCEB00880466 /* HomeTab.swift in Sources */,
03C49AC22C938DE100502321 /* SoupOpenGraphParser.swift in Sources */,
Expand Down Expand Up @@ -2448,6 +2455,7 @@
C92F01582AC4D6F700972489 /* NosTextField.swift in Sources */,
C9C2B77C29E072E400548B4A /* WebSocket+Nos.swift in Sources */,
C9DEC003298945150078B43A /* String+Lorem.swift in Sources */,
038EF09D2CC16D640031F7F2 /* PrivateKeyView.swift in Sources */,
C97A1C8B29E45B4E009D9E8D /* RawEventController.swift in Sources */,
C9DEC0632989541F0078B43A /* Bundle+Current.swift in Sources */,
C93EC2F429C34C860012EE2A /* NSPredicate+Bool.swift in Sources */,
Expand Down
3 changes: 3 additions & 0 deletions Nos/Assets/Assets.xcassets/copy-icon.imageset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
20 changes: 20 additions & 0 deletions Nos/Assets/Colors.xcassets/action-tertiary.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x1B",
"green" : "0x8F",
"red" : "0xFF"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
37 changes: 37 additions & 0 deletions Nos/Assets/Localization/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -3757,6 +3757,18 @@
}
}
},
"copyPrivateKey" : {
"comment" : "title for the button that copies the private key",
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Copy private key"
}
}
}
},
"copyQRLink" : {
"extractionState" : "manual",
"localizations" : {
Expand Down Expand Up @@ -11419,6 +11431,7 @@
}
},
"next" : {
"comment" : "title for a button that moves to the next step",
"extractionState" : "manual",
"localizations" : {
"de" : {
Expand Down Expand Up @@ -14051,6 +14064,18 @@
}
}
},
"privateKeyDescription" : {
"comment" : "a description for the private key screen explaining what a private key is",
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Your private key is the only login you need for Nos. It is stored in your device keychain. Similar to a password, you should not share it. \n\n**Important!** You should save it somewhere else as well because there is no recovery mechanism if you lose your device."
}
}
}
},
"privateKeyHeadline" : {
"comment" : "headline for the private key screen in onboarding",
"extractionState" : "manual",
Expand All @@ -14063,6 +14088,18 @@
}
}
},
"privateKeyNsecParenthetical" : {
"comment" : "the word \"nsec\" in parentheses in English. \"nsec\" should not be translated, but the parentheses may",
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "(nsec)"
}
}
}
},
"privateKeyPlaceholder" : {
"extractionState" : "manual",
"localizations" : {
Expand Down
12 changes: 12 additions & 0 deletions Nos/Extensions/Font+Clarity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ extension Font {
)
}

static func clarity(
_ fontWeight: Font.Weight,
size: CGFloat,
textStyle: Font.TextStyle
) -> Font {
.custom(
fontWeight.clarityFontName,
size: size,
relativeTo: textStyle
)
}

static func clarityRegular(_ textStyle: Font.TextStyle) -> Font {
clarity(.regular, textStyle: textStyle)
}
Expand Down
53 changes: 33 additions & 20 deletions Nos/Views/Onboarding/BuildYourNetworkView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,42 @@ struct BuildYourNetworkView: View {
private let padding: CGFloat = 40

var body: some View {
GeometryReader { geometry in
VStack(alignment: .leading, spacing: 20) {
Text("🔍")
.font(.system(size: 60))
Text("buildYourNetwork")
.font(.clarityBold(.title))
.foregroundStyle(Color.primaryTxt)
Text("buildYourNetworkDescription")
.foregroundStyle(Color.secondaryTxt)
Image.network
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: geometry.size.width)
.offset(x: -padding)
Spacer()
BigActionButton("findPeople") {
completion()
ZStack {
Color.appBg
.ignoresSafeArea()
ViewThatFits(in: .vertical) {
buildYourNetworkStack

ScrollView {
buildYourNetworkStack
}
}
.padding(padding)
.background(Color.appBg)
.navigationBarHidden(true)
}
.navigationBarHidden(true)
}

var buildYourNetworkStack: some View {
VStack(alignment: .leading, spacing: 20) {
Text("🔍")
.font(.system(size: 60))
Text("buildYourNetwork")
.font(.clarityBold(.title))
.foregroundStyle(Color.primaryTxt)
.fixedSize(horizontal: false, vertical: true)
Text("buildYourNetworkDescription")
.foregroundStyle(Color.secondaryTxt)
.fixedSize(horizontal: false, vertical: true)
Image.network
.resizable()
.aspectRatio(contentMode: .fit)
.padding(.horizontal, -padding)
Spacer()
BigActionButton("findPeople") { @MainActor in
completion()
}
}
.padding(padding)
.readabilityPadding()
}
}

Expand Down
2 changes: 1 addition & 1 deletion Nos/Views/Onboarding/CreateAccountView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct CreateAccountView: View {
} catch {
crashReporting.report(error)
}
state.step = .buildYourNetwork
state.step = .privateKey
}
}
.padding(40)
Expand Down
25 changes: 25 additions & 0 deletions Nos/Views/Onboarding/LargeNumberView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import SwiftUI

/// A view that displays a large number, used at the top of several onboarding screens.
struct LargeNumberView: View {
let number: Int

init(_ number: Int) {
self.number = number
}

var body: some View {
Text(number, format: .number)
.font(.clarity(.bold, size: 40, textStyle: .largeTitle))
.foregroundStyle(Color.primaryTxt)
.frame(width: 60, height: 60)
.background(
Circle()
.fill(Color.numberedStepBackground)
)
}
}

#Preview {
LargeNumberView(2)
}
4 changes: 4 additions & 0 deletions Nos/Views/Onboarding/OnboardingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ enum OnboardingStep {
case ageVerification
case notOldEnough
case createAccount
case privateKey
case buildYourNetwork
case login
}
Expand Down Expand Up @@ -49,6 +50,9 @@ struct OnboardingView: View {
case .createAccount:
CreateAccountView()
.environment(state)
case .privateKey:
PrivateKeyView()
.environment(state)
case .login:
OnboardingLoginView(completion: completion)
case .buildYourNetwork:
Expand Down
Loading

0 comments on commit d4ff40f

Please sign in to comment.