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
This commit is contained in:
Jays2Kings 2021-03-27 12:32:48 -04:00
parent 093018fd81
commit 78933e8191

View File

@ -51,7 +51,7 @@ object Notifications {
const val CHANNEL_BACKUP_RESTORE_PROGRESS = "backup_restore_progress_channel" const val CHANNEL_BACKUP_RESTORE_PROGRESS = "backup_restore_progress_channel"
const val ID_RESTORE_PROGRESS = -501 const val ID_RESTORE_PROGRESS = -501
const val ID_RESTORE_COMPLETE = -502 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_PROGRESS = -502
const val ID_BACKUP_COMPLETE = -503 const val ID_BACKUP_COMPLETE = -503
@ -61,6 +61,10 @@ object Notifications {
const val CHANNEL_CRASH_LOGS = "crash_logs_channel" const val CHANNEL_CRASH_LOGS = "crash_logs_channel"
const val ID_CRASH_LOGS = -601 const val ID_CRASH_LOGS = -601
private val deprecatedChannels = listOf(
"backup_restore_channel"
)
/** /**
* Creates the notification channels introduced in Android Oreo. * Creates the notification channels introduced in Android Oreo.
* *
@ -69,6 +73,9 @@ object Notifications {
fun createChannels(context: Context) { fun createChannels(context: Context) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return
// Delete old notification channels
deprecatedChannels.forEach(context.notificationManager::deleteNotificationChannel)
listOf( listOf(
NotificationChannelGroup(GROUP_BACKUP_RESTORE, context.getString(R.string.backup_and_restore)), NotificationChannelGroup(GROUP_BACKUP_RESTORE, context.getString(R.string.backup_and_restore)),
).forEach(context.notificationManager::createNotificationChannelGroup) ).forEach(context.notificationManager::createNotificationChannelGroup)