Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pop initial for firebase #807

Merged
merged 1 commit into from
Aug 1, 2018
Merged
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
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