diff --git a/Trust/Accounts/Coordinators/AccountsCoordinator.swift b/Trust/Accounts/Coordinators/AccountsCoordinator.swift index a3bc36986..a2bbd165e 100644 --- a/Trust/Accounts/Coordinators/AccountsCoordinator.swift +++ b/Trust/Accounts/Coordinators/AccountsCoordinator.swift @@ -49,17 +49,39 @@ class AccountsCoordinator: Coordinator { } @objc func add() { - showCreateWallet() + chooseImportOrCreateWallet() } - func showCreateWallet() { + func chooseImportOrCreateWallet() { + UIAlertController.alert(title: nil, + message: nil, + alertButtonTitles: [R.string.localizable.walletCreateButtonTitle(), R.string.localizable.walletImportButtonTitle(), R.string.localizable.cancel()], + alertButtonStyles: [.default, .default, .cancel], + viewController: navigationController) { index in + if index == 0 { + self.showCreateWallet() + } else if index == 1 { + self.showImportWallet() + } + } + } + + func importOrCreateWallet(entryPoint: WalletEntryPoint) { let coordinator = WalletCoordinator(keystore: keystore) coordinator.delegate = self addCoordinator(coordinator) - coordinator.start(.welcome) + coordinator.start(entryPoint) navigationController.present(coordinator.navigationController, animated: true, completion: nil) } + func showCreateWallet() { + importOrCreateWallet(entryPoint: .welcome) + } + + func showImportWallet() { + importOrCreateWallet(entryPoint: .importWallet) + } + func showInfoSheet(for account: Wallet, sender: UIView) { let controller = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) controller.popoverPresentationController?.sourceView = sender diff --git a/Trust/Localization/en.lproj/Localizable.strings b/Trust/Localization/en.lproj/Localizable.strings index 1a18b7e2e..63d258547 100644 --- a/Trust/Localization/en.lproj/Localizable.strings +++ b/Trust/Localization/en.lproj/Localizable.strings @@ -85,6 +85,8 @@ "transactions.myAddress.button.title" = "My Address"; "transactions.noTransactions.label.title" = "No Transactions Yet!"; "wallet.navigation.title" = "Wallets"; +"wallet.create.button.title" = "Create Wallet"; +"wallet.import.button.title" = "Import Wallet"; "wallets.backup.alertSheet.title" = "Backup Keystore"; "welcome.createWallet.button.title" = "CREATE WALLET"; "welcome.erc20.label.description" = "Support for ERC20 tokens by default. ";