From 1438cb9435a7bbbdeaebdff0308a69236515c8c3 Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Mon, 7 Oct 2024 15:28:21 +0530 Subject: [PATCH] MigrationReceiver: Remove non-required general and alert notification channels They have been renamed to downloads, install and export Signed-off-by: Aayush Gupta --- .../store/data/receiver/MigrationReceiver.kt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/aurora/store/data/receiver/MigrationReceiver.kt b/app/src/main/java/com/aurora/store/data/receiver/MigrationReceiver.kt index faf3e1ff2..1157dcb39 100644 --- a/app/src/main/java/com/aurora/store/data/receiver/MigrationReceiver.kt +++ b/app/src/main/java/com/aurora/store/data/receiver/MigrationReceiver.kt @@ -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()!!) { // !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")