Differential D7193 Diff 24569 native/android/app/src/main/java/app/comm/android/notifications/CommAndroidNotificationParser.java
Changeset View
Changeset View
Standalone View
Standalone View
native/android/app/src/main/java/app/comm/android/notifications/CommAndroidNotificationParser.java
Show All 11 Lines | private static final Set<String> OBLIGATORY_KEYS = Set.of( | ||||
CommNotificationsHandler.BODY_KEY, | CommNotificationsHandler.BODY_KEY, | ||||
CommNotificationsHandler.THREAD_ID_KEY); | CommNotificationsHandler.THREAD_ID_KEY); | ||||
private static final Set<String> OPTIONAL_KEYS = Set.of( | private static final Set<String> OPTIONAL_KEYS = Set.of( | ||||
CommNotificationsHandler.MESSAGE_INFOS_KEY, | CommNotificationsHandler.MESSAGE_INFOS_KEY, | ||||
CommNotificationsHandler.PREFIX_KEY); | CommNotificationsHandler.PREFIX_KEY); | ||||
public static WritableMap | public static WritableMap | ||||
parseRemoteMessageToJSForegroundMessage(RemoteMessage message) { | parseRemoteMessageToJSMessage(RemoteMessage message) { | ||||
if (message.getData() == null) { | if (message.getData() == null) { | ||||
return null; | return null; | ||||
} | } | ||||
WritableMap jsForegroundMessage = Arguments.createMap(); | WritableMap jsMessage = Arguments.createMap(); | ||||
for (String key : OBLIGATORY_KEYS) { | for (String key : OBLIGATORY_KEYS) { | ||||
String value = message.getData().get(key); | String value = message.getData().get(key); | ||||
if (value == null) { | if (value == null) { | ||||
return null; | return null; | ||||
} | } | ||||
jsForegroundMessage.putString(key, value); | jsMessage.putString(key, value); | ||||
} | } | ||||
for (String key : OPTIONAL_KEYS) { | for (String key : OPTIONAL_KEYS) { | ||||
String value = message.getData().get(key); | String value = message.getData().get(key); | ||||
if (value == null) { | if (value == null) { | ||||
continue; | continue; | ||||
} | } | ||||
jsForegroundMessage.putString(key, value); | jsMessage.putString(key, value); | ||||
} | } | ||||
return jsForegroundMessage; | return jsMessage; | ||||
} | } | ||||
} | } |