diff --git a/app/src/main/java/com/keylesspalace/tusky/SplashActivity.kt b/app/src/main/java/com/keylesspalace/tusky/SplashActivity.kt index c1a229ab..3dd2243b 100644 --- a/app/src/main/java/com/keylesspalace/tusky/SplashActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/SplashActivity.kt @@ -33,8 +33,8 @@ class SplashActivity : AppCompatActivity(), Injectable { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - /** delete old notification channels that were in use in Tusky 1.4 */ - NotificationHelper.deleteLegacyNotificationChannels(this) + /** delete old notification channels */ + NotificationHelper.deleteLegacyNotificationChannels(this, accountManager) /** Determine whether the user is currently logged in, and if so go ahead and load the * timeline. Otherwise, start the activity_login screen. */ diff --git a/app/src/main/java/com/keylesspalace/tusky/util/NotificationHelper.java b/app/src/main/java/com/keylesspalace/tusky/util/NotificationHelper.java index 295cf8ea..71cf81ac 100644 --- a/app/src/main/java/com/keylesspalace/tusky/util/NotificationHelper.java +++ b/app/src/main/java/com/keylesspalace/tusky/util/NotificationHelper.java @@ -37,7 +37,6 @@ import android.util.Log; import com.keylesspalace.tusky.MainActivity; import com.keylesspalace.tusky.R; import com.keylesspalace.tusky.TuskyApplication; -import com.keylesspalace.tusky.ViewThreadActivity; import com.keylesspalace.tusky.db.AccountEntity; import com.keylesspalace.tusky.db.AccountManager; import com.keylesspalace.tusky.entity.Notification; @@ -371,17 +370,22 @@ public class NotificationHelper { } } - public static void deleteLegacyNotificationChannels(Context context) { - // delete the notification channels that where used before the multi account mode was introduced to avoid confusion + public static void deleteLegacyNotificationChannels(Context context, AccountManager accountManager) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); + // used until Tusky 1.4 //noinspection ConstantConditions notificationManager.deleteNotificationChannel(CHANNEL_MENTION); notificationManager.deleteNotificationChannel(CHANNEL_FAVOURITE); notificationManager.deleteNotificationChannel(CHANNEL_BOOST); notificationManager.deleteNotificationChannel(CHANNEL_FOLLOW); + + // used until Tusky 1.7 + for(AccountEntity account: accountManager.getAllAccountsOrderedByActive()) { + notificationManager.deleteNotificationChannel(CHANNEL_FAVOURITE+" "+account.getIdentifier()); + } } }