An advanced Ethereum/EVM mobile wallet
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
alpha-wallet-ios/Trust/AppDelegate.swift

84 lines
3.4 KiB

// Copyright SIX DAY LLC. All rights reserved.
7 years ago
import UIKit
import Lokalise
import Branch
import RealmSwift
7 years ago
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate {
var window: UIWindow?
7 years ago
var coordinator: AppCoordinator!
//This is separate coordinator for the protection of the sensitive information.
lazy var protectionCoordinator: ProtectionCoordinator = {
return ProtectionCoordinator()
}()
7 years ago
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
print(Realm.Configuration().fileURL!)
window = UIWindow(frame: UIScreen.main.bounds)
do {
let keystore = try EtherKeystore()
coordinator = AppCoordinator(window: window!, keystore: keystore)
coordinator.start()
} catch {
print("EtherKeystore init issue.")
}
protectionCoordinator.didFinishLaunchingWithOptions()
Branch.getInstance().initSession(launchOptions: launchOptions, andRegisterDeepLinkHandler: {params, error in
if error == nil {
print("params: %@", params as? [String: AnyObject] ?? {})
}
})
7 years ago
return true
}
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
coordinator.didRegisterForRemoteNotificationsWithDeviceToken(deviceToken: deviceToken)
}
func applicationWillResignActive(_ application: UIApplication) {
protectionCoordinator.applicationWillResignActive()
7 years ago
}
func applicationDidBecomeActive(_ application: UIApplication) {
Lokalise.shared.checkForUpdates { _, _ in }
protectionCoordinator.applicationDidBecomeActive()
7 years ago
}
func applicationDidEnterBackground(_ application: UIApplication) {
protectionCoordinator.applicationDidEnterBackground()
}
func applicationWillEnterForeground(_ application: UIApplication) {
protectionCoordinator.applicationWillEnterForeground()
}
func application(_ application: UIApplication, shouldAllowExtensionPointIdentifier extensionPointIdentifier: UIApplicationExtensionPointIdentifier) -> Bool {
if extensionPointIdentifier == UIApplicationExtensionPointIdentifier.keyboard {
return false
}
return true
}
// Respond to URI scheme links
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
let branchHandled = Branch.getInstance().application(application,
open: url,
sourceApplication: sourceApplication,
annotation: annotation
)
if !branchHandled {
// If not handled by Branch, do other deep link routing for the Facebook SDK, Pinterest SDK, etc
}
// do other deep link routing for the Facebook SDK, Pinterest SDK, etc
return true
}
// Respond to Universal Links
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
Branch.getInstance().continue(userActivity)
//TODO query authorisation server from here for import universal link
return true
}
7 years ago
}