Update: BackgroundServicePlugin
parent
105ff6446b
commit
4d95357fcb
@ -1,18 +1,25 @@
|
|||||||
import UIKit
|
import UIKit
|
||||||
import Flutter
|
import Flutter
|
||||||
import flutter_downloader
|
import flutter_downloader
|
||||||
|
import flutter_background_service
|
||||||
|
|
||||||
@UIApplicationMain
|
@UIApplicationMain
|
||||||
@objc class AppDelegate: FlutterAppDelegate {
|
@objc class AppDelegate: FlutterAppDelegate {
|
||||||
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||||
GeneratedPluginRegistrant.register(with: self)
|
AppDelegate.registerPlugins(with: self)
|
||||||
FlutterDownloaderPlugin.setPluginRegistrantCallback(registerPlugins)
|
FlutterDownloaderPlugin.setPluginRegistrantCallback { registry in
|
||||||
|
if (!registry.hasPlugin("FlutterDownloaderPlugin")) {
|
||||||
|
FlutterDownloaderPlugin.register(with: registry.registrar(forPlugin: "FlutterDownloaderPlugin")!)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SwiftFlutterBackgroundServicePlugin.setPluginRegistrantCallback { registry in
|
||||||
|
AppDelegate.registerPlugins(with: registry)
|
||||||
|
}
|
||||||
|
|
||||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private func registerPlugins(registry: FlutterPluginRegistry) {
|
static func registerPlugins(with registry: FlutterPluginRegistry) {
|
||||||
if (!registry.hasPlugin("FlutterDownloaderPlugin")) {
|
GeneratedPluginRegistrant.register(with: registry)
|
||||||
FlutterDownloaderPlugin.register(with: registry.registrar(forPlugin: "FlutterDownloaderPlugin")!)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue