replace old seed screen with updated recovery password screen

pull/891/head
Ryan Zhao 2 years ago
parent 281dfc3bb4
commit 52ce8a49b4

@ -808,12 +808,14 @@ final class HomeVC: BaseVC, SessionUtilRespondingViewController, UITableViewData
// MARK: - Interaction // MARK: - Interaction
func handleContinueButtonTapped(from seedReminderView: SeedReminderView) { func handleContinueButtonTapped(from seedReminderView: SeedReminderView) {
let targetViewController: UIViewController = { if let recoveryPasswordView: RecoveryPasswordView = try? RecoveryPasswordView() {
if let seedVC: SeedVC = try? SeedVC() { let viewController: SessionHostingViewController = SessionHostingViewController(rootView: recoveryPasswordView)
return StyledNavigationController(rootViewController: seedVC) viewController.setNavBarTitle("recovery_password_title".localized())
self.navigationController?.pushViewController(viewController, animated: true) {
Storage.shared.writeAsync { db in db[.hasViewedSeed] = true }
} }
} else {
return ConfirmationModal( let targetViewController: UIViewController = ConfirmationModal(
info: ConfirmationModal.Info( info: ConfirmationModal.Info(
title: "ALERT_ERROR_TITLE".localized(), title: "ALERT_ERROR_TITLE".localized(),
body: .text("LOAD_RECOVERY_PASSWORD_ERROR".localized()), body: .text("LOAD_RECOVERY_PASSWORD_ERROR".localized()),
@ -821,9 +823,8 @@ final class HomeVC: BaseVC, SessionUtilRespondingViewController, UITableViewData
cancelStyle: .alert_text cancelStyle: .alert_text
) )
) )
}() present(targetViewController, animated: true, completion: nil)
}
present(targetViewController, animated: true, completion: nil)
} }
func show( func show(

@ -9,22 +9,19 @@ struct RecoveryPasswordView: View {
@EnvironmentObject var host: HostWrapper @EnvironmentObject var host: HostWrapper
@State private var copied: Bool = false @State private var copied: Bool = false
@State private var showQRCode: Bool = true @State private var showQRCode: Bool = false
private let mnemonic: String private let mnemonic: String
private let flow: Onboarding.Flow
static private let cornerRadius: CGFloat = 13 static private let cornerRadius: CGFloat = 13
static private let backgroundCornerRadius: CGFloat = 17 static private let backgroundCornerRadius: CGFloat = 17
static private let buttonWidth: CGFloat = 120 static private let buttonWidth: CGFloat = 130
public init(flow: Onboarding.Flow) throws { public init() throws {
self.mnemonic = try Identity.mnemonic() self.mnemonic = try Identity.mnemonic()
self.flow = flow
} }
public init(hardcode: String, flow: Onboarding.Flow) { public init(hardcode: String) {
self.mnemonic = hardcode self.mnemonic = hardcode
self.flow = flow
} }
var body: some View { var body: some View {
@ -241,6 +238,6 @@ struct RecoveryPasswordView: View {
struct RecoveryPasswordView_Previews: PreviewProvider { struct RecoveryPasswordView_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
RecoveryPasswordView(hardcode: "Voyage urban toyed maverick peculiar tuxedo penguin tree grass building listen speak withdraw terminal plane ", flow: .register) RecoveryPasswordView(hardcode: "Voyage urban toyed maverick peculiar tuxedo penguin tree grass building listen speak withdraw terminal plane ")
} }
} }

@ -420,17 +420,17 @@ class SettingsViewModel: SessionTableViewModel, NavigationItemSource, Navigatabl
SessionCell.Info( SessionCell.Info(
id: .recoveryPhrase, id: .recoveryPhrase,
leftAccessory: .icon( leftAccessory: .icon(
UIImage(named: "icon_recovery")? UIImage(named: "SessionShield")?
.withRenderingMode(.alwaysTemplate) .withRenderingMode(.alwaysTemplate)
), ),
title: "vc_settings_recovery_phrase_button_title".localized(), title: "recovery_password_title".localized(),
onTap: { onTap: {
let targetViewController: UIViewController = { if let recoveryPasswordView: RecoveryPasswordView = try? RecoveryPasswordView() {
if let modal: SeedModal = try? SeedModal() { let viewController: SessionHostingViewController = SessionHostingViewController(rootView: recoveryPasswordView)
return modal viewController.setNavBarTitle("recovery_password_title".localized())
} self?.transitionToScreen(viewController)
} else {
return ConfirmationModal( let targetViewController: UIViewController = ConfirmationModal(
info: ConfirmationModal.Info( info: ConfirmationModal.Info(
title: "ALERT_ERROR_TITLE".localized(), title: "ALERT_ERROR_TITLE".localized(),
body: .text("LOAD_RECOVERY_PASSWORD_ERROR".localized()), body: .text("LOAD_RECOVERY_PASSWORD_ERROR".localized()),
@ -438,9 +438,8 @@ class SettingsViewModel: SessionTableViewModel, NavigationItemSource, Navigatabl
cancelStyle: .alert_text cancelStyle: .alert_text
) )
) )
}() self?.transitionToScreen(targetViewController, transitionType: .present)
}
self?.transitionToScreen(targetViewController, transitionType: .present)
} }
), ),
SessionCell.Info( SessionCell.Info(

Loading…
Cancel
Save