fix bug : Volume test iOS sound
wasn't working anymore, seems since iOS 14, see https://stackoverflow.com/questions/69023854/ios-15-notification-sounds-are-not-playing-for-foreground-notifications and https://developer.apple.com/forums/thread/700884 ("Displaying" sound only notifications is no longer possible.) The solution is - to add a dummy text and body in the test notification - to add .list if iOS 14 or higher
This commit is contained in:
parent
48ee34a9bd
commit
a80a128b63
|
@ -2982,7 +2982,12 @@ extension RootViewController: UNUserNotificationCenterDelegate {
|
|||
} else if notification.request.identifier == ConstantsNotifications.notificationIdentifierForVolumeTest {
|
||||
|
||||
// user is testing iOS Sound volume in the settings. Only the sound should be played, the alert itself will not be shown
|
||||
if #available(iOS 14.0, *) {
|
||||
completionHandler([.sound, .list])
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
completionHandler([.sound])
|
||||
}
|
||||
|
||||
} else if notification.request.identifier == ConstantsNotifications.notificationIdentifierForxCGMTransmitterDelegatexDripError {
|
||||
|
||||
|
|
|
@ -71,9 +71,9 @@ struct SettingsViewAlertSettingsViewModel:SettingsViewModelProtocol {
|
|||
|
||||
// define and set the content
|
||||
let content = UNMutableNotificationContent()
|
||||
// body and title will not be shown, so contents can be empty
|
||||
content.body = ""
|
||||
content.title = ""
|
||||
// body and title will not be shown, because app is in the foreground
|
||||
content.body = "will not be shown"
|
||||
content.title = "will not be shown"
|
||||
// sound
|
||||
content.sound = UNNotificationSound.init(named: UNNotificationSoundName.init("xdripalert.aif"))
|
||||
// notification request
|
||||
|
|
Loading…
Reference in New Issue