secant-ios-wallet/secant/SecantApp.swift

48 lines
1.3 KiB
Swift

//
// secantApp.swift
// secant
//
// Created by Francisco Gindre on 7/29/21.
//
import SwiftUI
import ComposableArchitecture
import ZcashLightClientKit
final class AppDelegate: NSObject, UIApplicationDelegate {
var rootStore: RootStore = .placeholder
lazy var rootViewStore = ViewStore(
rootStore.stateless,
removeDuplicates: ==
)
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
walletLogger = OSLogger_(logLevel: .debug, category: LoggerConstants.walletLogs)
// set the default behavior for the NSDecimalNumber
NSDecimalNumber.defaultBehavior = Zatoshi.decimalHandler
rootViewStore.send(.initialization(.appDelegate(.didFinishLaunching)))
return true
}
func application(
_ application: UIApplication,
shouldAllowExtensionPointIdentifier extensionPointIdentifier: UIApplication.ExtensionPointIdentifier
) -> Bool {
return extensionPointIdentifier != UIApplication.ExtensionPointIdentifier.keyboard
}
}
@main
struct SecantApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
var body: some Scene {
WindowGroup {
RootView(store: appDelegate.rootStore)
}
}
}