react-native-mytatva-rn-sdk 1.2.48 → 1.2.49
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 +17 -25
- package/android/src/main/java/com/mytatvarnsdk/activity/BtManageActivity.java +345 -345
- package/android/src/main/java/com/mytatvarnsdk/activity/ConnectSensorActivity.kt +17 -38
- package/android/src/main/java/com/mytatvarnsdk/activity/ExitJourneyBottomSheet.kt +51 -51
- package/android/src/main/java/com/mytatvarnsdk/activity/PermissionActivity.kt +10 -5
- package/android/src/main/java/com/mytatvarnsdk/activity/PlaceSensorActivity.kt +4 -5
- package/android/src/main/java/com/mytatvarnsdk/activity/PlaceTransmitterActivity.kt +4 -5
- package/android/src/main/java/com/mytatvarnsdk/activity/QRActivity.kt +96 -92
- package/android/src/main/java/com/mytatvarnsdk/activity/SearchTransmitterActivity.kt +1 -1
- package/android/src/main/java/com/mytatvarnsdk/activity/SensorConnectSuccessActivity.kt +1 -1
- package/android/src/main/java/com/mytatvarnsdk/activity/StartCGMActivity.kt +4 -2
- package/android/src/main/java/com/mytatvarnsdk/activity/VideoActivity.kt +0 -1
- package/android/src/main/java/com/mytatvarnsdk/utils/TatvaEncryptionConfig.kt +0 -5
- package/ios/Database/KLTBluetoothManager.m +9 -4
- package/ios/Database/KLTDatabaseHandler.m +53 -6
- package/ios/MyReactNativeBridge.h +4 -1
- package/ios/MyReactNativeBridge.m +433 -191
- package/ios/Support/API.swift +0 -1
- package/ios/Support/Global.swift +12 -0
- package/ios/ViewControllers/AttachTransmitterViewController.swift +33 -2
- package/ios/ViewControllers/ChatWithExpertViewController.swift +33 -3
- package/ios/ViewControllers/ConnectToSensorViewController.swift +101 -12
- package/ios/ViewControllers/ConnectToTransmitterViewController.swift +121 -5
- package/ios/ViewControllers/ProvidePermissionViewController.swift +37 -5
- package/ios/ViewControllers/PutOnTheSensorViewController.swift +22 -2
- package/ios/ViewControllers/StartConnectionViewController.swift +31 -3
- package/ios/ViewModel/FinalViewModel.swift +155 -48
- package/package.json +1 -1
|
@@ -75,12 +75,9 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
75
75
|
private val apiScope = CoroutineScope(Dispatchers.IO + SupervisorJob())
|
|
76
76
|
private var debounceJob: Job? = null
|
|
77
77
|
private var isBatchProcessing = false
|
|
78
|
-
|
|
79
78
|
private var lastDeviceStatus: String? = null
|
|
80
|
-
|
|
81
79
|
private var glucoseObserver: Observer<PocGlucose?>? = null
|
|
82
80
|
private var isObserving = false
|
|
83
|
-
|
|
84
81
|
private var lastProcessedSyncTimeInMillis: Long? = null
|
|
85
82
|
|
|
86
83
|
init {
|
|
@@ -235,12 +232,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
235
232
|
|
|
236
233
|
|
|
237
234
|
private fun postEventDataToAPI(device: PocDevice?, mStatus: String, sensorId: String?) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
debounceJob = apiScope.launch {
|
|
242
|
-
delay(500)
|
|
243
|
-
|
|
235
|
+
apiScope.launch {
|
|
244
236
|
try {
|
|
245
237
|
val bluetoothAdapter: BluetoothAdapter? = BluetoothAdapter.getDefaultAdapter()
|
|
246
238
|
val bleStatus = bluetoothAdapter?.isEnabled == true
|
|
@@ -265,10 +257,8 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
265
257
|
debounceDeviceTimer?.schedule(object : TimerTask() {
|
|
266
258
|
override fun run() {
|
|
267
259
|
isDebounceTimerActive = false
|
|
268
|
-
|
|
269
260
|
callEventAPI(device, status, sensorId)
|
|
270
261
|
}
|
|
271
|
-
|
|
272
262
|
}, 1 * 60 * 1000) // 1 minutes in milliseconds
|
|
273
263
|
|
|
274
264
|
Log.d("Debounce", "Timer started for disconnection reminder")
|
|
@@ -290,7 +280,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
290
280
|
}
|
|
291
281
|
|
|
292
282
|
private fun callEventAPI(device: PocDevice?, status: String, sensorId: String?) {
|
|
293
|
-
Log.d("Device event Status", "Last Device event
|
|
283
|
+
Log.d("Device event Status", "Last Device event lastDeviceStatus API: $lastDeviceStatus")
|
|
294
284
|
|
|
295
285
|
if (status.isNotEmpty() && status != lastDeviceStatus) {
|
|
296
286
|
lastDeviceStatus = status
|
|
@@ -394,10 +384,13 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
394
384
|
)
|
|
395
385
|
return
|
|
396
386
|
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
387
|
+
if (isBatchProcessing) {
|
|
388
|
+
Log.d(
|
|
389
|
+
"observeAllGlucoseData",
|
|
390
|
+
"Batch processing in progress, skipping duplicate call"
|
|
391
|
+
)
|
|
392
|
+
return
|
|
393
|
+
}
|
|
401
394
|
|
|
402
395
|
// Remove existing observer if any to prevent memory leaks
|
|
403
396
|
stopObservingGlucoseData()
|
|
@@ -415,14 +408,13 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
415
408
|
if (lastSyncData != null) {
|
|
416
409
|
dataAge = currentTime - lastSyncData.timeInMillis
|
|
417
410
|
}
|
|
418
|
-
|
|
411
|
+
|
|
419
412
|
// Only proceed if timeInMillis is different from last processed
|
|
420
413
|
if (currentSyncTimeInMillis != null && lastProcessedSyncTimeInMillis != null && currentSyncTimeInMillis == lastProcessedSyncTimeInMillis) {
|
|
421
414
|
Log.d("SyncTimeCheck", "Duplicate sync time, skipping function calls")
|
|
422
415
|
return@Observer
|
|
423
416
|
}
|
|
424
417
|
|
|
425
|
-
|
|
426
418
|
if ((pocGlucose != null && lastSyncData == null) || (pocGlucose != null && lastSyncData != null && dataAge <= 4 * 60 * 1000L)) {
|
|
427
419
|
handleGlucoseData(pocGlucose)
|
|
428
420
|
Log.d(
|
|
@@ -433,9 +425,9 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
433
425
|
lastProcessedSyncTimeInMillis = currentSyncTimeInMillis
|
|
434
426
|
} else {
|
|
435
427
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
428
|
+
Handler(Looper.getMainLooper()).postDelayed({
|
|
429
|
+
observeAllGlucoseData(userToken)
|
|
430
|
+
}, 100)
|
|
439
431
|
Log.d(
|
|
440
432
|
"observeGlucoseData",
|
|
441
433
|
"Received null glucose data - skipping processing"
|
|
@@ -593,12 +585,12 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
593
585
|
}
|
|
594
586
|
|
|
595
587
|
if (lastSyncData != null && dataAge > 3 * 60 * 1000L) {
|
|
596
|
-
|
|
588
|
+
isBatchProcessing = true
|
|
597
589
|
CoroutineScope(Dispatchers.IO).launch {
|
|
598
|
-
|
|
590
|
+
|
|
599
591
|
val glucoseData = mModel.getGlucoseBetweenTime(lastSyncData.timeInMillis)
|
|
600
592
|
|
|
601
|
-
|
|
593
|
+
|
|
602
594
|
Log.d("observeAllGlucoseData: ", glucoseData.toString())
|
|
603
595
|
Log.d("Last sync time: ", lastSyncData.lastSyncTime.toString())
|
|
604
596
|
Log.d("current time: ", System.currentTimeMillis().toString())
|
|
@@ -664,7 +656,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
664
656
|
Log.e("processBatchDataAndStartObserver", "Error in batch processing: ${e.message}")
|
|
665
657
|
// Start live observation even on error
|
|
666
658
|
isBatchProcessing = false
|
|
667
|
-
|
|
659
|
+
withContext(Dispatchers.Main) {
|
|
668
660
|
if (!isObserving) {
|
|
669
661
|
observeGlucoseData(userToken)
|
|
670
662
|
}
|