推送超时处理
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user