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/AlphaWallet/AppDelegate.swift

78 lines
3.1 KiB

// Copyright SIX DAY LLC. All rights reserved.
7 years ago
import UIKit
import RealmSwift
7 years ago
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate {
var window: UIWindow?
private var appCoordinator: AppCoordinator!
//This is separate coordinator for the protection of the sensitive information.
private 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()
appCoordinator = AppCoordinator(window: window!, keystore: keystore)
appCoordinator.start()
} catch {
print("EtherKeystore init issue.")
}
//Status bar hidden at launch so launch screen is not distorted when call/tether bar is activated in phones without a notch, like iPhone 8 and earlier
application.isStatusBarHidden = false
protectionCoordinator.didFinishLaunchingWithOptions()
7 years ago
return true
}
func applicationWillResignActive(_ application: UIApplication) {
protectionCoordinator.applicationWillResignActive()
7 years ago
}
func applicationDidBecomeActive(_ application: UIApplication) {
//Lokalise.shared.checkForUpdates { _, _ in }
protectionCoordinator.applicationDidBecomeActive()
appCoordinator.handleUniversalLinkInPasteboard()
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(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey: Any] = [:]) -> Bool {
let _ = appCoordinator.handleOpen(url: url)
return true
}
// Respond to Universal Links
func application(_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
var handled = false
if let url = userActivity.webpageURL {
handled = 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
}
@discardableResult private func handleUniversalLink(url: URL) -> Bool {
let handled = appCoordinator.handleUniversalLink(url: url)
return handled
}
7 years ago
}