react-native-mytatva-rn-sdk 1.2.52 → 1.2.53
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 +113 -73
- package/android/src/main/java/com/mytatvarnsdk/activity/ConnectSensorActivity.kt +1 -1
- package/android/src/main/java/com/mytatvarnsdk/activity/PermissionActivity.kt +1 -1
- package/android/src/main/java/com/mytatvarnsdk/activity/PlaceSensorActivity.kt +1 -1
- package/android/src/main/java/com/mytatvarnsdk/activity/PlaceTransmitterActivity.kt +1 -1
- package/android/src/main/java/com/mytatvarnsdk/activity/SearchTransmitterActivity.kt +3 -4
- package/android/src/main/java/com/mytatvarnsdk/activity/SensorConnectSuccessActivity.kt +8 -5
- package/android/src/main/java/com/mytatvarnsdk/activity/StartCGMActivity.kt +1 -1
- package/android/src/main/java/com/mytatvarnsdk/network/AuthenticateSDKService.kt +197 -197
- package/android/src/main/java/com/mytatvarnsdk/utils/TatvaEncryptionConfig.kt +1 -1
- package/ios/Database/KLTBluetoothManager.m +4 -0
- package/ios/Database/KLTDatabaseHandler.m +50 -103
- package/ios/Database/KLTLocalSettingManager.h +3 -0
- package/ios/MyReactNativeBridge.m +27 -15
- package/ios/Support/API.swift +8 -8
- package/ios/ViewControllers/AttachTransmitterViewController.swift +1 -1
- package/ios/ViewModel/FinalViewModel.swift +12 -15
- package/lib/commonjs/CGMConnect.js +12 -12
- package/lib/commonjs/CGMConnect.js.map +1 -1
- package/lib/module/CGMConnect.js +12 -12
- package/lib/module/CGMConnect.js.map +1 -1
- package/lib/typescript/CGMConnect.d.ts +5 -5
- package/package.json +2 -2
- package/src/CGMConnect.ts +26 -12
|
@@ -86,6 +86,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
86
86
|
companion object {
|
|
87
87
|
var mReactContext: ReactApplicationContext? = null
|
|
88
88
|
var userToken: String = ""
|
|
89
|
+
var env: String = ""
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
override fun getName(): String {
|
|
@@ -93,9 +94,10 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
@ReactMethod
|
|
96
|
-
fun observeDeviceStatus(token: String) {
|
|
97
|
+
fun observeDeviceStatus(token: String, envType: String) {
|
|
97
98
|
try {
|
|
98
99
|
userToken = token
|
|
100
|
+
env = envType
|
|
99
101
|
|
|
100
102
|
// Reset previous state
|
|
101
103
|
lastDeviceStatus = null
|
|
@@ -104,7 +106,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
104
106
|
Handler(Looper.getMainLooper()).post {
|
|
105
107
|
mModel.device.observeForever { device ->
|
|
106
108
|
if (device != null) {
|
|
107
|
-
postEventDataToAPI(device, "", device.qrMessage ?: "")
|
|
109
|
+
postEventDataToAPI(device, "", device.qrMessage ?: "", envType)
|
|
108
110
|
Log.d("observeDeviceStatus: ", device.toString())
|
|
109
111
|
}
|
|
110
112
|
}
|
|
@@ -115,9 +117,15 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
115
117
|
}
|
|
116
118
|
|
|
117
119
|
@ReactMethod
|
|
118
|
-
fun observeTransmitterUnbindStatus(
|
|
120
|
+
fun observeTransmitterUnbindStatus(
|
|
121
|
+
token: String,
|
|
122
|
+
apiResponse: String?,
|
|
123
|
+
patientId: String,
|
|
124
|
+
envType: String
|
|
125
|
+
) {
|
|
119
126
|
try {
|
|
120
127
|
if (apiResponse != null && apiResponse.isNotEmpty()) {
|
|
128
|
+
env = envType
|
|
121
129
|
userToken = token
|
|
122
130
|
|
|
123
131
|
/*authenticateSDKService.getCGMData(
|
|
@@ -205,7 +213,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
205
213
|
postEventDataToAPI(
|
|
206
214
|
pocDevice,
|
|
207
215
|
DeviceStatus.TRANSMITTER_DISCONNECT.id,
|
|
208
|
-
pocDevice.qrMessage
|
|
216
|
+
pocDevice.qrMessage, envType
|
|
209
217
|
)
|
|
210
218
|
} else {
|
|
211
219
|
prefsHelper.lastPatientId = currentPatientId
|
|
@@ -215,7 +223,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
215
223
|
postEventDataToAPI(
|
|
216
224
|
pocDevice,
|
|
217
225
|
DeviceStatus.TRANSMITTER_DISCONNECT.id,
|
|
218
|
-
sensorId
|
|
226
|
+
sensorId, envType
|
|
219
227
|
)
|
|
220
228
|
}
|
|
221
229
|
|
|
@@ -235,7 +243,12 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
235
243
|
private var isDebounceTimerActive: Boolean = false
|
|
236
244
|
|
|
237
245
|
|
|
238
|
-
private fun postEventDataToAPI(
|
|
246
|
+
private fun postEventDataToAPI(
|
|
247
|
+
device: PocDevice?,
|
|
248
|
+
mStatus: String,
|
|
249
|
+
sensorId: String?,
|
|
250
|
+
envType: String
|
|
251
|
+
) {
|
|
239
252
|
apiScope.launch {
|
|
240
253
|
try {
|
|
241
254
|
val bluetoothAdapter: BluetoothAdapter? = BluetoothAdapter.getDefaultAdapter()
|
|
@@ -261,7 +274,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
261
274
|
debounceDeviceTimer?.schedule(object : TimerTask() {
|
|
262
275
|
override fun run() {
|
|
263
276
|
isDebounceTimerActive = false
|
|
264
|
-
callEventAPI(device, status, sensorId)
|
|
277
|
+
callEventAPI(device, status, sensorId, envType)
|
|
265
278
|
}
|
|
266
279
|
}, 1 * 60 * 1000) // 1 minutes in milliseconds
|
|
267
280
|
|
|
@@ -274,7 +287,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
274
287
|
|
|
275
288
|
Log.d("Debounce", "Timer cancelled, event triggered immediately")
|
|
276
289
|
|
|
277
|
-
callEventAPI(device, status, sensorId)
|
|
290
|
+
callEventAPI(device, status, sensorId, envType)
|
|
278
291
|
}
|
|
279
292
|
|
|
280
293
|
} catch (e: Exception) {
|
|
@@ -283,7 +296,12 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
283
296
|
}
|
|
284
297
|
}
|
|
285
298
|
|
|
286
|
-
private fun callEventAPI(
|
|
299
|
+
private fun callEventAPI(
|
|
300
|
+
device: PocDevice?,
|
|
301
|
+
status: String,
|
|
302
|
+
sensorId: String?,
|
|
303
|
+
envType: String
|
|
304
|
+
) {
|
|
287
305
|
Log.d("Device event Status", "Last Device event lastDeviceStatus API: $lastDeviceStatus")
|
|
288
306
|
|
|
289
307
|
if (status.isNotEmpty() && status != lastDeviceStatus) {
|
|
@@ -305,7 +323,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
305
323
|
}
|
|
306
324
|
|
|
307
325
|
authenticateSDKService.postDeviceData(
|
|
308
|
-
environment = TATVA_ENVIRONMENT.PROD,
|
|
326
|
+
environment = if (envType.lowercase() == "uat") TATVA_ENVIRONMENT.STAGE else TATVA_ENVIRONMENT.PROD,
|
|
309
327
|
data = obj.toString(),
|
|
310
328
|
token = userToken,
|
|
311
329
|
loaderListener = object : LoaderListener {
|
|
@@ -328,7 +346,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
328
346
|
}
|
|
329
347
|
|
|
330
348
|
@ReactMethod
|
|
331
|
-
fun startCgmTracky(token: String) {
|
|
349
|
+
fun startCgmTracky(token: String, envType: String) {
|
|
332
350
|
try {
|
|
333
351
|
userToken = token
|
|
334
352
|
val intent = Intent(currentActivity, StartCGMActivity::class.java)
|
|
@@ -350,7 +368,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
350
368
|
}
|
|
351
369
|
|
|
352
370
|
@ReactMethod
|
|
353
|
-
fun reconnectCgmTracky(token: String) {
|
|
371
|
+
fun reconnectCgmTracky(token: String, envType: String) {
|
|
354
372
|
try {
|
|
355
373
|
userToken = token
|
|
356
374
|
currentActivity?.startActivity(
|
|
@@ -376,9 +394,10 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
376
394
|
|
|
377
395
|
|
|
378
396
|
@ReactMethod
|
|
379
|
-
fun observeGlucoseData(token: String) {
|
|
397
|
+
fun observeGlucoseData(token: String, isForClear: Boolean = false, envType: String) {
|
|
380
398
|
try {
|
|
381
399
|
userToken = token
|
|
400
|
+
env = envType
|
|
382
401
|
|
|
383
402
|
// Ensure we're not already observing
|
|
384
403
|
if (isObserving && glucoseObserver != null) {
|
|
@@ -420,7 +439,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
420
439
|
}
|
|
421
440
|
|
|
422
441
|
if ((pocGlucose != null && lastSyncData == null) || (pocGlucose != null && lastSyncData != null && dataAge <= 4 * 60 * 1000L)) {
|
|
423
|
-
handleGlucoseData(pocGlucose)
|
|
442
|
+
handleGlucoseData(pocGlucose, envType)
|
|
424
443
|
Log.d(
|
|
425
444
|
"observeGlucoseData",
|
|
426
445
|
"Received glucose data - processing"
|
|
@@ -430,7 +449,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
430
449
|
} else {
|
|
431
450
|
|
|
432
451
|
Handler(Looper.getMainLooper()).postDelayed({
|
|
433
|
-
observeAllGlucoseData(userToken)
|
|
452
|
+
observeAllGlucoseData(userToken, isForClear, envType)
|
|
434
453
|
}, 100)
|
|
435
454
|
Log.d(
|
|
436
455
|
"observeGlucoseData",
|
|
@@ -463,7 +482,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
463
482
|
}
|
|
464
483
|
}
|
|
465
484
|
|
|
466
|
-
private fun handleGlucoseData(pocGlucose: PocGlucose) {
|
|
485
|
+
private fun handleGlucoseData(pocGlucose: PocGlucose, envType: String) {
|
|
467
486
|
try {
|
|
468
487
|
// Additional safety check
|
|
469
488
|
if (pocGlucose.glucoseId == null) {
|
|
@@ -487,7 +506,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
487
506
|
Log.d("Glucose data 3 min==> ", "Glucose data 3 min==> final Json: $json")
|
|
488
507
|
|
|
489
508
|
authenticateSDKService.postCGMData(
|
|
490
|
-
environment = TATVA_ENVIRONMENT.PROD,
|
|
509
|
+
environment = if (envType.lowercase() == "uat") TATVA_ENVIRONMENT.STAGE else TATVA_ENVIRONMENT.PROD,
|
|
491
510
|
data = json,
|
|
492
511
|
token = userToken,
|
|
493
512
|
responseListener = object : AuthenticateSDKService.ResponseListener {
|
|
@@ -509,7 +528,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
509
528
|
}
|
|
510
529
|
} else {
|
|
511
530
|
Log.d("handleGlucoseData", "Glucose data has error: ${pocGlucose.errorCode}")
|
|
512
|
-
handleGlucoseError(pocGlucose)
|
|
531
|
+
handleGlucoseError(pocGlucose, envType)
|
|
513
532
|
}
|
|
514
533
|
} catch (e: Exception) {
|
|
515
534
|
Log.e("handleGlucoseData", "Error handling glucose data: ${e.message}")
|
|
@@ -518,7 +537,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
518
537
|
}
|
|
519
538
|
|
|
520
539
|
// Extract error handling logic
|
|
521
|
-
private fun handleGlucoseError(pocGlucose: PocGlucose) {
|
|
540
|
+
private fun handleGlucoseError(pocGlucose: PocGlucose, envType: String) {
|
|
522
541
|
try {
|
|
523
542
|
// Additional safety check for deviceId
|
|
524
543
|
if (pocGlucose.deviceId == null) {
|
|
@@ -550,7 +569,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
550
569
|
}
|
|
551
570
|
}
|
|
552
571
|
|
|
553
|
-
postEventDataToAPI(it, statusId, it.qrMessage)
|
|
572
|
+
postEventDataToAPI(it, statusId, it.qrMessage, envType)
|
|
554
573
|
} ?: run {
|
|
555
574
|
Log.e(
|
|
556
575
|
"handleGlucoseError",
|
|
@@ -563,75 +582,89 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
563
582
|
}
|
|
564
583
|
}
|
|
565
584
|
|
|
566
|
-
|
|
567
585
|
@ReactMethod
|
|
568
|
-
fun observeAllGlucoseData(token: String) {
|
|
586
|
+
fun observeAllGlucoseData(token: String, isForClear: Boolean = false, envType: String) {
|
|
569
587
|
Log.d("function call", "observeAllGlucoseData")
|
|
588
|
+
|
|
570
589
|
if (isBatchProcessing) {
|
|
571
590
|
Log.d("observeAllGlucoseData", "Batch processing in progress, skipping duplicate call")
|
|
572
591
|
return
|
|
573
592
|
}
|
|
574
|
-
userToken = token
|
|
575
|
-
|
|
576
|
-
// FIX: Ensure proper cleanup and reset state
|
|
577
|
-
stopObservingGlucoseData()
|
|
578
|
-
|
|
579
|
-
// Add a small delay to ensure cleanup is complete
|
|
580
|
-
Handler(Looper.getMainLooper()).postDelayed({
|
|
581
|
-
try {
|
|
582
|
-
val lastSyncData = prefsHelper.lastSyncData
|
|
583
|
-
Log.d("lastSyncData: ", Gson().toJson(lastSyncData).toString())
|
|
584
|
-
val currentTime = System.currentTimeMillis()
|
|
585
|
-
var dataAge = System.currentTimeMillis()
|
|
586
|
-
|
|
587
|
-
if (prefsHelper.lastSyncData != null) {
|
|
588
|
-
dataAge = currentTime - prefsHelper.lastSyncData.timeInMillis
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
if (lastSyncData != null && dataAge > 3 * 60 * 1000L) {
|
|
592
|
-
isBatchProcessing = true
|
|
593
|
-
CoroutineScope(Dispatchers.IO).launch {
|
|
594
|
-
|
|
595
|
-
val glucoseData = mModel.getGlucoseBetweenTime(lastSyncData.timeInMillis)
|
|
596
593
|
|
|
594
|
+
userToken = token
|
|
595
|
+
env = envType
|
|
597
596
|
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
597
|
+
CoroutineScope(Dispatchers.IO).launch {
|
|
598
|
+
// Step 1: Clear DB first if needed
|
|
599
|
+
if (isForClear) {
|
|
600
|
+
mModel.clearAllGlucoseAndDeviceData() // suspend or blocking DB operation
|
|
601
|
+
}
|
|
601
602
|
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
Log.d(
|
|
606
|
-
"observeAllGlucoseData",
|
|
607
|
-
"No historical data found, starting live observation"
|
|
608
|
-
)
|
|
603
|
+
// Step 2: Back to main thread to stop observers and proceed
|
|
604
|
+
withContext(Dispatchers.Main) {
|
|
605
|
+
stopObservingGlucoseData()
|
|
609
606
|
|
|
610
|
-
|
|
611
|
-
|
|
607
|
+
Handler(Looper.getMainLooper()).postDelayed({
|
|
608
|
+
try {
|
|
609
|
+
val lastSyncData = prefsHelper.lastSyncData
|
|
610
|
+
Log.d("lastSyncData: ", Gson().toJson(lastSyncData).toString())
|
|
611
|
+
|
|
612
|
+
val currentTime = System.currentTimeMillis()
|
|
613
|
+
val dataAge =
|
|
614
|
+
if (lastSyncData != null) currentTime - lastSyncData.timeInMillis else 0L
|
|
615
|
+
|
|
616
|
+
if (lastSyncData != null && dataAge > 3 * 60 * 1000L) {
|
|
617
|
+
isBatchProcessing = true
|
|
618
|
+
CoroutineScope(Dispatchers.IO).launch {
|
|
619
|
+
val glucoseData =
|
|
620
|
+
mModel.getGlucoseBetweenTime(lastSyncData.timeInMillis)
|
|
621
|
+
|
|
622
|
+
Log.d("observeAllGlucoseData: ", glucoseData.toString())
|
|
623
|
+
Log.d("Last sync time: ", lastSyncData.lastSyncTime.toString())
|
|
624
|
+
Log.d("current time: ", System.currentTimeMillis().toString())
|
|
625
|
+
|
|
626
|
+
if (!glucoseData.isNullOrEmpty()) {
|
|
627
|
+
processBatchDataAndStartObserver(
|
|
628
|
+
glucoseData,
|
|
629
|
+
isForClear,
|
|
630
|
+
envType
|
|
631
|
+
)
|
|
632
|
+
} else {
|
|
633
|
+
Log.d(
|
|
634
|
+
"observeAllGlucoseData",
|
|
635
|
+
"No historical data found, starting live observation"
|
|
636
|
+
)
|
|
637
|
+
withContext(Dispatchers.Main) {
|
|
638
|
+
observeGlucoseData(userToken, isForClear, envType)
|
|
639
|
+
}
|
|
640
|
+
}
|
|
612
641
|
}
|
|
642
|
+
} else {
|
|
643
|
+
isBatchProcessing = false
|
|
644
|
+
observeGlucoseData(userToken, isForClear, envType)
|
|
613
645
|
}
|
|
646
|
+
} catch (e: Exception) {
|
|
647
|
+
isBatchProcessing = false
|
|
648
|
+
observeGlucoseData(userToken, isForClear, envType)
|
|
614
649
|
}
|
|
615
|
-
}
|
|
616
|
-
isBatchProcessing = false
|
|
617
|
-
observeGlucoseData(userToken)
|
|
618
|
-
}
|
|
619
|
-
} catch (e: Exception) {
|
|
620
|
-
isBatchProcessing = false
|
|
621
|
-
observeGlucoseData(userToken)
|
|
650
|
+
}, 100)
|
|
622
651
|
}
|
|
623
|
-
}
|
|
652
|
+
}
|
|
624
653
|
}
|
|
625
654
|
|
|
626
655
|
// New method to handle batch processing and ensure proper sequencing
|
|
627
|
-
private suspend fun processBatchDataAndStartObserver(
|
|
656
|
+
private suspend fun processBatchDataAndStartObserver(
|
|
657
|
+
dataList: List<PocGlucose>,
|
|
658
|
+
isForClear: Boolean = false,
|
|
659
|
+
envType: String
|
|
660
|
+
) {
|
|
628
661
|
try {
|
|
629
662
|
Log.d(
|
|
630
663
|
"processBatchDataAndStartObserver",
|
|
631
664
|
"Starting batch processing with ${dataList.size} records"
|
|
632
665
|
)
|
|
633
666
|
|
|
634
|
-
val success = processBatchDataSynchronously(dataList)
|
|
667
|
+
val success = processBatchDataSynchronously(dataList, envType)
|
|
635
668
|
|
|
636
669
|
if (success) {
|
|
637
670
|
Log.d("processBatchDataAndStartObserver", "Batch processing completed successfully")
|
|
@@ -647,7 +680,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
647
680
|
"processBatchDataAndStartObserver",
|
|
648
681
|
"Starting live observer after batch completion"
|
|
649
682
|
)
|
|
650
|
-
observeGlucoseData(userToken)
|
|
683
|
+
observeGlucoseData(userToken, isForClear, envType)
|
|
651
684
|
} else {
|
|
652
685
|
Log.d(
|
|
653
686
|
"processBatchDataAndStartObserver",
|
|
@@ -662,7 +695,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
662
695
|
isBatchProcessing = false
|
|
663
696
|
withContext(Dispatchers.Main) {
|
|
664
697
|
if (!isObserving) {
|
|
665
|
-
observeGlucoseData(userToken)
|
|
698
|
+
observeGlucoseData(userToken, isForClear, envType)
|
|
666
699
|
}
|
|
667
700
|
}
|
|
668
701
|
}
|
|
@@ -698,7 +731,10 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
698
731
|
}
|
|
699
732
|
|
|
700
733
|
// Updated batch processing method with better sync control
|
|
701
|
-
private suspend fun processBatchDataSynchronously(
|
|
734
|
+
private suspend fun processBatchDataSynchronously(
|
|
735
|
+
dataList: List<PocGlucose>,
|
|
736
|
+
envType: String
|
|
737
|
+
): Boolean {
|
|
702
738
|
if (dataList.isEmpty()) {
|
|
703
739
|
Log.d("processBatchDataSynchronously", "No data to upload")
|
|
704
740
|
return true
|
|
@@ -766,7 +802,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
766
802
|
)
|
|
767
803
|
logLongJson("Batch $index JSON=>>> ", json)
|
|
768
804
|
|
|
769
|
-
val uploadSuccessful = uploadBatchSynchronously(json, index)
|
|
805
|
+
val uploadSuccessful = uploadBatchSynchronously(json, index, envType)
|
|
770
806
|
|
|
771
807
|
if (uploadSuccessful) {
|
|
772
808
|
lastSyncedRecord = batch.lastOrNull()
|
|
@@ -793,7 +829,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
793
829
|
// Handle error status for the last processed record
|
|
794
830
|
lastSyncedRecord?.let { record ->
|
|
795
831
|
if (record.errorCode != enumError.NONE) {
|
|
796
|
-
handleGlucoseError(record)
|
|
832
|
+
handleGlucoseError(record, envType)
|
|
797
833
|
}
|
|
798
834
|
}
|
|
799
835
|
|
|
@@ -842,11 +878,15 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
842
878
|
}
|
|
843
879
|
|
|
844
880
|
// Helper method for synchronous batch upload
|
|
845
|
-
private suspend fun uploadBatchSynchronously(
|
|
881
|
+
private suspend fun uploadBatchSynchronously(
|
|
882
|
+
json: String,
|
|
883
|
+
batchIndex: Int,
|
|
884
|
+
envType: String
|
|
885
|
+
): Boolean {
|
|
846
886
|
return suspendCoroutine { continuation ->
|
|
847
887
|
try {
|
|
848
888
|
authenticateSDKService.postCGMData(
|
|
849
|
-
environment = TATVA_ENVIRONMENT.PROD,
|
|
889
|
+
environment = if (envType.lowercase() == "uat") TATVA_ENVIRONMENT.STAGE else TATVA_ENVIRONMENT.PROD,
|
|
850
890
|
data = json,
|
|
851
891
|
token = userToken,
|
|
852
892
|
responseListener = object : AuthenticateSDKService.ResponseListener {
|
|
@@ -92,7 +92,7 @@ class ConnectSensorActivity : BaseBleActivity() {
|
|
|
92
92
|
|
|
93
93
|
binding.toolbar.btnWhatsapp.setOnClickListener {
|
|
94
94
|
startActivity(
|
|
95
|
-
Intent(this, HelpActivity::class.java).putExtra("ScreenName", "Sensor
|
|
95
|
+
Intent(this, HelpActivity::class.java).putExtra("ScreenName", "Sensor page")
|
|
96
96
|
)
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -170,7 +170,7 @@ class PermissionActivity : BasePermissionActivity() {
|
|
|
170
170
|
binding.toolbar.btnWhatsapp.setOnClickListener {
|
|
171
171
|
startActivity(
|
|
172
172
|
Intent(this, HelpActivity::class.java)
|
|
173
|
-
.putExtra("ScreenName", "
|
|
173
|
+
.putExtra("ScreenName", "connection journey page")
|
|
174
174
|
)
|
|
175
175
|
}
|
|
176
176
|
|
|
@@ -62,7 +62,7 @@ class PlaceSensorActivity : AppCompatActivity() {
|
|
|
62
62
|
binding.toolbar.btnWhatsapp.setOnClickListener {
|
|
63
63
|
startActivity(
|
|
64
64
|
Intent(this, HelpActivity::class.java)
|
|
65
|
-
.putExtra("ScreenName", "
|
|
65
|
+
.putExtra("ScreenName", "Sensor page")
|
|
66
66
|
)
|
|
67
67
|
}
|
|
68
68
|
|
|
@@ -70,7 +70,7 @@ class PlaceTransmitterActivity : AppCompatActivity() {
|
|
|
70
70
|
binding.toolbar.btnWhatsapp.setOnClickListener {
|
|
71
71
|
startActivity(
|
|
72
72
|
Intent(this, HelpActivity::class.java)
|
|
73
|
-
.putExtra("ScreenName", "
|
|
73
|
+
.putExtra("ScreenName", "Transmitter page")
|
|
74
74
|
)
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -151,7 +151,7 @@ class SearchTransmitterActivity : BaseBleActivity() {
|
|
|
151
151
|
binding.btnSupport.btnProceed.setOnClickListener {
|
|
152
152
|
startActivity(
|
|
153
153
|
Intent(this, HelpActivity::class.java)
|
|
154
|
-
.putExtra("ScreenName", "Transmitter
|
|
154
|
+
.putExtra("ScreenName", "Transmitter page")
|
|
155
155
|
)
|
|
156
156
|
}
|
|
157
157
|
|
|
@@ -234,8 +234,7 @@ class SearchTransmitterActivity : BaseBleActivity() {
|
|
|
234
234
|
manageErrorState(false, "")
|
|
235
235
|
} else {
|
|
236
236
|
sendDataToRN("", "cgm_transmitter_detection_failed")
|
|
237
|
-
|
|
238
|
-
manageErrorState(true, "")
|
|
237
|
+
manageErrorState(true, "Timeout")
|
|
239
238
|
}
|
|
240
239
|
Log.d("Search Transmitter Error--> ", "Search Transmitter Error--> scanEnd")
|
|
241
240
|
}
|
|
@@ -326,7 +325,7 @@ class SearchTransmitterActivity : BaseBleActivity() {
|
|
|
326
325
|
binding.toolbar.btnWhatsapp.setOnClickListener {
|
|
327
326
|
startActivity(
|
|
328
327
|
Intent(this, HelpActivity::class.java)
|
|
329
|
-
.putExtra("ScreenName", "Transmitter
|
|
328
|
+
.putExtra("ScreenName", "Transmitter page")
|
|
330
329
|
)
|
|
331
330
|
}
|
|
332
331
|
|
|
@@ -21,6 +21,7 @@ import com.facebook.react.bridge.Arguments
|
|
|
21
21
|
import com.facebook.react.bridge.CatalystInstance
|
|
22
22
|
import com.facebook.react.bridge.WritableMap
|
|
23
23
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
24
|
+
import com.mytatvarnsdk.CgmTrackyLibModule
|
|
24
25
|
import com.mytatvarnsdk.R
|
|
25
26
|
import com.mytatvarnsdk.databinding.ActivitySensorConnectSuccessBinding
|
|
26
27
|
import com.mytatvarnsdk.databinding.ExitDialogBottomsheetBinding
|
|
@@ -34,7 +35,6 @@ import kotlinx.coroutines.CoroutineScope
|
|
|
34
35
|
import kotlinx.coroutines.Dispatchers
|
|
35
36
|
import kotlinx.coroutines.Job
|
|
36
37
|
import org.json.JSONObject
|
|
37
|
-
import com.mytatvarnsdk.CgmTrackyLibModule
|
|
38
38
|
import java.text.SimpleDateFormat
|
|
39
39
|
import java.util.Date
|
|
40
40
|
import java.util.Locale
|
|
@@ -80,15 +80,18 @@ class SensorConnectSuccessActivity : AppCompatActivity() {
|
|
|
80
80
|
binding.toolbar.btnWhatsapp.setOnClickListener {
|
|
81
81
|
startActivity(
|
|
82
82
|
Intent(this, HelpActivity::class.java)
|
|
83
|
-
.putExtra("ScreenName", "Sensor
|
|
83
|
+
.putExtra("ScreenName", "Sensor page")
|
|
84
84
|
)
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
binding.toolbar.btnWatchDemo.setOnClickListener {
|
|
88
|
-
sendDataToRN("","cgm_watch_demo_clicked")
|
|
88
|
+
sendDataToRN("", "cgm_watch_demo_clicked")
|
|
89
89
|
|
|
90
90
|
startActivity(
|
|
91
|
-
Intent(this, VideoActivity::class.java).putExtra(
|
|
91
|
+
Intent(this, VideoActivity::class.java).putExtra(
|
|
92
|
+
"VideoId",
|
|
93
|
+
if (isForReconnect) "n_pUrFoZ1wQ" else "r5Zemc4R044"
|
|
94
|
+
)
|
|
92
95
|
)
|
|
93
96
|
}
|
|
94
97
|
|
|
@@ -171,7 +174,7 @@ class SensorConnectSuccessActivity : AppCompatActivity() {
|
|
|
171
174
|
obj.put("rawData", rawData)
|
|
172
175
|
|
|
173
176
|
authenticateSDKService.postDeviceData(
|
|
174
|
-
environment = TATVA_ENVIRONMENT.PROD,
|
|
177
|
+
environment = if (CgmTrackyLibModule.env.lowercase() == "uat") TATVA_ENVIRONMENT.STAGE else TATVA_ENVIRONMENT.PROD,
|
|
175
178
|
data = obj.toString(),
|
|
176
179
|
token = CgmTrackyLibModule.userToken,
|
|
177
180
|
loaderListener = object : LoaderListener {
|
|
@@ -92,7 +92,7 @@ class StartCGMActivity : AppCompatActivity() {
|
|
|
92
92
|
binding.toolbar.btnWhatsapp.setOnClickListener {
|
|
93
93
|
startActivity(
|
|
94
94
|
Intent(this, HelpActivity::class.java)
|
|
95
|
-
.putExtra("ScreenName", "
|
|
95
|
+
.putExtra("ScreenName", "connection journey page")
|
|
96
96
|
)
|
|
97
97
|
}
|
|
98
98
|
|