Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New wallet dialog #626

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Decred Wallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -366,6 +367,7 @@
DDCF259B22B8A361005FCBB9 /* Send.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Send.storyboard; sourceTree = "<group>"; };
DDCF25A022B8A3D4005FCBB9 /* Settings.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Settings.storyboard; sourceTree = "<group>"; };
DDCF25A822B8A487005FCBB9 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
DDCF5EF8243BB4B000F389EE /* NewWalletDialog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewWalletDialog.swift; sourceTree = "<group>"; };
DDD65AD622A935460027CDA8 /* LicenseViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LicenseViewController.swift; sourceTree = "<group>"; };
DDDF95CB23C11F760057AA7F /* VerifyMessage.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = VerifyMessage.storyboard; sourceTree = "<group>"; };
DDDF95CD23C11F760057AA7F /* VerifyMessageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VerifyMessageViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -740,6 +742,7 @@
B3B469F1228F0F2600A68EDD /* OverviewViewController.swift */,
B34A2F9023E8ED1500B8BC01 /* MultiWalletSyncDetailsLoader.swift */,
B34A2F8E23E8E90500B8BC01 /* WalletSyncDetailsTableViewCell.swift */,
DDCF5EF8243BB4B000F389EE /* NewWalletDialog.swift */,
);
path = Overview;
sourceTree = "<group>";
Expand Down Expand Up @@ -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 */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down Expand Up @@ -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()
Expand Down
41 changes: 41 additions & 0 deletions Decred Wallet/Features/Overview/NewWalletDialog.swift
Original file line number Diff line number Diff line change
@@ -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)
}
}
80 changes: 80 additions & 0 deletions Decred Wallet/Features/Overview/Overview.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,86 @@
</objects>
<point key="canvasLocation" x="-3391.304347826087" y="-1453.125"/>
</scene>
<!--New Wallet Dialog-->
<scene sceneID="ERY-Q8-aQV">
<objects>
<viewController storyboardIdentifier="NewWalletDialog" useStoryboardIdentifierAsRestorationIdentifier="YES" id="gsE-BC-zqT" customClass="NewWalletDialog" customModule="Decred_Wallet" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="ezv-G3-Xw6"/>
<viewControllerLayoutGuide type="bottom" id="jwJ-6c-2Yh"/>
</layoutGuides>
<view key="view" opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" id="Yvf-wj-B13">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="6rI-5F-8LF">
<rect key="frame" x="31" y="291.5" width="352" height="313.5"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="UfY-KA-vOc">
<rect key="frame" x="31" y="291.5" width="352" height="313.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Welcome to Decred Wallet." textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4Qb-GT-wAg">
<rect key="frame" x="20" y="20" width="312" height="20.5"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
<color key="textColor" white="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="xibLocalizedStringKey" value="welcomeToDecredWallet"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="749" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zxC-uh-g28">
<rect key="frame" x="20" y="56.5" width="312" height="191"/>
<string key="text">Your 33 word seed is your wallet, keep it safe. Without it your funds cannot be recovered should your device be lost or destroyed.

Initial 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.</string>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" white="0.02" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="xibLocalizedStringKey" value="newWalletMsg"/>
</userDefinedRuntimeAttributes>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Nay-UD-HAN">
<rect key="frame" x="20" y="263.5" width="312" height="30"/>
<state key="normal" title="ok">
<color key="titleColor" white="0.29999999999999999" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="xibLocalizedStringKey" value="ok"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="OkAction:" destination="gsE-BC-zqT" eventType="touchUpInside" id="kSL-Km-JKg"/>
</connections>
</button>
</subviews>
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="width" relation="lessThanOrEqual" constant="400" id="ahQ-6n-mbI"/>
</constraints>
<edgeInsets key="layoutMargins" top="20" left="20" bottom="20" right="20"/>
</stackView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="6rI-5F-8LF" firstAttribute="top" secondItem="UfY-KA-vOc" secondAttribute="top" id="3gN-qW-fbK"/>
<constraint firstItem="UfY-KA-vOc" firstAttribute="width" secondItem="Yvf-wj-B13" secondAttribute="width" multiplier="0.85" priority="999" id="B8g-aF-sZ3"/>
<constraint firstItem="6rI-5F-8LF" firstAttribute="height" secondItem="UfY-KA-vOc" secondAttribute="height" id="HKZ-GV-7M2"/>
<constraint firstItem="6rI-5F-8LF" firstAttribute="width" secondItem="UfY-KA-vOc" secondAttribute="width" id="ODe-ks-OnI"/>
<constraint firstItem="6rI-5F-8LF" firstAttribute="leading" secondItem="UfY-KA-vOc" secondAttribute="leading" id="T0b-2g-5tE"/>
<constraint firstItem="UfY-KA-vOc" firstAttribute="centerX" secondItem="Yvf-wj-B13" secondAttribute="centerX" id="lDg-e5-Z89"/>
<constraint firstItem="UfY-KA-vOc" firstAttribute="centerY" secondItem="Yvf-wj-B13" secondAttribute="centerY" id="qWJ-zz-eKn"/>
</constraints>
<viewLayoutGuide key="safeArea" id="tSa-0G-seT"/>
</view>
<connections>
<outlet property="dialogBackground" destination="6rI-5F-8LF" id="Aru-Wr-QPl"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="kht-lD-a88" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-1051" y="-717"/>
</scene>
</scenes>
<resources>
<image name="ic_close" width="24" height="24"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import UIKit

class RestoreExistingWalletSuccessViewController: UIViewController {
@IBAction func getStarted(_ sender: Any) {
NavigationMenuTabBarController.setupMenuAndLaunchApp(isNewWallet: false)
NavigationMenuTabBarController.setupMenuAndLaunchApp(isNewWallet: true)
}
}
5 changes: 4 additions & 1 deletion Decred Wallet/Utils/LocalizedStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: "")
Expand Down Expand Up @@ -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: "")
Expand Down
4 changes: 4 additions & 0 deletions Decred Wallet/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 4 additions & 0 deletions Decred Wallet/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 4 additions & 0 deletions Decred Wallet/pt-BR.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 4 additions & 0 deletions Decred Wallet/ru-RU.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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" = "Подтверждено";
Expand Down
4 changes: 4 additions & 0 deletions Decred Wallet/vi.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 4 additions & 0 deletions Decred Wallet/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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" = "已确认";
Expand Down