🎉 Create the iOS extension widget target
This commit is contained in:
@@ -11,6 +11,8 @@ import WatchConnectivity
|
||||
_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||
) -> Bool {
|
||||
syncDefaultsToGroup()
|
||||
|
||||
UNUserNotificationCenter.current().delegate = notifyDelegate
|
||||
|
||||
let replyableMessageCategory = UNNotificationCategory(
|
||||
|
||||
35
ios/Runner/Services/GroupDefaultSync.swift
Normal file
35
ios/Runner/Services/GroupDefaultSync.swift
Normal file
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// GroupDefaultSync.swift
|
||||
// Runner
|
||||
//
|
||||
// Created by LittleSheep on 2026/1/3.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
private let flutterKeyPrefix = "flutter."
|
||||
|
||||
private let flutterKeysToSync: [String] = [
|
||||
"dyn_user_tk"
|
||||
]
|
||||
|
||||
func syncDefaultsToGroup() {
|
||||
let standard = UserDefaults.standard
|
||||
let shared = UserDefaults(suiteName: "dev.solsynth.solian")
|
||||
|
||||
guard let shared else {
|
||||
print("[iOS] App Group UserDefaults not available")
|
||||
return
|
||||
}
|
||||
|
||||
for key in flutterKeysToSync {
|
||||
guard key.hasPrefix(flutterKeyPrefix) else { continue }
|
||||
|
||||
if let value = standard.object(forKey: key) {
|
||||
print("[iOS] Syncing key to App Group: \(key)")
|
||||
shared.set(value, forKey: key)
|
||||
}
|
||||
}
|
||||
|
||||
shared.synchronize()
|
||||
}
|
||||
Reference in New Issue
Block a user