Commit a09ff214 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk

sound: fix sound for notifications and calls

- fix sound for incoming message notification
- fix sound for incoming call

Change-Id: Ibd4ee8b65fcda5b8c8e509edcfab3979550e36a8
parent 9c858082
...@@ -166,6 +166,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD ...@@ -166,6 +166,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
UserDefaults.standard.set(true, forKey: hardareAccelerationKey) UserDefaults.standard.set(true, forKey: hardareAccelerationKey)
return return
} }
for account in self.accountService.accounts {
self.accountService.setRingtonePath(forAccountId: account.id)
}
self.reloadDataFor(account: currentAccount) self.reloadDataFor(account: currentAccount)
if self.accountService.proxyEnabled() { if self.accountService.proxyEnabled() {
self.registerVoipNotifications() self.registerVoipNotifications()
......
...@@ -78,6 +78,7 @@ class LocalNotificationsHelper { ...@@ -78,6 +78,7 @@ class LocalNotificationsHelper {
content.title = title content.title = title
content.body = body content.body = body
content.userInfo = data content.userInfo = data
content.sound = UNNotificationSound.default()
content.badge = UIApplication.shared.applicationIconBadgeNumber + 1 as NSNumber content.badge = UIApplication.shared.applicationIconBadgeNumber + 1 as NSNumber
let notificationTrigger = UNTimeIntervalNotificationTrigger(timeInterval: 0.01, repeats: false) let notificationTrigger = UNTimeIntervalNotificationTrigger(timeInterval: 0.01, repeats: false)
let identifier = Int64(arc4random_uniform(10000000)) let identifier = Int64(arc4random_uniform(10000000))
...@@ -92,6 +93,7 @@ class LocalNotificationsHelper { ...@@ -92,6 +93,7 @@ class LocalNotificationsHelper {
notification.alertTitle = title notification.alertTitle = title
notification.alertBody = body notification.alertBody = body
notification.userInfo = data notification.userInfo = data
notification.soundName = UILocalNotificationDefaultSoundName
notification.applicationIconBadgeNumber = UIApplication.shared.applicationIconBadgeNumber + 1 notification.applicationIconBadgeNumber = UIApplication.shared.applicationIconBadgeNumber + 1
UIApplication.shared.scheduleLocalNotification(notification) UIApplication.shared.scheduleLocalNotification(notification)
} }
...@@ -179,10 +181,12 @@ class LocalNotificationsHelper { ...@@ -179,10 +181,12 @@ class LocalNotificationsHelper {
callService.currentCall.filter({ call in callService.currentCall.filter({ call in
return call.callId == callID && (call.state == .over || call.state == .failure) return call.callId == callID && (call.state == .over || call.state == .failure)
}).single() }).single()
.observeOn(MainScheduler.instance)
.subscribe(onNext: { _ in .subscribe(onNext: { _ in
let content = UNMutableNotificationContent() let content = UNMutableNotificationContent()
content.title = NotificationCallTitle.missedCall.getString() content.title = NotificationCallTitle.missedCall.getString()
content.body = name content.body = name
content.sound = UNNotificationSound.default()
content.badge = UIApplication.shared.applicationIconBadgeNumber + 1 as NSNumber content.badge = UIApplication.shared.applicationIconBadgeNumber + 1 as NSNumber
let notificationTrigger = UNTimeIntervalNotificationTrigger(timeInterval: 0.01, repeats: false) let notificationTrigger = UNTimeIntervalNotificationTrigger(timeInterval: 0.01, repeats: false)
let notificationRequest = UNNotificationRequest(identifier: callID, content: content, trigger: notificationTrigger) let notificationRequest = UNNotificationRequest(identifier: callID, content: content, trigger: notificationTrigger)
...@@ -208,6 +212,7 @@ class LocalNotificationsHelper { ...@@ -208,6 +212,7 @@ class LocalNotificationsHelper {
notification.userInfo = data notification.userInfo = data
notification.alertTitle = NotificationCallTitle.missedCall.getString() notification.alertTitle = NotificationCallTitle.missedCall.getString()
notification.alertBody = name notification.alertBody = name
notification.soundName = UILocalNotificationDefaultSoundName
notification.applicationIconBadgeNumber = UIApplication.shared.applicationIconBadgeNumber + 1 notification.applicationIconBadgeNumber = UIApplication.shared.applicationIconBadgeNumber + 1
UIApplication.shared.scheduleLocalNotification(notification) UIApplication.shared.scheduleLocalNotification(notification)
}).disposed(by: self.disposeBag) }).disposed(by: self.disposeBag)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment