mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 06:15:12 +00:00
parent
58cfcdeb00
commit
257d3104b2
@ -53,7 +53,7 @@ public class PackageReplacedReceiver extends BroadcastReceiver {
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
NextcloudTalkApplication.getSharedApplication().getComponentApplication().inject(this);
|
||||
|
||||
if (!appPreferences.getIsNotificationChannelUpgradedToV2() && intent != null && intent.getAction() != null &&
|
||||
if (intent != null && intent.getAction() != null &&
|
||||
intent.getAction().equals("android.intent.action.MY_PACKAGE_REPLACED")) {
|
||||
try {
|
||||
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
|
||||
@ -62,17 +62,23 @@ public class PackageReplacedReceiver extends BroadcastReceiver {
|
||||
(NotificationManager) context.getSystemService(Context
|
||||
.NOTIFICATION_SERVICE);
|
||||
|
||||
|
||||
if (notificationManager != null) {
|
||||
for (NotificationChannelGroup notificationChannelGroup : notificationManager
|
||||
.getNotificationChannelGroups()) {
|
||||
notificationManager.deleteNotificationChannelGroup(notificationChannelGroup.getId());
|
||||
if (!appPreferences.getIsNotificationChannelUpgradedToV2()) {
|
||||
for (NotificationChannelGroup notificationChannelGroup : notificationManager
|
||||
.getNotificationChannelGroups()) {
|
||||
notificationManager.deleteNotificationChannelGroup(notificationChannelGroup.getId());
|
||||
}
|
||||
|
||||
notificationManager.deleteNotificationChannel(NotificationUtils.NOTIFICATION_CHANNEL_CALLS);
|
||||
notificationManager.deleteNotificationChannel(NotificationUtils.NOTIFICATION_CHANNEL_MESSAGES);
|
||||
|
||||
appPreferences.setNotificationChannelIsUpgradedToV2(true);
|
||||
}
|
||||
|
||||
notificationManager.deleteNotificationChannel(NotificationUtils.NOTIFICATION_CHANNEL_CALLS);
|
||||
notificationManager.deleteNotificationChannel(NotificationUtils.NOTIFICATION_CHANNEL_MESSAGES);
|
||||
|
||||
appPreferences.setNotificationChannelIsUpgradedToV2(true);
|
||||
if (!appPreferences.getIsMessagesNotificationChannelUpgradedToV3() && packageInfo.versionCode > 51) {
|
||||
notificationManager.deleteNotificationChannel(NotificationUtils.NOTIFICATION_CHANNEL_MESSAGES_V2);
|
||||
appPreferences.setNotificationChannelIsUpgradedToV2(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -168,6 +168,16 @@ public interface AppPreferences {
|
||||
@RemoveMethod
|
||||
void removeNotificationChannelUpgradeToV2();
|
||||
|
||||
@KeyByString("messages_notification_channel_upgrade_to_v3")
|
||||
boolean getIsMessagesNotificationChannelUpgradedToV3();
|
||||
|
||||
@KeyByString("messages_notification_channel_upgrade_to_v3")
|
||||
void setMessagesNotificationChannelIsUpgradedToV3(boolean value);
|
||||
|
||||
@KeyByString("messages_notification_channel_upgrade_to_v3")
|
||||
@RemoveMethod
|
||||
void removeMessagesNotificationChannelUpgradeToV3();
|
||||
|
||||
@ClearMethod
|
||||
void clear();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user