Skip to content

Commit

Permalink
Merge pull request #807 from Truebill/fix-pop-initial
Browse files Browse the repository at this point in the history
Fix pop initial for firebase
  • Loading branch information
Gp2mv3 authored Aug 1, 2018
2 parents a071458 + 1510612 commit b61ce08
Showing 1 changed file with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,18 @@ public Map<String, Object> getConstants() {
return constants;
}

public void onNewIntent(Intent intent) {
private Bundle getBundleFromIntent(Intent intent) {
Bundle bundle = null;
if (intent.hasExtra("notification")) {
Bundle bundle = intent.getBundleExtra("notification");
bundle = intent.getBundleExtra("notification");
} else if (intent.hasExtra("google.message_id")) {
bundle = intent.getExtras();
}
return bundle;
}
public void onNewIntent(Intent intent) {
Bundle bundle = this.getBundleFromIntent(intent);
if (bundle != null) {
bundle.putBoolean("foreground", false);
intent.putExtra("notification", bundle);
mJsDelivery.notifyNotification(bundle);
Expand Down Expand Up @@ -155,8 +164,7 @@ public void getInitialNotification(Promise promise) {
WritableMap params = Arguments.createMap();
Activity activity = getCurrentActivity();
if (activity != null) {
Intent intent = activity.getIntent();
Bundle bundle = intent.getBundleExtra("notification");
Bundle bundle = this.getBundleFromIntent(activity.getIntent());
if (bundle != null) {
bundle.putBoolean("foreground", false);
String bundleString = mJsDelivery.convertJSON(bundle);
Expand Down Expand Up @@ -210,12 +218,12 @@ public void cancelLocalNotifications(ReadableMap userInfo) {
}

@ReactMethod
/**
* Clear notification from the notification centre.
*/
public void clearLocalNotification(int notificationID) {
mRNPushNotificationHelper.clearNotification(notificationID);
}
/**
* Clear notification from the notification centre.
*/
public void clearLocalNotification(int notificationID) {
mRNPushNotificationHelper.clearNotification(notificationID);
}

@ReactMethod
public void registerNotificationActions(ReadableArray actions) {
Expand Down

0 comments on commit b61ce08

Please sign in to comment.