TF-1861 Config worker manager on iOS

(cherry picked from commit a71422861efda154a79cc6c11d6fe190a88710dc)
This commit is contained in:
dab246
2023-05-23 08:39:31 +07:00
committed by Dat Vu
parent 9550982e73
commit 9f402b9ec1
2 changed files with 27 additions and 7 deletions
+21 -6
View File
@@ -3,23 +3,32 @@ import Flutter
import flutter_downloader
import receive_sharing_intent
import flutter_local_notifications
import workmanager
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
/// Registers all pubspec-referenced Flutter plugins in the given registry.
static func registerPlugins(with registry: FlutterPluginRegistry) {
GeneratedPluginRegistrant.register(with: registry)
}
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
/// Register the app's plugins in the context of a normal run
AppDelegate.registerPlugins(with: self)
FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { (registry) in
GeneratedPluginRegistrant.register(with: registry)
}
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
}
GeneratedPluginRegistrant.register(with: self)
UIApplication.shared.setMinimumBackgroundFetchInterval(TimeInterval(60*15))
FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { registry in
AppDelegate.registerPlugins(with: registry)
}
FlutterDownloaderPlugin.setPluginRegistrantCallback { registry in
if (!registry.hasPlugin("FlutterDownloaderPlugin")) {
@@ -32,12 +41,18 @@ import flutter_local_notifications
if url.scheme == "mailto" {
if let url = handleEmailAndress(open: url) {
let corrected = launchOptions!.map { (key, value) in key != .url ? (key, value) : (key, url) }
return sharingIntent.application(application, didFinishLaunchingWithOptions: Dictionary(uniqueKeysWithValues: corrected))
}
}
}
WorkmanagerPlugin.setPluginRegistrantCallback { registry in
AppDelegate.registerPlugins(with: registry)
}
WorkmanagerPlugin.registerTask(withIdentifier: "com.linagora.ios.teammail.sendingQueue")
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
+6 -1
View File
@@ -61,8 +61,13 @@
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>remote-notification</string>
<string>remote-notification</string>
<string>processing</string>
</array>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>com.linagora.ios.teammail.sendingQueue</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>