Skip to content

Commit

Permalink
Rename default account and other UI fixes (#694)
Browse files Browse the repository at this point in the history
* Rename default account to language translation and fix UI on wallet migration,delete watch only message and smaller screens

* Fix overlapping UI on sync details screen

* Refactor create/restore wallet function

* remove commented code
  • Loading branch information
macsleven committed Jun 2, 2020
1 parent aaff2e1 commit 3b2e0c8
Show file tree
Hide file tree
Showing 21 changed files with 138 additions and 110 deletions.
2 changes: 1 addition & 1 deletion Decred Wallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -834,8 +834,8 @@
DD493C01247654BC00C0D772 /* WatchOnlyWalletInfoTableViewCell.swift */,
DD493C05247654BC00C0D772 /* WatchOnlyWalletTableViewCell.xib */,
DD493BFF247654BC00C0D772 /* WatchOnlyWalletInfoTableViewCell.xib */,
B3E727C523DD4ABF003B06B4 /* WalletAccountTableViewCell.xib */,
DD493C03247654BC00C0D772 /* WatchOnlyWalletTableViewCell.swift */,
B3E727C523DD4ABF003B06B4 /* WalletAccountTableViewCell.xib */,
B3E727C923DD4AE7003B06B4 /* WalletAccountTableViewCell.swift */,
B3B9432823E4D0B30088EC3E /* WalletSettingsViewController.swift */,
B3D474DE23E55B5D00B6E305 /* WalletSettings.swift */,
Expand Down
2 changes: 2 additions & 0 deletions Decred Wallet/Constants/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ struct GlobalConstants {
static let LEGACY_TESTNET_HD_PATH = "m / 44' / 11' /"
static let MAINNET_HD_PATH = "m / 44' / 42' /"
static let LEGACY_MAINNET_HD_PATH = "m / 44' / 20' /"
static let DEFAULT = "default"
}

struct Wallet {
static let defaultRequiredConfirmations: Int32 = 2
static let DEFAULT_ACCOUNT_NUMBER = 0
}
}
30 changes: 20 additions & 10 deletions Decred Wallet/Features/App Launch/StartScreenViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ class StartScreenViewController: UIViewController, CAAnimationDelegate {
print("init multiwallet error: \(initError!.localizedDescription)")
}

if WalletLoader.shared.oneOrMoreWalletsExist {
if SingleToMultiWalletMigration.migrationNeeded {
self.loadingLabel.text = LocalizedStrings.migratingWallet
self.animationDurationSeconds = 5

} else if WalletLoader.shared.oneOrMoreWalletsExist {
self.loadingLabel.text = LocalizedStrings.openingWallet
self.animationDurationSeconds = 5
}
Expand Down Expand Up @@ -136,15 +140,21 @@ class StartScreenViewController: UIViewController, CAAnimationDelegate {
@IBAction func createNewwallet(_ sender: Any) {
Security.spending(initialSecurityType: .password)
.requestNewCode(sender: self, isChangeAttempt: false) { pinOrPassword, type, completion in

WalletLoader.shared.createWallet(spendingPinOrPassword: pinOrPassword, securityType: type, walletName: LocalizedStrings.myWallet) {
createWalletError in

if createWalletError != nil {
completion?.displayError(errorMessage: createWalletError!.localizedDescription)
} else {
completion?.dismissDialog()
NavigationMenuTabBarController.setupMenuAndLaunchApp(isNewWallet: true)

DispatchQueue.global(qos: .userInitiated).async {
do {
let wallet = try WalletLoader.shared.multiWallet.createNewWallet(LocalizedStrings.myWallet, privatePassphrase: pinOrPassword, privatePassphraseType: type.type)

Utils.renameDefaultAccountToLocalLanguage(wallet: wallet)

DispatchQueue.main.async {
completion?.dismissDialog()
NavigationMenuTabBarController.setupMenuAndLaunchApp(isNewWallet: true)
}
} catch let error {
DispatchQueue.main.async {
completion?.displayError(errorMessage: error.localizedDescription)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PES-gD-iwp" customClass="RoundedView" customModule="Decred_Wallet" customModuleProvider="target">
<rect key="frame" x="40" y="372" width="334" height="162"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Remove wallet from device?" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DmN-2k-s0e">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Remove wallet from device?" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" minimumFontSize="15" translatesAutoresizingMaskIntoConstraints="NO" id="DmN-2k-s0e">
<rect key="frame" x="24" y="20" width="286" height="25.5"/>
<fontDescription key="fontDescription" name="SourceSansPro-SemiBold" family="Source Sans Pro" pointSize="20"/>
<color key="textColor" red="0.035294117649999998" green="0.078431372550000003" blue="0.25098039220000001" alpha="1" colorSpace="calibratedRGB"/>
Expand Down Expand Up @@ -558,7 +558,7 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Jix-Yz-rr0">
<rect key="frame" x="0.0" y="606" width="414" height="290"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Create watch only wallet" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CPF-2i-5k9">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Create watch only wallet" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="11" translatesAutoresizingMaskIntoConstraints="NO" id="CPF-2i-5k9">
<rect key="frame" x="24" y="24" width="366" height="25.5"/>
<fontDescription key="fontDescription" name="SourceSansPro-SemiBold" family="Source Sans Pro" pointSize="20"/>
<color key="textColor" red="0.035294117649999998" green="0.078431372550000003" blue="0.25098039220000001" alpha="1" colorSpace="calibratedRGB"/>
Expand Down
10 changes: 5 additions & 5 deletions Decred Wallet/Features/More/More Features/About/About.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand Down Expand Up @@ -155,13 +155,13 @@
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5gB-oy-pZx">
<rect key="frame" x="4" y="0.0" width="406" height="896"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<string key="text">ISC License
<mutableString key="text">ISC License

Copyright (c) 2018-2019 The Decred developers
Copyright (c) 2018-2020 The Decred developers

Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.</string>
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.</mutableString>
<color key="textColor" white="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
Expand Down
Loading

0 comments on commit 3b2e0c8

Please sign in to comment.