Created
July 10, 2019 11:06
-
-
Save littleGnAl/a0bd1b378bb5bcb7f3464d542f8ef732 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@UIApplicationMain | |
@objc class AppDelegate: FlutterAppDelegate { | |
lazy var sqlDelightManager: SqlDelightManager = { | |
Db().defaultDriver() | |
let accountingRepository = AccountingRepository(accountingDB: Db().instance) | |
return SqlDelightManager(accountingRepository: accountingRepository) | |
}() | |
override func application( | |
_ application: UIApplication, | |
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? | |
) -> Bool { | |
let controller: FlutterViewController = window?.rootViewController as! FlutterViewController | |
let sqlDelightChannel = FlutterMethodChannel( | |
name: SqlDelightManagerKt.SQLDELIGHT_CHANNEL, | |
binaryMessenger: controller) | |
sqlDelightChannel.setMethodCallHandler({ | |
[weak self] (methodCall: FlutterMethodCall, flutterResult: @escaping FlutterResult) -> Void in | |
let args = methodCall.arguments as? [String: Any] ?? [:] | |
self?.sqlDelightManager.methodCall( | |
method: methodCall.method, | |
arguments: args, | |
result: {(r: Any) -> KotlinUnit in | |
flutterResult(r) | |
return KotlinUnit() | |
}) | |
}) | |
GeneratedPluginRegistrant.register(with: self) | |
return super.application(application, didFinishLaunchingWithOptions: launchOptions) | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment