mirror of
https://github.com/linagora/tmail-flutter.git
synced 2026-12-06 16:04:20 +00:00
* HOTFIX Support iOS 26 * Bump version to v0.28.16 * Bump MinimumOSVersion AppFrameworkInfo.plist to 14 * Bump version to v0.28.17 * HOTFIX Support iOS 26 UISceneDelegate * HOTFIX pubspec lock and yaml format * HOTFIX Update SceneDelegate removeAppBadger log
29 lines
1020 B
Swift
29 lines
1020 B
Swift
import Flutter
|
|
import UIKit
|
|
|
|
class SceneDelegate: FlutterSceneDelegate {
|
|
override func sceneDidBecomeActive(_ scene: UIScene) {
|
|
removeAppBadger()
|
|
updateApplicationStateInUserDefaults(true)
|
|
}
|
|
|
|
override func sceneDidEnterBackground(_ scene: UIScene) {
|
|
updateApplicationStateInUserDefaults(false)
|
|
}
|
|
|
|
private func removeAppBadger() {
|
|
TwakeLogger.shared.log(message: "SceneDelegate::removeAppBadger")
|
|
if #available(iOS 16.0, *) {
|
|
UNUserNotificationCenter.current().setBadgeCount(0)
|
|
} else {
|
|
UIApplication.shared.applicationIconBadgeNumber = 0
|
|
}
|
|
}
|
|
|
|
private func updateApplicationStateInUserDefaults(_ appIsActive: Bool) {
|
|
let appGroupId = (Bundle.main.object(forInfoDictionaryKey: "AppGroupId") as? String) ?? "group.\(Bundle.main.bundleIdentifier!)"
|
|
let userDefaults = UserDefaults(suiteName: appGroupId)
|
|
userDefaults?.set(appIsActive, forKey: CoreUtils.APPLICATION_STATE)
|
|
}
|
|
}
|