@react-native-firebase/messaging 23.5.0 → 23.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [23.7.0](https://github.com/invertase/react-native-firebase/compare/v23.6.0...v23.7.0) (2025-12-08)
7
+
8
+ **Note:** Version bump only for package @react-native-firebase/messaging
9
+
10
+ ## [23.6.0](https://github.com/invertase/react-native-firebase/compare/v23.5.0...v23.6.0) (2025-12-08)
11
+
12
+ ### Bug Fixes
13
+
14
+ - **messaging, android:** properly remove remote message from prefs ([336901b](https://github.com/invertase/react-native-firebase/commit/336901b00f0553f57fa18ce416f513f915c9a8ed))
15
+ - **messaging, android:** properly shrink stored messages to limit ([53fb8c8](https://github.com/invertase/react-native-firebase/commit/53fb8c86e0ab2559a69c1309e7a1c9afec4bcb1f))
16
+ - **messaging, android:** purge message store to limit first, add second ([47ea774](https://github.com/invertase/react-native-firebase/commit/47ea774e2830c0ef3e95c06acfb3960a3ae0bc74))
17
+
6
18
  ## [23.5.0](https://github.com/invertase/react-native-firebase/compare/v23.4.1...v23.5.0) (2025-10-30)
7
19
 
8
20
  **Note:** Version bump only for package @react-native-firebase/messaging
@@ -36,11 +36,8 @@ def jsonTargetSdk = appPackageJson['sdkVersions']['android']['targetSdk']
36
36
  def jsonCompileSdk = appPackageJson['sdkVersions']['android']['compileSdk']
37
37
  def coreVersionDetected = appPackageJson['version']
38
38
  def coreVersionRequired = packageJson['peerDependencies'][appPackageJson['name']]
39
- // Only log after build completed so log warning appears at the end
40
39
  if (coreVersionDetected != coreVersionRequired) {
41
- gradle.buildFinished {
42
- project.logger.warn("ReactNativeFirebase WARNING: NPM package '${packageJson['name']}' depends on '${appPackageJson['name']}' v${coreVersionRequired} but found v${coreVersionDetected}, this might cause build issues or runtime crashes.")
43
- }
40
+ project.logger.warn("ReactNativeFirebase WARNING: NPM package '${packageJson['name']}' depends on '${appPackageJson['name']}' v${coreVersionRequired} but found v${coreVersionDetected}, this might cause build issues or runtime crashes.")
44
41
  }
45
42
 
46
43
  project.ext {
@@ -28,19 +28,21 @@ public class ReactNativeFirebaseMessagingStoreImpl implements ReactNativeFirebas
28
28
  reactToJSON(remoteMessageToWritableMap(remoteMessage)).toString();
29
29
  // Log.d("storeFirebaseMessage", remoteMessageString);
30
30
  UniversalFirebasePreferences preferences = UniversalFirebasePreferences.getSharedInstance();
31
- preferences.setStringValue(remoteMessage.getMessageId(), remoteMessageString);
32
- // save new notification id
33
- String notifications = preferences.getStringValue(S_KEY_ALL_NOTIFICATION_IDS, "");
34
- notifications += remoteMessage.getMessageId() + DELIMITER; // append to last
35
31
 
36
- // check and remove old notifications message
37
- List<String> allNotificationList = convertToArray(notifications);
38
- if (allNotificationList.size() > MAX_SIZE_NOTIFICATIONS) {
39
- String firstRemoteMessageId = allNotificationList.get(0);
40
- preferences.remove(firstRemoteMessageId);
41
- notifications = removeRemoteMessage(firstRemoteMessageId, notifications);
32
+ // remove old notifications message before store to free space as needed
33
+ String notificationIds = preferences.getStringValue(S_KEY_ALL_NOTIFICATION_IDS, "");
34
+ List<String> allNotificationList = convertToArray(notificationIds);
35
+ while (allNotificationList.size() > MAX_SIZE_NOTIFICATIONS - 1) {
36
+ clearFirebaseMessage(allNotificationList.get(0));
37
+ allNotificationList.remove(0);
42
38
  }
43
- preferences.setStringValue(S_KEY_ALL_NOTIFICATION_IDS, notifications);
39
+
40
+ // now refetch the ids after possible removals, and store the new message
41
+ notificationIds = preferences.getStringValue(S_KEY_ALL_NOTIFICATION_IDS, "");
42
+ preferences.setStringValue(remoteMessage.getMessageId(), remoteMessageString);
43
+ // save new notification id
44
+ notificationIds += remoteMessage.getMessageId() + DELIMITER; // append to last
45
+ preferences.setStringValue(S_KEY_ALL_NOTIFICATION_IDS, notificationIds);
44
46
  } catch (JSONException e) {
45
47
  e.printStackTrace();
46
48
  }
@@ -76,17 +78,17 @@ public class ReactNativeFirebaseMessagingStoreImpl implements ReactNativeFirebas
76
78
  @Override
77
79
  public void clearFirebaseMessage(String remoteMessageId) {
78
80
  UniversalFirebasePreferences preferences = UniversalFirebasePreferences.getSharedInstance();
79
- preferences.remove(remoteMessageId);
81
+ preferences.remove(remoteMessageId).apply();
80
82
  // check and remove old notifications message
81
- String notifications = preferences.getStringValue(S_KEY_ALL_NOTIFICATION_IDS, "");
82
- if (!notifications.isEmpty()) {
83
- notifications = removeRemoteMessage(remoteMessageId, notifications); // remove from list
84
- preferences.setStringValue(S_KEY_ALL_NOTIFICATION_IDS, notifications);
83
+ String notificationIds = preferences.getStringValue(S_KEY_ALL_NOTIFICATION_IDS, "");
84
+ if (!notificationIds.isEmpty()) {
85
+ notificationIds = removeRemoteMessageId(remoteMessageId, notificationIds); // remove from list
86
+ preferences.setStringValue(S_KEY_ALL_NOTIFICATION_IDS, notificationIds);
85
87
  }
86
88
  }
87
89
 
88
- private String removeRemoteMessage(String remoteMessageId, String notifications) {
89
- return notifications.replace(remoteMessageId + DELIMITER, "");
90
+ private String removeRemoteMessageId(String remoteMessageId, String notificationIds) {
91
+ return notificationIds.replace(remoteMessageId + DELIMITER, "");
90
92
  }
91
93
 
92
94
  private List<String> convertToArray(String string) {
package/lib/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- module.exports = '23.5.0';
2
+ module.exports = '23.7.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-firebase/messaging",
3
- "version": "23.5.0",
3
+ "version": "23.7.0",
4
4
  "author": "Invertase <oss@invertase.io> (http://invertase.io)",
5
5
  "description": "React Native Firebase - React Native Firebase provides native integration of Firebase Cloud Messaging (FCM) for both Android & iOS. FCM is a cost free service, allowing for server-device and device-device communication. The React Native Firebase Messaging module provides a simple JavaScript API to interact with FCM.",
6
6
  "main": "lib/index.js",
@@ -24,11 +24,11 @@
24
24
  "messaging"
25
25
  ],
26
26
  "peerDependencies": {
27
- "@react-native-firebase/app": "23.5.0",
27
+ "@react-native-firebase/app": "23.7.0",
28
28
  "expo": ">=47.0.0"
29
29
  },
30
30
  "devDependencies": {
31
- "expo": "^53.0.20"
31
+ "expo": "^54.0.27"
32
32
  },
33
33
  "peerDependenciesMeta": {
34
34
  "expo": {
@@ -39,5 +39,5 @@
39
39
  "access": "public",
40
40
  "provenance": true
41
41
  },
42
- "gitHead": "5d27948f349d4d6c977c55036e2afd13df8d622f"
42
+ "gitHead": "2a30c0b1e41a2b239172afd167f98a03fd422f2c"
43
43
  }
@@ -1 +1 @@
1
- {"root":["./src/index.ts","./src/android/index.ts","./src/android/setupFirebaseNotifationIcon.ts"],"version":"5.9.2"}
1
+ {"root":["./src/index.ts","./src/android/index.ts","./src/android/setupFirebaseNotifationIcon.ts"],"version":"5.9.3"}