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

@ -9,22 +9,19 @@ struct RecoveryPasswordView: View {
@EnvironmentObject var host: HostWrapper
@State private var copied: Bool = false
@State private var showQRCode: Bool = true
@State private var showQRCode: Bool = false
private let mnemonic: String
private let flow: Onboarding.Flow
static private let cornerRadius: CGFloat = 13
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.flow = flow
}
public init(hardcode: String, flow: Onboarding.Flow) {
public init(hardcode: String) {
self.mnemonic = hardcode
self.flow = flow
}
var body: some View {
@ -241,6 +238,6 @@ struct RecoveryPasswordView: View {
struct RecoveryPasswordView_Previews: PreviewProvider {
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(
id: .recoveryPhrase,
leftAccessory: .icon(
UIImage(named: "icon_recovery")?
UIImage(named: "SessionShield")?
.withRenderingMode(.alwaysTemplate)
),
title: "vc_settings_recovery_phrase_button_title".localized(),
title: "recovery_password_title".localized(),
onTap: {
let targetViewController: UIViewController = {
if let modal: SeedModal = try? SeedModal() {
return modal
}
return ConfirmationModal(
if let recoveryPasswordView: RecoveryPasswordView = try? RecoveryPasswordView() {
let viewController: SessionHostingViewController = SessionHostingViewController(rootView: recoveryPasswordView)
viewController.setNavBarTitle("recovery_password_title".localized())
self?.transitionToScreen(viewController)
} else {
let targetViewController: UIViewController = ConfirmationModal(
info: ConfirmationModal.Info(
title: "ALERT_ERROR_TITLE".localized(),
body: .text("LOAD_RECOVERY_PASSWORD_ERROR".localized()),
@ -438,9 +438,8 @@ class SettingsViewModel: SessionTableViewModel, NavigationItemSource, Navigatabl
cancelStyle: .alert_text
)
)
}()
self?.transitionToScreen(targetViewController, transitionType: .present)
self?.transitionToScreen(targetViewController, transitionType: .present)
}
}
),
SessionCell.Info(

Loading…
Cancel
Save