Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -575,4 +575,7 @@ website/public
!**/.yarn/plugins
!**/.yarn/releases
!**/.yarn/sdks
!**/.yarn/versions
!**/.yarn/versions

# Typescript items
*.tsbuildinfo
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public class ReactNativeFirebaseMessagingSerializer {
private static final String KEY_ERROR = "error";
private static final String KEY_TO = "to";
private static final String KEY_TTL = "ttl";
private static final String KEY_PRIORITY = "priority";
private static final String KEY_ORIGINAL_PRIORITY = "originalPriority";
private static final String EVENT_MESSAGE_SENT = "messaging_message_sent";
private static final String EVENT_MESSAGES_DELETED = "messaging_message_deleted";
private static final String EVENT_MESSAGE_RECEIVED = "messaging_message_received";
Expand Down Expand Up @@ -99,6 +101,8 @@ static WritableMap remoteMessageToWritableMap(RemoteMessage remoteMessage) {
messageMap.putMap(KEY_DATA, dataMap);
messageMap.putDouble(KEY_TTL, remoteMessage.getTtl());
messageMap.putDouble(KEY_SENT_TIME, remoteMessage.getSentTime());
messageMap.putInt(KEY_PRIORITY, remoteMessage.getPriority());
messageMap.putInt(KEY_ORIGINAL_PRIORITY, remoteMessage.getOriginalPriority());

if (remoteMessage.getNotification() != null) {
messageMap.putMap(
Expand Down
40 changes: 40 additions & 0 deletions packages/messaging/lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,46 @@ export namespace FirebaseMessagingTypes {
* Options for features provided by the FCM SDK for Web.
*/
fcmOptions: FcmOptions;

/**
* Priority - android-specific, undefined on non-android platforms, default PRIORITY_UNKNOWN
*/
priority?: MessagePriority;

/**
* Original priority - android-specific, undefined on non-android platforms, default PRIORITY_UNKNOWN
*/
originalPriority?: MessagePriority;
}

/**
* Represents the priority of a RemoteMessage
*
* Note: this is an android-specific property of RemoteMessages
*
* See https://github.com/firebase/firebase-android-sdk/blob/b6d01070d246b74f02c42da5691f99f52763e48b/firebase-messaging/src/main/java/com/google/firebase/messaging/RemoteMessage.java#L57-L64
*
* Example:
*
* ```js
* firebase.messaging.MessagePriority.PRIORITY_NORMAL;
* ```
*/
export enum MessagePriority {
/**
* Unknown priority, this will be returned as the default on non-android platforms
*/
PRIORITY_UNKNOWN = 0,

/**
* High priority - Activities may start foreground services if they receive high priority messages
*/
PRIORITY_HIGH = 1,

/**
* Normal priority - Activities have restrictions and may only perform unobtrusive actions on receipt
*/
PRIORITY_NORMAL = 2,
}

/**
Expand Down
Loading