Commit 5e3f9e299a69700d156936e3d47897ca6113830d

Authored by 权海
1 parent a388346a

feat(ui):调整ios AppDelegate

... ... @@ -13,11 +13,11 @@ import AppTrackingTransparency
import AdSupport
@Observable
class AppDelegate: FlutterAppDelegate {
class AppDelegate: NSObject, UIApplicationDelegate {
let flutterEngine: FlutterEngine = FlutterEngine(name: "main_flutter_engine")
override func application(
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
... ... @@ -32,11 +32,11 @@ class AppDelegate: FlutterAppDelegate {
NativePigeonRegistrar.register(binaryMessenger: flutterEngine.binaryMessenger)
WatchConnectivityService.shared.activate()
HealthKitService.shared.startBackgroundObserversIfNeeded()
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
//
return true
}
override func application(_ application: UIApplication,
func application(_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
let tokenParts = deviceToken.map { data in String(format: "%02.2hhx", data) }
let token = tokenParts.joined()
... ... @@ -44,18 +44,20 @@ class AppDelegate: FlutterAppDelegate {
print("✅ Device Token: \(token)")
}
override func application(_ application: UIApplication,
func application(_ application: UIApplication,
didFailToRegisterForRemoteNotificationsWithError error: Error) {
print("❌ Failed to register: \(error.localizedDescription)")
}
override func userNotificationCenter(_ center: UNUserNotificationCenter,
}
extension AppDelegate: UNUserNotificationCenterDelegate{
func userNotificationCenter(_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
completionHandler([.banner, .sound, .badge])
}
override func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
let userInfo = response.notification.request.content.userInfo
// 从通知中获取 URL
... ... @@ -76,7 +78,6 @@ class AppDelegate: FlutterAppDelegate {
}
}
extension AppDelegate {
private func requestIDFAAuthorization() {
if ATTrackingManager.trackingAuthorizationStatus == .notDetermined {
... ...
... ... @@ -67,19 +67,19 @@ class MyTab extends GetView<MyController> {
title: context.l10n.help,
onTap: () => Get.toNamed(Routes.HELP),
),
if (kDebugMode) ...[
const SizedBox(height: 12),
const SizedBox(height: 12),
_SettingsRow(
title: 'Route List',
title: 'Apple Health Upload 测试',
onTap: () {
Get.toNamed(Routes.ROUTE_LIST);
controller.testAppleHealthUpload();
},
),
if (kDebugMode) ...[
const SizedBox(height: 12),
_SettingsRow(
title: 'Apple Health Upload 测试',
title: 'Route List',
onTap: () {
controller.testAppleHealthUpload();
Get.toNamed(Routes.ROUTE_LIST);
},
),
],
... ...