@suro4ek/appmetrica-push-sdk 1.0.8 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -78,18 +78,17 @@ class AppMetricaPushModule(reactContext: ReactApplicationContext) : ReactContext
78
78
  @ReactMethod
79
79
  fun isNotificationFromAppMetrica(notification: ReadableMap, promise: Promise) {
80
80
  try {
81
- // Проверяем, что push уведомление не от AppMetrica
82
- // Это нужно для собственных сервисов обработки push уведомлений
81
+ // Проверяем, что push уведомление от AppMetrica
82
+ // AppMetrica добавляет ключ "yamp" в data объект
83
83
  var isFromAppMetrica = false
84
-
84
+
85
85
  if (notification.hasKey("data")) {
86
- // Проверяем наличие специфических полей AppMetrica в данных
87
- val data = notification.getString("data")
88
- if (data != null && data.contains("appmetrica")) {
86
+ val data = notification.getMap("data")
87
+ if (data != null && data.hasKey("yamp")) {
89
88
  isFromAppMetrica = true
90
89
  }
91
90
  }
92
-
91
+
93
92
  promise.resolve(isFromAppMetrica)
94
93
  } catch (e: Exception) {
95
94
  Log.e(TAG, "Failed to check if notification is from AppMetrica", e)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suro4ek/appmetrica-push-sdk",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "React Native library for Yandex AppMetrica Push SDK",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",