Skip to content

Commit

Permalink
Add select coin view and controller
Browse files Browse the repository at this point in the history
  • Loading branch information
vikmeup committed Jul 17, 2018
1 parent 86447ad commit 92d254d
Show file tree
Hide file tree
Showing 12 changed files with 326 additions and 12 deletions.
12 changes: 12 additions & 0 deletions Trust.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@
73ED85A92034C42D00593BF3 /* StringFormatterTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73ED85A82034C42D00593BF3 /* StringFormatterTest.swift */; };
73F2FF3C20557C020021976E /* TrustOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73F2FF3B20557C020021976E /* TrustOperation.swift */; };
7704836820FDB05A00837735 /* CoinViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7704836720FDB05A00837735 /* CoinViewModel.swift */; };
7704836B20FE99B600837735 /* CoinViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7704836920FE99B600837735 /* CoinViewCell.swift */; };
7704836C20FE99B600837735 /* CoinViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7704836A20FE99B600837735 /* CoinViewCell.xib */; };
7704836E20FE9B4000837735 /* SelectCoinsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7704836D20FE9B4000837735 /* SelectCoinsViewModel.swift */; };
7712437620FD45440097296E /* ImportMainWalletViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7712437520FD45440097296E /* ImportMainWalletViewController.swift */; };
7712437820FD8DEF0097296E /* SelectCoinViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7712437720FD8DEF0097296E /* SelectCoinViewController.swift */; };
7712437A20FD97730097296E /* WalletAccountViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7712437920FD97730097296E /* WalletAccountViewModel.swift */; };
Expand Down Expand Up @@ -823,6 +826,9 @@
73ED85A82034C42D00593BF3 /* StringFormatterTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringFormatterTest.swift; sourceTree = "<group>"; };
73F2FF3B20557C020021976E /* TrustOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrustOperation.swift; sourceTree = "<group>"; };
7704836720FDB05A00837735 /* CoinViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoinViewModel.swift; sourceTree = "<group>"; };
7704836920FE99B600837735 /* CoinViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoinViewCell.swift; sourceTree = "<group>"; };
7704836A20FE99B600837735 /* CoinViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CoinViewCell.xib; sourceTree = "<group>"; };
7704836D20FE9B4000837735 /* SelectCoinsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectCoinsViewModel.swift; sourceTree = "<group>"; };
7712437520FD45440097296E /* ImportMainWalletViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImportMainWalletViewController.swift; sourceTree = "<group>"; };
7712437720FD8DEF0097296E /* SelectCoinViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectCoinViewController.swift; sourceTree = "<group>"; };
7712437920FD97730097296E /* WalletAccountViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletAccountViewModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1495,6 +1501,7 @@
29AD3D5620F5BB08007893C9 /* WalletsViewModel.swift */,
7712437920FD97730097296E /* WalletAccountViewModel.swift */,
7704836720FDB05A00837735 /* CoinViewModel.swift */,
7704836D20FE9B4000837735 /* SelectCoinsViewModel.swift */,
);
path = ViewModels;
sourceTree = "<group>";
Expand Down Expand Up @@ -2295,6 +2302,8 @@
29AD3D5220F5BA2E007893C9 /* WalletTableViewCell.swift */,
29AD3D5320F5BA2E007893C9 /* WalletTableViewCell.xib */,
29AD3D5B20F6D2E3007893C9 /* WalletTitleView.swift */,
7704836920FE99B600837735 /* CoinViewCell.swift */,
7704836A20FE99B600837735 /* CoinViewCell.xib */,
);
path = Views;
sourceTree = "<group>";
Expand Down Expand Up @@ -2700,6 +2709,7 @@
29AD3D5520F5BA2E007893C9 /* WalletTableViewCell.xib in Resources */,
775DF43F203E38D3009CD082 /* NonFungibleTokenViewCell.xib in Resources */,
73DE7B3320987D8F00AE04E6 /* NonFungibleCollectionViewCell.xib in Resources */,
7704836C20FE99B600837735 /* CoinViewCell.xib in Resources */,
296106CE1F777E410006164B /* LaunchScreen.storyboard in Resources */,
290B2B541F8F50030053C83E /* Localizable.strings in Resources */,
2912CD021F6A830700C6CBE3 /* Assets.xcassets in Resources */,
Expand Down Expand Up @@ -3205,6 +3215,7 @@
29CA4B771F6FBBFB0032313D /* RequestViewModel.swift in Sources */,
7721A6CE202EFC21004DB16C /* AddCustomNetworkViewModel.swift in Sources */,
291A1B691F980E3400ADEC80 /* StackViewController.swift in Sources */,
7704836E20FE9B4000837735 /* SelectCoinsViewModel.swift in Sources */,
73C41C73201B5EFF00243C6C /* LockCreatePasscodeViewModel.swift in Sources */,
2959961A1FADB79300DB66A8 /* TokenTransfer.swift in Sources */,
295247E71F835BA0007FDC31 /* InfoHeaderView.swift in Sources */,
Expand Down Expand Up @@ -3248,6 +3259,7 @@
771D5371205923F500C79485 /* NetworkConditionViewModel.swift in Sources */,
2912CD321F6A83EE00C6CBE3 /* WelcomeViewController.swift in Sources */,
29F114F61FA8147300114A29 /* RequestCoordinator.swift in Sources */,
7704836B20FE99B600837735 /* CoinViewCell.swift in Sources */,
29525B9E203C34CF00900DE9 /* SupportViewModel.swift in Sources */,
773B8DB920716EFF00D05690 /* GetNonceProvider.swift in Sources */,
777871312082DF3D00CF7303 /* GetTransactionReceiptRequest.swift in Sources */,
Expand Down
3 changes: 3 additions & 0 deletions Trust/Localization/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -275,3 +275,6 @@
"BackupPhrase" = "Backup Phrase";
"Address" = "Address";
"CreatingWallet" = "Creating Wallet";
"WalletImported" = "Wallet Imported";
"SelectCoin" = "Select Coin";
"ImportMainWallet" = "Import Main Wallet";
149 changes: 149 additions & 0 deletions Trust/Localization/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,160 @@
"transaction.cell.sent.title" = "Envoyé";
"transaction.cell.tokenTransfer.title" = "Transférer %@";
"Yesterday" = "Hier";
"Deleting" = "Suppression";
"EthereumAddress" = "Ethereum Adresse";
"InCoordinatorError.onlyWatchAccount" = "Ce portefeuille ne peut être utilisé que pour regarder. Importer une Clé Privée/Keystore pour signer des transactions/messages.";
"Share With Friends" = "Partager avec des amis";
"transaction.cell.unknown.title" = "Inconnu";
"welldone.description.label.text" = "Aidez-nous à grandir en partageant cette application avec vos amis !";
"welldone.navigation.title" = "Merci !";
"welldone.viewmodel.sharing.text1" = "Voici l'application que j'utilise pour stocker mes jetons ETH et ERC20.";
"welldone.viewmodel.sharing.text2" = "Découvrez Trust - le portefeuille qui me permet de stocker en toute sécurité mes jetons Ethereum et ERC20.";
"welldone.viewmodel.sharing.text3" = "Je stocke en toute sécurité les jetons Ethereum et ERC20 dans le portefeuille Trust";
"welldone.viewmodel.sharing.text4" = "Je sécurise mes jetons Ethereum et ERC20 dans le portefeuille Trust.";
"browser.home.button.title" = "Accueil";
"browser.reload.button.title" = "Recharger";
"configureTransaction.gasPriceGwei.label.title" = "Prix du gaz (Gwei)";
"enterPassword.confirmPassword.textField.placeholder" = "Confirmez le mot de passe";
"enterPassword.navigation.title" = "Sauvegarde mot de passe";
"enterPassword.password.header.placeholder" = "Mot de passe utilisé pour crypter votre fichier de sauvegarde afin de le garder en sécurité !";
"enterPassword.password.textField.placeholder" = "Mot de passe";
"lock.create.passcode.view.model.confirm" = "Veuillez saisir à nouveau votre code d'accès.";
"lock.create.passcode.view.model.initial" = "Entrez un nouveau code d'accès";
"lock.create.passcode.view.model.title" = "Définir le code d'accès";
"lock.enter.passcode.view.model.incorrect.passcode" = "Code d'accès incorrect. Il vous reste %li tentatives.";
"lock.enter.passcode.view.model.initial" = "Entrez votre code d'accès.";
"lock.enter.passcode.view.model.touch.id" = "Se connecter avec Touch ID";
"lock.enter.passcode.view.model.try.after.one.minute" = "Essayez après 1 minute.";
"Name" = "Nom";
"send.action.copy.transaction.title" = "Copier l'ID de transaction";
"settings.dappbroser.button.title" = "Navigateur DApps";
"settings.emailUsReadFAQ.button.title" = "Envoyez-nous un e-mail (Lisez d'abord la FAQ)";
"settings.faq.button.title" = "FAQ";
"settings.wallets.balance" = "Solde: %@ ETH";
"transaction.cell.failed.title" = "Échec";
"transaction.cell.pending.title" = "En attente";
"transactions.receive.button.title" = "Recevoir";
"accounts.confirm.delete.message" = "Assurez-vous d'avoir une sauvegarde de votre portefeuille.";
"accounts.confirm.delete.title" = "Êtes-vous sûr de vouloir supprimer ce portefeuille?";
"Approve" = "Approuver";
"ChainID" = "ID de la chaîne";
"Endpoint" = "Point de terminaison";
"send.error.invalidAmount" = "Montant non valide";
"settings.customNetwork.navigation.title" = "Réseau personnalisé";
"settings.network.custom.label.title" = "Personnalisé";
"transaction.blockNumber.label.title" = "Bloc #";
"transaction.confirmation.label.title" = "Confirmation";
"transaction.from.label.title" = "De";
"transaction.id.label.title" = "Transaction #";
"transaction.time.label.title" = "Temps de transaction";
"transaction.to.label.title" = "Pour";
"settings.allowPushNotifications.button.title" = "Autoriser les Notifications Push";
"settings.pushNotifications.allowPushNotifications.footer" = "Vous serez averti des transactions envoyées et reçues.";
"settings.pushNotifications.payment.button.title" = "Envoyer et recevoir";
"settings.pushNotifications.title" = "Notifications push";
"bookmarks.noBookmarks.label.title" = "Aucun signet pour le moment";
"browser.addbookmark.button.title" = "Ajouter un signet";
"browser.bookmarks.button.title" = "Signets";
"browser.bookmarks.confirm.delete.title" = "Êtes-vous sûr de vouloir supprimer ce signet?";
"browser.bookmarks.title" = "Signets";
"browser.url.textfield.placeholder" = "Rechercher ou entrer l'URL du site";
"Collectibles" = "Collectibles";
"confirmPayment.maxTotal.label.title" = "Max Total";
"Delete" = "Supprimer";
"Edit" = "Modifier";
"emptyView.noNonTokens.label.title" = "Aucune collection trouvée";
"enterPassword.passwordNoMatch.error" = "Les mots de passe ne correspondent pas !";
"export.noKPrivateKey.label.title" = "Pas de clé privée pour le portefeuille";
"export.privateKey.navigation.title" = "Exporter la clé privée";
"export.qrCode.loading.label" = "Génération du code QR";
"export.warning.private.key" = "Exportez à vos risques et périls !";
"export.warningTwo.private.key" = "N’importe qui possédant votre clé privée aura plein accès à votre portefeuille !";
"import.wallet.mnemonic.placeholder" = "Mots séparés par un espace. (contient habituellement 12 mots)";
"import.wallet.watch.placeholder" = "%@ Adresse";
"settings.joinCommunity.label.title" = "Rejoindre la communauté";
"settings.support.title" = "Support";
"tokens.token.edit.navigation.title" = "Modifier le jeton personnalisé";
"wallet.section.hdWallet.title" = "Portefeuille HD";
"wallets.export.alertSheet.title" = "Exporter la clé privée";
"Share" = "Partager";
"collectibles.discover.label.title" = "Explorer sur OpenSea.io";
"configureTransaction.error.gasFeeHigh" = "Les frais de gaz sont trop élevés. Max disponible: %1$@ %2$@";
"sent.transaction.message" = "Attendez que la transaction soit minée sur le réseau pour voir les détails.";
"sent.transaction.title" = "Transaction Effectuée !";
"settings.network.test.warnning.dont.show.again" = "Ne plus afficher";
"settings.network.test.warnning.message" = "Vous passez à un réseau de test où les transactions sont uniquement à des fins de test";
"settings.network.test.warnning.title" = "Attention";
"Disable" = "Désactiver";
"Wallets" = "Portefeuilles";
"browser.qrCode.button.title" = "QR Balayage de code";
"nft.details.external.button.title" = "Ouvrir sur OpenSea.io";
"nft.details.internal.button.title" = "Ouvrir sur %@";
"Bookmarks" = "Signets";
"History" = "Historique";
"history.noHistory.label.title" = "Pas encore d'historique !";
"New" = "Nouveau";
"configureTransaction.dataField.label.title" = "Données (facultatif). %@";
"Nonce" = "Nonce";
"transaction.recipient.label.title" = "Destinataire";
"transaction.sender.label.title" = "Expéditeur";
"Are you sure you would like to delete?" = "Êtes-vous sûr de vouloir supprimer?";
"confirmPayment.amount.label.title" = "Montant";
"confirmPayment.dapp.label.title" = "DApp";
"DuckDuckGo" = "DuckDuckGo";
"Google" = "Google";
"IncomingTransaction" = "Transaction entrante";
"OutgoingTransaction" = "Transaction sortante";
"PendingTransaction" = "Transaction en attente";
"settings.browser.clearCache.alert.message" = "Cela effacera le cache, les cookies et autres données de navigation.";
"settings.browser.clearCache.alert.title" = "Effacer les données de navigation ?";
"settings.browser.clearCache.title" = "Effacer le cache du navigateur";
"settings.browser.searchEngine.title" = "Moteur de recherche";
"settings.browser.title" = "Navigateur DApps";
"transaction.deployContract.label.title" = "Déployer le contrat intelligent";
"import.keystore.footer" = "Plusieurs lignes de texte commençant par \" {...} \" plus le mot de passe que vous avez utilisé pour le chiffrer";
"import.mnemonic.footer" = "En général 12 mots (parfois 24) séparés par des espaces simples";
"import.privateKey.footer" = "Généralement de 64 caractères alphanumériques";
"import.watch.footer" = "Vous pouvez \"regarder\" n'importe quelle adresse publique sans divulguer votre clé privée. Cela vous permet de visualiser les soldes et les transactions, mais pas d'envoyer des transactions.";
"Infura" = "Infura";
"Keystore" = "Fichier de clés de sauvegarde";
"NetworkFee" = "Frais de réseau";
"OpenSea" = "OpenSea";
"PoweredBy" = "Alimenté par";
"send.error.insufficientEther" = "Solde %@ insuffisant";
"send.error.insufficientGas" = "Insuffisant %@ pour couvrir les frais de gaz";
"send.error.insufficientToken" = "Balance jetons %@ insuffisante";
"settings.about.title" = "A propos de";
"settings.autoLock.button.title" = "Verrouillage automatique";
"wallets.navigation.title.autolock.five.hour" = "En cas d'absence pendant 5 heures";
"wallets.navigation.title.autolock.five.minutes" = "En cas d'absence pendant 5 minutes";
"wallets.navigation.title.autolock.immediate" = "Immédiat";
"wallets.navigation.title.autolock.one.hour" = "En cas d'absence pendant 1 heure";
"wallets.navigation.title.autolock.one.minute" = "En cas d'absence pendant 1 minute.";
"Watch" = "Regarder";
"Done" = "Terminé";
"Manage" = "Gérer";
"passphrase.seed.label.title" = "Ces 12 mots sont la seule façon de restaurer votre portefeuille Trust. \n Enregistrez-les dans un endroit sûr et secret.";
"settings.analitics.answer.description" = "Aidez Trust à améliorer l'expérience utilisateur en partageant le diagnostic quotidien de l'application.";
"settings.analitics.branch.description" = "Aidez Trust à améliorer l'engagement des utilisateurs en partageant des redirections de liens profonds.";
"settings.analitics.crashlytics.description" = "Aidez les développeurs de Trust à améliorer ses produits et services en envoyant automatiquement des rapports de crash.";
"settings.privacy.title" = "Vie privée";
"Skip" = "Sauter";
"VerifyBackupPhrase" = "Vérifier la phrase de sauvegarde";
"verify.passphrase.invalidOrder.title" = "Commande non valide. Réessayez !";
"verify.passphrase.welldone.title" = "Bien joué ! %@";
"verifyPassphrase.label.title" = "Tapez les mots pour les mettre côte à côte dans le bon ordre.";
"verifyPassphrase.skip.confirm.message" = "La perte d'une phrase de sauvegarde peut mettre votre portefeuille en danger !";
"verifyPassphrase.skip.confirm.title" = "Êtes-vous sûr de vouloir ignorer cette étape?";
"wallet.info.exportBackupPhrase" = "Afficher la phrase de sauvegarde";
"Reload" = "Recharger";
"Phrase" = "Phrase";
"Wallet" = "Portefeuille";
"MyWalletAddress" = "Mon adresse de portefeuille";
"WalletCreated" = "Portefeuille créé";
"Back" = "Précédent";
"MainWallet" = "Portefeuille principal";
"ImportedWallets" = "Portefeuilles importés";
"BackupPhrase" = "Phrase de sauvegarde";
"Address" = "Adresse";
"CreatingWallet" = "Créer un portefeuille";
2 changes: 2 additions & 0 deletions Trust/Localization/ru.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,5 @@
"ImportedWallets" = "Импортированные кошельки";
"Address" = "Адрес";
"CreatingWallet" = "Создание Кошелька";
"WalletImported" = "Кошелек был импортирован";
"SelectCoin" = "Выберите Монету";
2 changes: 2 additions & 0 deletions Trust/Localization/uk.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
"WalletCreated" = "Гаманець створений";
"Back" = "Назад";
"MainWallet" = "Основний Гаманець";
"Address" = "Адреса";
"CreatingWallet" = "Створення Гаманця";
34 changes: 25 additions & 9 deletions Trust/Wallet/Coordinators/WalletCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ final class WalletCoordinator: Coordinator {
switch entryPoint {
case .welcome:
if let _ = keystore.mainWallet {
setImportWalletView()
setSelectCoin()
} else {
setWelcomeView()
}
case .importWallet:
if let _ = keystore.mainWallet {
setImportWalletView()
setSelectCoin()
} else {
setImportMainWallet()
}
Expand All @@ -47,11 +47,10 @@ final class WalletCoordinator: Coordinator {
}
}

private func setImportWalletView() {
let controller = ImportWalletViewController(keystore: keystore)
private func pushImportWalletView(for coin: Coin) {
let controller = ImportWalletViewController(keystore: keystore, for: coin)
controller.delegate = self
controller.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(dismiss))
navigationController.viewControllers = [controller]
navigationController.pushViewController(controller, animated: true)
}

private func setWelcomeView() {
Expand All @@ -63,9 +62,7 @@ final class WalletCoordinator: Coordinator {

func pushImportWallet() {
if let _ = keystore.mainWallet {
let controller = ImportWalletViewController(keystore: keystore)
controller.delegate = self
navigationController.pushViewController(controller, animated: true)
pushSelectCoin()
} else {
importMainWallet()
}
Expand Down Expand Up @@ -156,6 +153,19 @@ final class WalletCoordinator: Coordinator {
navigationController.pushViewController(controller, animated: true)
}

private func pushSelectCoin() {
let controller = SelectCoinViewController(coins: Config.current.servers)
controller.delegate = self
navigationController.pushViewController(controller, animated: true)
}

private func setSelectCoin() {
let controller = SelectCoinViewController(coins: Config.current.servers)
controller.delegate = self
controller.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(dismiss))
navigationController.viewControllers = [controller]
}

func showConfirm(for account: Wallet, completedBackup: Bool) {
let type = WalletType.hd(account)
let wallet = WalletInfo(type: type, info: WalletObject.from(type))
Expand Down Expand Up @@ -234,3 +244,9 @@ extension WalletCoordinator: ImportMainWalletViewControllerDelegate {
walletCreated(wallet: wallet, type: .imported)
}
}

extension WalletCoordinator: SelectCoinViewControllerDelegate {
func didSelect(coin: Coin, in controller: SelectCoinViewController) {
pushImportWalletView(for: coin)
}
}
4 changes: 3 additions & 1 deletion Trust/Wallet/Types/WalletInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ struct WalletInfo {
case .privateKey(let account), .hd(let account):
return account.accounts
case .address(let coin, let address):
return []
return [
Account(wallet: .none, address: address, derivationPath: coin.derivationPath(at: 0)),
]
}
}

Expand Down
Loading

0 comments on commit 92d254d

Please sign in to comment.