remove unneeded notification channel
This commit is contained in:
parent
889f9efef2
commit
b8d8615ad9
@ -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. */
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user