This commit is contained in:
DDIsFriend
2023-08-30 14:26:08 +08:00
parent b846be8803
commit cae8beeb03
31 changed files with 462 additions and 339 deletions

View File

@@ -21,21 +21,25 @@ class NotificationService: UNNotificationServiceExtension {
// Modify the notification content here...
// bestAttemptContent.title = "\(bestAttemptContent.title) [modified]"
let userInfo = bestAttemptContent.userInfo
let aps = userInfo["aps"] as? [String:Any]
if let aps, (aps["alert"] as? String) == "新订单" {
let juheVehcileName = userInfo["juheVehcileName"] as? String
// group
let aps = userInfo[aps_key] as? [String:Any]
if let aps, (aps[alert_key] as? String) == "新订单" {
var sound : UNNotificationSound?
let juheVehcileName = userInfo[juheVehcileName_key] as? String
if juheVehcileName?.isEmpty == false {
bestAttemptContent.sound = UNNotificationSound(named: UNNotificationSoundName(rawValue: "juheNewOrderAudio.wav"))
sound = UNNotificationSound(named: UNNotificationSoundName(rawValue: juheNewOrderAudio_key))
}else{
bestAttemptContent.sound = UNNotificationSound(named: UNNotificationSoundName(rawValue: "newOrderAudio.wav"))
sound = UNNotificationSound(named: UNNotificationSoundName(rawValue: newOrderAudio_key))
}
bestAttemptContent.sound = sound
GROUP.setBestAttemptContentUserInfo(bestAttemptContentUserInfo: userInfo)
}
let userDefault = UserDefaults.init(suiteName: "group.com.sino.supplier")
userDefault?.setValue(userInfo, forKey: "bestAttemptContentUserInfo_key")
JPushNotificationExtensionService.jpushSetAppkey("259b546bb2aaf5f02ffa2547")
JPushNotificationExtensionService.jpushSetAppkey(JPushKey)
JPushNotificationExtensionService.jpushReceive(request) {
contentHandler(request.content)
}