推送超时处理

This commit is contained in:
DDIsFriend
2023-09-07 20:14:59 +08:00
parent 3b4714e8b5
commit b89ca9ba4c
3 changed files with 40 additions and 5 deletions

View File

@@ -81,6 +81,8 @@ class NotificationService: UNNotificationServiceExtension {
if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
let userInfo = bestAttemptContent.userInfo
let userInfo = bestAttemptContent.userInfo
if let dict = GROUP.parserAlertToDictionary(userInfo: userInfo) {
if let title = dict[pushNoti_title_key] {
bestAttemptContent.title = title
@@ -92,8 +94,41 @@ class NotificationService: UNNotificationServiceExtension {
bestAttemptContent.body = body
}
bestAttemptContent.sound = .default
contentHandler(bestAttemptContent)
//
if GROUP.isOrderPushNotification(userInfo: userInfo) == true {
var sound : UNNotificationSound?
let juheVehcileName = userInfo[pushNoti_juheVehcileName_key] as? String
if juheVehcileName?.isEmpty == false {
sound = UNNotificationSound(named: UNNotificationSoundName(rawValue: juheNewOrderAudio_key))
}else{
sound = UNNotificationSound(named: UNNotificationSoundName(rawValue: newOrderAudio_key))
}
bestAttemptContent.sound = sound
GROUP.setBestAttemptContentUserInfo(bestAttemptContentUserInfo: userInfo)
contentHandler(bestAttemptContent)
}else{
// group
if let isShowPop = (userInfo[pushNoti_broadcastKeywords_key] as? Bool), isShowPop == true {
if let userInfo = GROUP.bestAttemptContentUserInfo,GROUP.isOrderPushNotification(userInfo: userInfo) == true {
}else{
GROUP.setBestAttemptContentUserInfo(bestAttemptContentUserInfo: userInfo)
}
}
//
if GROUP.isAppointmentPushNotification(userInfo: userInfo) == true {
bestAttemptContent.sound = UNNotificationSound(named: UNNotificationSoundName(rawValue: appointmentOrderAudio_key))
contentHandler(bestAttemptContent)
}else if let broadcastKeywords = (userInfo[pushNoti_broadcastKeywords_key] as? String),broadcastKeywords.isEmpty == false {
bestAttemptContent.sound = .default
contentHandler(bestAttemptContent)
}else{
bestAttemptContent.sound = .default
contentHandler(bestAttemptContent)
}
}
}
}