From 0b70828ca3e1f4e00817a32d6327381b4605c75c Mon Sep 17 00:00:00 2001 From: Yogev Ben David Date: Sun, 11 Aug 2019 23:21:05 +0300 Subject: [PATCH] Revert "Remove verify notification, Closes #296" --- .../core/notification/PushNotification.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java b/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java index 3ea5eb3..2c970e9 100644 --- a/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java +++ b/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java @@ -43,6 +43,10 @@ public class PushNotification implements IPushNotification { }; public static IPushNotification get(Context context, Bundle bundle) { + if (verifyNotificationBundle(bundle) == false) { + return null; + } + Context appContext = context.getApplicationContext(); if (appContext instanceof INotificationsApplication) { return ((INotificationsApplication) appContext).getPushNotification(context, bundle, AppLifecycleFacadeHolder.get(), new AppLaunchHelper()); @@ -58,6 +62,14 @@ public class PushNotification implements IPushNotification { mNotificationProps = createProps(bundle); } + private static boolean verifyNotificationBundle(Bundle bundle) { + if (bundle.getString("google.message_id") != null) { + return true; + } + + return false; + } + @Override public void onReceived() throws InvalidNotificationException { postNotification(null); -- 2.26.2