Skip to content

Commit ccdfd5d

Browse files
committed
Make findInvalidNotificationIds instance method
1 parent 20806c4 commit ccdfd5d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ protected static Intent buildOpenAppIntent(Context context, Class className) {
416416
void performNotificationHousekeeping(Set<String> ids) {
417417
Log.d(TAG_UNITY, "Checking for invalid notification IDs still hanging around");
418418

419-
Set<String> invalid = findInvalidNotificationIds(mContext, ids);
419+
Set<String> invalid = findInvalidNotificationIds(ids);
420420
synchronized (UnityNotificationManager.class) {
421421
Set<String> currentIds = new HashSet<>(ids);
422422
for (String id : invalid) {
@@ -430,20 +430,20 @@ void performNotificationHousekeeping(Set<String> ids) {
430430
deleteExpiredNotificationIntent(id);
431431
}
432432

433-
private static Set<String> findInvalidNotificationIds(Context context, Set<String> ids) {
434-
Intent intent = buildNotificationIntent(context);
433+
private Set<String> findInvalidNotificationIds(Set<String> ids) {
434+
Intent intent = buildNotificationIntent(mContext);
435435
HashSet<String> invalid = new HashSet<String>();
436436
for (String id : ids) {
437437
// Get the given broadcast PendingIntent by id as request code.
438438
// FLAG_NO_CREATE is set to return null if the described PendingIntent doesn't exist.
439-
PendingIntent broadcast = getBroadcastPendingIntent(context, Integer.valueOf(id), intent, PendingIntent.FLAG_NO_CREATE);
439+
PendingIntent broadcast = getBroadcastPendingIntent(mContext, Integer.valueOf(id), intent, PendingIntent.FLAG_NO_CREATE);
440440
if (broadcast == null) {
441441
invalid.add(id);
442442
}
443443
}
444444

445445
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
446-
StatusBarNotification[] active = getNotificationManager(context).getActiveNotifications();
446+
StatusBarNotification[] active = getNotificationManager().getActiveNotifications();
447447
for (StatusBarNotification notification : active) {
448448
// any notifications in status bar are still valid
449449
String id = String.valueOf(notification.getId());

0 commit comments

Comments
 (0)