Skip to content

Commit

Permalink
feat(messaging, android): make native serializer object + events buil…
Browse files Browse the repository at this point in the history
…der APIs public (invertase#4618)

This enables their use in brownfield situations
  • Loading branch information
alexisbronchart authored Nov 26, 2020
1 parent 610ed7b commit d1a58a9
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import java.util.Map;
import java.util.Set;

class ReactNativeFirebaseMessagingSerializer {
public class ReactNativeFirebaseMessagingSerializer {
private static final String KEY_TOKEN = "token";
private static final String KEY_COLLAPSE_KEY = "collapseKey";
private static final String KEY_DATA = "data";
Expand All @@ -29,28 +29,28 @@ class ReactNativeFirebaseMessagingSerializer {
private static final String EVENT_MESSAGE_SEND_ERROR = "messaging_message_send_error";
private static final String EVENT_NEW_TOKEN = "messaging_token_refresh";

static ReactNativeFirebaseEvent messagesDeletedToEvent() {
public static ReactNativeFirebaseEvent messagesDeletedToEvent() {
return new ReactNativeFirebaseEvent(EVENT_MESSAGES_DELETED, Arguments.createMap());
}

static ReactNativeFirebaseEvent messageSentToEvent(String messageId) {
public static ReactNativeFirebaseEvent messageSentToEvent(String messageId) {
WritableMap eventBody = Arguments.createMap();
eventBody.putString(KEY_MESSAGE_ID, messageId);
return new ReactNativeFirebaseEvent(EVENT_MESSAGE_SENT, eventBody);
}

static ReactNativeFirebaseEvent messageSendErrorToEvent(String messageId, Exception sendError) {
public static ReactNativeFirebaseEvent messageSendErrorToEvent(String messageId, Exception sendError) {
WritableMap eventBody = Arguments.createMap();
eventBody.putString(KEY_MESSAGE_ID, messageId);
eventBody.putMap(KEY_ERROR, SharedUtils.getExceptionMap(sendError));
return new ReactNativeFirebaseEvent(EVENT_MESSAGE_SEND_ERROR, eventBody);
}

static ReactNativeFirebaseEvent remoteMessageToEvent(RemoteMessage remoteMessage, Boolean openEvent) {
public static ReactNativeFirebaseEvent remoteMessageToEvent(RemoteMessage remoteMessage, Boolean openEvent) {
return new ReactNativeFirebaseEvent(openEvent ? EVENT_NOTIFICATION_OPENED : EVENT_MESSAGE_RECEIVED, remoteMessageToWritableMap(remoteMessage));
}

static ReactNativeFirebaseEvent newTokenToTokenEvent(String newToken) {
public static ReactNativeFirebaseEvent newTokenToTokenEvent(String newToken) {
WritableMap eventBody = Arguments.createMap();
eventBody.putString(KEY_TOKEN, newToken);
return new ReactNativeFirebaseEvent(EVENT_NEW_TOKEN, eventBody);
Expand Down

0 comments on commit d1a58a9

Please sign in to comment.