Skip to content

Commit

Permalink
Support delete-multiple push notification
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Apr 21, 2021
1 parent 207c51b commit d5cca71
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ class MagicFirebaseMessagingService : FirebaseMessagingService() {
cancelExistingNotificationWithId(applicationContext, signatureVerification!!.userEntity, notificationId)
} 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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,10 @@ public Result doWork() {
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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,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;

Expand Down

0 comments on commit d5cca71

Please sign in to comment.