Skip to content

Commit 4247c31

Browse files
authored
Merge pull request #357 from wix/revert-349-removeVerifyNotification
Revert "Remove verify notification, Closes #296"
2 parents 106c78c + 0b70828 commit 4247c31

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java

+12
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ public void onAppNotVisible() {
4343
};
4444

4545
public static IPushNotification get(Context context, Bundle bundle) {
46+
if (verifyNotificationBundle(bundle) == false) {
47+
return null;
48+
}
49+
4650
Context appContext = context.getApplicationContext();
4751
if (appContext instanceof INotificationsApplication) {
4852
return ((INotificationsApplication) appContext).getPushNotification(context, bundle, AppLifecycleFacadeHolder.get(), new AppLaunchHelper());
@@ -58,6 +62,14 @@ protected PushNotification(Context context, Bundle bundle, AppLifecycleFacade ap
5862
mNotificationProps = createProps(bundle);
5963
}
6064

65+
private static boolean verifyNotificationBundle(Bundle bundle) {
66+
if (bundle.getString("google.message_id") != null) {
67+
return true;
68+
}
69+
70+
return false;
71+
}
72+
6173
@Override
6274
public void onReceived() throws InvalidNotificationException {
6375
postNotification(null);

0 commit comments

Comments
 (0)