react-native-mytatva-rn-sdk 1.2.96 → 1.2.98
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.
- package/android/src/main/java/com/mytatvarnsdk/CgmTrackyLibModule.kt +84 -0
- package/android/src/main/java/com/mytatvarnsdk/activity/ConnectSensorActivity.kt +158 -18
- package/android/src/main/java/com/mytatvarnsdk/activity/HelpActivity.kt +3 -9
- package/android/src/main/java/com/mytatvarnsdk/activity/PermissionActivity.kt +51 -16
- package/android/src/main/java/com/mytatvarnsdk/activity/PlaceSensorActivity.kt +29 -13
- package/android/src/main/java/com/mytatvarnsdk/activity/PlaceTransmitterActivity.kt +29 -13
- package/android/src/main/java/com/mytatvarnsdk/activity/QRActivity.kt +146 -5
- package/android/src/main/java/com/mytatvarnsdk/activity/SearchTransmitterActivity.kt +108 -13
- package/android/src/main/java/com/mytatvarnsdk/activity/SensorConnectSuccessActivity.kt +43 -16
- package/android/src/main/java/com/mytatvarnsdk/activity/StartCGMActivity.kt +26 -15
- package/android/src/main/java/com/mytatvarnsdk/activity/VideoActivity.kt +96 -50
- package/android/src/main/java/com/mytatvarnsdk/network/AuthenticateSDKService.kt +113 -0
- package/android/src/main/java/com/mytatvarnsdk/utils/CgmModuleSentryLog.kt +205 -0
- package/android/src/main/java/com/mytatvarnsdk/utils/CgmSentryLog.kt +28 -0
- package/android/src/main/java/com/mytatvarnsdk/utils/CustomerSupportConfig.kt +137 -0
- package/android/src/main/java/com/mytatvarnsdk/utils/ToolbarSupportHelper.kt +83 -0
- package/ios/Custom/CustomTopUIView.swift +25 -0
- package/ios/MyReactNativeBridge.m +4 -0
- package/ios/Support/API.swift +117 -18
- package/ios/Support/CustomTopViewSupportHelper.swift +55 -0
- package/ios/Support/CustomerSupportConfig.swift +169 -0
- package/ios/Support/Global.swift +2 -2
- package/ios/Support/GlobalYouTubePlayerView.swift +102 -11
- package/ios/ViewControllers/AttachTransmitterViewController.swift +16 -21
- package/ios/ViewControllers/ChatWithExpertViewController.swift +1 -7
- package/ios/ViewControllers/ConnectToSensorViewController.swift +16 -21
- package/ios/ViewControllers/ConnectToTransmitterViewController.swift +16 -21
- package/ios/ViewControllers/ProvidePermissionViewController.swift +16 -21
- package/ios/ViewControllers/PutOnTheSensorViewController.swift +16 -21
- package/ios/ViewControllers/StartConnectionViewController.swift +18 -25
- package/ios/ViewModel/FinalViewModel.swift +2 -2
- package/package.json +1 -1
|
@@ -44,6 +44,7 @@ import com.mytatvarnsdk.model.GlucoseLogRequest
|
|
|
44
44
|
import com.mytatvarnsdk.model.MainActivityModel
|
|
45
45
|
import com.mytatvarnsdk.network.AuthenticateSDKService
|
|
46
46
|
import com.mytatvarnsdk.network.AuthenticateSDKService.LoaderListener
|
|
47
|
+
import com.mytatvarnsdk.utils.CustomerSupportConfig
|
|
47
48
|
import com.mytatvarnsdk.utils.DeviceStatus
|
|
48
49
|
import com.mytatvarnsdk.utils.TATVA_ENVIRONMENT
|
|
49
50
|
import io.sentry.ScopeCallback
|
|
@@ -282,6 +283,63 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
282
283
|
}
|
|
283
284
|
}
|
|
284
285
|
|
|
286
|
+
/** SDK `latestGlucose` observer telemetry — must never throw or block queue/upload. */
|
|
287
|
+
private fun logSdkGlucoseReceivedSafely(pocGlucose: PocGlucose) {
|
|
288
|
+
try {
|
|
289
|
+
safeLogModuleEvent {
|
|
290
|
+
val activeSensorId = try {
|
|
291
|
+
prefsHelper?.qrInformation?.sensor ?: lastConnectCgm ?: ""
|
|
292
|
+
} catch (_: Throwable) {
|
|
293
|
+
""
|
|
294
|
+
}
|
|
295
|
+
val pocJson = try {
|
|
296
|
+
Gson().toJson(pocGlucose)
|
|
297
|
+
} catch (_: Throwable) {
|
|
298
|
+
try {
|
|
299
|
+
pocGlucose.toString()
|
|
300
|
+
} catch (_: Throwable) {
|
|
301
|
+
""
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
val attributes = try {
|
|
305
|
+
mapOf(
|
|
306
|
+
"glucoseId" to safePocField { pocGlucose.glucoseId?.toString() ?: "" },
|
|
307
|
+
"activeSensorId" to activeSensorId,
|
|
308
|
+
"timeInMillis" to safePocField { pocGlucose.timeInMillis.toString() },
|
|
309
|
+
"showGlucoseMG" to safePocField { pocGlucose.showGlucoseMG.toString() },
|
|
310
|
+
"showGlucose" to safePocField { pocGlucose.showGlucose.toString() },
|
|
311
|
+
"deviceId" to safePocField { pocGlucose.deviceId?.toString() ?: "" },
|
|
312
|
+
"errorCode" to safePocField { pocGlucose.errorCode?.toString() ?: "" },
|
|
313
|
+
"name" to safePocField { pocGlucose.name ?: "" }
|
|
314
|
+
)
|
|
315
|
+
} catch (_: Throwable) {
|
|
316
|
+
emptyMap()
|
|
317
|
+
}
|
|
318
|
+
val message = try {
|
|
319
|
+
"SDK latestGlucose received | glucoseId=${pocGlucose.glucoseId ?: ""} | showGlucoseMG=${pocGlucose.showGlucoseMG} | activeSensorId=$activeSensorId"
|
|
320
|
+
} catch (_: Throwable) {
|
|
321
|
+
"SDK latestGlucose received"
|
|
322
|
+
}
|
|
323
|
+
logModuleEvent(
|
|
324
|
+
where = "observeGlucoseData.sdkGlucoseReceived",
|
|
325
|
+
message = message,
|
|
326
|
+
level = SentryLogLevel.INFO,
|
|
327
|
+
jsonPayload = pocJson,
|
|
328
|
+
attributes = attributes
|
|
329
|
+
)
|
|
330
|
+
}
|
|
331
|
+
} catch (_: Throwable) {
|
|
332
|
+
// Observer callback must always continue to queue/upload.
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
private inline fun safePocField(block: () -> String): String =
|
|
337
|
+
try {
|
|
338
|
+
block()
|
|
339
|
+
} catch (_: Throwable) {
|
|
340
|
+
""
|
|
341
|
+
}
|
|
342
|
+
|
|
285
343
|
private fun cgmStatusDeviceAttributes(
|
|
286
344
|
status: String,
|
|
287
345
|
device: PocDevice?,
|
|
@@ -322,6 +380,28 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
322
380
|
}
|
|
323
381
|
}
|
|
324
382
|
|
|
383
|
+
private fun fetchCustomerSupportDetails() {
|
|
384
|
+
if (userToken.isEmpty()) {
|
|
385
|
+
CustomerSupportConfig.applyFailureDefaults()
|
|
386
|
+
return
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
val environment =
|
|
390
|
+
if (env.lowercase() == "uat") TATVA_ENVIRONMENT.STAGE else TATVA_ENVIRONMENT.PROD
|
|
391
|
+
|
|
392
|
+
authenticateSDKService.fetchCustomerSupportDetails(
|
|
393
|
+
environment = environment,
|
|
394
|
+
token = userToken,
|
|
395
|
+
onSuccess = { response ->
|
|
396
|
+
CustomerSupportConfig.updateFromResponse(response)
|
|
397
|
+
},
|
|
398
|
+
onFailure = {
|
|
399
|
+
Log.w("fetchCustomerSupportDetails", "Failed to fetch customer support details, using failure defaults")
|
|
400
|
+
CustomerSupportConfig.applyFailureDefaults()
|
|
401
|
+
}
|
|
402
|
+
)
|
|
403
|
+
}
|
|
404
|
+
|
|
325
405
|
@ReactMethod
|
|
326
406
|
fun observeDeviceStatus(token: String, envType: String) {
|
|
327
407
|
try {
|
|
@@ -643,6 +723,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
643
723
|
updateUserData(userData)
|
|
644
724
|
userToken = token
|
|
645
725
|
env = envType.lowercase()
|
|
726
|
+
fetchCustomerSupportDetails()
|
|
646
727
|
val intent = Intent(currentActivity, StartCGMActivity::class.java)
|
|
647
728
|
intent.putExtra("envType", env)
|
|
648
729
|
currentActivity?.startActivity(intent)
|
|
@@ -671,6 +752,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
671
752
|
updateUserData(userData)
|
|
672
753
|
userToken = token
|
|
673
754
|
env = envType.lowercase()
|
|
755
|
+
fetchCustomerSupportDetails()
|
|
674
756
|
currentActivity?.startActivity(
|
|
675
757
|
Intent(currentActivity, StartCGMActivity::class.java).putExtra(
|
|
676
758
|
"IsForReconnect",
|
|
@@ -743,6 +825,8 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
743
825
|
return@Observer
|
|
744
826
|
}
|
|
745
827
|
|
|
828
|
+
logSdkGlucoseReceivedSafely(pocGlucose)
|
|
829
|
+
|
|
746
830
|
// Check for duplicate using glucoseId instead of timestamp
|
|
747
831
|
val glucoseId = pocGlucose.glucoseId ?: run {
|
|
748
832
|
Log.w("observeGlucoseData", "Glucose ID is null, skipping")
|
|
@@ -42,6 +42,10 @@ import com.mytatvarnsdk.myView.progress.ProgressManagement
|
|
|
42
42
|
import com.mytatvarnsdk.myView.progress.ProgressType
|
|
43
43
|
import com.mytatvarnsdk.network.AuthenticateSDKService
|
|
44
44
|
import com.mytatvarnsdk.utils.TATVA_ENVIRONMENT
|
|
45
|
+
import com.mytatvarnsdk.utils.ToolbarSupportHelper
|
|
46
|
+
import com.mytatvarnsdk.utils.CgmModuleSentryLog.logModuleEvent
|
|
47
|
+
import com.mytatvarnsdk.utils.CgmModuleSentryLog.safeLogModuleEvent
|
|
48
|
+
import io.sentry.SentryLogLevel
|
|
45
49
|
import kotlinx.coroutines.CoroutineScope
|
|
46
50
|
import kotlinx.coroutines.Dispatchers
|
|
47
51
|
import kotlinx.coroutines.SupervisorJob
|
|
@@ -99,19 +103,14 @@ class ConnectSensorActivity : BaseBleActivity() {
|
|
|
99
103
|
openExitDialog()
|
|
100
104
|
}
|
|
101
105
|
|
|
102
|
-
binding.toolbar.btnWhatsapp
|
|
103
|
-
startActivity(
|
|
104
|
-
Intent(this, HelpActivity::class.java).putExtra("ScreenName", "Sensor page")
|
|
105
|
-
)
|
|
106
|
-
}
|
|
106
|
+
ToolbarSupportHelper.bindWhatsappButton(this, binding.toolbar.btnWhatsapp)
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
108
|
+
ToolbarSupportHelper.configureWatchDemoButton(
|
|
109
|
+
context = this,
|
|
110
|
+
btnWatchDemo = binding.toolbar.btnWatchDemo,
|
|
111
|
+
isForReconnect = isForReconnect,
|
|
112
|
+
onClickAnalytics = { sendDataToRN("", "cgm_watch_demo_clicked") }
|
|
113
|
+
)
|
|
115
114
|
|
|
116
115
|
val callback: OnBackPressedCallback = object : OnBackPressedCallback(true) {
|
|
117
116
|
override fun handleOnBackPressed() {
|
|
@@ -139,6 +138,21 @@ class ConnectSensorActivity : BaseBleActivity() {
|
|
|
139
138
|
fun manageErrorState(showError: Boolean, errorStatus: String) {
|
|
140
139
|
ProgressManagement.getInstance().dismissWait(this)
|
|
141
140
|
if (showError) {
|
|
141
|
+
if (errorStatus.isNotEmpty()) {
|
|
142
|
+
safeLogModuleEvent {
|
|
143
|
+
logModuleEvent(
|
|
144
|
+
where = "ConnectSensorActivity.error",
|
|
145
|
+
message = "CGM journey error | screen=${javaClass.simpleName} | $errorStatus",
|
|
146
|
+
level = SentryLogLevel.WARN,
|
|
147
|
+
attributes = mapOf(
|
|
148
|
+
"error_message" to errorStatus,
|
|
149
|
+
"screen" to javaClass.simpleName,
|
|
150
|
+
"is_reconnect" to isForReconnect.toString(),
|
|
151
|
+
),
|
|
152
|
+
logsOnly = true,
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
}
|
|
142
156
|
binding.clFail.visibility = View.VISIBLE
|
|
143
157
|
binding.clMain.visibility = View.GONE
|
|
144
158
|
binding.commonButton.root.visibility = View.GONE
|
|
@@ -299,6 +313,20 @@ class ConnectSensorActivity : BaseBleActivity() {
|
|
|
299
313
|
if (requestCode == REQUEST_QR && resultCode == RESULT_OK && data != null) {
|
|
300
314
|
val device: PocDevice? = data.getParcelableExtra("device")
|
|
301
315
|
if (device != null) {
|
|
316
|
+
safeLogModuleEvent {
|
|
317
|
+
logModuleEvent(
|
|
318
|
+
where = "cgmJourney.cgm_qr_activity_result_ok",
|
|
319
|
+
message = "CGM journey | screen=${javaClass.simpleName} | step=cgm_qr_activity_result_ok",
|
|
320
|
+
level = SentryLogLevel.INFO,
|
|
321
|
+
attributes = mapOf(
|
|
322
|
+
"journey_step" to "cgm_qr_activity_result_ok",
|
|
323
|
+
"screen" to javaClass.simpleName,
|
|
324
|
+
"is_reconnect" to isForReconnect.toString(),
|
|
325
|
+
"transmitter_name" to (device.name ?: ""),
|
|
326
|
+
),
|
|
327
|
+
logsOnly = true,
|
|
328
|
+
)
|
|
329
|
+
}
|
|
302
330
|
val lastConnectCgm = CgmTrackyLibModule.lastConnectCgm
|
|
303
331
|
Log.d("ConnectSensor", "lastConnectCgm: $lastConnectCgm")
|
|
304
332
|
|
|
@@ -337,6 +365,17 @@ class ConnectSensorActivity : BaseBleActivity() {
|
|
|
337
365
|
val scope = CoroutineScope(Dispatchers.IO + SupervisorJob())
|
|
338
366
|
val authenticateSDKService = AuthenticateSDKService(scope = scope)
|
|
339
367
|
|
|
368
|
+
safeLogModuleEvent {
|
|
369
|
+
logModuleEvent(
|
|
370
|
+
where = "ConnectSensorActivity.verifyDevice.request",
|
|
371
|
+
message = "Diasens device verification request | sensorId=$scannedSensorId",
|
|
372
|
+
level = SentryLogLevel.INFO,
|
|
373
|
+
jsonPayload = """{"sensorId":"$scannedSensorId","deviceType":"CGM","vendor":"diasens"}""",
|
|
374
|
+
attributes = mapOf("sensor_id" to scannedSensorId),
|
|
375
|
+
logsOnly = true,
|
|
376
|
+
)
|
|
377
|
+
}
|
|
378
|
+
|
|
340
379
|
authenticateSDKService.verifyDevice(
|
|
341
380
|
environment = if (envType.lowercase() == "uat") TATVA_ENVIRONMENT.STAGE else TATVA_ENVIRONMENT.PROD,
|
|
342
381
|
token = token,
|
|
@@ -345,6 +384,16 @@ class ConnectSensorActivity : BaseBleActivity() {
|
|
|
345
384
|
override fun onResponseSuccess(response: String) {
|
|
346
385
|
try {
|
|
347
386
|
Log.d("ConnectSensor", "Device verification API response: $response")
|
|
387
|
+
safeLogModuleEvent {
|
|
388
|
+
logModuleEvent(
|
|
389
|
+
where = "ConnectSensorActivity.verifyDevice.success",
|
|
390
|
+
message = "Diasens device verification response",
|
|
391
|
+
level = SentryLogLevel.INFO,
|
|
392
|
+
jsonPayload = "response=$response",
|
|
393
|
+
attributes = mapOf("sensor_id" to scannedSensorId),
|
|
394
|
+
logsOnly = true,
|
|
395
|
+
)
|
|
396
|
+
}
|
|
348
397
|
|
|
349
398
|
val verificationResponse = Gson().fromJson(response, DeviceVerificationResponse::class.java)
|
|
350
399
|
val code = when (val rawCode = verificationResponse.code) {
|
|
@@ -375,6 +424,21 @@ class ConnectSensorActivity : BaseBleActivity() {
|
|
|
375
424
|
}
|
|
376
425
|
} catch (e: Exception) {
|
|
377
426
|
Log.e("ConnectSensor", "Error parsing device verification response: ${e.message}")
|
|
427
|
+
safeLogModuleEvent {
|
|
428
|
+
val errorMessage = e.message ?: "Failed to parse verification response"
|
|
429
|
+
logModuleEvent(
|
|
430
|
+
where = "ConnectSensorActivity.verifyDevice.parseError",
|
|
431
|
+
message = "CGM journey error | screen=${javaClass.simpleName} | $errorMessage",
|
|
432
|
+
level = SentryLogLevel.WARN,
|
|
433
|
+
throwable = e,
|
|
434
|
+
attributes = mapOf(
|
|
435
|
+
"error_message" to errorMessage,
|
|
436
|
+
"screen" to javaClass.simpleName,
|
|
437
|
+
"is_reconnect" to isForReconnect.toString(),
|
|
438
|
+
),
|
|
439
|
+
logsOnly = true,
|
|
440
|
+
)
|
|
441
|
+
}
|
|
378
442
|
runOnUiThread {
|
|
379
443
|
ProgressManagement.getInstance().dismissWait(this@ConnectSensorActivity)
|
|
380
444
|
manageErrorState(true, "Try Again")
|
|
@@ -382,23 +446,66 @@ class ConnectSensorActivity : BaseBleActivity() {
|
|
|
382
446
|
}
|
|
383
447
|
}
|
|
384
448
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
449
|
+
override fun onResponseFail() {
|
|
450
|
+
Log.e("ConnectSensor", "Device verification API call failed")
|
|
451
|
+
safeLogModuleEvent {
|
|
452
|
+
val errorMessage =
|
|
453
|
+
"Diasens device verification API failed | sensorId=$scannedSensorId"
|
|
454
|
+
logModuleEvent(
|
|
455
|
+
where = "ConnectSensorActivity.verifyDevice.fail",
|
|
456
|
+
message = "CGM journey error | screen=${javaClass.simpleName} | $errorMessage",
|
|
457
|
+
level = SentryLogLevel.WARN,
|
|
458
|
+
attributes = mapOf(
|
|
459
|
+
"error_message" to errorMessage,
|
|
460
|
+
"screen" to javaClass.simpleName,
|
|
461
|
+
"is_reconnect" to isForReconnect.toString(),
|
|
462
|
+
),
|
|
463
|
+
logsOnly = true,
|
|
464
|
+
)
|
|
465
|
+
}
|
|
466
|
+
runOnUiThread {
|
|
467
|
+
ProgressManagement.getInstance().dismissWait(this@ConnectSensorActivity)
|
|
468
|
+
manageErrorState(true, "Try Again")
|
|
469
|
+
}
|
|
390
470
|
}
|
|
391
471
|
}
|
|
392
|
-
}
|
|
393
472
|
)
|
|
394
473
|
} catch (e: Exception) {
|
|
395
474
|
Log.e("ConnectSensor", "Error validating diasens sensor: ${e.message}")
|
|
475
|
+
safeLogModuleEvent {
|
|
476
|
+
val errorMessage = e.message ?: "Diasens validation exception"
|
|
477
|
+
logModuleEvent(
|
|
478
|
+
where = "ConnectSensorActivity.validateDiasensSensor",
|
|
479
|
+
message = "CGM journey error | screen=${javaClass.simpleName} | $errorMessage",
|
|
480
|
+
level = SentryLogLevel.WARN,
|
|
481
|
+
throwable = e,
|
|
482
|
+
attributes = mapOf(
|
|
483
|
+
"error_message" to errorMessage,
|
|
484
|
+
"screen" to javaClass.simpleName,
|
|
485
|
+
"is_reconnect" to isForReconnect.toString(),
|
|
486
|
+
),
|
|
487
|
+
logsOnly = true,
|
|
488
|
+
)
|
|
489
|
+
}
|
|
396
490
|
ProgressManagement.getInstance().dismissWait(this)
|
|
397
491
|
manageErrorState(true, "Try Again")
|
|
398
492
|
}
|
|
399
493
|
}
|
|
400
494
|
|
|
401
495
|
private fun manageDeviceVerificationError(message: String) {
|
|
496
|
+
safeLogModuleEvent {
|
|
497
|
+
logModuleEvent(
|
|
498
|
+
where = "ConnectSensorActivity.deviceVerificationError",
|
|
499
|
+
message = "CGM journey error | screen=${javaClass.simpleName} | $message",
|
|
500
|
+
level = SentryLogLevel.WARN,
|
|
501
|
+
attributes = mapOf(
|
|
502
|
+
"error_message" to message,
|
|
503
|
+
"screen" to javaClass.simpleName,
|
|
504
|
+
"is_reconnect" to isForReconnect.toString(),
|
|
505
|
+
),
|
|
506
|
+
logsOnly = true,
|
|
507
|
+
)
|
|
508
|
+
}
|
|
402
509
|
ProgressManagement.getInstance().dismissWait(this)
|
|
403
510
|
binding.clFail.visibility = View.VISIBLE
|
|
404
511
|
binding.clMain.visibility = View.GONE
|
|
@@ -454,6 +561,21 @@ class ConnectSensorActivity : BaseBleActivity() {
|
|
|
454
561
|
}
|
|
455
562
|
} catch (e: Exception) {
|
|
456
563
|
Log.d("bind::-> ", "bind: ${e.message}")
|
|
564
|
+
safeLogModuleEvent {
|
|
565
|
+
val errorMessage = e.message ?: "Sensor bind exception"
|
|
566
|
+
logModuleEvent(
|
|
567
|
+
where = "ConnectSensorActivity.bind",
|
|
568
|
+
message = "CGM journey error | screen=${javaClass.simpleName} | $errorMessage",
|
|
569
|
+
level = SentryLogLevel.WARN,
|
|
570
|
+
throwable = e,
|
|
571
|
+
attributes = mapOf(
|
|
572
|
+
"error_message" to errorMessage,
|
|
573
|
+
"screen" to javaClass.simpleName,
|
|
574
|
+
"is_reconnect" to isForReconnect.toString(),
|
|
575
|
+
),
|
|
576
|
+
logsOnly = true,
|
|
577
|
+
)
|
|
578
|
+
}
|
|
457
579
|
}
|
|
458
580
|
}
|
|
459
581
|
|
|
@@ -482,6 +604,20 @@ class ConnectSensorActivity : BaseBleActivity() {
|
|
|
482
604
|
}
|
|
483
605
|
|
|
484
606
|
private fun sendDataToRN(data: String, status: String) {
|
|
607
|
+
safeLogModuleEvent {
|
|
608
|
+
logModuleEvent(
|
|
609
|
+
where = "cgmJourney.$status",
|
|
610
|
+
message = "CGM journey | screen=${javaClass.simpleName} | step=$status",
|
|
611
|
+
level = SentryLogLevel.INFO,
|
|
612
|
+
jsonPayload = data.takeIf { it.isNotEmpty() },
|
|
613
|
+
attributes = mapOf(
|
|
614
|
+
"journey_step" to status,
|
|
615
|
+
"screen" to javaClass.simpleName,
|
|
616
|
+
"is_reconnect" to isForReconnect.toString(),
|
|
617
|
+
),
|
|
618
|
+
logsOnly = true,
|
|
619
|
+
)
|
|
620
|
+
}
|
|
485
621
|
if (reactContext != null) {
|
|
486
622
|
try {
|
|
487
623
|
val catalystInstance: CatalystInstance = reactContext.catalystInstance
|
|
@@ -560,4 +696,8 @@ class ConnectSensorActivity : BaseBleActivity() {
|
|
|
560
696
|
|
|
561
697
|
}
|
|
562
698
|
|
|
699
|
+
override fun onResume() {
|
|
700
|
+
super.onResume()
|
|
701
|
+
}
|
|
702
|
+
|
|
563
703
|
}
|
|
@@ -17,6 +17,8 @@ import com.facebook.react.bridge.WritableMap
|
|
|
17
17
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
18
18
|
import com.mytatvarnsdk.CgmTrackyLibModule
|
|
19
19
|
import com.mytatvarnsdk.R
|
|
20
|
+
import com.mytatvarnsdk.utils.CustomerSupportConfig
|
|
21
|
+
import com.mytatvarnsdk.utils.ToolbarSupportHelper
|
|
20
22
|
import com.mytatvarnsdk.databinding.ActivityHelpBinding
|
|
21
23
|
import org.json.JSONObject
|
|
22
24
|
|
|
@@ -109,15 +111,7 @@ class HelpActivity : AppCompatActivity() {
|
|
|
109
111
|
}
|
|
110
112
|
|
|
111
113
|
private fun openWhatsApp() {
|
|
112
|
-
|
|
113
|
-
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(waBotUrl))
|
|
114
|
-
try {
|
|
115
|
-
// You don't need to set the package for browser-based WhatsApp bots
|
|
116
|
-
startActivity(intent)
|
|
117
|
-
} catch (e: Exception) {
|
|
118
|
-
e.printStackTrace()
|
|
119
|
-
Toast.makeText(this, "Error opening WhatsApp Bot", Toast.LENGTH_SHORT).show()
|
|
120
|
-
}
|
|
114
|
+
ToolbarSupportHelper.openWhatsApp(this, CustomerSupportConfig.effectiveWhatsAppNumber())
|
|
121
115
|
}
|
|
122
116
|
|
|
123
117
|
private fun sendDataToRN(data: String, status: String) {
|
|
@@ -36,9 +36,13 @@ import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
|
36
36
|
import com.mytatvarnsdk.CgmTrackyLibModule
|
|
37
37
|
import com.mytatvarnsdk.R
|
|
38
38
|
import com.mytatvarnsdk.base.BasePermissionActivity
|
|
39
|
+
import com.mytatvarnsdk.utils.ToolbarSupportHelper
|
|
39
40
|
import com.mytatvarnsdk.databinding.ActivityPermissionBinding
|
|
40
41
|
import com.mytatvarnsdk.databinding.BluetoothDialogBottomsheetBinding
|
|
41
42
|
import com.mytatvarnsdk.databinding.ExitDialogBottomsheetBinding
|
|
43
|
+
import com.mytatvarnsdk.utils.CgmModuleSentryLog.logModuleEvent
|
|
44
|
+
import com.mytatvarnsdk.utils.CgmModuleSentryLog.safeLogModuleEvent
|
|
45
|
+
import io.sentry.SentryLogLevel
|
|
42
46
|
import org.json.JSONObject
|
|
43
47
|
|
|
44
48
|
class PermissionActivity : BasePermissionActivity() {
|
|
@@ -167,23 +171,14 @@ class PermissionActivity : BasePermissionActivity() {
|
|
|
167
171
|
finish()
|
|
168
172
|
}
|
|
169
173
|
|
|
170
|
-
binding.toolbar.btnWhatsapp
|
|
171
|
-
startActivity(
|
|
172
|
-
Intent(this, HelpActivity::class.java)
|
|
173
|
-
.putExtra("ScreenName", "connection journey page")
|
|
174
|
-
)
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
binding.toolbar.btnWatchDemo.setOnClickListener {
|
|
178
|
-
sendDataToRN("", "cgm_watch_demo_clicked")
|
|
174
|
+
ToolbarSupportHelper.bindWhatsappButton(this, binding.toolbar.btnWhatsapp)
|
|
179
175
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
176
|
+
ToolbarSupportHelper.configureWatchDemoButton(
|
|
177
|
+
context = this,
|
|
178
|
+
btnWatchDemo = binding.toolbar.btnWatchDemo,
|
|
179
|
+
isForReconnect = isForReconnect,
|
|
180
|
+
onClickAnalytics = { sendDataToRN("", "cgm_watch_demo_clicked") }
|
|
181
|
+
)
|
|
187
182
|
|
|
188
183
|
binding.tvKnowMore.setOnClickListener {
|
|
189
184
|
openBluetoothDialog()
|
|
@@ -202,6 +197,20 @@ class PermissionActivity : BasePermissionActivity() {
|
|
|
202
197
|
}
|
|
203
198
|
|
|
204
199
|
private fun sendDataToRN(data: String, status: String) {
|
|
200
|
+
safeLogModuleEvent {
|
|
201
|
+
logModuleEvent(
|
|
202
|
+
where = "cgmJourney.$status",
|
|
203
|
+
message = "CGM journey | screen=${javaClass.simpleName} | step=$status",
|
|
204
|
+
level = SentryLogLevel.INFO,
|
|
205
|
+
jsonPayload = data.takeIf { it.isNotEmpty() },
|
|
206
|
+
attributes = mapOf(
|
|
207
|
+
"journey_step" to status,
|
|
208
|
+
"screen" to javaClass.simpleName,
|
|
209
|
+
"is_reconnect" to isForReconnect.toString(),
|
|
210
|
+
),
|
|
211
|
+
logsOnly = true,
|
|
212
|
+
)
|
|
213
|
+
}
|
|
205
214
|
if (reactContext != null) {
|
|
206
215
|
try {
|
|
207
216
|
val catalystInstance: CatalystInstance = reactContext.catalystInstance
|
|
@@ -643,12 +652,38 @@ class PermissionActivity : BasePermissionActivity() {
|
|
|
643
652
|
}
|
|
644
653
|
|
|
645
654
|
private fun onLocationPermissionGranted() {
|
|
655
|
+
safeLogModuleEvent {
|
|
656
|
+
logModuleEvent(
|
|
657
|
+
where = "cgmJourney.cgm_location_permission_granted",
|
|
658
|
+
message = "CGM journey | screen=${javaClass.simpleName} | step=cgm_location_permission_granted",
|
|
659
|
+
level = SentryLogLevel.INFO,
|
|
660
|
+
attributes = mapOf(
|
|
661
|
+
"journey_step" to "cgm_location_permission_granted",
|
|
662
|
+
"screen" to javaClass.simpleName,
|
|
663
|
+
"is_reconnect" to isForReconnect.toString(),
|
|
664
|
+
),
|
|
665
|
+
logsOnly = true,
|
|
666
|
+
)
|
|
667
|
+
}
|
|
646
668
|
setSwitchChecked(binding.switchLocation, true)
|
|
647
669
|
updateProceedButtonState()
|
|
648
670
|
}
|
|
649
671
|
|
|
650
672
|
@RequiresPermission(Manifest.permission.BLUETOOTH_CONNECT)
|
|
651
673
|
private fun onBluetoothPermissionGranted() {
|
|
674
|
+
safeLogModuleEvent {
|
|
675
|
+
logModuleEvent(
|
|
676
|
+
where = "cgmJourney.cgm_bluetooth_permission_granted",
|
|
677
|
+
message = "CGM journey | screen=${javaClass.simpleName} | step=cgm_bluetooth_permission_granted",
|
|
678
|
+
level = SentryLogLevel.INFO,
|
|
679
|
+
attributes = mapOf(
|
|
680
|
+
"journey_step" to "cgm_bluetooth_permission_granted",
|
|
681
|
+
"screen" to javaClass.simpleName,
|
|
682
|
+
"is_reconnect" to isForReconnect.toString(),
|
|
683
|
+
),
|
|
684
|
+
logsOnly = true,
|
|
685
|
+
)
|
|
686
|
+
}
|
|
652
687
|
if (bluetoothAdapter == null) {
|
|
653
688
|
Toast.makeText(this, "Bluetooth not supported", Toast.LENGTH_SHORT).show()
|
|
654
689
|
} else {
|
|
@@ -25,6 +25,10 @@ import com.mytatvarnsdk.CgmTrackyLibModule
|
|
|
25
25
|
import com.mytatvarnsdk.R
|
|
26
26
|
import com.mytatvarnsdk.databinding.ActivityPlaceSensorBinding
|
|
27
27
|
import com.mytatvarnsdk.databinding.ExitDialogBottomsheetBinding
|
|
28
|
+
import com.mytatvarnsdk.utils.CgmModuleSentryLog.logModuleEvent
|
|
29
|
+
import com.mytatvarnsdk.utils.CgmModuleSentryLog.safeLogModuleEvent
|
|
30
|
+
import com.mytatvarnsdk.utils.ToolbarSupportHelper
|
|
31
|
+
import io.sentry.SentryLogLevel
|
|
28
32
|
|
|
29
33
|
class PlaceSensorActivity : AppCompatActivity() {
|
|
30
34
|
private lateinit var binding: ActivityPlaceSensorBinding
|
|
@@ -59,20 +63,14 @@ class PlaceSensorActivity : AppCompatActivity() {
|
|
|
59
63
|
.load(R.drawable.ic_play_gif)
|
|
60
64
|
.into(binding.ivPlay)
|
|
61
65
|
|
|
62
|
-
binding.toolbar.btnWhatsapp
|
|
63
|
-
startActivity(
|
|
64
|
-
Intent(this, HelpActivity::class.java)
|
|
65
|
-
.putExtra("ScreenName", "Sensor page")
|
|
66
|
-
)
|
|
67
|
-
}
|
|
66
|
+
ToolbarSupportHelper.bindWhatsappButton(this, binding.toolbar.btnWhatsapp)
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
68
|
+
ToolbarSupportHelper.configureWatchDemoButton(
|
|
69
|
+
context = this,
|
|
70
|
+
btnWatchDemo = binding.toolbar.btnWatchDemo,
|
|
71
|
+
isForReconnect = isForReconnect,
|
|
72
|
+
onClickAnalytics = { sendDataToRN("", "cgm_watch_demo_clicked") }
|
|
73
|
+
)
|
|
76
74
|
|
|
77
75
|
binding.commonButton.tvProceed.text = "I Have Placed The Sensor"
|
|
78
76
|
binding.commonButton.btnProceed.setOnClickListener {
|
|
@@ -99,6 +97,20 @@ class PlaceSensorActivity : AppCompatActivity() {
|
|
|
99
97
|
}
|
|
100
98
|
|
|
101
99
|
private fun sendDataToRN(data: String, status: String) {
|
|
100
|
+
safeLogModuleEvent {
|
|
101
|
+
logModuleEvent(
|
|
102
|
+
where = "cgmJourney.$status",
|
|
103
|
+
message = "CGM journey | screen=${javaClass.simpleName} | step=$status",
|
|
104
|
+
level = SentryLogLevel.INFO,
|
|
105
|
+
jsonPayload = data.takeIf { it.isNotEmpty() },
|
|
106
|
+
attributes = mapOf(
|
|
107
|
+
"journey_step" to status,
|
|
108
|
+
"screen" to javaClass.simpleName,
|
|
109
|
+
"is_reconnect" to isForReconnect.toString(),
|
|
110
|
+
),
|
|
111
|
+
logsOnly = true,
|
|
112
|
+
)
|
|
113
|
+
}
|
|
102
114
|
if (reactContext != null) {
|
|
103
115
|
try {
|
|
104
116
|
val catalystInstance: CatalystInstance = reactContext.catalystInstance
|
|
@@ -164,5 +176,9 @@ class PlaceSensorActivity : AppCompatActivity() {
|
|
|
164
176
|
dialog.show()
|
|
165
177
|
}
|
|
166
178
|
|
|
179
|
+
override fun onResume() {
|
|
180
|
+
super.onResume()
|
|
181
|
+
}
|
|
182
|
+
|
|
167
183
|
|
|
168
184
|
}
|
|
@@ -25,6 +25,10 @@ import com.mytatvarnsdk.CgmTrackyLibModule
|
|
|
25
25
|
import com.mytatvarnsdk.R
|
|
26
26
|
import com.mytatvarnsdk.databinding.ActivityPlaceTransmitterBinding
|
|
27
27
|
import com.mytatvarnsdk.databinding.ExitDialogBottomsheetBinding
|
|
28
|
+
import com.mytatvarnsdk.utils.CgmModuleSentryLog.logModuleEvent
|
|
29
|
+
import com.mytatvarnsdk.utils.CgmModuleSentryLog.safeLogModuleEvent
|
|
30
|
+
import com.mytatvarnsdk.utils.ToolbarSupportHelper
|
|
31
|
+
import io.sentry.SentryLogLevel
|
|
28
32
|
|
|
29
33
|
class PlaceTransmitterActivity : AppCompatActivity() {
|
|
30
34
|
private lateinit var binding: ActivityPlaceTransmitterBinding
|
|
@@ -71,20 +75,14 @@ class PlaceTransmitterActivity : AppCompatActivity() {
|
|
|
71
75
|
finish()
|
|
72
76
|
}
|
|
73
77
|
|
|
74
|
-
binding.toolbar.btnWhatsapp
|
|
75
|
-
startActivity(
|
|
76
|
-
Intent(this, HelpActivity::class.java)
|
|
77
|
-
.putExtra("ScreenName", "Transmitter page")
|
|
78
|
-
)
|
|
79
|
-
}
|
|
78
|
+
ToolbarSupportHelper.bindWhatsappButton(this, binding.toolbar.btnWhatsapp)
|
|
80
79
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
80
|
+
ToolbarSupportHelper.configureWatchDemoButton(
|
|
81
|
+
context = this,
|
|
82
|
+
btnWatchDemo = binding.toolbar.btnWatchDemo,
|
|
83
|
+
isForReconnect = isForReconnect,
|
|
84
|
+
onClickAnalytics = { sendDataToRN("", "cgm_watch_demo_clicked") }
|
|
85
|
+
)
|
|
88
86
|
|
|
89
87
|
binding.toolbar.btnClose.setOnClickListener {
|
|
90
88
|
openExitDialog()
|
|
@@ -136,6 +134,20 @@ class PlaceTransmitterActivity : AppCompatActivity() {
|
|
|
136
134
|
}
|
|
137
135
|
|
|
138
136
|
private fun sendDataToRN(data: String, status: String) {
|
|
137
|
+
safeLogModuleEvent {
|
|
138
|
+
logModuleEvent(
|
|
139
|
+
where = "cgmJourney.$status",
|
|
140
|
+
message = "CGM journey | screen=${javaClass.simpleName} | step=$status",
|
|
141
|
+
level = SentryLogLevel.INFO,
|
|
142
|
+
jsonPayload = data.takeIf { it.isNotEmpty() },
|
|
143
|
+
attributes = mapOf(
|
|
144
|
+
"journey_step" to status,
|
|
145
|
+
"screen" to javaClass.simpleName,
|
|
146
|
+
"is_reconnect" to isForReconnect.toString(),
|
|
147
|
+
),
|
|
148
|
+
logsOnly = true,
|
|
149
|
+
)
|
|
150
|
+
}
|
|
139
151
|
if (reactContext != null) {
|
|
140
152
|
try {
|
|
141
153
|
val catalystInstance: CatalystInstance = reactContext.catalystInstance
|
|
@@ -170,4 +182,8 @@ class PlaceTransmitterActivity : AppCompatActivity() {
|
|
|
170
182
|
Log.e("sendDataToRNDirectly", "Error sending data to React", e)
|
|
171
183
|
}
|
|
172
184
|
}
|
|
185
|
+
|
|
186
|
+
override fun onResume() {
|
|
187
|
+
super.onResume()
|
|
188
|
+
}
|
|
173
189
|
}
|