Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
lyz committed Oct 12, 2022
1 parent 348eb9b commit 73941f8
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;

import com.facebook.react.bridge.ReactContext;
import com.wix.reactnativenotifications.core.AppLaunchHelper;
Expand All @@ -18,6 +19,7 @@
import com.wix.reactnativenotifications.core.JsIOHelper;
import com.wix.reactnativenotifications.core.NotificationIntentAdapter;

import static com.wix.reactnativenotifications.Defs.LOGTAG;
import static com.wix.reactnativenotifications.Defs.NOTIFICATION_OPENED_EVENT_NAME;
import static com.wix.reactnativenotifications.Defs.NOTIFICATION_RECEIVED_EVENT_NAME;
import static com.wix.reactnativenotifications.Defs.NOTIFICATION_RECEIVED_BACKGROUND_EVENT_NAME;
Expand Down Expand Up @@ -207,9 +209,12 @@ private void notifyReceivedBackgroundToJS() {

private void notifyOpenedToJS() {
Bundle response = new Bundle();
response.putBundle("notification", mNotificationProps.asBundle());

mJsIOHelper.sendEventToJS(NOTIFICATION_OPENED_EVENT_NAME, response, mAppLifecycleFacade.getRunningReactContext());
try {
response.putBundle("notification", mNotificationProps.asBundle());
mJsIOHelper.sendEventToJS(NOTIFICATION_OPENED_EVENT_NAME, response, mAppLifecycleFacade.getRunningReactContext());
} catch (NullPointerException e) {
Log.e(LOGTAG, "notifyOpenedToJS: Null pointer exception");
}
}

protected void launchOrResumeApp() {
Expand Down

0 comments on commit 73941f8

Please sign in to comment.