diff --git a/Session/Onboarding/DisplayNameView.swift b/Session/Onboarding/DisplayNameView.swift index 71178c6c6..22f786d17 100644 --- a/Session/Onboarding/DisplayNameView.swift +++ b/Session/Onboarding/DisplayNameView.swift @@ -18,76 +18,74 @@ struct DisplayNameView: View { } var body: some View { - NavigationView { - ZStack(alignment: .center) { - if #available(iOS 14.0, *) { - ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary).ignoresSafeArea() - } else { - ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary) - } - - VStack( - alignment: .leading, - spacing: 0 - ) { - Spacer(minLength: 0) - - let title: String = (self.flow == .register) ? "vc_display_name_title_2".localized() : "onboarding_display_name_title_new".localized() - Text(title) - .bold() - .font(.system(size: Values.veryLargeFontSize)) - .foregroundColor(themeColor: .textPrimary) - - Spacer(minLength: 0) - .frame(maxHeight: 2 * Values.mediumSpacing) - - let explanation: String = (self.flow == .register) ? "onboarding_display_name_explanation".localized() : "onboarding_display_name_explanation_new".localized() - Text(explanation) - .font(.system(size: Values.smallFontSize)) - .foregroundColor(themeColor: .textPrimary) - .fixedSize(horizontal: false, vertical: true) - - Spacer(minLength: 0) - .frame(maxHeight: 2 * Values.mediumSpacing) - - SessionTextField( - $displayName, - placeholder: "onboarding_display_name_hint".localized(), - error: $error - ) - - Spacer(minLength: 0) - .frame(maxHeight: Values.massiveSpacing) - - Spacer(minLength: 0) - } - .padding(.horizontal, Values.veryLargeSpacing) - .padding(.bottom, Values.largeButtonHeight) - - VStack() { - Spacer(minLength: 0) - - Button { - register() - } label: { - Text("continue_2".localized()) - .bold() - .font(.system(size: Values.smallFontSize)) - .foregroundColor(themeColor: .sessionButton_text) - .frame( - maxWidth: .infinity, - maxHeight: Values.largeButtonHeight, - alignment: .center - ) - .overlay( - Capsule() - .stroke(themeColor: .sessionButton_border) - ) - } - .padding(.horizontal, Values.massiveSpacing) - } - .padding(.vertical, Values.mediumSpacing) + ZStack(alignment: .center) { + if #available(iOS 14.0, *) { + ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary).ignoresSafeArea() + } else { + ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary) } + + VStack( + alignment: .leading, + spacing: 0 + ) { + Spacer(minLength: 0) + + let title: String = (self.flow == .register) ? "vc_display_name_title_2".localized() : "onboarding_display_name_title_new".localized() + Text(title) + .bold() + .font(.system(size: Values.veryLargeFontSize)) + .foregroundColor(themeColor: .textPrimary) + + Spacer(minLength: 0) + .frame(maxHeight: 2 * Values.mediumSpacing) + + let explanation: String = (self.flow == .register) ? "onboarding_display_name_explanation".localized() : "onboarding_display_name_explanation_new".localized() + Text(explanation) + .font(.system(size: Values.smallFontSize)) + .foregroundColor(themeColor: .textPrimary) + .fixedSize(horizontal: false, vertical: true) + + Spacer(minLength: 0) + .frame(maxHeight: 2 * Values.mediumSpacing) + + SessionTextField( + $displayName, + placeholder: "onboarding_display_name_hint".localized(), + error: $error + ) + + Spacer(minLength: 0) + .frame(maxHeight: Values.massiveSpacing) + + Spacer(minLength: 0) + } + .padding(.horizontal, Values.veryLargeSpacing) + .padding(.bottom, Values.largeButtonHeight) + + VStack() { + Spacer(minLength: 0) + + Button { + register() + } label: { + Text("continue_2".localized()) + .bold() + .font(.system(size: Values.smallFontSize)) + .foregroundColor(themeColor: .sessionButton_text) + .frame( + maxWidth: .infinity, + maxHeight: Values.largeButtonHeight, + alignment: .center + ) + .overlay( + Capsule() + .stroke(themeColor: .sessionButton_border) + ) + } + .padding(.horizontal, Values.massiveSpacing) + } + .padding(.vertical, Values.mediumSpacing) } } diff --git a/Session/Onboarding/LandingView.swift b/Session/Onboarding/LandingView.swift index 999d641b3..323d95367 100644 --- a/Session/Onboarding/LandingView.swift +++ b/Session/Onboarding/LandingView.swift @@ -12,116 +12,114 @@ struct LandingView: View { @State var numberOfBubblesShown: Int = 0 var body: some View { - NavigationView { - ZStack(alignment: .center) { - if #available(iOS 14.0, *) { - ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary).ignoresSafeArea() - } else { - ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary) - } + ZStack(alignment: .center) { + if #available(iOS 14.0, *) { + ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary).ignoresSafeArea() + } else { + ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary) + } + + VStack( + alignment: .center, + spacing: 0 + ) { + Spacer(minLength: 0) - VStack( - alignment: .center, - spacing: 0 - ) { - Spacer(minLength: 0) - - Text("onboarding_landing_title".localized()) - .bold() - .font(.system(size: Values.veryLargeFontSize)) - .foregroundColor(themeColor: .textPrimary) - - Spacer(minLength: 0) - .frame(maxHeight: 2 * Values.mediumSpacing) - - FakeChat($numberOfBubblesShown) - .onAppear { - guard numberOfBubblesShown < 4 else { return } - - Timer.scheduledTimerOnMainThread(withTimeInterval: 0.2, repeats: false) { _ in + Text("onboarding_landing_title".localized()) + .bold() + .font(.system(size: Values.veryLargeFontSize)) + .foregroundColor(themeColor: .textPrimary) + + Spacer(minLength: 0) + .frame(maxHeight: 2 * Values.mediumSpacing) + + FakeChat($numberOfBubblesShown) + .onAppear { + guard numberOfBubblesShown < 4 else { return } + + Timer.scheduledTimerOnMainThread(withTimeInterval: 0.2, repeats: false) { _ in + withAnimation(.spring().speed(0.68)) { + numberOfBubblesShown = 1 + } + Timer.scheduledTimerOnMainThread(withTimeInterval: 1.5, repeats: true) { timer in withAnimation(.spring().speed(0.68)) { - numberOfBubblesShown = 1 - } - Timer.scheduledTimerOnMainThread(withTimeInterval: 1.5, repeats: true) { timer in - withAnimation(.spring().speed(0.68)) { - numberOfBubblesShown += 1 - if numberOfBubblesShown >= 4 { - timer.invalidate() - } + numberOfBubblesShown += 1 + if numberOfBubblesShown >= 4 { + timer.invalidate() } } } } - - Spacer(minLength: 0) - .frame(maxHeight: Values.massiveSpacing) - - Spacer(minLength: 0) - } - .padding(.vertical, Values.mediumSpacing) - .padding(.bottom, 3 * Values.largeButtonHeight) + } - VStack( - alignment: .center, - spacing: Values.mediumSpacing - ) { - Spacer() - - Button { - register() - } label: { - Text("onboarding_landing_register_button_title".localized()) - .bold() - .font(.system(size: Values.smallFontSize)) - .foregroundColor(themeColor: .sessionButton_primaryFilledText) - .frame( - maxWidth: .infinity, - maxHeight: Values.largeButtonHeight, - alignment: .center - ) - .backgroundColor(themeColor: .sessionButton_primaryFilledBackground) - .cornerRadius(Values.largeButtonHeight / 2) - } - .padding(.horizontal, Values.massiveSpacing) - - Button { - restore() - } label: { - Text("onboarding_landing_restore_button_title".localized()) - .bold() - .font(.system(size: Values.smallFontSize)) - .foregroundColor(themeColor: .sessionButton_text) - .frame( - maxWidth: .infinity, - maxHeight: Values.largeButtonHeight, - alignment: .center - ) - .overlay( - Capsule() - .stroke(themeColor: .sessionButton_border) - ) - } - .padding(.horizontal, Values.massiveSpacing) - - Button { - openLegalUrl() - } label: { - let attributedText: NSAttributedString = { - let text = String(format: "onboarding_T&C".localized(), "terms_of_service".localized(), "privacy_policy".localized()) - let result = NSMutableAttributedString( - string: text, - attributes: [ .font : UIFont.systemFont(ofSize: Values.verySmallFontSize)] - ) - result.addAttribute(.font, value: UIFont.boldSystemFont(ofSize: Values.verySmallFontSize), range: (text as NSString).range(of: "terms_of_service".localized())) - result.addAttribute(.font, value: UIFont.boldSystemFont(ofSize: Values.verySmallFontSize), range: (text as NSString).range(of: "privacy_policy".localized())) - - return result - }() - AttributedText(attributedText) - .foregroundColor(themeColor: .textPrimary) - } - .padding(.horizontal, Values.massiveSpacing) + Spacer(minLength: 0) + .frame(maxHeight: Values.massiveSpacing) + + Spacer(minLength: 0) + } + .padding(.vertical, Values.mediumSpacing) + .padding(.bottom, 3 * Values.largeButtonHeight) + + VStack( + alignment: .center, + spacing: Values.mediumSpacing + ) { + Spacer() + + Button { + register() + } label: { + Text("onboarding_landing_register_button_title".localized()) + .bold() + .font(.system(size: Values.smallFontSize)) + .foregroundColor(themeColor: .sessionButton_primaryFilledText) + .frame( + maxWidth: .infinity, + maxHeight: Values.largeButtonHeight, + alignment: .center + ) + .backgroundColor(themeColor: .sessionButton_primaryFilledBackground) + .cornerRadius(Values.largeButtonHeight / 2) } + .padding(.horizontal, Values.massiveSpacing) + + Button { + restore() + } label: { + Text("onboarding_landing_restore_button_title".localized()) + .bold() + .font(.system(size: Values.smallFontSize)) + .foregroundColor(themeColor: .sessionButton_text) + .frame( + maxWidth: .infinity, + maxHeight: Values.largeButtonHeight, + alignment: .center + ) + .overlay( + Capsule() + .stroke(themeColor: .sessionButton_border) + ) + } + .padding(.horizontal, Values.massiveSpacing) + + Button { + openLegalUrl() + } label: { + let attributedText: NSAttributedString = { + let text = String(format: "onboarding_T&C".localized(), "terms_of_service".localized(), "privacy_policy".localized()) + let result = NSMutableAttributedString( + string: text, + attributes: [ .font : UIFont.systemFont(ofSize: Values.verySmallFontSize)] + ) + result.addAttribute(.font, value: UIFont.boldSystemFont(ofSize: Values.verySmallFontSize), range: (text as NSString).range(of: "terms_of_service".localized())) + result.addAttribute(.font, value: UIFont.boldSystemFont(ofSize: Values.verySmallFontSize), range: (text as NSString).range(of: "privacy_policy".localized())) + + return result + }() + AttributedText(attributedText) + .foregroundColor(themeColor: .textPrimary) + } + .padding(.horizontal, Values.massiveSpacing) } } } diff --git a/Session/Onboarding/LoadAccountView.swift b/Session/Onboarding/LoadAccountView.swift index b3ab05936..cfa249d34 100644 --- a/Session/Onboarding/LoadAccountView.swift +++ b/Session/Onboarding/LoadAccountView.swift @@ -15,33 +15,31 @@ struct LoadAccountView: View { @State private var errorString: String? = nil var body: some View { - NavigationView { - ZStack(alignment: .topLeading) { - if #available(iOS 14.0, *) { - ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary).ignoresSafeArea() - } else { - ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary) + ZStack(alignment: .topLeading) { + if #available(iOS 14.0, *) { + ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary).ignoresSafeArea() + } else { + ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary) + } + VStack( + spacing: 0 + ){ + CustomTopTabBar(tabIndex: $tabIndex) + .frame(maxWidth: .infinity) + + if tabIndex == 0 { + EnterRecoveryPasswordView( + $recoveryPassword, + error: $errorString, + continueWithMnemonic: continueWithMnemonic + ) } - VStack( - spacing: 0 - ){ - CustomTopTabBar(tabIndex: $tabIndex) - .frame(maxWidth: .infinity) - - if tabIndex == 0 { - EnterRecoveryPasswordView( - $recoveryPassword, - error: $errorString, - continueWithMnemonic: continueWithMnemonic - ) - } - else { - ScanQRCodeView( - $hexEncodedSeed, - error: $errorString, - continueWithhexEncodedSeed: continueWithhexEncodedSeed - ) - } + else { + ScanQRCodeView( + $hexEncodedSeed, + error: $errorString, + continueWithhexEncodedSeed: continueWithhexEncodedSeed + ) } } } diff --git a/Session/Onboarding/LoadingView.swift b/Session/Onboarding/LoadingView.swift index 3e4a52015..4905e3978 100644 --- a/Session/Onboarding/LoadingView.swift +++ b/Session/Onboarding/LoadingView.swift @@ -20,42 +20,40 @@ struct LoadingView: View { } var body: some View { - NavigationView { - ZStack(alignment: .center) { - if #available(iOS 14.0, *) { - ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary).ignoresSafeArea() - } else { - ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary) - } - - VStack( - alignment: .center, - spacing: Values.mediumSpacing - ) { - Spacer() - - CircularProgressView($percentage) - .padding(.horizontal, Values.massiveSpacing) - .padding(.bottom, Values.mediumSpacing) - .onAppear { - progress() - observeProfileRetrieving() - } - - Text("onboarding_load_account_waiting".localized()) - .bold() - .font(.system(size: Values.mediumLargeFontSize)) - .foregroundColor(themeColor: .textPrimary) - - Text("onboarding_loading_account".localized()) - .font(.system(size: Values.smallFontSize)) - .foregroundColor(themeColor: .textPrimary) - - Spacer() - } - .padding(.horizontal, Values.veryLargeSpacing) - .padding(.bottom, Values.massiveSpacing + Values.largeButtonHeight) + ZStack(alignment: .center) { + if #available(iOS 14.0, *) { + ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary).ignoresSafeArea() + } else { + ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary) } + + VStack( + alignment: .center, + spacing: Values.mediumSpacing + ) { + Spacer() + + CircularProgressView($percentage) + .padding(.horizontal, Values.massiveSpacing) + .padding(.bottom, Values.mediumSpacing) + .onAppear { + progress() + observeProfileRetrieving() + } + + Text("onboarding_load_account_waiting".localized()) + .bold() + .font(.system(size: Values.mediumLargeFontSize)) + .foregroundColor(themeColor: .textPrimary) + + Text("onboarding_loading_account".localized()) + .font(.system(size: Values.smallFontSize)) + .foregroundColor(themeColor: .textPrimary) + + Spacer() + } + .padding(.horizontal, Values.veryLargeSpacing) + .padding(.bottom, Values.massiveSpacing + Values.largeButtonHeight) } } diff --git a/Session/Onboarding/PNModeView.swift b/Session/Onboarding/PNModeView.swift index 65c1067f8..9f2494872 100644 --- a/Session/Onboarding/PNModeView.swift +++ b/Session/Onboarding/PNModeView.swift @@ -39,70 +39,68 @@ struct PNModeView: View { ] var body: some View { - NavigationView { - ZStack(alignment: .center) { - if #available(iOS 14.0, *) { - ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary).ignoresSafeArea() - } else { - ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary) - } + ZStack(alignment: .center) { + if #available(iOS 14.0, *) { + ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary).ignoresSafeArea() + } else { + ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary) + } + + VStack( + alignment: .leading, + spacing: Values.mediumSpacing + ) { + Spacer() + + Text("vc_pn_mode_title".localized()) + .bold() + .font(.system(size: Values.veryLargeFontSize)) + .foregroundColor(themeColor: .textPrimary) + .padding(.vertical, Values.mediumSpacing) VStack( alignment: .leading, - spacing: Values.mediumSpacing - ) { - Spacer() - - Text("vc_pn_mode_title".localized()) - .bold() - .font(.system(size: Values.veryLargeFontSize)) - .foregroundColor(themeColor: .textPrimary) - .padding(.vertical, Values.mediumSpacing) - - VStack( - alignment: .leading, - spacing: Values.mediumSpacing) - { - ForEach( - 0...(options.count - 1), - id: \.self - ) { index in - PNOptionView( - currentSelection: $currentSelection, - info: options[index] - ) - } + spacing: Values.mediumSpacing) + { + ForEach( + 0...(options.count - 1), + id: \.self + ) { index in + PNOptionView( + currentSelection: $currentSelection, + info: options[index] + ) } - - Spacer() } - .padding(.horizontal, Values.veryLargeSpacing) - .padding(.bottom, Values.massiveSpacing + Values.largeButtonHeight) - VStack() { - Spacer() - - Button { - register() - } label: { - Text("continue_2".localized()) - .bold() - .font(.system(size: Values.smallFontSize)) - .foregroundColor(themeColor: .sessionButton_text) - .frame( - maxWidth: .infinity, - maxHeight: Values.largeButtonHeight, - alignment: .center - ) - .overlay( - Capsule() - .stroke(themeColor: .sessionButton_border) - ) - } - .padding(.horizontal, Values.massiveSpacing) - } - .padding(.vertical, Values.mediumSpacing) + Spacer() } + .padding(.horizontal, Values.veryLargeSpacing) + .padding(.bottom, Values.massiveSpacing + Values.largeButtonHeight) + + VStack() { + Spacer() + + Button { + register() + } label: { + Text("continue_2".localized()) + .bold() + .font(.system(size: Values.smallFontSize)) + .foregroundColor(themeColor: .sessionButton_text) + .frame( + maxWidth: .infinity, + maxHeight: Values.largeButtonHeight, + alignment: .center + ) + .overlay( + Capsule() + .stroke(themeColor: .sessionButton_border) + ) + } + .padding(.horizontal, Values.massiveSpacing) + } + .padding(.vertical, Values.mediumSpacing) } } diff --git a/Session/Onboarding/RecoveryPasswordView.swift b/Session/Onboarding/RecoveryPasswordView.swift index 2a4dcc36c..9a9826fb4 100644 --- a/Session/Onboarding/RecoveryPasswordView.swift +++ b/Session/Onboarding/RecoveryPasswordView.swift @@ -25,100 +25,98 @@ struct RecoveryPasswordView: View { } var body: some View { - NavigationView { - ZStack(alignment: .center) { - if #available(iOS 14.0, *) { - ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary).ignoresSafeArea() - } else { - ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary) - } + ZStack(alignment: .center) { + if #available(iOS 14.0, *) { + ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary).ignoresSafeArea() + } else { + ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary) + } + + VStack( + alignment: .leading, + spacing: Values.mediumSpacing + ) { + Spacer() - VStack( - alignment: .leading, - spacing: Values.mediumSpacing + HStack( + alignment: .bottom, + spacing: Values.smallSpacing ) { - Spacer() - - HStack( - alignment: .bottom, - spacing: Values.smallSpacing - ) { - Text("onboarding_recovery_password_title".localized()) - .bold() - .font(.system(size: Values.veryLargeFontSize)) - .foregroundColor(themeColor: .textPrimary) - - Image("SessionShield") - .resizable() - .renderingMode(.template) - .foregroundColor(themeColor: .textPrimary) - .scaledToFit() - .frame( - maxWidth: Values.largeFontSize, - maxHeight: Values.largeFontSize - ) - .padding(.bottom, Values.verySmallSpacing) - } - - Text("onboarding_recovery_password_explanation".localized()) - .font(.system(size: Values.smallFontSize)) + Text("onboarding_recovery_password_title".localized()) + .bold() + .font(.system(size: Values.veryLargeFontSize)) .foregroundColor(themeColor: .textPrimary) - Text(mnemonic) - .font(.spaceMono(size: Values.verySmallFontSize)) - .multilineTextAlignment(.center) - .foregroundColor(themeColor: .primary) - .frame(maxWidth: .infinity) - .padding(.all, Values.largeSpacing) - .overlay( - RoundedRectangle( - cornerSize: CGSize( - width: Self.cornerRadius, - height: Self.cornerRadius - ) - ) - .stroke(themeColor: .borderSeparator) + Image("SessionShield") + .resizable() + .renderingMode(.template) + .foregroundColor(themeColor: .textPrimary) + .scaledToFit() + .frame( + maxWidth: Values.largeFontSize, + maxHeight: Values.largeFontSize ) - - Button { - copyRecoveryPassword() - } label: { - let buttonTitle: String = self.copied ? "copied".localized() : "tap_to_copy".localized() - Text(buttonTitle) - .font(.system(size: Values.verySmallFontSize)) - .foregroundColor(themeColor: .textSecondary) - } - .frame(maxWidth: .infinity) - - Spacer() + .padding(.bottom, Values.verySmallSpacing) } - .padding(.horizontal, Values.veryLargeSpacing) - .padding(.bottom, Values.massiveSpacing + Values.largeButtonHeight) - VStack() { - Spacer() - - Button { - finishRegister() - } label: { - Text("continue_2".localized()) - .bold() - .font(.system(size: Values.smallFontSize)) - .foregroundColor(themeColor: .sessionButton_text) - .frame( - maxWidth: .infinity, - maxHeight: Values.largeButtonHeight, - alignment: .center + Text("onboarding_recovery_password_explanation".localized()) + .font(.system(size: Values.smallFontSize)) + .foregroundColor(themeColor: .textPrimary) + + Text(mnemonic) + .font(.spaceMono(size: Values.verySmallFontSize)) + .multilineTextAlignment(.center) + .foregroundColor(themeColor: .primary) + .frame(maxWidth: .infinity) + .padding(.all, Values.largeSpacing) + .overlay( + RoundedRectangle( + cornerSize: CGSize( + width: Self.cornerRadius, + height: Self.cornerRadius ) - .overlay( - Capsule() - .stroke(themeColor: .sessionButton_border) - ) - } - .padding(.horizontal, Values.massiveSpacing) + ) + .stroke(themeColor: .borderSeparator) + ) + + Button { + copyRecoveryPassword() + } label: { + let buttonTitle: String = self.copied ? "copied".localized() : "tap_to_copy".localized() + Text(buttonTitle) + .font(.system(size: Values.verySmallFontSize)) + .foregroundColor(themeColor: .textSecondary) } - .padding(.vertical, Values.mediumSpacing) + .frame(maxWidth: .infinity) + + Spacer() } + .padding(.horizontal, Values.veryLargeSpacing) + .padding(.bottom, Values.massiveSpacing + Values.largeButtonHeight) + + VStack() { + Spacer() + + Button { + finishRegister() + } label: { + Text("continue_2".localized()) + .bold() + .font(.system(size: Values.smallFontSize)) + .foregroundColor(themeColor: .sessionButton_text) + .frame( + maxWidth: .infinity, + maxHeight: Values.largeButtonHeight, + alignment: .center + ) + .overlay( + Capsule() + .stroke(themeColor: .sessionButton_border) + ) + } + .padding(.horizontal, Values.massiveSpacing) + } + .padding(.vertical, Values.mediumSpacing) } }