delete notification channels only on Android Oreo

This commit is contained in:
tibbi
2019-01-08 15:56:48 +01:00
parent 26151b22ca
commit 0e58358287

View File

@@ -214,9 +214,11 @@ fun Context.getNotification(pendingIntent: PendingIntent, event: Event, content:
// create a new channel for every new sound uri as the new Android Oreo notification system is fundamentally broken // create a new channel for every new sound uri as the new Android Oreo notification system is fundamentally broken
if (soundUri != config.lastSoundUri || config.lastVibrateOnReminder != config.vibrateOnReminder) { if (soundUri != config.lastSoundUri || config.lastVibrateOnReminder != config.vibrateOnReminder) {
if (!publicVersion) { if (!publicVersion) {
if (isOreoPlus()) {
val oldChannelId = "simple_calendar_${config.lastReminderChannel}_${config.reminderAudioStream}" val oldChannelId = "simple_calendar_${config.lastReminderChannel}_${config.reminderAudioStream}"
notificationManager.deleteNotificationChannel(oldChannelId) notificationManager.deleteNotificationChannel(oldChannelId)
} }
}
config.lastVibrateOnReminder = config.vibrateOnReminder config.lastVibrateOnReminder = config.vibrateOnReminder
config.lastReminderChannel = System.currentTimeMillis() config.lastReminderChannel = System.currentTimeMillis()