From 78933e8191090dbacaec732c1a62f849e5589a6a Mon Sep 17 00:00:00 2001 From: Jays2Kings Date: Sat, 27 Mar 2021 12:32:48 -0400 Subject: [PATCH] Setting backup restore channel without "v2" I mean I could keep it v2 to keep with upstream but I'm too far gone and I never had a v1 Also removing old backchannel since I did have that --- .../kanade/tachiyomi/data/notification/Notifications.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/notification/Notifications.kt b/app/src/main/java/eu/kanade/tachiyomi/data/notification/Notifications.kt index e2c70d7433..8ba5e479f9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/notification/Notifications.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/notification/Notifications.kt @@ -51,7 +51,7 @@ object Notifications { const val CHANNEL_BACKUP_RESTORE_PROGRESS = "backup_restore_progress_channel" const val ID_RESTORE_PROGRESS = -501 const val ID_RESTORE_COMPLETE = -502 - const val CHANNEL_BACKUP_RESTORE_COMPLETE = "backup_restore_complete_channel_v2" + const val CHANNEL_BACKUP_RESTORE_COMPLETE = "backup_restore_complete_channel" const val ID_BACKUP_PROGRESS = -502 const val ID_BACKUP_COMPLETE = -503 @@ -61,6 +61,10 @@ object Notifications { const val CHANNEL_CRASH_LOGS = "crash_logs_channel" const val ID_CRASH_LOGS = -601 + private val deprecatedChannels = listOf( + "backup_restore_channel" + ) + /** * Creates the notification channels introduced in Android Oreo. * @@ -69,6 +73,9 @@ object Notifications { fun createChannels(context: Context) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return + // Delete old notification channels + deprecatedChannels.forEach(context.notificationManager::deleteNotificationChannel) + listOf( NotificationChannelGroup(GROUP_BACKUP_RESTORE, context.getString(R.string.backup_and_restore)), ).forEach(context.notificationManager::createNotificationChannelGroup)