From 828e96a92f35c35058bc0ea3834826faa0eeedde Mon Sep 17 00:00:00 2001 From: macsleven Date: Mon, 6 Apr 2020 23:47:49 +0100 Subject: [PATCH 1/2] new wallet dialog design --- Decred Wallet.xcodeproj/project.pbxproj | 4 + .../Features/Overview/NewWalletDialog.swift | 41 ++++++++++ .../Features/Overview/Overview.storyboard | 80 +++++++++++++++++++ Decred Wallet/Utils/LocalizedStrings.swift | 5 +- Decred Wallet/en.lproj/Localizable.strings | 4 + Decred Wallet/es.lproj/Localizable.strings | 4 + Decred Wallet/pt-BR.lproj/Localizable.strings | 4 + Decred Wallet/ru-RU.lproj/Localizable.strings | 4 + Decred Wallet/vi.lproj/Localizable.strings | 4 + .../zh-Hans.lproj/Localizable.strings | 4 + 10 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 Decred Wallet/Features/Overview/NewWalletDialog.swift diff --git a/Decred Wallet.xcodeproj/project.pbxproj b/Decred Wallet.xcodeproj/project.pbxproj index f00e98c3f..d766a268b 100644 --- a/Decred Wallet.xcodeproj/project.pbxproj +++ b/Decred Wallet.xcodeproj/project.pbxproj @@ -176,6 +176,7 @@ DDCF259C22B8A362005FCBB9 /* Send.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DDCF259B22B8A361005FCBB9 /* Send.storyboard */; }; DDCF25A122B8A3D4005FCBB9 /* Settings.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DDCF25A022B8A3D4005FCBB9 /* Settings.storyboard */; }; DDCF25A922B8A488005FCBB9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DDCF25A822B8A487005FCBB9 /* Main.storyboard */; }; + DDCF5EF9243BB4B000F389EE /* NewWalletDialog.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDCF5EF8243BB4B000F389EE /* NewWalletDialog.swift */; }; DDD65AD722A935460027CDA8 /* LicenseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD65AD622A935460027CDA8 /* LicenseViewController.swift */; }; DDDF95CC23C11F760057AA7F /* VerifyMessage.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DDDF95CB23C11F760057AA7F /* VerifyMessage.storyboard */; }; DDDF95CE23C11F760057AA7F /* VerifyMessageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDDF95CD23C11F760057AA7F /* VerifyMessageViewController.swift */; }; @@ -366,6 +367,7 @@ DDCF259B22B8A361005FCBB9 /* Send.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Send.storyboard; sourceTree = ""; }; DDCF25A022B8A3D4005FCBB9 /* Settings.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Settings.storyboard; sourceTree = ""; }; DDCF25A822B8A487005FCBB9 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; + DDCF5EF8243BB4B000F389EE /* NewWalletDialog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewWalletDialog.swift; sourceTree = ""; }; DDD65AD622A935460027CDA8 /* LicenseViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LicenseViewController.swift; sourceTree = ""; }; DDDF95CB23C11F760057AA7F /* VerifyMessage.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = VerifyMessage.storyboard; sourceTree = ""; }; DDDF95CD23C11F760057AA7F /* VerifyMessageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VerifyMessageViewController.swift; sourceTree = ""; }; @@ -740,6 +742,7 @@ B3B469F1228F0F2600A68EDD /* OverviewViewController.swift */, B34A2F9023E8ED1500B8BC01 /* MultiWalletSyncDetailsLoader.swift */, B34A2F8E23E8E90500B8BC01 /* WalletSyncDetailsTableViewCell.swift */, + DDCF5EF8243BB4B000F389EE /* NewWalletDialog.swift */, ); path = Overview; sourceTree = ""; @@ -1173,6 +1176,7 @@ 103BE67E240D1F9E007910DA /* WalletSelectorCollectionViewCell.swift in Sources */, B3B46993228F0C2E00A68EDD /* AppDelegate.swift in Sources */, 108A2E7423DE311900B13A22 /* SelfSizedTableView.swift in Sources */, + DDCF5EF9243BB4B000F389EE /* NewWalletDialog.swift in Sources */, B3B46A12228F0F2700A68EDD /* TextFieldDoneButton.swift in Sources */, B3B46A1D228F0F2700A68EDD /* RequestPasswordViewController.swift in Sources */, B3B469FA228F0F2700A68EDD /* UIColor.swift in Sources */, diff --git a/Decred Wallet/Features/Overview/NewWalletDialog.swift b/Decred Wallet/Features/Overview/NewWalletDialog.swift new file mode 100644 index 000000000..9bcbce08c --- /dev/null +++ b/Decred Wallet/Features/Overview/NewWalletDialog.swift @@ -0,0 +1,41 @@ +// +// NewWalletDialog.swift +// Decred Wallet +// +// Copyright (c) 2020 The Decred developers +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. +import UIKit + +class NewWalletDialog: UIViewController { + @IBOutlet weak var dialogBackground: UIView! + var onDialogDismissed: (()->Void)? + + override func viewDidLoad() { + super.viewDidLoad() + + let tap = UITapGestureRecognizer(target: self.view, action: #selector(self.view.endEditing(_:))) + tap.cancelsTouchesInView = false + self.view.addGestureRecognizer(tap) + + let layer = self.view.layer + layer.frame = dialogBackground.frame + layer.shadowColor = UIColor.gray.cgColor + layer.shadowRadius = 20 + layer.shadowOpacity = 0.9 + layer.shadowOffset = CGSize(width: 0, height: 20) + } + + @IBAction private func OkAction(_ sender: UIButton) { + self.dismiss(animated: true, completion: nil) + self.onDialogDismissed?() + } + + static func show(onDialogDismissed: @escaping (()->Void)) { + let newWalletDialog = Storyboard.Overview.instantiateViewController(for: self) + newWalletDialog.onDialogDismissed = onDialogDismissed + newWalletDialog.modalTransitionStyle = .crossDissolve + newWalletDialog.modalPresentationStyle = .overCurrentContext + AppDelegate.shared.window?.rootViewController?.present(newWalletDialog, animated: true, completion: nil) + } +} diff --git a/Decred Wallet/Features/Overview/Overview.storyboard b/Decred Wallet/Features/Overview/Overview.storyboard index 554dd6f00..3c3915ec4 100644 --- a/Decred Wallet/Features/Overview/Overview.storyboard +++ b/Decred Wallet/Features/Overview/Overview.storyboard @@ -841,6 +841,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Decred Wallet/Utils/LocalizedStrings.swift b/Decred Wallet/Utils/LocalizedStrings.swift index 8650f38a3..81925dcbb 100644 --- a/Decred Wallet/Utils/LocalizedStrings.swift +++ b/Decred Wallet/Utils/LocalizedStrings.swift @@ -174,6 +174,10 @@ struct LocalizedStrings { static let walletCreated = NSLocalizedString("walletCreated", comment: "") static let backUpYourWalletsReminder = NSLocalizedString("backUpYourWalletsReminder", comment: "") + /* New Wallet Dialog */ + static let newWalletMsg = NSLocalizedString("newWalletMsg", comment: "") + static let welcomeToDecredWallet = NSLocalizedString("welcomeToDecredWallet", comment: "") + /* Transactions */ static let pending = NSLocalizedString("pending", comment: "") static let confirmed = NSLocalizedString("confirmed", comment: "") @@ -268,7 +272,6 @@ struct LocalizedStrings { static let confirmToSend = NSLocalizedString("confirmToSend", comment: "") static let addressFromQr = NSLocalizedString("addressFromQr", comment: "") - /* Confirm Send Fund */ static let sending = NSLocalizedString("sending", comment: "") static let withFee = NSLocalizedString("withFee", comment: "") diff --git a/Decred Wallet/en.lproj/Localizable.strings b/Decred Wallet/en.lproj/Localizable.strings index 6dcf5ce0d..bb8194fe6 100644 --- a/Decred Wallet/en.lproj/Localizable.strings +++ b/Decred Wallet/en.lproj/Localizable.strings @@ -180,6 +180,10 @@ "walletCreated" = "Wallet created"; "backUpYourWalletsReminder" = "Remember to back up your wallets as soon as possible."; +/* New Wallet Dialog */ +"newWalletMsg" = "Your 33 word seed is your wallet, keep it safe. Without it your funds cannot be recovered should your device be lost or destroyed.\n\nInitial wallet sync will take longer than usual. The wallet will connect to p2p nodes to download the blockchain headers, and will fetch only the blocks that you need while preserving your privacy."; +"welcomeToDecredWallet" = "Welcome to Decred Wallet."; + /* Transactions */ "pending" = "Pending"; "confirmed" = "Confirmed"; diff --git a/Decred Wallet/es.lproj/Localizable.strings b/Decred Wallet/es.lproj/Localizable.strings index 5b1b20dab..371fff27e 100644 --- a/Decred Wallet/es.lproj/Localizable.strings +++ b/Decred Wallet/es.lproj/Localizable.strings @@ -180,6 +180,10 @@ "walletCreated" = "Wallet created"; "backUpYourWalletsReminder" = "Remember to back up your wallets as soon as possible."; +/* New Wallet Dialog */ +"newWalletMsg" = "Your 33 word seed is your wallet, keep it safe. Without it your funds cannot be recovered should your device be lost or destroyed.\n\nInitial wallet sync will take longer than usual. The wallet will connect to p2p nodes to download the blockchain headers, and will fetch only the blocks that you need while preserving your privacy."; +"welcomeToDecredWallet" = "Welcome to Decred Wallet."; + /* Transactions */ "pending" = "Pendiente"; "confirmed" = "Confirmad"; diff --git a/Decred Wallet/pt-BR.lproj/Localizable.strings b/Decred Wallet/pt-BR.lproj/Localizable.strings index 9ab5fa4dc..4a1729033 100644 --- a/Decred Wallet/pt-BR.lproj/Localizable.strings +++ b/Decred Wallet/pt-BR.lproj/Localizable.strings @@ -180,6 +180,10 @@ "walletCreated" = "Wallet created"; "backUpYourWalletsReminder" = "Remember to back up your wallets as soon as possible."; +/* New Wallet Dialog */ +"newWalletMsg" = "Your 33 word seed is your wallet, keep it safe. Without it your funds cannot be recovered should your device be lost or destroyed.\n\nInitial wallet sync will take longer than usual. The wallet will connect to p2p nodes to download the blockchain headers, and will fetch only the blocks that you need while preserving your privacy."; +"welcomeToDecredWallet" = "Welcome to Decred Wallet."; + /* Transactions */ "pending" = "Pendente"; "confirmed" = "Confirmar"; diff --git a/Decred Wallet/ru-RU.lproj/Localizable.strings b/Decred Wallet/ru-RU.lproj/Localizable.strings index c82ad6f5b..fac1db305 100644 --- a/Decred Wallet/ru-RU.lproj/Localizable.strings +++ b/Decred Wallet/ru-RU.lproj/Localizable.strings @@ -180,6 +180,10 @@ "walletCreated" = "Wallet created"; "backUpYourWalletsReminder" = "Remember to back up your wallets as soon as possible."; +/* New Wallet Dialog */ +"newWalletMsg" = "Your 33 word seed is your wallet, keep it safe. Without it your funds cannot be recovered should your device be lost or destroyed.\n\nInitial wallet sync will take longer than usual. The wallet will connect to p2p nodes to download the blockchain headers, and will fetch only the blocks that you need while preserving your privacy."; +"welcomeToDecredWallet" = "Welcome to Decred Wallet."; + /* Transactions */ "pending" = "В ожидании"; "confirmed" = "Подтверждено"; diff --git a/Decred Wallet/vi.lproj/Localizable.strings b/Decred Wallet/vi.lproj/Localizable.strings index 0f79cb8f1..e09c59651 100644 --- a/Decred Wallet/vi.lproj/Localizable.strings +++ b/Decred Wallet/vi.lproj/Localizable.strings @@ -180,6 +180,10 @@ "walletCreated" = "Wallet created"; "backUpYourWalletsReminder" = "Remember to back up your wallets as soon as possible."; +/* New Wallet Dialog */ +"newWalletMsg" = "Your 33 word seed is your wallet, keep it safe. Without it your funds cannot be recovered should your device be lost or destroyed.\n\nInitial wallet sync will take longer than usual. The wallet will connect to p2p nodes to download the blockchain headers, and will fetch only the blocks that you need while preserving your privacy."; +"welcomeToDecredWallet" = "Welcome to Decred Wallet."; + /* Transactions */ "pending" = "Đang chờ xử lý"; "confirmed" = "Đã xác nhận"; diff --git a/Decred Wallet/zh-Hans.lproj/Localizable.strings b/Decred Wallet/zh-Hans.lproj/Localizable.strings index eb82b86ac..ef99ab32c 100644 --- a/Decred Wallet/zh-Hans.lproj/Localizable.strings +++ b/Decred Wallet/zh-Hans.lproj/Localizable.strings @@ -180,6 +180,10 @@ "walletCreated" = "Wallet created"; "backUpYourWalletsReminder" = "Remember to back up your wallets as soon as possible."; +/* New Wallet Dialog */ +"newWalletMsg" = "Your 33 word seed is your wallet, keep it safe. Without it your funds cannot be recovered should your device be lost or destroyed.\n\nInitial wallet sync will take longer than usual. The wallet will connect to p2p nodes to download the blockchain headers, and will fetch only the blocks that you need while preserving your privacy."; +"welcomeToDecredWallet" = "Welcome to Decred Wallet."; + /* Transactions */ "pending" = "等待"; "confirmed" = "已确认"; From 9acdc49d297d11decdad5ca5e53f117e587eddac Mon Sep 17 00:00:00 2001 From: macsleven Date: Tue, 7 Apr 2020 22:26:25 +0100 Subject: [PATCH 2/2] add welcome dialog --- .../NavigationMenuTabBarController.swift | 11 +++++++++-- .../RestoreExistingWalletSuccessViewController.swift | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Decred Wallet/Features/Navigation Menu/NavigationMenuTabBarController.swift b/Decred Wallet/Features/Navigation Menu/NavigationMenuTabBarController.swift index b011a60af..29bbc9424 100644 --- a/Decred Wallet/Features/Navigation Menu/NavigationMenuTabBarController.swift +++ b/Decred Wallet/Features/Navigation Menu/NavigationMenuTabBarController.swift @@ -27,7 +27,12 @@ class NavigationMenuTabBarController: UITabBarController { override func viewDidAppear(_ animated: Bool) { if self.isNewWallet { self.isNewWallet = false - Utils.showBanner(in: self.view, type: .success, text: LocalizedStrings.walletCreated) + NewWalletDialog.show { + Utils.showBanner(in: self.view, type: .success, text: LocalizedStrings.walletCreated) + self.startSync() + } + } else { + self.startSync() } } @@ -117,7 +122,9 @@ class NavigationMenuTabBarController: UITabBarController { let startView = NavigationMenuTabBarController() startView.isNewWallet = isNewWallet AppDelegate.shared.setAndDisplayRootViewController(startView.wrapInNavigationcontroller()) - + } + + private func startSync() { // start sync and new tx listener SyncManager.shared.startSync(allowSyncOnCellular: Settings.syncOnCellular) TransactionNotification.shared.startListeningForNotifications() diff --git a/Decred Wallet/Features/Wallet Setup/RestoreExistingWalletSuccessViewController.swift b/Decred Wallet/Features/Wallet Setup/RestoreExistingWalletSuccessViewController.swift index 69467dc71..4b2e95f36 100644 --- a/Decred Wallet/Features/Wallet Setup/RestoreExistingWalletSuccessViewController.swift +++ b/Decred Wallet/Features/Wallet Setup/RestoreExistingWalletSuccessViewController.swift @@ -10,6 +10,6 @@ import UIKit class RestoreExistingWalletSuccessViewController: UIViewController { @IBAction func getStarted(_ sender: Any) { - NavigationMenuTabBarController.setupMenuAndLaunchApp(isNewWallet: false) + NavigationMenuTabBarController.setupMenuAndLaunchApp(isNewWallet: true) } }