Skip to content

Commit 53fb8c8

Browse files
committed
fix(messaging, android): properly shrink stored messages to limit
previously, stored messages were cleared one at a time each time a message came in, opening the possibility that the store would contain more messages then the limit and never get back down to the limit. now it will attempt to shrink down to the limit every time a message comes in ensuring that if there is an over limit condition it will be fixed quickly
1 parent 336901b commit 53fb8c8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ public void storeFirebaseMessage(RemoteMessage remoteMessage) {
3636

3737
// check and remove old notifications message
3838
List<String> allNotificationList = convertToArray(notificationIds);
39-
if (allNotificationList.size() > MAX_SIZE_NOTIFICATIONS) {
39+
while (allNotificationList.size() > MAX_SIZE_NOTIFICATIONS) {
4040
clearFirebaseMessage(allNotificationList.get(0));
41+
allNotificationList.remove(0);
4142
}
4243
} catch (JSONException e) {
4344
e.printStackTrace();

0 commit comments

Comments
 (0)