diff --git a/.travis.yml b/.travis.yml index 0ac62798..859f3136 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: swift -osx_image: xcode10.2.1 +osx_image: xcode10.2 cache: directories: - Carthage diff --git a/Localization/en.lproj/Localizable.strings b/Localization/en.lproj/Localizable.strings index 004be872..5315fd4b 100644 --- a/Localization/en.lproj/Localizable.strings +++ b/Localization/en.lproj/Localizable.strings @@ -18,6 +18,8 @@ "defaults.address" = "Address"; "defaults.next" = "Next"; "defaults.previous" = "Previous"; +"defaults.delete" = "Delete"; +"defaults.open" = "Open"; // ---------------------------------------- // MainTabbarNavigation.storyboard @@ -56,7 +58,7 @@ // Set wallet pin "setup.pinCode.setPinTitle" = "Set wallet PIN"; -"setup.pinCode.setPinDesc" = "Your wallet PIN will be used to open this app, and to send XVG with. If you forget it, you wont be able to access your wallet."; +"setup.pinCode.setPinDesc" = "Your wallet PIN will be used to open this app, and to send XVG with. If you forget it, you won't be able to access your wallet."; // Re enter wallet pin diff --git a/VergeiOS/Assets/LaunchScreen.storyboard b/VergeiOS/Assets/LaunchScreen.storyboard index 0bebf0fa..111d51ad 100644 --- a/VergeiOS/Assets/LaunchScreen.storyboard +++ b/VergeiOS/Assets/LaunchScreen.storyboard @@ -29,11 +29,31 @@ + + + + + + + + + + diff --git a/VergeiOS/Assets/Setup.storyboard b/VergeiOS/Assets/Setup.storyboard index 797ee056..9ae08215 100644 --- a/VergeiOS/Assets/Setup.storyboard +++ b/VergeiOS/Assets/Setup.storyboard @@ -29,9 +29,6 @@ - - - @@ -45,9 +42,6 @@ - - - diff --git a/VergeiOS/Controllers/RestoreGuide/EnterRecoveryKeyController.swift b/VergeiOS/Controllers/RestoreGuide/EnterRecoveryKeyController.swift index 5a131fa8..0f6d9f07 100644 --- a/VergeiOS/Controllers/RestoreGuide/EnterRecoveryKeyController.swift +++ b/VergeiOS/Controllers/RestoreGuide/EnterRecoveryKeyController.swift @@ -21,14 +21,24 @@ class EnterRecoveryKeyController: AbstractRestoreViewController { override func viewDidLoad() { super.viewDidLoad() - setupTextFieldBar() - updateView(index: index) + self.setupTextFieldBar() + self.updateView(index: self.index) } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) - keyTextField.becomeFirstResponder() + self.keyTextField.becomeFirstResponder() + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + + if self.keys.count == self.numberOfWords { + self.keys = [] + self.index = 0 + self.updateView(index: self.index) + } } private func setupTextFieldBar() { @@ -55,8 +65,8 @@ class EnterRecoveryKeyController: AbstractRestoreViewController { nextButton ] - keyTextField.inputAccessoryView = keyboardToolbar - keyTextField.delegate = self + self.keyTextField.inputAccessoryView = keyboardToolbar + self.keyTextField.delegate = self } private func createLabelText(index: Int) -> String { @@ -72,13 +82,12 @@ class EnterRecoveryKeyController: AbstractRestoreViewController { } private func updateView(index: Int) { - print(keys) - keyLabel.text = createLabelText(index: index) - keyTextField.text = keys.indices.contains(index) ? keys[index] : "" - keyTextField.placeholder = createPlaceholderText(index: index) - keyProgressLabel.text = createProgressText(index: index) + self.keyLabel.text = self.createLabelText(index: index) + self.keyTextField.text = self.keys.indices.contains(index) ? keys[index] : "" + self.keyTextField.placeholder = self.createPlaceholderText(index: index) + self.keyProgressLabel.text = self.createProgressText(index: index) - guard let toolbar = keyTextField.inputAccessoryView as? UIToolbar else { + guard let toolbar = self.keyTextField.inputAccessoryView as? UIToolbar else { return } @@ -91,38 +100,41 @@ class EnterRecoveryKeyController: AbstractRestoreViewController { if text == nil || text!.count == 0 { return false } - - keys.insert(text!, at: index) + + self.keys.insert(text!, at: index) return true } @objc func previousClick() { - keys.removeLast() - index = index - 1 - updateView(index: index) + self.keys.removeLast() + self.index = self.index - 1 + updateView(index: self.index) } @objc func nextClick() { - let isAdded: Bool = addKeyToList(text: keyTextField.text) + let isAdded: Bool = self.addKeyToList(text: self.keyTextField.text) - if index < numberOfWords - 1 { - if isAdded { - index = index + 1 - updateView(index: index) - } else { - keyTextField.shake() - return - } - } else { - performSegue(withIdentifier: "showFinalRecovery", sender: self) + if !isAdded { + self.keyTextField.shake() + + return } + if self.index < self.numberOfWords - 1 { + self.index = self.index + 1 + self.updateView(index: self.index) + } + + if self.keys.count == self.numberOfWords { + print(self.keys) + self.performSegue(withIdentifier: "showFinalRecovery", sender: self) + } } func setMnemonicAndProceed(_ mnemonic: [String]) { - keys = mnemonic + self.keys = mnemonic - performSegue(withIdentifier: "showFinalRecovery", sender: self) + self.performSegue(withIdentifier: "showFinalRecovery", sender: self) } override func prepare(for segue: UIStoryboardSegue, sender: Any?) { @@ -142,7 +154,7 @@ class EnterRecoveryKeyController: AbstractRestoreViewController { extension EnterRecoveryKeyController: UITextFieldDelegate { public func textFieldShouldReturn(_ textField: UITextField) -> Bool { - nextClick() + self.nextClick() return true } diff --git a/VergeiOS/Controllers/Settings/ServiceUrlTableViewController.swift b/VergeiOS/Controllers/Settings/ServiceUrlTableViewController.swift index 13bffeb7..f609f1ee 100644 --- a/VergeiOS/Controllers/Settings/ServiceUrlTableViewController.swift +++ b/VergeiOS/Controllers/Settings/ServiceUrlTableViewController.swift @@ -71,7 +71,7 @@ class ServiceUrlTableViewController: LocalizableTableViewController { } func errorDuringChange(alert: UIAlertController) { - alert.addAction(UIAlertAction(title: "default.cencel".localized, style: .cancel)) + alert.addAction(UIAlertAction(title: "defaults.cancel".localized, style: .cancel)) alert.addAction(UIAlertAction(title: "settings.serviceUrl.alert.usePrevUrl".localized, style: .default) { action in self.rollbackServiceUrl(serviceUrl: self.previousServiceUrl) }) diff --git a/VergeiOS/Extensions/UIAlertController+Statics.swift b/VergeiOS/Extensions/UIAlertController+Statics.swift index a2bf3b6d..8083ee00 100644 --- a/VergeiOS/Extensions/UIAlertController+Statics.swift +++ b/VergeiOS/Extensions/UIAlertController+Statics.swift @@ -13,9 +13,9 @@ extension UIAlertController { preferredStyle: .alert ) - let delete = UIAlertAction(title: "Delete", style: .destructive, handler: handler) + let delete = UIAlertAction(title: "defaults.delete".localized, style: .destructive, handler: handler) - alert.addAction(UIAlertAction(title: "Cancel", style: .cancel)) + alert.addAction(UIAlertAction(title: "defaults.cancel".localized, style: .cancel)) alert.addAction(delete) return alert @@ -28,7 +28,7 @@ extension UIAlertController { preferredStyle: .alert ) - alert.addAction(UIAlertAction(title: "Ok", style: .cancel)) + alert.addAction(UIAlertAction(title: "defaults.ok".localized, style: .cancel)) return alert } @@ -40,9 +40,9 @@ extension UIAlertController { preferredStyle: .alert ) - let delete = UIAlertAction(title: "Delete", style: .destructive, handler: handler) + let delete = UIAlertAction(title: "defaults.delete".localized, style: .destructive, handler: handler) - alert.addAction(UIAlertAction(title: "Cancel", style: .cancel)) + alert.addAction(UIAlertAction(title: "defaults.cancel".localized, style: .cancel)) alert.addAction(delete) return alert @@ -56,7 +56,7 @@ extension UIAlertController { preferredStyle: .alert ) - alert.addAction(UIAlertAction(title: "Ok", style: .cancel)) + alert.addAction(UIAlertAction(title: "defaults.ok".localized, style: .cancel)) return alert } @@ -68,7 +68,7 @@ extension UIAlertController { preferredStyle: .alert ) - alert.addAction(UIAlertAction(title: "Ok", style: .cancel)) + alert.addAction(UIAlertAction(title: "defaults.ok".localized, style: .cancel)) return alert } @@ -83,7 +83,7 @@ extension UIAlertController { actionSheet.addAction(UIAlertAction(title: "Start Tor", style: .default)) actionSheet.addAction(UIAlertAction(title: "Without Tor", style: .destructive)) - actionSheet.addAction(UIAlertAction(title: "Cancel", style: .cancel)) + actionSheet.addAction(UIAlertAction(title: "defaults.cancel".localized, style: .cancel)) return actionSheet } @@ -91,8 +91,8 @@ extension UIAlertController { static func createShowTermsOfUseAlert() -> UIAlertController { let alert = UIAlertController(title: "View Wallet Terms of Use", message: nil, preferredStyle: .alert) - alert.addAction(UIAlertAction(title: "Cancel", style: .cancel)) - alert.addAction(UIAlertAction(title: "Open", style: .default) { action in + alert.addAction(UIAlertAction(title: "defaults.cancel".localized, style: .cancel)) + alert.addAction(UIAlertAction(title: "defaults.open".localized, style: .default) { action in if let path: URL = URL(string: Constants.termsOfUse) { UIApplication.shared.open(path, options: [:]) }