Skip to content

Commit 038482e

Browse files
committed
refactor(messaging, android): centralize remote message removal logic
it was duplicated, which means any fixes have to be in multiple spots
1 parent 2ca86df commit 038482e

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

packages/messaging/android/src/main/java/io/invertase/firebase/messaging/ReactNativeFirebaseMessagingStoreImpl.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,8 @@ public void storeFirebaseMessage(RemoteMessage remoteMessage) {
3636
// check and remove old notifications message
3737
List<String> allNotificationList = convertToArray(notificationIds);
3838
if (allNotificationList.size() > MAX_SIZE_NOTIFICATIONS) {
39-
String firstRemoteMessageId = allNotificationList.get(0);
40-
preferences.remove(firstRemoteMessageId);
41-
notificationIds = removeRemoteMessageId(firstRemoteMessageId, notificationIds);
39+
clearFirebaseMessage(allNotificationList.get(0));
4240
}
43-
preferences.setStringValue(S_KEY_ALL_NOTIFICATION_IDS, notificationIds);
4441
} catch (JSONException e) {
4542
e.printStackTrace();
4643
}

0 commit comments

Comments
 (0)