From ed67551164c53e270cc4309670c8ab29540c2ccd Mon Sep 17 00:00:00 2001
From: 55nknown <55922348+55nknown@users.noreply.github.com>
Date: Sun, 18 Sep 2022 18:40:40 +0200
Subject: [PATCH] foreground_service setup
---
.../android/app/src/main/AndroidManifest.xml | 40 +++++++++++--------
filcnaplo/ios/Runner/AppDelegate.swift | 12 ++++++
filcnaplo/ios/Runner/Runner-Bridging-Header.h | 1 +
.../Flutter/GeneratedPluginRegistrant.swift | 4 ++
filcnaplo/pubspec.yaml | 2 +
5 files changed, 42 insertions(+), 17 deletions(-)
diff --git a/filcnaplo/android/app/src/main/AndroidManifest.xml b/filcnaplo/android/app/src/main/AndroidManifest.xml
index 38ae1d5..9e7636b 100644
--- a/filcnaplo/android/app/src/main/AndroidManifest.xml
+++ b/filcnaplo/android/app/src/main/AndroidManifest.xml
@@ -1,19 +1,25 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+ E
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/filcnaplo/ios/Runner/AppDelegate.swift b/filcnaplo/ios/Runner/AppDelegate.swift
index 70693e4..e265c10 100644
--- a/filcnaplo/ios/Runner/AppDelegate.swift
+++ b/filcnaplo/ios/Runner/AppDelegate.swift
@@ -8,6 +8,18 @@ import Flutter
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
+
+ // here, Without this code the task will not work.
+ SwiftFlutterForegroundTaskPlugin.setPluginRegistrantCallback(registerPlugins)
+ if #available(iOS 10.0, *) {
+ UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
+ }
+
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
+
+// here
+func registerPlugins(registry: FlutterPluginRegistry) {
+ GeneratedPluginRegistrant.register(with: registry)
+}
\ No newline at end of file
diff --git a/filcnaplo/ios/Runner/Runner-Bridging-Header.h b/filcnaplo/ios/Runner/Runner-Bridging-Header.h
index 308a2a5..10e9f02 100644
--- a/filcnaplo/ios/Runner/Runner-Bridging-Header.h
+++ b/filcnaplo/ios/Runner/Runner-Bridging-Header.h
@@ -1 +1,2 @@
#import "GeneratedPluginRegistrant.h"
+#import
diff --git a/filcnaplo/macos/Flutter/GeneratedPluginRegistrant.swift b/filcnaplo/macos/Flutter/GeneratedPluginRegistrant.swift
index 32775c0..e7883c4 100644
--- a/filcnaplo/macos/Flutter/GeneratedPluginRegistrant.swift
+++ b/filcnaplo/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -8,8 +8,10 @@ import Foundation
import connectivity_plus_macos
import dynamic_color
import flutter_acrylic
+import flutter_local_notifications
import path_provider_macos
import share_plus_macos
+import shared_preferences_macos
import sqflite
import url_launcher_macos
@@ -17,8 +19,10 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin"))
DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin"))
FlutterAcrylicPlugin.register(with: registry.registrar(forPlugin: "FlutterAcrylicPlugin"))
+ FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
+ SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
}
diff --git a/filcnaplo/pubspec.yaml b/filcnaplo/pubspec.yaml
index 7b254ef..539fd37 100644
--- a/filcnaplo/pubspec.yaml
+++ b/filcnaplo/pubspec.yaml
@@ -46,6 +46,8 @@ dependencies:
crypto: ^3.0.2
elegant_notification: ^1.6.1
flutter_feather_icons: ^2.0.0+1
+ flutter_foreground_task: ^3.9.0
+ flutter_local_notifications: ^11.0.0
dev_dependencies:
flutter_test: