Skip to content

Commit 2ca86df

Browse files
committed
refactor(messaging, android): rename notificationId-related items for clarity
1 parent b388022 commit 2ca86df

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ public void storeFirebaseMessage(RemoteMessage remoteMessage) {
3030
UniversalFirebasePreferences preferences = UniversalFirebasePreferences.getSharedInstance();
3131
preferences.setStringValue(remoteMessage.getMessageId(), remoteMessageString);
3232
// save new notification id
33-
String notifications = preferences.getStringValue(S_KEY_ALL_NOTIFICATION_IDS, "");
34-
notifications += remoteMessage.getMessageId() + DELIMITER; // append to last
33+
String notificationIds = preferences.getStringValue(S_KEY_ALL_NOTIFICATION_IDS, "");
34+
notificationIds += remoteMessage.getMessageId() + DELIMITER; // append to last
3535

3636
// check and remove old notifications message
37-
List<String> allNotificationList = convertToArray(notifications);
37+
List<String> allNotificationList = convertToArray(notificationIds);
3838
if (allNotificationList.size() > MAX_SIZE_NOTIFICATIONS) {
3939
String firstRemoteMessageId = allNotificationList.get(0);
4040
preferences.remove(firstRemoteMessageId);
41-
notifications = removeRemoteMessage(firstRemoteMessageId, notifications);
41+
notificationIds = removeRemoteMessageId(firstRemoteMessageId, notificationIds);
4242
}
43-
preferences.setStringValue(S_KEY_ALL_NOTIFICATION_IDS, notifications);
43+
preferences.setStringValue(S_KEY_ALL_NOTIFICATION_IDS, notificationIds);
4444
} catch (JSONException e) {
4545
e.printStackTrace();
4646
}
@@ -78,15 +78,15 @@ public void clearFirebaseMessage(String remoteMessageId) {
7878
UniversalFirebasePreferences preferences = UniversalFirebasePreferences.getSharedInstance();
7979
preferences.remove(remoteMessageId);
8080
// 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);
81+
String notificationIds = preferences.getStringValue(S_KEY_ALL_NOTIFICATION_IDS, "");
82+
if (!notificationIds.isEmpty()) {
83+
notificationIds = removeRemoteMessageId(remoteMessageId, notificationIds); // remove from list
84+
preferences.setStringValue(S_KEY_ALL_NOTIFICATION_IDS, notificationIds);
8585
}
8686
}
8787

88-
private String removeRemoteMessage(String remoteMessageId, String notifications) {
89-
return notifications.replace(remoteMessageId + DELIMITER, "");
88+
private String removeRemoteMessageId(String remoteMessageId, String notificationIds) {
89+
return notificationIds.replace(remoteMessageId + DELIMITER, "");
9090
}
9191

9292
private List<String> convertToArray(String string) {

0 commit comments

Comments
 (0)