Skip to content

Commit

Permalink
Fix twelfth word missing bug
Browse files Browse the repository at this point in the history
  • Loading branch information
SwenVanZanten committed May 12, 2019
1 parent bbcf24c commit fa23a4d
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: swift
osx_image: xcode10.2.1
osx_image: xcode10.2
cache:
directories:
- Carthage
Expand Down
4 changes: 3 additions & 1 deletion Localization/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"defaults.address" = "Address";
"defaults.next" = "Next";
"defaults.previous" = "Previous";
"defaults.delete" = "Delete";
"defaults.open" = "Open";

// ----------------------------------------
// MainTabbarNavigation.storyboard
Expand Down Expand Up @@ -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

Expand Down
20 changes: 20 additions & 0 deletions VergeiOS/Assets/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,31 @@
<constraint firstAttribute="width" constant="200" id="jLw-5B-o45"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Privacy is our standard." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1uk-JM-OVG">
<rect key="frame" x="40" y="539" width="295" height="33"/>
<fontDescription key="fontDescription" name="AvenirNext-DemiBoldItalic" family="Avenir Next" pointSize="24"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Verge iOS wallet" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lTO-g1-bMO">
<rect key="frame" x="40" y="188" width="295" height="44"/>
<fontDescription key="fontDescription" name="AvenirNext-DemiBold" family="Avenir Next" pointSize="32"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="lTO-g1-bMO" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="43R-gE-Sz6"/>
<constraint firstItem="lTO-g1-bMO" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="40" id="FRC-g1-Vns"/>
<constraint firstItem="lTO-g1-bMO" firstAttribute="top" secondItem="f4d-ym-bsP" secondAttribute="bottom" constant="8" id="PqO-Rf-2ke"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="1uk-JM-OVG" secondAttribute="bottom" constant="95" id="WV9-2L-C1e"/>
<constraint firstItem="1uk-JM-OVG" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="Xtu-gZ-zAR"/>
<constraint firstItem="1uk-JM-OVG" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="40" id="YUJ-24-Sky"/>
<constraint firstItem="f4d-ym-bsP" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="100" id="hN7-lN-lqY"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="1uk-JM-OVG" secondAttribute="trailing" constant="40" id="tZV-wd-ke3"/>
<constraint firstItem="f4d-ym-bsP" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="wn3-Pp-vWy"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="lTO-g1-bMO" secondAttribute="trailing" constant="40" id="xwl-WQ-IDr"/>
</constraints>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
Expand Down
6 changes: 0 additions & 6 deletions VergeiOS/Assets/Setup.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
<fontDescription key="fontDescription" name="AvenirNext-DemiBold" family="Avenir Next" pointSize="32"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizationId" value="setup.walletName"/>
</userDefinedRuntimeAttributes>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="LogoWhite" translatesAutoresizingMaskIntoConstraints="NO" id="jdy-ZC-H6U">
<rect key="frame" x="87.5" y="120" width="200" height="60"/>
Expand All @@ -45,9 +42,6 @@
<fontDescription key="fontDescription" name="AvenirNext-DemiBoldItalic" family="Avenir Next" pointSize="24"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizationId" value="setup.loadingTor.subtitle"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
Expand Down
72 changes: 42 additions & 30 deletions VergeiOS/Controllers/RestoreGuide/EnterRecoveryKeyController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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 {
Expand All @@ -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
}

Expand All @@ -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?) {
Expand All @@ -142,7 +154,7 @@ class EnterRecoveryKeyController: AbstractRestoreViewController {

extension EnterRecoveryKeyController: UITextFieldDelegate {
public func textFieldShouldReturn(_ textField: UITextField) -> Bool {
nextClick()
self.nextClick()

return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down
20 changes: 10 additions & 10 deletions VergeiOS/Extensions/UIAlertController+Statics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand All @@ -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
Expand All @@ -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
}
Expand All @@ -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
}
Expand All @@ -83,16 +83,16 @@ 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
}

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: [:])
}
Expand Down

0 comments on commit fa23a4d

Please sign in to comment.