From 2910aa3d6331de6bd1057ce270a8702a5ca5c6c8 Mon Sep 17 00:00:00 2001 From: Michael Scoff Date: Tue, 24 Oct 2017 02:23:36 -0700 Subject: [PATCH] Remove CreateWalletViewController --- Trust.xcodeproj/project.pbxproj | 4 - .../CreateWalletViewController.swift | 136 ------------------ 2 files changed, 140 deletions(-) delete mode 100644 Trust/Wallet/ViewControllers/CreateWalletViewController.swift diff --git a/Trust.xcodeproj/project.pbxproj b/Trust.xcodeproj/project.pbxproj index e1c9b5d99..e15ea1336 100644 --- a/Trust.xcodeproj/project.pbxproj +++ b/Trust.xcodeproj/project.pbxproj @@ -24,7 +24,6 @@ 2912CD101F6A830700C6CBE3 /* TrustTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2912CD0F1F6A830700C6CBE3 /* TrustTests.swift */; }; 2912CD1B1F6A830700C6CBE3 /* TrustUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2912CD1A1F6A830700C6CBE3 /* TrustUITests.swift */; }; 2912CD2B1F6A833E00C6CBE3 /* TransactionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2912CD2A1F6A833E00C6CBE3 /* TransactionsViewController.swift */; }; - 2912CD2D1F6A839700C6CBE3 /* CreateWalletViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2912CD2C1F6A839700C6CBE3 /* CreateWalletViewController.swift */; }; 2912CD2F1F6A83A100C6CBE3 /* ImportWalletViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2912CD2E1F6A83A100C6CBE3 /* ImportWalletViewController.swift */; }; 2912CD321F6A83EE00C6CBE3 /* WelcomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2912CD311F6A83EE00C6CBE3 /* WelcomeViewController.swift */; }; 2912CD341F6A849C00C6CBE3 /* WelcomeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2912CD331F6A849C00C6CBE3 /* WelcomeViewModel.swift */; }; @@ -226,7 +225,6 @@ 2912CD1A1F6A830700C6CBE3 /* TrustUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrustUITests.swift; sourceTree = ""; }; 2912CD1C1F6A830700C6CBE3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 2912CD2A1F6A833E00C6CBE3 /* TransactionsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionsViewController.swift; sourceTree = ""; }; - 2912CD2C1F6A839700C6CBE3 /* CreateWalletViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateWalletViewController.swift; sourceTree = ""; }; 2912CD2E1F6A83A100C6CBE3 /* ImportWalletViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImportWalletViewController.swift; sourceTree = ""; }; 2912CD311F6A83EE00C6CBE3 /* WelcomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeViewController.swift; sourceTree = ""; }; 2912CD331F6A849C00C6CBE3 /* WelcomeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeViewModel.swift; sourceTree = ""; }; @@ -911,7 +909,6 @@ 2977CAEE1F7E0C0D009682A0 /* ViewControllers */ = { isa = PBXGroup; children = ( - 2912CD2C1F6A839700C6CBE3 /* CreateWalletViewController.swift */, 2912CD2E1F6A83A100C6CBE3 /* ImportWalletViewController.swift */, ); path = ViewControllers; @@ -1739,7 +1736,6 @@ 29A0E1871F706D0700BAAAED /* EthereumConverter.swift in Sources */, 29AD8A0C1F93FBBF008E10E7 /* Subscribable.swift in Sources */, 295247DF1F8326EF007FDC31 /* AccountViewCell.swift in Sources */, - 2912CD2D1F6A839700C6CBE3 /* CreateWalletViewController.swift in Sources */, 290FD8BB1F7BFE7400548896 /* GetBlockByNumberRequest.swift in Sources */, 291F52B71F6B870400B369AB /* CastError.swift in Sources */, 293248841F88CCD2008A9818 /* SplashState.swift in Sources */, diff --git a/Trust/Wallet/ViewControllers/CreateWalletViewController.swift b/Trust/Wallet/ViewControllers/CreateWalletViewController.swift deleted file mode 100644 index d171215c3..000000000 --- a/Trust/Wallet/ViewControllers/CreateWalletViewController.swift +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright SIX DAY LLC. All rights reserved. - -import UIKit -import Eureka -import BonMot -import OnePasswordExtension - -protocol CreateWalletViewControllerDelegate: class { - func didPressImportWallet(in viewController: CreateWalletViewController) - func didCreateAccount(account: Account, in viewController: CreateWalletViewController) - func didCancel(in viewController: CreateWalletViewController) -} - -class CreateWalletViewController: FormViewController { - - private let viewModel = CreateWalletViewModel() - private let keystore = EtherKeystore() - - struct Values { - static let password = "password" - static let passwordRepeat = "passwordRepeat" - } - - lazy var onePasswordCoordinator: OnePasswordCoordinator = { - return OnePasswordCoordinator(keystore: self.keystore) - }() - - weak var delegate: CreateWalletViewControllerDelegate? - - override func viewDidLoad() { - super.viewDidLoad() - title = viewModel.title - view.backgroundColor = .white - -// if OnePasswordExtension.shared().isAppExtensionAvailable() { -// self.navigationItem.rightBarButtonItem = UIBarButtonItem( -// image: R.image.onepasswordButton(), -// style: .done, -// target: self, -// action: #selector(onePasswordCreate) -// ) -// } - - form +++ - Section { - var header = HeaderFooterView(.class) - header.height = { 90 } - header.onSetupView = { (view, section) -> Void in - view.label.attributedText = "Password will be used to protect your digital wallet".styled( - with: - .color(UIColor(hex: "6e6e72")), - .font(UIFont.systemFont(ofSize: 14, weight: UIFontWeightRegular)), - .lineHeightMultiple(1.25) - ) - view.logoImageView.image = R.image.create_wallet() - } - $0.header = header - } - - <<< AppFormAppearance.textFieldFloat(tag: Values.password) { - $0.add(rule: RuleRequired()) - $0.validationOptions = .validatesOnDemand - }.cellUpdate { cell, _ in - cell.textField.isSecureTextEntry = true - cell.textField.textAlignment = .left - cell.textField.placeholder = "Password" - } - - <<< AppFormAppearance.textFieldFloat(tag: Values.passwordRepeat) { - $0.add(rule: RuleRequired()) - $0.validationOptions = .validatesOnDemand - }.cellUpdate { cell, _ in - cell.textField.isSecureTextEntry = true - cell.textField.textAlignment = .left - cell.textField.placeholder = "Confirm password" - } - - +++ Section("") - - <<< ButtonRow("Create") { - $0.title = $0.tag - }.onCellSelection { [unowned self] (_, row) in - let validatedError = row.section?.form?.validate() - guard let errors = validatedError, errors.isEmpty else { return } - self.startImport() - } - - +++ Section("") - +++ Section("") - +++ Section("Already have a wallet?") - <<< ButtonRow("Import") { - $0.title = $0.tag - }.onCellSelection { [unowned self] (_, _) in - self.importWallet() - } - } - - func handleCreatedAccount(account: Account) { - delegate?.didCreateAccount(account: account, in: self) - } - - func startImport() { - - let passwordRow: TextFloatLabelRow? = form.rowBy(tag: Values.password) - let passwordRepeatRow: TextFloatLabelRow? = form.rowBy(tag: Values.passwordRepeat) - - let password = passwordRow?.value ?? "" - let passwordRepeat = passwordRepeatRow?.value ?? "" - - guard password == passwordRepeat else { - return - } - - createAccount(for: password) - } - - func createAccount(for password: String) { - let account = keystore.createAccout(password: password) - handleCreatedAccount(account: account) - } - - func importWallet() { - delegate?.didPressImportWallet(in: self) - } - - func onePasswordCreate() { - onePasswordCoordinator.createWallet(in: self) { result in - switch result { - case .success(let account): - self.handleCreatedAccount(account: account) - case .failure(let error): - self.displayError(error: error) - } - } - } -}