Show a prompt to let user choose to create or import wallet. Only show welcome screen for former

pull/98/head
Hwee-Boon Yar 7 years ago
parent 4d5150dffc
commit 20a09aa94a
  1. 28
      Trust/Accounts/Coordinators/AccountsCoordinator.swift
  2. 2
      Trust/Localization/en.lproj/Localizable.strings

@ -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

@ -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. ";

Loading…
Cancel
Save