1
0
Fork 1

try to fix bad notification bug (Christian Schneppe)

This commit is contained in:
12aw 2022-04-29 00:14:29 +02:00
parent 5df0e38e42
commit d87c6df2d8
6 changed files with 9 additions and 8 deletions

View file

@ -111,6 +111,7 @@ public class NotificationService {
public static final int MISSED_CALL_NOTIFICATION_ID = NOTIFICATION_ID_MULTIPLIER * 14;
public static final int IMPORT_BACKUP_NOTIFICATION_ID = NOTIFICATION_ID_MULTIPLIER * 16;
public static final int EXPORT_BACKUP_NOTIFICATION_ID = NOTIFICATION_ID_MULTIPLIER * 18;
public static final int UPDATE_NOTIFICATION_ID = NOTIFICATION_ID_MULTIPLIER * 20;
private final XmppConnectionService mXmppConnectionService;
private final LinkedHashMap<String, ArrayList<Message>> notifications = new LinkedHashMap<>();
private final LinkedHashMap<Conversational, MissedCallsInfo> mMissedCalls = new LinkedHashMap<>();
@ -1772,7 +1773,7 @@ public class NotificationService {
}
public void AppUpdateServiceNotification(Notification notification) {
notify(FOREGROUND_NOTIFICATION_ID, notification);
notify(UPDATE_NOTIFICATION_ID, notification);
}
private void notify(String tag, int id, Notification notification) {

View file

@ -2591,7 +2591,7 @@ public class XmppConnectionService extends Service {
getNotificationService().clear(conversation);
conversation.setStatus(Conversation.STATUS_ARCHIVED);
conversation.setNextMessage(null);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (Compatibility.runsTwentySix()) {
try {
mNotificationService.cleanNotificationChannels(this, conversation.getUuid());
} catch (Exception e) {
@ -2779,7 +2779,7 @@ public class XmppConnectionService extends Service {
for (final Conversation conversation : conversations) {
if (conversation.getAccount() == account) {
if (conversation.getMode() == Conversation.MODE_MULTI) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (Compatibility.runsTwentySix()) {
try {
mNotificationService.cleanNotificationChannels(this, conversation.getUuid());
} catch (Exception e) {
@ -3448,7 +3448,7 @@ public class XmppConnectionService extends Service {
}
private void leaveMuc(Conversation conversation, boolean now) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (Compatibility.runsTwentySix()) {
try {
mNotificationService.cleanNotificationChannels(this, conversation.getUuid());
} catch (Exception e) {

View file

@ -47,10 +47,6 @@ public class Compatibility {
return Build.VERSION.SDK_INT < Build.VERSION_CODES.M || (ContextCompat.checkSelfPermission(context, android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED);
}
public static boolean runsTwentySix() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
}
public static boolean runsTwentyThree() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.M;
}
@ -59,6 +55,10 @@ public class Compatibility {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N;
}
public static boolean runsTwentySix() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
}
public static boolean runsTwentyEight() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.P;
}