MigrationReceiver: Remove non-required general and alert notification channels
They have been renamed to downloads, install and export Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
package com.aurora.store.data.receiver
|
||||
|
||||
import android.app.NotificationManager
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.util.Log
|
||||
import androidx.core.content.getSystemService
|
||||
import com.aurora.Constants
|
||||
import com.aurora.extensions.isOAndAbove
|
||||
import com.aurora.store.data.work.CacheWorker
|
||||
import com.aurora.store.util.CertUtil
|
||||
import com.aurora.store.util.Preferences
|
||||
@@ -21,7 +24,7 @@ class MigrationReceiver : BroadcastReceiver() {
|
||||
companion object {
|
||||
private const val TAG = "MigrationReceiver"
|
||||
|
||||
private const val PREF_VERSION = 2 // BUMP THIS MANUALLY ON ADDING NEW MIGRATION STEP
|
||||
private const val PREF_VERSION = 3 // BUMP THIS MANUALLY ON ADDING NEW MIGRATION STEP
|
||||
|
||||
fun runMigrationsIfRequired(context: Context) {
|
||||
val oldVersion = Preferences.getInteger(context, PREFERENCE_MIGRATION_VERSION)
|
||||
@@ -65,6 +68,17 @@ class MigrationReceiver : BroadcastReceiver() {
|
||||
currentVersion++
|
||||
}
|
||||
|
||||
// 63 -> 64
|
||||
if (currentVersion == 2) {
|
||||
if (isOAndAbove()) {
|
||||
with(context.getSystemService<NotificationManager>()!!) { // !1189
|
||||
deleteNotificationChannel("NOTIFICATION_CHANNEL_GENERAL")
|
||||
deleteNotificationChannel("NOTIFICATION_CHANNEL_ALERT")
|
||||
}
|
||||
}
|
||||
currentVersion++
|
||||
}
|
||||
|
||||
// Add new migrations / defaults above this point.
|
||||
if (currentVersion != PREF_VERSION) {
|
||||
Log.e(TAG, "Upgrading to version $PREF_VERSION left it at $currentVersion instead")
|
||||
|
||||
Reference in New Issue
Block a user