diff --git a/app/src/gplay/java/com/nextcloud/talk/services/firebase/MagicFirebaseMessagingService.kt b/app/src/gplay/java/com/nextcloud/talk/services/firebase/MagicFirebaseMessagingService.kt index f94110196..f966235f5 100644 --- a/app/src/gplay/java/com/nextcloud/talk/services/firebase/MagicFirebaseMessagingService.kt +++ b/app/src/gplay/java/com/nextcloud/talk/services/firebase/MagicFirebaseMessagingService.kt @@ -169,6 +169,14 @@ class MagicFirebaseMessagingService : FirebaseMessagingService() { ) } else if (deleteAll) { cancelAllNotificationsForAccount(applicationContext, signatureVerification!!.userEntity) + } else if (deleteMultiple) { + notificationIds.forEach { + cancelExistingNotificationWithId( + applicationContext, + signatureVerification!!.userEntity, + it + ) + } } else if (type == "call") { val fullScreenIntent = Intent(applicationContext, MagicCallActivity::class.java) val bundle = Bundle() @@ -201,7 +209,11 @@ class MagicFirebaseMessagingService : FirebaseMessagingService() { LoganSquare.parse(ringtonePreferencesString, RingtoneSettings::class.java) ringtoneSettings.ringtoneUri } catch (exception: IOException) { - Uri.parse("android.resource://" + applicationContext.packageName + "/raw/librem_by_feandesign_call") + Uri.parse( + "android.resource://" + + applicationContext.packageName + + "/raw/librem_by_feandesign_call" + ) } } diff --git a/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java b/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java index 12362217c..60ef8115f 100644 --- a/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java +++ b/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java @@ -586,6 +586,10 @@ public class NotificationWorker extends Worker { NotificationUtils.INSTANCE.cancelExistingNotificationWithId(context, signatureVerification.getUserEntity(), decryptedPushMessage.getNotificationId()); } else if (decryptedPushMessage.isDeleteAll()) { NotificationUtils.INSTANCE.cancelAllNotificationsForAccount(context, signatureVerification.getUserEntity()); + } else if (decryptedPushMessage.isDeleteMultiple()) { + for (long notificationId : decryptedPushMessage.getNotificationIds()) { + NotificationUtils.INSTANCE.cancelExistingNotificationWithId(context, signatureVerification.getUserEntity(), notificationId); + } } else { credentials = ApiUtils.getCredentials(signatureVerification.getUserEntity().getUsername(), signatureVerification.getUserEntity().getToken()); diff --git a/app/src/main/java/com/nextcloud/talk/models/json/push/DecryptedPushMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/push/DecryptedPushMessage.java index 245bde202..1f3498950 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/push/DecryptedPushMessage.java +++ b/app/src/main/java/com/nextcloud/talk/models/json/push/DecryptedPushMessage.java @@ -44,12 +44,18 @@ public class DecryptedPushMessage { @JsonField(name = "nid") public long notificationId; + @JsonField(name = "nids") + public long[] notificationIds; + @JsonField(name = "delete") public boolean delete; @JsonField(name = "delete-all") public boolean deleteAll; + @JsonField(name = "delete-multiple") + public boolean deleteMultiple; + @JsonIgnore public NotificationUser notificationUser; @@ -99,6 +105,14 @@ public class DecryptedPushMessage { return this.timestamp; } + public long[] getNotificationIds() { + return notificationIds; + } + + public boolean isDeleteMultiple() { + return deleteMultiple; + } + public void setApp(String app) { this.app = app; } @@ -139,6 +153,14 @@ public class DecryptedPushMessage { this.timestamp = timestamp; } + public void setNotificationIds(long[] notificationIds) { + this.notificationIds = notificationIds; + } + + public void setDeleteMultiple(boolean deleteMultiple) { + this.deleteMultiple = deleteMultiple; + } + public boolean equals(final Object o) { if (o == this) { return true; diff --git a/scripts/analysis/findbugs-results.txt b/scripts/analysis/findbugs-results.txt index 9889789ba..e1170b641 100644 --- a/scripts/analysis/findbugs-results.txt +++ b/scripts/analysis/findbugs-results.txt @@ -1 +1 @@ -499 \ No newline at end of file +489 \ No newline at end of file diff --git a/spotbugs-filter.xml b/spotbugs-filter.xml index e9a5d30f4..cb023898c 100644 --- a/spotbugs-filter.xml +++ b/spotbugs-filter.xml @@ -33,6 +33,10 @@ + + + +