Commit cecb0586 authored by Alex朱枝文's avatar Alex朱枝文

从app头像进去app badge状态清零

parent d8528e93
...@@ -83,6 +83,7 @@ extension AppDelegate: JPUSHRegisterDelegate { ...@@ -83,6 +83,7 @@ extension AppDelegate: JPUSHRegisterDelegate {
// 请求消息页面通知权限通知 // 请求消息页面通知权限通知
NotificationCenter.default.post(name: YhConstant.YhNotification.didReqeustNotifyPermissionNotification, object: nil) NotificationCenter.default.post(name: YhConstant.YhNotification.didReqeustNotifyPermissionNotification, object: nil)
} }
clearAllUnreadBadge()
YHOSSManager.share.getOSSID() YHOSSManager.share.getOSSID()
} }
...@@ -162,4 +163,14 @@ extension AppDelegate { ...@@ -162,4 +163,14 @@ extension AppDelegate {
} }
} }
} }
private func clearAllUnreadBadge() {
DispatchQueue.main.async {
if #available(iOS 16.0, *) {
UNUserNotificationCenter.current().setBadgeCount(0)
} else {
UIApplication.shared.applicationIconBadgeNumber = 0
}
}
}
} }
...@@ -109,13 +109,7 @@ extension YHTabBarViewController { ...@@ -109,13 +109,7 @@ extension YHTabBarViewController {
} }
} }
} }
@objc func clearAllUnreadBadge() {
DispatchQueue.main.async {
UIApplication.shared.applicationIconBadgeNumber = 0
}
}
func reportDeviceInfo() { func reportDeviceInfo() {
if !YHLoginManager.shared.isLogin() { if !YHLoginManager.shared.isLogin() {
return return
......
...@@ -103,7 +103,7 @@ extension YHButlerServiceManager { ...@@ -103,7 +103,7 @@ extension YHButlerServiceManager {
/// 必须在初始化后调用 /// 必须在初始化后调用
func getLastMessage() -> YHButlerServiceMessage? { func getLastMessage() -> YHButlerServiceMessage? {
guard let message = getSessionList().first else { guard let message = getSessionList().last else {
return nil return nil
} }
return YHButlerServiceMessageHandler.handleSessionMessage(sessionMessage: message) return YHButlerServiceMessageHandler.handleSessionMessage(sessionMessage: message)
...@@ -201,7 +201,7 @@ extension YHButlerServiceManager { ...@@ -201,7 +201,7 @@ extension YHButlerServiceManager {
/// 获取所有会话的列表;非平台电商用户,只有一个会话项,平台电商用户,有多个会话项 /// 获取所有会话的列表;非平台电商用户,只有一个会话项,平台电商用户,有多个会话项
func getSessionList() -> [QYSessionInfo] { func getSessionList() -> [QYSessionInfo] {
let list = conversationManager?.getSessionList() ?? [] let list = conversationManager?.getSessionList() ?? []
printLog("$$$$getSessionList \(list.first?.lastMessageText ?? "") \(list.first?.lastMessageType.rawValue ?? 0) \(list.first?.lastMessageTimeStamp ?? 0)") printLog("$$$$getSessionList \(list.last?.lastMessageText ?? "") \(list.last?.lastMessageType.rawValue ?? 0) \(list.last?.lastMessageTimeStamp ?? 0)")
return list return list
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment