@suro4ek/appmetrica-push-sdk 1.0.7 → 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.
|
@@ -32,21 +32,20 @@ class AppMetricaPushModule(reactContext: ReactApplicationContext) : ReactContext
|
|
|
32
32
|
try {
|
|
33
33
|
val debugMode = if (config.hasKey("debugMode")) config.getBoolean("debugMode") else false
|
|
34
34
|
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
// Инициализация AppMetrica Push
|
|
36
|
+
AppMetricaPush.activate(reactApplicationContext)
|
|
37
|
+
|
|
39
38
|
// Настройка дефолтного канала AppMetrica Push SDK
|
|
40
39
|
setupAppMetricaDefaultChannel()
|
|
41
|
-
|
|
40
|
+
|
|
42
41
|
if (debugMode) {
|
|
43
|
-
Log.d(TAG, "AppMetrica Push
|
|
42
|
+
Log.d(TAG, "AppMetrica Push initialized successfully")
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
promise.resolve(true)
|
|
47
46
|
} catch (e: Exception) {
|
|
48
|
-
Log.e(TAG, "Failed to initialize AppMetrica Push
|
|
49
|
-
promise.reject("INIT_ERROR",
|
|
47
|
+
Log.e(TAG, "Failed to initialize AppMetrica Push", e)
|
|
48
|
+
promise.reject("INIT_ERROR", e.message)
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
|
|
@@ -79,18 +78,17 @@ class AppMetricaPushModule(reactContext: ReactApplicationContext) : ReactContext
|
|
|
79
78
|
@ReactMethod
|
|
80
79
|
fun isNotificationFromAppMetrica(notification: ReadableMap, promise: Promise) {
|
|
81
80
|
try {
|
|
82
|
-
// Проверяем, что push уведомление
|
|
83
|
-
//
|
|
81
|
+
// Проверяем, что push уведомление от AppMetrica
|
|
82
|
+
// AppMetrica добавляет ключ "yamp" в data объект
|
|
84
83
|
var isFromAppMetrica = false
|
|
85
|
-
|
|
84
|
+
|
|
86
85
|
if (notification.hasKey("data")) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (data != null && data.contains("appmetrica")) {
|
|
86
|
+
val data = notification.getMap("data")
|
|
87
|
+
if (data != null && data.hasKey("yamp")) {
|
|
90
88
|
isFromAppMetrica = true
|
|
91
89
|
}
|
|
92
90
|
}
|
|
93
|
-
|
|
91
|
+
|
|
94
92
|
promise.resolve(isFromAppMetrica)
|
|
95
93
|
} catch (e: Exception) {
|
|
96
94
|
Log.e(TAG, "Failed to check if notification is from AppMetrica", e)
|
|
@@ -174,4 +172,4 @@ class AppMetricaPushModule(reactContext: ReactApplicationContext) : ReactContext
|
|
|
174
172
|
"4.2.1" // Fallback версия
|
|
175
173
|
}
|
|
176
174
|
}
|
|
177
|
-
}
|
|
175
|
+
}
|