mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 12:09:45 +01:00
parent
58cfcdeb00
commit
257d3104b2
@ -53,7 +53,7 @@ public class PackageReplacedReceiver extends BroadcastReceiver {
|
|||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
NextcloudTalkApplication.getSharedApplication().getComponentApplication().inject(this);
|
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")) {
|
intent.getAction().equals("android.intent.action.MY_PACKAGE_REPLACED")) {
|
||||||
try {
|
try {
|
||||||
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
|
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
|
||||||
@ -62,8 +62,8 @@ public class PackageReplacedReceiver extends BroadcastReceiver {
|
|||||||
(NotificationManager) context.getSystemService(Context
|
(NotificationManager) context.getSystemService(Context
|
||||||
.NOTIFICATION_SERVICE);
|
.NOTIFICATION_SERVICE);
|
||||||
|
|
||||||
|
|
||||||
if (notificationManager != null) {
|
if (notificationManager != null) {
|
||||||
|
if (!appPreferences.getIsNotificationChannelUpgradedToV2()) {
|
||||||
for (NotificationChannelGroup notificationChannelGroup : notificationManager
|
for (NotificationChannelGroup notificationChannelGroup : notificationManager
|
||||||
.getNotificationChannelGroups()) {
|
.getNotificationChannelGroups()) {
|
||||||
notificationManager.deleteNotificationChannelGroup(notificationChannelGroup.getId());
|
notificationManager.deleteNotificationChannelGroup(notificationChannelGroup.getId());
|
||||||
@ -75,6 +75,12 @@ public class PackageReplacedReceiver extends BroadcastReceiver {
|
|||||||
appPreferences.setNotificationChannelIsUpgradedToV2(true);
|
appPreferences.setNotificationChannelIsUpgradedToV2(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!appPreferences.getIsMessagesNotificationChannelUpgradedToV3() && packageInfo.versionCode > 51) {
|
||||||
|
notificationManager.deleteNotificationChannel(NotificationUtils.NOTIFICATION_CHANNEL_MESSAGES_V2);
|
||||||
|
appPreferences.setNotificationChannelIsUpgradedToV2(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
Log.e(TAG, "Failed to fetch package info");
|
Log.e(TAG, "Failed to fetch package info");
|
||||||
|
@ -168,6 +168,16 @@ public interface AppPreferences {
|
|||||||
@RemoveMethod
|
@RemoveMethod
|
||||||
void removeNotificationChannelUpgradeToV2();
|
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
|
@ClearMethod
|
||||||
void clear();
|
void clear();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user