Custom sound support

This commit is contained in:
Ali
2022-03-25 21:08:01 +04:00
parent e1b4e15da8
commit f58c2460d1
3 changed files with 61 additions and 3 deletions

View File

@@ -662,6 +662,7 @@ private final class NotificationServiceHandler {
|> deliverOn(self.queue)).start(next: { [weak self] records, sharedData in
var recordId: AccountRecordId?
var isCurrentAccount: Bool = false
var customSoundPath: String?
if let keyId = notificationPayloadKeyId(data: payloadData) {
outer: for listRecord in records.records {
@@ -681,6 +682,8 @@ private final class NotificationServiceHandler {
let inAppNotificationSettings = sharedData.entries[ApplicationSpecificSharedDataKeys.inAppNotificationSettings]?.get(InAppNotificationSettings.self) ?? InAppNotificationSettings.defaultSettings
customSoundPath = inAppNotificationSettings.customSound
let voiceCallSettings: VoiceCallSettings
if let value = sharedData.entries[ApplicationSpecificSharedDataKeys.voiceCallSettings]?.get(VoiceCallSettings.self) {
voiceCallSettings = value
@@ -923,7 +926,11 @@ private final class NotificationServiceHandler {
}
if let sound = aps["sound"] as? String {
content.sound = sound
if let customSoundPath = customSoundPath {
content.sound = customSoundPath
} else {
content.sound = sound
}
}
if let category = aps["category"] as? String {