Browse Source

fix: 移除通知徽章设置并在应用激活时重置徽章数

移除SetReminderHandler中的通知徽章设置,避免重复显示
在AppDelegate中添加应用启动和激活时的徽章数重置逻辑
newdev_shunjiawei
lxm 9 months ago
parent
commit
3ffcaa09ff
  1. 6
      ios/Runner/AppDelegate.swift
  2. 1
      local_plugins/chat_api/ios/chat_api/Sources/chat_api/SystemFunctionHandler.swift

6
ios/Runner/AppDelegate.swift

@ -7,10 +7,16 @@ import UIKit
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
application.applicationIconBadgeNumber = 0
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
override func applicationDidBecomeActive(_ application: UIApplication) {
application.applicationIconBadgeNumber = 0
super.applicationDidBecomeActive(application)
}
// 添加URL回调监听
override func application(
_ app: UIApplication,

1
local_plugins/chat_api/ios/chat_api/Sources/chat_api/SystemFunctionHandler.swift

@ -823,7 +823,6 @@ private class SetReminderHandler: FunctionHandler {
let notificationContent = UNMutableNotificationContent()
notificationContent.title = title
notificationContent.body = content
notificationContent.badge = 1
// 关键配置:闹钟级声音(突破静音,最大音量)
notificationContent.sound = UNNotificationSound.criticalSoundNamed(

Loading…
Cancel
Save