Skip to content

Commit 1ca606d

Browse files
committed
More attention to detail
1 parent d2019d9 commit 1ca606d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

com.unity.mobile.notifications/Runtime/Android/Plugins/com/unity/androidnotifications/UnityNotificationBackgroundThread.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,21 @@ public CancelNotificationTask(int id) {
4747
public boolean run(Context context, Set<String> notificationIds) {
4848
UnityNotificationManager.cancelPendingNotificationIntent(context, notificationId);
4949
String id = String.valueOf(notificationId);
50-
UnityNotificationManager.deleteExpiredNotificationIntent(context, id);
51-
notificationIds.remove(id);
52-
return true;
50+
if (notificationIds.remove(id)) {
51+
UnityNotificationManager.deleteExpiredNotificationIntent(context, id);
52+
return true;
53+
}
54+
55+
return false;
5356
}
5457
}
5558

5659
private static class CancelAllNotificationsTask extends Task {
5760
@Override
5861
public boolean run(Context context, Set<String> notificationIds) {
62+
if (notificationIds.isEmpty())
63+
return false;
64+
5965
for (String id : notificationIds) {
6066
UnityNotificationManager.cancelPendingNotificationIntent(context, Integer.valueOf(id));
6167
UnityNotificationManager.deleteExpiredNotificationIntent(context, id);

0 commit comments

Comments
 (0)