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

83 lines
3.4 KiB

// Copyright SIX DAY LLC. All rights reserved.
import UIKit
import Lokalise
import Branch
import RealmSwift
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate {
var window: UIWindow?
var coordinator: AppCoordinator!
//This is separate coordinator for the protection of the sensitive information.
lazy var protectionCoordinator: ProtectionCoordinator = {
return ProtectionCoordinator()
}()
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] ?? {})
}
})
return true
}
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
coordinator.didRegisterForRemoteNotificationsWithDeviceToken(deviceToken: deviceToken)
}
func applicationWillResignActive(_ application: UIApplication) {
protectionCoordinator.applicationWillResignActive()
}
func applicationDidBecomeActive(_ application: UIApplication) {
Lokalise.shared.checkForUpdates { _, _ in }
protectionCoordinator.applicationDidBecomeActive()
}
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
}
}