Merge branch 'master' into fix-build-warnings-from-appcode

pull/384/head
James Sangalli 7 years ago committed by GitHub
commit 386458ba60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      Trust/AppCoordinator.swift
  2. 3
      Trust/AppDelegate.swift
  3. 6
      Trust/Market/Coordinators/UniversalLinkCoordinator.swift
  4. 9
      Trust/Wallet/Coordinators/WalletCoordinator.swift

@ -71,6 +71,16 @@ class AppCoordinator: NSObject, Coordinator {
addCoordinator(coordinator)
}
func closeWelcomeWindow() {
guard navigationController.viewControllers.contains(welcomeViewController) else {
return
}
navigationController.dismiss(animated: true, completion: nil)
if let wallet = keystore.recentlyUsedWallet {
showTransactions(for: wallet)
}
}
func inializers() {
var paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .allDomainsMask, true).flatMap { URL(fileURLWithPath: $0) }
paths.append(keystore.keystoreDirectory)
@ -122,6 +132,10 @@ class AppCoordinator: NSObject, Coordinator {
coordinator.start()
addCoordinator(coordinator)
}
func createInitialWallet() {
WalletCoordinator(keystore: keystore).createInitialWallet()
}
}
//Disable creating and importing wallets from welcome screen

@ -61,6 +61,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
func application(_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
appCoordinator.createInitialWallet()
appCoordinator.closeWelcomeWindow()
let url = userActivity.webpageURL
universalLinkCoordinator = UniversalLinkCoordinator()
universalLinkCoordinator.ethPrice = appCoordinator.ethPrice
@ -69,7 +71,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
universalLinkCoordinator.start()
let handled = universalLinkCoordinator.handleUniversalLink(url: url)
//TODO: if we handle other types of URLs, check if handled==false, then we pass the url to another handlers
return true
}
}

@ -4,6 +4,7 @@ import Foundation
import Alamofire
import BigInt
import Realm
import TrustKeystore
protocol UniversalLinkCoordinatorDelegate: class {
func viewControllerForPresenting(in coordinator: UniversalLinkCoordinator) -> UIViewController?
@ -18,6 +19,7 @@ class UniversalLinkCoordinator: Coordinator {
var ethPrice: Subscribable<Double>?
var ethBalance: Subscribable<BigInt>?
var hasCompleted = false
var addressOfNewWallet: String?
func start() {
preparingToImportUniversalLink()
@ -39,7 +41,7 @@ class UniversalLinkCoordinator: Coordinator {
"v": signature.substring(from: 128),
"r": "0x" + signature.substring(with: Range(uncheckedBounds: (0, 64))),
"s": "0x" + signature.substring(with: Range(uncheckedBounds: (64, 128))),
"networkId": Config.init().chainID.description
"networkId": Config().chainID.description
]
if isForTransfer {
@ -112,12 +114,12 @@ class UniversalLinkCoordinator: Coordinator {
}
//Returns true if handled
func handleUniversalLink(url: URL?) -> Bool {
let matchedPrefix = (url?.description.contains(UniversalLinkHandler().urlPrefix))!
guard matchedPrefix else {
return false
}
let signedOrder = UniversalLinkHandler().parseUniversalLink(url: (url?.absoluteString)!)
getTicketDetailsAndEcRecover(signedOrder: signedOrder) { result in
if let goodResult = result {

@ -14,7 +14,7 @@ class WalletCoordinator: Coordinator {
var navigationController: UINavigationController
weak var delegate: WalletCoordinatorDelegate?
var entryPoint: WalletEntryPoint?
let keystore: Keystore
var keystore: Keystore
var coordinators: [Coordinator] = []
init(
@ -62,6 +62,13 @@ class WalletCoordinator: Coordinator {
navigationController.pushViewController(controller, animated: true)
}
func createInitialWallet() {
if !keystore.hasWallets {
let account = keystore.createAccount(password: PasswordGenerator.generateRandom())
keystore.recentlyUsedWallet = Wallet(type: WalletType.real(account))
}
}
func createInstantWallet() {
navigationController.displayLoading(text: R.string.localizable.walletCreateInProgress(), animated: false)
let password = PasswordGenerator.generateRandom()

Loading…
Cancel
Save