Skip to content

Commit

Permalink
Merge pull request #658 from Syn-McJ/fix/seed-phrase-screen
Browse files Browse the repository at this point in the history
fix: seed phrase screen
  • Loading branch information
pankcuf authored Jul 10, 2024
2 parents b719906 + 770f51e commit 929122c
Show file tree
Hide file tree
Showing 24 changed files with 596 additions and 626 deletions.
62 changes: 30 additions & 32 deletions DashWallet.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -123,25 +123,29 @@ final class BackupInfoViewController: BaseViewController {

@IBAction
func backupButtonAction() {
if type == .setup {
let authManager = DSAuthenticationManager.sharedInstance()

if type == .setup && authManager.didAuthenticate {
showSeedPhraseViewController()
} else {
DSAuthenticationManager.sharedInstance()
.authenticate(withPrompt: nil,
usingBiometricAuthentication: false,
alertIfLockout: true) { [weak self] authenticated, _, _ in
guard authenticated else {
return
}

guard let self else {
return
}
authManager.authenticate(withPrompt: nil,
usingBiometricAuthentication: false,
alertIfLockout: true) { [weak self] authenticated, _, _ in
guard authenticated else {
return
}

guard let self else {
return
}

if type != .setup {
self.seedPhraseModel = DWPreviewSeedPhraseModel()
self.seedPhraseModel.getOrCreateNewWallet()
self.showSeedPhraseViewController()
}

self.showSeedPhraseViewController()
}
}
}

Expand Down Expand Up @@ -194,7 +198,7 @@ extension BackupInfoViewController {
}

private func showSeedPhraseViewController() {
let controller = DWBackupSeedPhraseViewController(model: seedPhraseModel)
let controller = BackupSeedPhraseViewController(model: seedPhraseModel)
controller.shouldCreateNewWalletOnScreenshot = shouldCreateNewWalletOnScreenshot
controller.delegate = delegate
navigationController?.pushViewController(controller, animated: true)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//
// Created by Andrew Podkovyrin
// Copyright © 2019 Dash Core Group. All rights reserved.
//
// Licensed under the MIT License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/MIT
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import Foundation

import UIKit

class BackupSeedPhraseViewController: DWPreviewSeedPhraseViewController {

var shouldCreateNewWalletOnScreenshot: Bool = false

override func viewDidLoad() {
super.viewDidLoad()

self.title = NSLocalizedString("Backup Wallet", comment: "A noun. Used as a title.")
self.actionButton?.isEnabled = false

self.contentView.displayType = DWSeedPhraseDisplayType.backup

#if SNAPSHOT
self.actionButton.accessibilityIdentifier = "seedphrase_continue_button"
#endif
}

var actionButtonTitle: String {
return NSLocalizedString("Continue", comment: "")
}

@objc override func actionButtonAction(_ sender: Any) {
let seedPhrase = self.contentView.model

let controller = DWVerifySeedPhraseViewController(seedPhrase: seedPhrase!)
controller.delegate = self.delegate
self.navigationController?.pushViewController(controller, animated: true)
}

override func screenshotAlertOKAction() {
if !self.shouldCreateNewWalletOnScreenshot {
return
}

self.model.clearAllWallets()

self.feedbackGenerator.notificationOccurred(.error)

let seedPhrase = self.model.getOrCreateNewWallet()
self.contentView.updateSeedPhraseModelAnimated(seedPhrase)
self.contentView.showScreenshotDetectedErrorMessage()

self.actionButton?.isEnabled = false
}
}

This file was deleted.

This file was deleted.

5 changes: 4 additions & 1 deletion DashWallet/dashwallet-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ static const bool _SNAPSHOT = 0;
#import "DWCenteredTableView.h"

//MARK: Backup Wallet
#import "DWBackupSeedPhraseViewController.h"
#import "DWPreviewSeedPhraseViewController.h"
#import "DWSecureWalletDelegate.h"
#import "DWPreviewSeedPhraseContentView.h"
#import "DWPreviewSeedPhraseViewController+DWProtected.h"
#import "DWVerifySeedPhraseViewController.h"

//MARK: Payment flow
#import "DWQRScanModel.h"
Expand Down
Loading

0 comments on commit 929122c

Please sign in to comment.