update
This commit is contained in:
BIN
OrderSchedulingNotificationService/.DS_Store
vendored
Normal file
BIN
OrderSchedulingNotificationService/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -19,6 +19,11 @@ class NotificationService: UNNotificationServiceExtension {
|
||||
|
||||
if let bestAttemptContent = bestAttemptContent {
|
||||
// Modify the notification content here...
|
||||
JPushNotificationExtensionService.jpushSetAppkey(JPushKey)
|
||||
JPushNotificationExtensionService.jpushReceive(request) {
|
||||
contentHandler(request.content)
|
||||
}
|
||||
|
||||
let userInfo = bestAttemptContent.userInfo
|
||||
|
||||
if let dict = GROUP.parserAlertToDictionary(userInfo: userInfo) {
|
||||
@@ -46,16 +51,23 @@ class NotificationService: UNNotificationServiceExtension {
|
||||
bestAttemptContent.sound = sound
|
||||
|
||||
GROUP.setBestAttemptContentUserInfo(bestAttemptContentUserInfo: userInfo)
|
||||
contentHandler(bestAttemptContent)
|
||||
}else{
|
||||
bestAttemptContent.sound = .default
|
||||
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 let broadcastKeywords = (userInfo[pushNoti_broadcastKeywords_key] as? String),broadcastKeywords.isEmpty == false {
|
||||
bestAttemptContent.sound = .default
|
||||
contentHandler(bestAttemptContent)
|
||||
}else{
|
||||
bestAttemptContent.sound = .default
|
||||
contentHandler(bestAttemptContent)
|
||||
}
|
||||
}
|
||||
|
||||
JPushNotificationExtensionService.jpushSetAppkey(JPushKey)
|
||||
JPushNotificationExtensionService.jpushReceive(request) {
|
||||
contentHandler(request.content)
|
||||
}
|
||||
|
||||
contentHandler(bestAttemptContent)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +75,20 @@ class NotificationService: UNNotificationServiceExtension {
|
||||
// Called just before the extension will be terminated by the system.
|
||||
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
|
||||
if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
|
||||
let userInfo = bestAttemptContent.userInfo
|
||||
|
||||
if let dict = GROUP.parserAlertToDictionary(userInfo: userInfo) {
|
||||
if let title = dict[pushNoti_title_key] {
|
||||
bestAttemptContent.title = title
|
||||
}
|
||||
if let body = dict[pushNoti_body_key] {
|
||||
bestAttemptContent.body = body
|
||||
}
|
||||
}else if let body = GROUP.parserAlertToString(userInfo: userInfo) {
|
||||
bestAttemptContent.body = body
|
||||
}
|
||||
|
||||
bestAttemptContent.sound = .default
|
||||
contentHandler(bestAttemptContent)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user