remove unneeded notification channel
This commit is contained in:
parent
2dcbce3fbc
commit
33c59cf578
2 changed files with 9 additions and 5 deletions
|
@ -33,8 +33,8 @@ class SplashActivity : AppCompatActivity(), Injectable {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
/** delete old notification channels that were in use in Tusky 1.4 */
|
/** delete old notification channels */
|
||||||
NotificationHelper.deleteLegacyNotificationChannels(this)
|
NotificationHelper.deleteLegacyNotificationChannels(this, accountManager)
|
||||||
|
|
||||||
/** Determine whether the user is currently logged in, and if so go ahead and load the
|
/** Determine whether the user is currently logged in, and if so go ahead and load the
|
||||||
* timeline. Otherwise, start the activity_login screen. */
|
* timeline. Otherwise, start the activity_login screen. */
|
||||||
|
|
|
@ -37,7 +37,6 @@ import android.util.Log;
|
||||||
import com.keylesspalace.tusky.MainActivity;
|
import com.keylesspalace.tusky.MainActivity;
|
||||||
import com.keylesspalace.tusky.R;
|
import com.keylesspalace.tusky.R;
|
||||||
import com.keylesspalace.tusky.TuskyApplication;
|
import com.keylesspalace.tusky.TuskyApplication;
|
||||||
import com.keylesspalace.tusky.ViewThreadActivity;
|
|
||||||
import com.keylesspalace.tusky.db.AccountEntity;
|
import com.keylesspalace.tusky.db.AccountEntity;
|
||||||
import com.keylesspalace.tusky.db.AccountManager;
|
import com.keylesspalace.tusky.db.AccountManager;
|
||||||
import com.keylesspalace.tusky.entity.Notification;
|
import com.keylesspalace.tusky.entity.Notification;
|
||||||
|
@ -371,17 +370,22 @@ public class NotificationHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void deleteLegacyNotificationChannels(Context context) {
|
public static void deleteLegacyNotificationChannels(Context context, AccountManager accountManager) {
|
||||||
// delete the notification channels that where used before the multi account mode was introduced to avoid confusion
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
|
||||||
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
|
|
||||||
|
// used until Tusky 1.4
|
||||||
//noinspection ConstantConditions
|
//noinspection ConstantConditions
|
||||||
notificationManager.deleteNotificationChannel(CHANNEL_MENTION);
|
notificationManager.deleteNotificationChannel(CHANNEL_MENTION);
|
||||||
notificationManager.deleteNotificationChannel(CHANNEL_FAVOURITE);
|
notificationManager.deleteNotificationChannel(CHANNEL_FAVOURITE);
|
||||||
notificationManager.deleteNotificationChannel(CHANNEL_BOOST);
|
notificationManager.deleteNotificationChannel(CHANNEL_BOOST);
|
||||||
notificationManager.deleteNotificationChannel(CHANNEL_FOLLOW);
|
notificationManager.deleteNotificationChannel(CHANNEL_FOLLOW);
|
||||||
|
|
||||||
|
// used until Tusky 1.7
|
||||||
|
for(AccountEntity account: accountManager.getAllAccountsOrderedByActive()) {
|
||||||
|
notificationManager.deleteNotificationChannel(CHANNEL_FAVOURITE+" "+account.getIdentifier());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue