react-native-mytatva-rn-sdk 1.2.88 → 1.2.90
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/build.gradle +4 -0
- package/android/src/main/java/com/mytatvarnsdk/CgmTrackyLibModule.kt +230 -30
- package/android/src/main/java/com/mytatvarnsdk/utils/RetrofitInstance.kt +12 -0
- package/android/src/main/res/drawable/ic_charging_case.png +0 -0
- package/android/src/main/res/drawable/ic_transmitter.png +0 -0
- package/android/src/main/res/drawable/img_cgm_device.png +0 -0
- package/android/src/main/res/drawable/img_cgm_pod_detect_error.png +0 -0
- package/android/src/main/res/layout/activity_search_transmitter.xml +12 -2
- package/ios/Support/API.swift +16 -1
- package/ios/icon.xcassets/CGM_with_Toggle.imageset/CGM_with_Toggle.png +0 -0
- package/ios/icon.xcassets/Take_out_transmitter.imageset/Take our transmitter.png +0 -0
- package/ios/icon.xcassets/flip_the_reference.imageset/flip_the_reference.png +0 -0
- package/lib/commonjs/CGMConnect.js +0 -1
- package/lib/commonjs/CGMConnect.js.map +1 -1
- package/lib/module/CGMConnect.js +0 -1
- package/lib/module/CGMConnect.js.map +1 -1
- package/package.json +1 -1
- package/src/CGMConnect.ts +0 -1
package/android/build.gradle
CHANGED
|
@@ -164,6 +164,10 @@ dependencies {
|
|
|
164
164
|
// Support library depends on this lightweight import
|
|
165
165
|
implementation 'androidx.lifecycle:lifecycle-runtime:2.1.0'
|
|
166
166
|
|
|
167
|
+
// Sentry: uses host app's init (e.g. @sentry/react-native); only capture from native here
|
|
168
|
+
implementation platform('io.sentry:sentry-bom:7.14.0')
|
|
169
|
+
implementation 'io.sentry:sentry-android'
|
|
170
|
+
|
|
167
171
|
// network
|
|
168
172
|
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
|
169
173
|
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
|
@@ -44,6 +44,8 @@ import com.mytatvarnsdk.network.AuthenticateSDKService
|
|
|
44
44
|
import com.mytatvarnsdk.network.AuthenticateSDKService.LoaderListener
|
|
45
45
|
import com.mytatvarnsdk.utils.DeviceStatus
|
|
46
46
|
import com.mytatvarnsdk.utils.TATVA_ENVIRONMENT
|
|
47
|
+
import io.sentry.Sentry
|
|
48
|
+
import io.sentry.SentryLevel
|
|
47
49
|
import kotlinx.coroutines.CoroutineScope
|
|
48
50
|
import kotlinx.coroutines.Dispatchers
|
|
49
51
|
import kotlinx.coroutines.Job
|
|
@@ -102,12 +104,91 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
102
104
|
var userToken: String = ""
|
|
103
105
|
var env: String = ""
|
|
104
106
|
var lastConnectCgm: String = ""
|
|
107
|
+
|
|
108
|
+
// Sentry event message field is typically much smaller than "extra" fields.
|
|
109
|
+
// Keep JSON in extras as a full (clipped) payload, but also include a small prefix in the message
|
|
110
|
+
// so it's visible in the Sentry dashboard list/search.
|
|
111
|
+
private const val MAX_SENTRY_DATA_EXTRA_CHARS = 16_384
|
|
112
|
+
private const val MAX_SENTRY_MESSAGE_DATA_CHARS = 2_000
|
|
105
113
|
}
|
|
106
114
|
|
|
107
115
|
override fun getName(): String {
|
|
108
116
|
return "CgmTrackyLib"
|
|
109
117
|
}
|
|
110
118
|
|
|
119
|
+
/**
|
|
120
|
+
* Uses the host app's Sentry client (never call Sentry.init here).
|
|
121
|
+
* [data]: [Throwable] → exception event; anything else → message + extra `data` (stringified, clipped);
|
|
122
|
+
* null → error message with location only.
|
|
123
|
+
*/
|
|
124
|
+
private fun captureModuleException(
|
|
125
|
+
where: String,
|
|
126
|
+
data: Any?,
|
|
127
|
+
level: SentryLevel = SentryLevel.ERROR
|
|
128
|
+
) {
|
|
129
|
+
try {
|
|
130
|
+
Sentry.withScope { scope ->
|
|
131
|
+
scope.setTag("cgm_tracky_lib", "true")
|
|
132
|
+
scope.setExtra("location", where)
|
|
133
|
+
if (env.isNotEmpty()) {
|
|
134
|
+
scope.setExtra("tatva_env", env)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
when (data) {
|
|
138
|
+
null ->
|
|
139
|
+
run {
|
|
140
|
+
Sentry.captureMessage("CgmTrackyLib: $where", level)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
is Throwable ->
|
|
144
|
+
run {
|
|
145
|
+
// Put exception summary into `extra.data` for quick inspection.
|
|
146
|
+
val throwableText =
|
|
147
|
+
"${data.javaClass.simpleName}: ${data.message ?: ""}".trim()
|
|
148
|
+
val clipped =
|
|
149
|
+
if (throwableText.length > MAX_SENTRY_DATA_EXTRA_CHARS) {
|
|
150
|
+
throwableText.take(MAX_SENTRY_DATA_EXTRA_CHARS) + "…"
|
|
151
|
+
} else {
|
|
152
|
+
throwableText
|
|
153
|
+
}
|
|
154
|
+
scope.setExtra("data", clipped)
|
|
155
|
+
Sentry.captureException(data)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
else -> {
|
|
159
|
+
val text = when (data) {
|
|
160
|
+
is String -> data
|
|
161
|
+
else -> data.toString()
|
|
162
|
+
}
|
|
163
|
+
val clipped =
|
|
164
|
+
if (text.length > MAX_SENTRY_DATA_EXTRA_CHARS) {
|
|
165
|
+
text.take(MAX_SENTRY_DATA_EXTRA_CHARS) + "…"
|
|
166
|
+
} else {
|
|
167
|
+
text
|
|
168
|
+
}
|
|
169
|
+
scope.setExtra("data", clipped)
|
|
170
|
+
// Duplicate under a more explicit key so it is easy to find in Sentry UI.
|
|
171
|
+
scope.setExtra("json", clipped)
|
|
172
|
+
|
|
173
|
+
// Also include a prefix in the message itself so it appears in the main event row.
|
|
174
|
+
// (In some Sentry views, extra fields are not shown by default.)
|
|
175
|
+
val messageData =
|
|
176
|
+
if (clipped.length > MAX_SENTRY_MESSAGE_DATA_CHARS) {
|
|
177
|
+
clipped.take(MAX_SENTRY_MESSAGE_DATA_CHARS) + "…"
|
|
178
|
+
} else {
|
|
179
|
+
clipped
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
Sentry.captureMessage("CgmTrackyLib: $where | data=$messageData", level)
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
} catch (sentryEx: Exception) {
|
|
187
|
+
// If Sentry itself fails, never crash the CGM processing flow.
|
|
188
|
+
Log.e("captureModuleException", "Sentry capture failed: ${sentryEx.message}", sentryEx)
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
111
192
|
private fun updateUserData(data: ReadableMap?) {
|
|
112
193
|
currentUserData = data
|
|
113
194
|
// Always reset so stale values from a previous user don't persist
|
|
@@ -121,7 +202,8 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
121
202
|
}
|
|
122
203
|
}
|
|
123
204
|
} catch (e: Exception) {
|
|
124
|
-
Log.e("updateUserData", "Error extracting last_connect_cgm: ${e.message}")
|
|
205
|
+
Log.e("updateUserData", "Error extracting last_connect_cgm: ${e.message}", e)
|
|
206
|
+
captureModuleException("updateUserData", e)
|
|
125
207
|
}
|
|
126
208
|
}
|
|
127
209
|
|
|
@@ -154,7 +236,8 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
154
236
|
deviceObserver?.let { mModel.device.observeForever(it) }
|
|
155
237
|
}
|
|
156
238
|
} catch (e: Exception) {
|
|
157
|
-
Log.e("observeDeviceStatus", "observeDeviceStatus: ${e.message}")
|
|
239
|
+
Log.e("observeDeviceStatus", "observeDeviceStatus: ${e.message}", e)
|
|
240
|
+
captureModuleException("observeDeviceStatus", e)
|
|
158
241
|
}
|
|
159
242
|
}
|
|
160
243
|
|
|
@@ -281,7 +364,8 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
281
364
|
}
|
|
282
365
|
}
|
|
283
366
|
} catch (e: Exception) {
|
|
284
|
-
Log.e("observeTransmitterUnbindStatus", "observeTransmitterUnbindStatus: ${e.message}")
|
|
367
|
+
Log.e("observeTransmitterUnbindStatus", "observeTransmitterUnbindStatus: ${e.message}", e)
|
|
368
|
+
captureModuleException("observeTransmitterUnbindStatus", e)
|
|
285
369
|
}
|
|
286
370
|
}
|
|
287
371
|
|
|
@@ -337,7 +421,8 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
337
421
|
}
|
|
338
422
|
|
|
339
423
|
} catch (e: Exception) {
|
|
340
|
-
e.
|
|
424
|
+
Log.e("postEventDataToAPI", "postEventDataToAPI: ${e.message}", e)
|
|
425
|
+
captureModuleException("postEventDataToAPI", e)
|
|
341
426
|
}
|
|
342
427
|
}
|
|
343
428
|
}
|
|
@@ -403,7 +488,8 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
403
488
|
intent.putExtra("envType", env)
|
|
404
489
|
currentActivity?.startActivity(intent)
|
|
405
490
|
} catch (e: Exception) {
|
|
406
|
-
Log.e("startCgmTracky", "startCgmTracky: ${e.message}")
|
|
491
|
+
Log.e("startCgmTracky", "startCgmTracky: ${e.message}", e)
|
|
492
|
+
captureModuleException("startCgmTracky", e)
|
|
407
493
|
}
|
|
408
494
|
}
|
|
409
495
|
|
|
@@ -431,7 +517,8 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
431
517
|
).putExtra("envType", env)
|
|
432
518
|
)
|
|
433
519
|
} catch (e: Exception) {
|
|
434
|
-
Log.e("reconnectCgmTracky", "reconnectCgmTracky: ${e.message}")
|
|
520
|
+
Log.e("reconnectCgmTracky", "reconnectCgmTracky: ${e.message}", e)
|
|
521
|
+
captureModuleException("reconnectCgmTracky", e)
|
|
435
522
|
}
|
|
436
523
|
}
|
|
437
524
|
|
|
@@ -441,7 +528,8 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
441
528
|
val intent = Intent(currentActivity, HelpActivity::class.java)
|
|
442
529
|
currentActivity?.startActivity(intent)
|
|
443
530
|
} catch (e: Exception) {
|
|
444
|
-
Log.e("openHelpSupport", "openHelpSupport: ${e.message}")
|
|
531
|
+
Log.e("openHelpSupport", "openHelpSupport: ${e.message}", e)
|
|
532
|
+
captureModuleException("openHelpSupport", e)
|
|
445
533
|
}
|
|
446
534
|
}
|
|
447
535
|
|
|
@@ -512,7 +600,8 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
512
600
|
isObserving = true
|
|
513
601
|
Log.d("observeGlucoseData", "Live glucose observer started successfully")
|
|
514
602
|
} catch (e: Exception) {
|
|
515
|
-
Log.e("observeGlucoseData", "Error adding observer: ${e.message}")
|
|
603
|
+
Log.e("observeGlucoseData", "Error adding observer: ${e.message}", e)
|
|
604
|
+
captureModuleException("observeGlucoseData.observeForever", e)
|
|
516
605
|
glucoseObserver = null
|
|
517
606
|
isObserving = false
|
|
518
607
|
}
|
|
@@ -520,8 +609,8 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
520
609
|
}
|
|
521
610
|
|
|
522
611
|
} catch (e: Exception) {
|
|
523
|
-
Log.e("observeGlucoseData", "observeGlucoseData: ${e.message}")
|
|
524
|
-
e
|
|
612
|
+
Log.e("observeGlucoseData", "observeGlucoseData: ${e.message}", e)
|
|
613
|
+
captureModuleException("observeGlucoseData", e)
|
|
525
614
|
isObserving = false
|
|
526
615
|
glucoseObserver = null
|
|
527
616
|
}
|
|
@@ -586,7 +675,6 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
586
675
|
}
|
|
587
676
|
|
|
588
677
|
Log.d("handleGlucoseData", "Processing glucose data: ${pocGlucose.glucoseId}")
|
|
589
|
-
|
|
590
678
|
if (pocGlucose.errorCode == enumError.NONE) {
|
|
591
679
|
/* if (pocGlucose.showGlucoseMG > 0) { */
|
|
592
680
|
val dto: GlucoseLog = mapToDto(pocGlucose)
|
|
@@ -596,10 +684,18 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
596
684
|
val request: GlucoseLogRequest =
|
|
597
685
|
GlucoseLogRequest(vendor = "GoodFlip", logs = logs)
|
|
598
686
|
val gson: Gson = GsonBuilder().create()
|
|
599
|
-
val json = gson.toJson(request)
|
|
600
687
|
|
|
601
|
-
|
|
688
|
+
// Attach sensorId at the top level of the payload sent to /cgm/logs
|
|
689
|
+
val singlePayloadJsonObject = JSONObject(gson.toJson(request)).apply {
|
|
690
|
+
val activeSensorId =
|
|
691
|
+
prefsHelper?.qrInformation?.sensor ?: lastConnectCgm ?: ""
|
|
692
|
+
put("sensorId", activeSensorId)
|
|
693
|
+
}
|
|
694
|
+
val json = singlePayloadJsonObject.toString()
|
|
602
695
|
|
|
696
|
+
Log.d("Glucose data 3 min==> ", "Glucose data 3 min==> final Json: $json")
|
|
697
|
+
// String → captureModuleException puts JSON in scope extra "data" (clipped); INFO avoids error-rate noise.
|
|
698
|
+
// captureModuleException("handleGlucoseData==>postCGMData", json, level = SentryLevel.INFO)
|
|
603
699
|
authenticateSDKService.postCGMData(
|
|
604
700
|
environment = if (envType.lowercase() == "uat") TATVA_ENVIRONMENT.STAGE else TATVA_ENVIRONMENT.PROD,
|
|
605
701
|
data = json,
|
|
@@ -607,10 +703,31 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
607
703
|
responseListener = object : AuthenticateSDKService.ResponseListener {
|
|
608
704
|
override fun onResponseSuccess(response: String) {
|
|
609
705
|
updateSyncMetadata(pocGlucose)
|
|
706
|
+
// captureModuleException(
|
|
707
|
+
// "handleGlucoseData.postCGMData.success",
|
|
708
|
+
// json,
|
|
709
|
+
// extras =
|
|
710
|
+
// mapOf(
|
|
711
|
+
// "pocGlucose" to pocGlucose.toString(),
|
|
712
|
+
// "sdk_response" to response
|
|
713
|
+
// ),
|
|
714
|
+
// level = SentryLevel.INFO
|
|
715
|
+
// )
|
|
610
716
|
Log.d("CGM Data", "Single glucose data uploaded successfully")
|
|
611
717
|
}
|
|
612
718
|
|
|
613
719
|
override fun onResponseFail() {
|
|
720
|
+
val lastSync = prefsHelper?.lastSyncData
|
|
721
|
+
val contextData =
|
|
722
|
+
"failure_reason=Failed to upload single glucose data;" +
|
|
723
|
+
"pocGlucose=${pocGlucose};" +
|
|
724
|
+
"lastSync_glucoseId=${lastSync?.glucoseId ?: ""};" +
|
|
725
|
+
"lastSync_timeInMillis=${lastSync?.timeInMillis ?: ""}"
|
|
726
|
+
captureModuleException(
|
|
727
|
+
"handleGlucoseData.postCGMData.fail",
|
|
728
|
+
"$json | $contextData",
|
|
729
|
+
level = SentryLevel.WARNING
|
|
730
|
+
)
|
|
614
731
|
Log.e("CGM Data", "Failed to upload single glucose data")
|
|
615
732
|
}
|
|
616
733
|
}
|
|
@@ -624,11 +741,31 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
624
741
|
} */
|
|
625
742
|
} else {
|
|
626
743
|
Log.d("handleGlucoseData", "Glucose data has error: ${pocGlucose.errorCode}")
|
|
744
|
+
val lastSync = prefsHelper?.lastSyncData
|
|
745
|
+
val contextData =
|
|
746
|
+
"failure_reason=Glucose data has error: ${pocGlucose.errorCode};" +
|
|
747
|
+
"pocGlucose=${pocGlucose};" +
|
|
748
|
+
"lastSync_glucoseId=${lastSync?.glucoseId ?: ""};" +
|
|
749
|
+
"lastSync_timeInMillis=${lastSync?.timeInMillis ?: ""}"
|
|
750
|
+
captureModuleException(
|
|
751
|
+
"handleGlucoseData==>postCGMData",
|
|
752
|
+
"Glucose data has error: ${pocGlucose.errorCode} | $contextData",
|
|
753
|
+
level = SentryLevel.INFO
|
|
754
|
+
)
|
|
627
755
|
handleGlucoseError(pocGlucose, envType)
|
|
628
756
|
}
|
|
629
757
|
} catch (e: Exception) {
|
|
630
|
-
Log.e("handleGlucoseData", "Error handling glucose data: ${e.message}")
|
|
631
|
-
|
|
758
|
+
Log.e("handleGlucoseData", "Error handling glucose data: ${e.message}", e)
|
|
759
|
+
val lastSync = prefsHelper?.lastSyncData
|
|
760
|
+
val contextData =
|
|
761
|
+
"failure_reason=Exception in handleGlucoseData;" +
|
|
762
|
+
"pocGlucose=${pocGlucose};" +
|
|
763
|
+
"lastSync_glucoseId=${lastSync?.glucoseId ?: ""};" +
|
|
764
|
+
"lastSync_timeInMillis=${lastSync?.timeInMillis ?: ""}"
|
|
765
|
+
captureModuleException(
|
|
766
|
+
"handleGlucoseData",
|
|
767
|
+
RuntimeException("handleGlucoseData failed | $contextData", e)
|
|
768
|
+
)
|
|
632
769
|
}
|
|
633
770
|
}
|
|
634
771
|
|
|
@@ -673,8 +810,8 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
673
810
|
)
|
|
674
811
|
}
|
|
675
812
|
} catch (e: Exception) {
|
|
676
|
-
Log.e("handleGlucoseError", "Error handling glucose error: ${e.message}")
|
|
677
|
-
e
|
|
813
|
+
Log.e("handleGlucoseError", "Error handling glucose error: ${e.message}", e)
|
|
814
|
+
captureModuleException("handleGlucoseError", e)
|
|
678
815
|
}
|
|
679
816
|
}
|
|
680
817
|
|
|
@@ -718,6 +855,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
718
855
|
val dataAge = if (lastSyncData != null) currentTime - lastSyncData.timeInMillis else 0L
|
|
719
856
|
|
|
720
857
|
if (lastSyncData != null && dataAge > 3 * 60 * 1000L) {
|
|
858
|
+
|
|
721
859
|
val glucoseData = mModel.getGlucoseBetweenTime(lastSyncData.timeInMillis)
|
|
722
860
|
|
|
723
861
|
val glucoseCount = glucoseData?.size ?: 0
|
|
@@ -766,7 +904,6 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
766
904
|
}
|
|
767
905
|
}
|
|
768
906
|
} else {
|
|
769
|
-
Log.d("observeAllGlucoseData", "ydgdfgf")
|
|
770
907
|
Log.d("observeAllGlucoseData", "Processing ${pendingData.size} pending items")
|
|
771
908
|
// No batch needed, but process pending data if any
|
|
772
909
|
if (pendingData.isNotEmpty()) {
|
|
@@ -787,6 +924,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
787
924
|
}
|
|
788
925
|
} catch (e: Exception) {
|
|
789
926
|
Log.e("observeAllGlucoseData", "Error in batch processing: ${e.message}", e)
|
|
927
|
+
captureModuleException("observeAllGlucoseData", e)
|
|
790
928
|
} finally {
|
|
791
929
|
// Always reset the flag
|
|
792
930
|
isBatchProcessing.set(false)
|
|
@@ -834,7 +972,8 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
834
972
|
}
|
|
835
973
|
|
|
836
974
|
} catch (e: Exception) {
|
|
837
|
-
Log.e("processBatchDataAndStartObserver", "Error in batch processing: ${e.message}")
|
|
975
|
+
Log.e("processBatchDataAndStartObserver", "Error in batch processing: ${e.message}", e)
|
|
976
|
+
captureModuleException("processBatchDataAndStartObserver", e)
|
|
838
977
|
// Start live observation even on error
|
|
839
978
|
withContext(Dispatchers.Main) {
|
|
840
979
|
if (!isObserving) {
|
|
@@ -853,7 +992,8 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
853
992
|
Log.d("dbFile======", dbFile.absolutePath)
|
|
854
993
|
promise.resolve(dbFile.absolutePath)
|
|
855
994
|
} catch (e: Exception) {
|
|
856
|
-
Log.d("dbFileerrrr======", "dbFileerrrr======")
|
|
995
|
+
Log.d("dbFileerrrr======", "dbFileerrrr======", e)
|
|
996
|
+
captureModuleException("getTrackLibDbPath", e)
|
|
857
997
|
promise.reject("ERROR_DB_PATH", e)
|
|
858
998
|
}
|
|
859
999
|
}
|
|
@@ -883,7 +1023,8 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
883
1023
|
prefsHelper?.clearQRInformation()
|
|
884
1024
|
|
|
885
1025
|
} catch (e: Exception) {
|
|
886
|
-
Log.e("resetCgmState", "Error resetting CGM state: ${e.message}")
|
|
1026
|
+
Log.e("resetCgmState", "Error resetting CGM state: ${e.message}", e)
|
|
1027
|
+
captureModuleException("resetCgmState", e)
|
|
887
1028
|
}
|
|
888
1029
|
}
|
|
889
1030
|
|
|
@@ -943,7 +1084,8 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
943
1084
|
promise.resolve(resultArray)
|
|
944
1085
|
|
|
945
1086
|
} catch (e: Exception) {
|
|
946
|
-
Log.e("getCgmLogFiles", "Error getting log files: ${e.message}")
|
|
1087
|
+
Log.e("getCgmLogFiles", "Error getting log files: ${e.message}", e)
|
|
1088
|
+
captureModuleException("getCgmLogFiles", e)
|
|
947
1089
|
promise.reject("ERROR_GET_LOG_FILES", e.message, e)
|
|
948
1090
|
}
|
|
949
1091
|
}
|
|
@@ -1052,7 +1194,14 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
1052
1194
|
}
|
|
1053
1195
|
|
|
1054
1196
|
val allResult = AllCGMLogRequest(vendor = "GoodFlip", logs = transformedLogs)
|
|
1055
|
-
|
|
1197
|
+
|
|
1198
|
+
// Attach sensorId at the top level of the batch payload sent to /cgm/logs
|
|
1199
|
+
val sensorPayloadJsonObject = JSONObject(Gson().toJson(allResult)).apply {
|
|
1200
|
+
val activeSensorId =
|
|
1201
|
+
prefsHelper?.qrInformation?.sensor ?: lastConnectCgm ?: ""
|
|
1202
|
+
put("sensorId", activeSensorId)
|
|
1203
|
+
}
|
|
1204
|
+
val json = sensorPayloadJsonObject.toString()
|
|
1056
1205
|
|
|
1057
1206
|
// Check if logs array is empty - skip API call if so
|
|
1058
1207
|
if (transformedLogs.isEmpty()) {
|
|
@@ -1079,10 +1228,38 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
1079
1228
|
lastSyncedRecord = batch.lastOrNull()
|
|
1080
1229
|
// Update sync metadata after each successful batch
|
|
1081
1230
|
updateSyncMetadata(lastSyncedRecord)
|
|
1231
|
+
// captureModuleException(
|
|
1232
|
+
// "processBatchDataSynchronously.batchSuccess",
|
|
1233
|
+
// json,
|
|
1234
|
+
// extras =
|
|
1235
|
+
// mapOf(
|
|
1236
|
+
// "batchIndex" to index.toString(),
|
|
1237
|
+
// "lastSyncedRecord" to (lastSyncedRecord?.toString() ?: "")
|
|
1238
|
+
// ),
|
|
1239
|
+
// level = SentryLevel.INFO
|
|
1240
|
+
// )
|
|
1241
|
+
|
|
1082
1242
|
Log.d("Batch Upload", "✅ Batch $index uploaded and synced successfully")
|
|
1083
1243
|
} else {
|
|
1084
1244
|
allBatchesSuccessful = false
|
|
1085
1245
|
Log.e("Batch Upload", "❌ Batch $index failed")
|
|
1246
|
+
val lastSync = prefsHelper?.lastSyncData
|
|
1247
|
+
val contextData =
|
|
1248
|
+
"failure_reason=postCGMData returned failure;" +
|
|
1249
|
+
"batchIndex=$index;" +
|
|
1250
|
+
"batch_records=${batch.size};" +
|
|
1251
|
+
"payload_chars=${json.length};" +
|
|
1252
|
+
"first_glucoseId=${batch.firstOrNull()?.glucoseId ?: ""};" +
|
|
1253
|
+
"last_glucoseId=${batch.lastOrNull()?.glucoseId ?: ""};" +
|
|
1254
|
+
"first_timeInMillis=${batch.firstOrNull()?.timeInMillis ?: ""};" +
|
|
1255
|
+
"last_timeInMillis=${batch.lastOrNull()?.timeInMillis ?: ""};" +
|
|
1256
|
+
"lastSync_glucoseId=${lastSync?.glucoseId ?: ""};" +
|
|
1257
|
+
"lastSync_timeInMillis=${lastSync?.timeInMillis ?: ""}"
|
|
1258
|
+
captureModuleException(
|
|
1259
|
+
"processBatchDataSynchronously.batchUploadFailed",
|
|
1260
|
+
"postCGMData returned failure for batch $index | $contextData",
|
|
1261
|
+
level = SentryLevel.WARNING
|
|
1262
|
+
)
|
|
1086
1263
|
// Continue with next batch instead of breaking (optional based on your needs)
|
|
1087
1264
|
// break
|
|
1088
1265
|
}
|
|
@@ -1091,7 +1268,14 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
1091
1268
|
delay(500L)
|
|
1092
1269
|
|
|
1093
1270
|
} catch (e: Exception) {
|
|
1094
|
-
Log.e("Batch Upload", "❌ Batch $index exception: ${e.message}")
|
|
1271
|
+
Log.e("Batch Upload", "❌ Batch $index exception: ${e.message}", e)
|
|
1272
|
+
captureModuleException(
|
|
1273
|
+
"processBatchDataSynchronously.batch",
|
|
1274
|
+
RuntimeException(
|
|
1275
|
+
"processBatchDataSynchronously.batch failed | batchIndex=$index",
|
|
1276
|
+
e
|
|
1277
|
+
)
|
|
1278
|
+
)
|
|
1095
1279
|
allBatchesSuccessful = false
|
|
1096
1280
|
// Continue processing other batches
|
|
1097
1281
|
}
|
|
@@ -1135,7 +1319,8 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
1135
1319
|
deviceObserver?.let { mModel.device.removeObserver(it) }
|
|
1136
1320
|
Log.d("stopObservingGlucoseData", "Device observer removed successfully")
|
|
1137
1321
|
} catch (e: Exception) {
|
|
1138
|
-
Log.e("stopObservingGlucoseData", "Error removing observers: ${e.message}")
|
|
1322
|
+
Log.e("stopObservingGlucoseData", "Error removing observers: ${e.message}", e)
|
|
1323
|
+
captureModuleException("stopObservingGlucoseData.removeObservers", e)
|
|
1139
1324
|
}
|
|
1140
1325
|
}
|
|
1141
1326
|
|
|
@@ -1144,7 +1329,8 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
1144
1329
|
lastDeviceStatus = null
|
|
1145
1330
|
|
|
1146
1331
|
} catch (e: Exception) {
|
|
1147
|
-
Log.e("stopObservingGlucoseData", "Error stopping observer: ${e.message}")
|
|
1332
|
+
Log.e("stopObservingGlucoseData", "Error stopping observer: ${e.message}", e)
|
|
1333
|
+
captureModuleException("stopObservingGlucoseData", e)
|
|
1148
1334
|
}
|
|
1149
1335
|
}
|
|
1150
1336
|
|
|
@@ -1171,7 +1357,14 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
1171
1357
|
}
|
|
1172
1358
|
)
|
|
1173
1359
|
} catch (e: Exception) {
|
|
1174
|
-
Log.e("uploadBatchSynchronously", "Exception in batch $batchIndex: ${e.message}")
|
|
1360
|
+
Log.e("uploadBatchSynchronously", "Exception in batch $batchIndex: ${e.message}", e)
|
|
1361
|
+
captureModuleException(
|
|
1362
|
+
"uploadBatchSynchronously",
|
|
1363
|
+
RuntimeException(
|
|
1364
|
+
"uploadBatchSynchronously failed | batchIndex=$batchIndex",
|
|
1365
|
+
e
|
|
1366
|
+
)
|
|
1367
|
+
)
|
|
1175
1368
|
continuation.resume(false)
|
|
1176
1369
|
}
|
|
1177
1370
|
}
|
|
@@ -1198,7 +1391,8 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
1198
1391
|
"Sync metadata updated: glucoseId=${it.glucoseId}, time=${it.timeInMillis}"
|
|
1199
1392
|
)
|
|
1200
1393
|
} catch (e: Exception) {
|
|
1201
|
-
Log.e("updateSyncMetadata", "Error updating sync metadata: ${e.message}")
|
|
1394
|
+
Log.e("updateSyncMetadata", "Error updating sync metadata: ${e.message}", e)
|
|
1395
|
+
captureModuleException("updateSyncMetadata", e)
|
|
1202
1396
|
}
|
|
1203
1397
|
}
|
|
1204
1398
|
}
|
|
@@ -1281,8 +1475,14 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
|
|
|
1281
1475
|
mReactContext?.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
1282
1476
|
?.emit(eventName, map)
|
|
1283
1477
|
} catch (e: Exception) {
|
|
1284
|
-
Log.e("Error sendDataToReact: ", e.message.toString())
|
|
1285
|
-
|
|
1478
|
+
Log.e("Error sendDataToReact: ", e.message.toString(), e)
|
|
1479
|
+
captureModuleException(
|
|
1480
|
+
"sendDataToReact",
|
|
1481
|
+
RuntimeException(
|
|
1482
|
+
"sendDataToReact failed | eventName=$eventName;status=$status",
|
|
1483
|
+
e
|
|
1484
|
+
)
|
|
1485
|
+
)
|
|
1286
1486
|
}
|
|
1287
1487
|
}
|
|
1288
1488
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
package com.mytatvarnsdk.utils
|
|
2
2
|
|
|
3
3
|
import androidx.annotation.Keep
|
|
4
|
+
import okhttp3.OkHttpClient
|
|
4
5
|
import retrofit2.Retrofit
|
|
5
6
|
import retrofit2.converter.gson.GsonConverterFactory
|
|
7
|
+
import java.util.concurrent.TimeUnit
|
|
6
8
|
|
|
7
9
|
@Keep
|
|
8
10
|
class RetrofitInstance {
|
|
@@ -10,9 +12,19 @@ class RetrofitInstance {
|
|
|
10
12
|
companion object {
|
|
11
13
|
val BASE_URL = "https://www.google.com"
|
|
12
14
|
|
|
15
|
+
// Shared OkHttpClient with 30s timeouts for all CGM APIs
|
|
16
|
+
private val httpClient: OkHttpClient by lazy {
|
|
17
|
+
OkHttpClient.Builder()
|
|
18
|
+
.connectTimeout(30, TimeUnit.SECONDS)
|
|
19
|
+
.readTimeout(30, TimeUnit.SECONDS)
|
|
20
|
+
.writeTimeout(30, TimeUnit.SECONDS)
|
|
21
|
+
.build()
|
|
22
|
+
}
|
|
23
|
+
|
|
13
24
|
fun getRetroInstance(): Retrofit {
|
|
14
25
|
return Retrofit.Builder()
|
|
15
26
|
.baseUrl(BASE_URL)
|
|
27
|
+
.client(httpClient)
|
|
16
28
|
.addConverterFactory(GsonConverterFactory.create())
|
|
17
29
|
.build()
|
|
18
30
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -624,7 +624,17 @@
|
|
|
624
624
|
app:layout_constraintEnd_toEndOf="parent"
|
|
625
625
|
app:layout_constraintStart_toStartOf="parent"
|
|
626
626
|
app:layout_constraintTop_toTopOf="parent"
|
|
627
|
-
app:srcCompat="@drawable/ic_transmitter"
|
|
627
|
+
app:srcCompat="@drawable/ic_transmitter"
|
|
628
|
+
android:visibility="gone" />
|
|
629
|
+
|
|
630
|
+
<androidx.appcompat.widget.AppCompatImageView
|
|
631
|
+
android:id="@+id/ivPodDetectError"
|
|
632
|
+
android:layout_width="100dp"
|
|
633
|
+
android:layout_height="100dp"
|
|
634
|
+
app:layout_constraintEnd_toEndOf="parent"
|
|
635
|
+
app:layout_constraintStart_toStartOf="parent"
|
|
636
|
+
app:layout_constraintTop_toTopOf="parent"
|
|
637
|
+
app:srcCompat="@drawable/img_cgm_pod_detect_error" />
|
|
628
638
|
|
|
629
639
|
<TextView
|
|
630
640
|
android:layout_width="wrap_content"
|
|
@@ -641,7 +651,7 @@
|
|
|
641
651
|
app:layout_constraintBottom_toBottomOf="parent"
|
|
642
652
|
app:layout_constraintEnd_toEndOf="parent"
|
|
643
653
|
app:layout_constraintStart_toStartOf="parent"
|
|
644
|
-
app:layout_constraintTop_toBottomOf="@id/
|
|
654
|
+
app:layout_constraintTop_toBottomOf="@id/ivPodDetectError" />
|
|
645
655
|
|
|
646
656
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
647
657
|
|
package/ios/Support/API.swift
CHANGED
|
@@ -117,8 +117,20 @@ class API {
|
|
|
117
117
|
|
|
118
118
|
print("===>Raw JSON: \(data)")
|
|
119
119
|
|
|
120
|
+
// Attach sensorId at top level for /cgm/logs, using same behavior as Android
|
|
121
|
+
let activeSensorId = UserDefaults.standard.string(forKey: "sensorId") ?? ""
|
|
122
|
+
var finalJsonString = jsonString
|
|
123
|
+
if !activeSensorId.isEmpty,
|
|
124
|
+
let baseObject = try? JSONSerialization.jsonObject(with: jsonData, options: []) as? [String: Any] {
|
|
125
|
+
var updatedObject = baseObject
|
|
126
|
+
updatedObject["sensorId"] = activeSensorId
|
|
127
|
+
if let updatedData = try? JSONSerialization.data(withJSONObject: updatedObject, options: []),
|
|
128
|
+
let updatedString = String(data: updatedData, encoding: .utf8) {
|
|
129
|
+
finalJsonString = updatedString
|
|
130
|
+
}
|
|
131
|
+
}
|
|
120
132
|
|
|
121
|
-
guard let encrypted = Crypto.shared.getEncryptedText(data:
|
|
133
|
+
guard let encrypted = Crypto.shared.getEncryptedText(data: finalJsonString, encryptionKey: encryptionKey, encryptionIv: encryptionIv) else { return }
|
|
122
134
|
print("===>Encrypted: \(encrypted)")
|
|
123
135
|
|
|
124
136
|
if let decrypted = Crypto.shared.getDecryptedData(cipherText: encrypted, encryptionKey: encryptionKey, encryptionIv: encryptionIv) {
|
|
@@ -133,6 +145,7 @@ class API {
|
|
|
133
145
|
|
|
134
146
|
var request = URLRequest(url: url)
|
|
135
147
|
request.httpMethod = "POST"
|
|
148
|
+
request.timeoutInterval = 30
|
|
136
149
|
request.setValue(envType.lowercased() == "uat" ? STAGE_API_KEY : PROD_API_KEY, forHTTPHeaderField: "api-key")
|
|
137
150
|
// request.setValue(environment == .stage ? STAGE_API_KEY : PROD_API_KEY, forHTTPHeaderField: "api-key")
|
|
138
151
|
request.setValue(token, forHTTPHeaderField: "token")
|
|
@@ -197,6 +210,7 @@ class API {
|
|
|
197
210
|
let url = URL(string: urlString)!
|
|
198
211
|
var request = URLRequest(url: url)
|
|
199
212
|
request.httpMethod = "POST"
|
|
213
|
+
request.timeoutInterval = 30
|
|
200
214
|
|
|
201
215
|
// Set headers
|
|
202
216
|
request.addValue("text/plain", forHTTPHeaderField: "Content-Type")
|
|
@@ -260,6 +274,7 @@ class API {
|
|
|
260
274
|
let url = URL(string: "https://api-feature2.mytatva.in/api/v8/cgm/status")!
|
|
261
275
|
var request = URLRequest(url: url)
|
|
262
276
|
request.httpMethod = "GET"
|
|
277
|
+
request.timeoutInterval = 30
|
|
263
278
|
|
|
264
279
|
// Set headers
|
|
265
280
|
//request.addValue("application/json", forHTTPHeaderField: "Content-Type")
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -113,7 +113,6 @@ const observeTransmitterUnbindStatusHandler = async (token, apiResponse, patient
|
|
|
113
113
|
};
|
|
114
114
|
exports.observeTransmitterUnbindStatusHandler = observeTransmitterUnbindStatusHandler;
|
|
115
115
|
const observeResetLogoutHandler = async () => {
|
|
116
|
-
console.log('observeResetLogoutHandler====');
|
|
117
116
|
try {
|
|
118
117
|
const result = await cgmLib.resetCgmState();
|
|
119
118
|
console.log(result);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","eventSubscription","LINKING_ERROR","Platform","select","ios","default","cgmLib","NativeModules","CgmTrackyLib","Proxy","get","Error","initializeCGMEventListener","callback","iosEventEmitter","NativeEventEmitter","remove","OS","DeviceEventEmitter","addListener","eventData","status","removeCGMEventListener","startCGM","token","envType","userData","console","log","result","startCgmTracky","error","exports","reconnectCGM","reconnectCgmTracky","observeAllGlucoseDataHandler","isCleanData","observeAllGlucoseData","deviceStatus","observeDeviceStatus","helpCGM","openHelpSupport","observeTransmitterUnbindStatusHandler","apiResponse","patientId","observeTransmitterUnbindStatus","observeResetLogoutHandler","resetCgmState","getSqliteDBPath","getTrackLibDbPath","stopCGM","getCgmLogFilePaths","getCgmLogFiles","length"],"sources":["CGMConnect.ts"],"sourcesContent":["import {\n DeviceEventEmitter,\n EmitterSubscription,\n NativeEventEmitter,\n NativeModules,\n Platform,\n} from 'react-native';\n\nlet eventSubscription: EmitterSubscription | null = null;\n\nconst LINKING_ERROR =\n `The package 'react-native-mytatva-rn-sdk' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo Go\\n';\n\nconst cgmLib = NativeModules.CgmTrackyLib\n ? NativeModules.CgmTrackyLib\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nfunction initializeCGMEventListener(callback: (eventData: any) => void) {\n const iosEventEmitter = new NativeEventEmitter(cgmLib);\n if (eventSubscription) {\n eventSubscription.remove();\n }\n\n if (Platform.OS === 'android') {\n eventSubscription = DeviceEventEmitter.addListener(\n 'cgmDeviceEvent',\n (eventData: any) => {\n const { status } = eventData;\n if (status === 'WARM_PERIOD_STARTED') {\n callback(eventData);\n } else {\n callback(eventData);\n }\n }\n );\n } else if (Platform.OS === 'ios' && iosEventEmitter) {\n eventSubscription = iosEventEmitter.addListener(\n 'cgmDeviceEvent',\n (eventData: any) => {\n const { status } = eventData;\n if (status === 'WARM_PERIOD_STARTED') {\n callback(eventData);\n } else {\n callback(eventData);\n }\n }\n );\n }\n}\n\nfunction removeCGMEventListener() {\n if (eventSubscription) {\n eventSubscription.remove();\n eventSubscription = null;\n }\n}\n\nconst startCGM = async (token: string, envType: string, userData: any) => {\n console.log('startCGM===');\n try {\n const result = await cgmLib.startCgmTracky(token, envType, userData);\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst reconnectCGM = async (token: string, envType: string, userData: any) => {\n console.log('reconnectCGM====');\n try {\n const result = await cgmLib.reconnectCgmTracky(token, envType, userData);\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeAllGlucoseDataHandler = async (\n token: string,\n isCleanData: boolean,\n envType: string,\n userData: any\n) => {\n console.log('observeAllGlucoseDataHandler====');\n try {\n if (Platform.OS === 'android') {\n const result = await cgmLib.observeAllGlucoseData(\n token,\n isCleanData,\n envType,\n userData\n );\n const deviceStatus = await cgmLib.observeDeviceStatus(token, envType);\n console.log(result);\n console.log(deviceStatus);\n } else if (Platform.OS === 'ios') {\n const result = await cgmLib.observeAllGlucoseData(\n token,\n isCleanData,\n envType\n );\n console.log(result);\n }\n } catch (error) {\n console.log('error====', error);\n console.error(error);\n }\n};\n\nconst helpCGM = async (token: string, envType: string) => {\n console.log('helpCGM====');\n try {\n const result = await cgmLib.openHelpSupport();\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeTransmitterUnbindStatusHandler = async (\n token: string,\n apiResponse: string,\n patientId: string,\n envType: string,\n userData: any\n) => {\n console.log('observeTransmitterUnbindStatusHandler====');\n try {\n const result =\n Platform.OS === 'android'\n ? await cgmLib.observeTransmitterUnbindStatus(\n token,\n apiResponse,\n patientId,\n envType,\n userData\n )\n : await cgmLib.observeTransmitterUnbindStatus(\n token,\n apiResponse,\n patientId,\n envType\n );\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeResetLogoutHandler = async () => {\n console.log('observeResetLogoutHandler====');\n try {\n const result = await cgmLib.resetCgmState();\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst getSqliteDBPath = async (): Promise<string> => {\n const result = await cgmLib.getTrackLibDbPath();\n return result;\n};\n\nconst stopCGM = async () => {\n // Implementation\n};\n\n/**\n * Get all CGM log file paths\n * Returns array of absolute file paths to CGM log files (CSV format)\n * Use react-native-fs or similar in your main app to read these files\n *\n * @returns Promise<string[]> - Array of absolute file paths\n *\n * @example\n * const logPaths = await getCgmLogFilePaths();\n * // Android: ['/storage/emulated/0/Android/data/.../Documents/12345_POCTech.csv']\n * // iOS: ['/var/mobile/Containers/Data/Application/.../Documents/runLog/1_SensorID.csv']\n */\nconst getCgmLogFilePaths = async (): Promise<string[]> => {\n try {\n const result = await cgmLib.getCgmLogFiles();\n console.log(`CGM Log Files: ${result.length} files found`);\n return result;\n } catch (error) {\n console.error('Error getting CGM log file paths:', error);\n throw error;\n }\n};\n\nexport {\n startCGM,\n stopCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath,\n getCgmLogFilePaths,\n};\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAQA,IAAIC,iBAA6C,GAAG,IAAI;AAExD,MAAMC,aAAa,GACjB,sFAAsF,GACtFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,MAAM,GAAGC,0BAAa,CAACC,YAAY,GACrCD,0BAAa,CAACC,YAAY,GAC1B,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACV,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,SAASW,0BAA0BA,CAACC,QAAkC,EAAE;EACtE,MAAMC,eAAe,GAAG,IAAIC,+BAAkB,CAACT,MAAM,CAAC;EACtD,IAAI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MC,MAAM,GAAG,MAAMvB,MAAM,CAACyC,aAAa,CAAC,CAAC;IAC3CpB,OAAO,CAACC,GAAG,CAACC,MAAM,CAAC;EACrB,CAAC,CAAC,OAAOE,KAAK,EAAE;IACdJ,OAAO,CAACI,KAAK,CAACA,KAAK,CAAC;EACtB;AACF,CAAC;AAACC,OAAA,CAAAc,yBAAA,GAAAA,yBAAA;AAEF,MAAME,eAAe,GAAG,MAAAA,CAAA,KAA6B;EACnD,MAAMnB,MAAM,GAAG,MAAMvB,MAAM,CAAC2C,iBAAiB,CAAC,CAAC;EAC/C,OAAOpB,MAAM;AACf,CAAC;AAACG,OAAA,CAAAgB,eAAA,GAAAA,eAAA;AAEF,MAAME,OAAO,GAAG,MAAAA,CAAA,KAAY;EAC1B;AAAA,CACD;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXAlB,OAAA,CAAAkB,OAAA,GAAAA,OAAA;AAYA,MAAMC,kBAAkB,GAAG,MAAAA,CAAA,KAA+B;EACxD,IAAI;IACF,MAAMtB,MAAM,GAAG,MAAMvB,MAAM,CAAC8C,cAAc,CAAC,CAAC;IAC5CzB,OAAO,CAACC,GAAG,CAAC,kBAAkBC,MAAM,CAACwB,MAAM,cAAc,CAAC;IAC1D,OAAOxB,MAAM;EACf,CAAC,CAAC,OAAOE,KAAK,EAAE;IACdJ,OAAO,CAACI,KAAK,CAAC,mCAAmC,EAAEA,KAAK,CAAC;IACzD,MAAMA,KAAK;EACb;AACF,CAAC;AAACC,OAAA,CAAAmB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_reactNative","require","eventSubscription","LINKING_ERROR","Platform","select","ios","default","cgmLib","NativeModules","CgmTrackyLib","Proxy","get","Error","initializeCGMEventListener","callback","iosEventEmitter","NativeEventEmitter","remove","OS","DeviceEventEmitter","addListener","eventData","status","removeCGMEventListener","startCGM","token","envType","userData","console","log","result","startCgmTracky","error","exports","reconnectCGM","reconnectCgmTracky","observeAllGlucoseDataHandler","isCleanData","observeAllGlucoseData","deviceStatus","observeDeviceStatus","helpCGM","openHelpSupport","observeTransmitterUnbindStatusHandler","apiResponse","patientId","observeTransmitterUnbindStatus","observeResetLogoutHandler","resetCgmState","getSqliteDBPath","getTrackLibDbPath","stopCGM","getCgmLogFilePaths","getCgmLogFiles","length"],"sources":["CGMConnect.ts"],"sourcesContent":["import {\n DeviceEventEmitter,\n EmitterSubscription,\n NativeEventEmitter,\n NativeModules,\n Platform,\n} from 'react-native';\n\nlet eventSubscription: EmitterSubscription | null = null;\n\nconst LINKING_ERROR =\n `The package 'react-native-mytatva-rn-sdk' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo Go\\n';\n\nconst cgmLib = NativeModules.CgmTrackyLib\n ? NativeModules.CgmTrackyLib\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nfunction initializeCGMEventListener(callback: (eventData: any) => void) {\n const iosEventEmitter = new NativeEventEmitter(cgmLib);\n if (eventSubscription) {\n eventSubscription.remove();\n }\n\n if (Platform.OS === 'android') {\n eventSubscription = DeviceEventEmitter.addListener(\n 'cgmDeviceEvent',\n (eventData: any) => {\n const { status } = eventData;\n if (status === 'WARM_PERIOD_STARTED') {\n callback(eventData);\n } else {\n callback(eventData);\n }\n }\n );\n } else if (Platform.OS === 'ios' && iosEventEmitter) {\n eventSubscription = iosEventEmitter.addListener(\n 'cgmDeviceEvent',\n (eventData: any) => {\n const { status } = eventData;\n if (status === 'WARM_PERIOD_STARTED') {\n callback(eventData);\n } else {\n callback(eventData);\n }\n }\n );\n }\n}\n\nfunction removeCGMEventListener() {\n if (eventSubscription) {\n eventSubscription.remove();\n eventSubscription = null;\n }\n}\n\nconst startCGM = async (token: string, envType: string, userData: any) => {\n console.log('startCGM===');\n try {\n const result = await cgmLib.startCgmTracky(token, envType, userData);\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst reconnectCGM = async (token: string, envType: string, userData: any) => {\n console.log('reconnectCGM====');\n try {\n const result = await cgmLib.reconnectCgmTracky(token, envType, userData);\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeAllGlucoseDataHandler = async (\n token: string,\n isCleanData: boolean,\n envType: string,\n userData: any\n) => {\n console.log('observeAllGlucoseDataHandler====');\n try {\n if (Platform.OS === 'android') {\n const result = await cgmLib.observeAllGlucoseData(\n token,\n isCleanData,\n envType,\n userData\n );\n const deviceStatus = await cgmLib.observeDeviceStatus(token, envType);\n console.log(result);\n console.log(deviceStatus);\n } else if (Platform.OS === 'ios') {\n const result = await cgmLib.observeAllGlucoseData(\n token,\n isCleanData,\n envType\n );\n console.log(result);\n }\n } catch (error) {\n console.log('error====', error);\n console.error(error);\n }\n};\n\nconst helpCGM = async (token: string, envType: string) => {\n console.log('helpCGM====');\n try {\n const result = await cgmLib.openHelpSupport();\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeTransmitterUnbindStatusHandler = async (\n token: string,\n apiResponse: string,\n patientId: string,\n envType: string,\n userData: any\n) => {\n console.log('observeTransmitterUnbindStatusHandler====');\n try {\n const result =\n Platform.OS === 'android'\n ? await cgmLib.observeTransmitterUnbindStatus(\n token,\n apiResponse,\n patientId,\n envType,\n userData\n )\n : await cgmLib.observeTransmitterUnbindStatus(\n token,\n apiResponse,\n patientId,\n envType\n );\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeResetLogoutHandler = async () => {\n try {\n const result = await cgmLib.resetCgmState();\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst getSqliteDBPath = async (): Promise<string> => {\n const result = await cgmLib.getTrackLibDbPath();\n return result;\n};\n\nconst stopCGM = async () => {\n // Implementation\n};\n\n/**\n * Get all CGM log file paths\n * Returns array of absolute file paths to CGM log files (CSV format)\n * Use react-native-fs or similar in your main app to read these files\n *\n * @returns Promise<string[]> - Array of absolute file paths\n *\n * @example\n * const logPaths = await getCgmLogFilePaths();\n * // Android: ['/storage/emulated/0/Android/data/.../Documents/12345_POCTech.csv']\n * // iOS: ['/var/mobile/Containers/Data/Application/.../Documents/runLog/1_SensorID.csv']\n */\nconst getCgmLogFilePaths = async (): Promise<string[]> => {\n try {\n const result = await cgmLib.getCgmLogFiles();\n console.log(`CGM Log Files: ${result.length} files found`);\n return result;\n } catch (error) {\n console.error('Error getting CGM log file paths:', error);\n throw error;\n }\n};\n\nexport {\n startCGM,\n stopCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath,\n getCgmLogFilePaths,\n};\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAQA,IAAIC,iBAA6C,GAAG,IAAI;AAExD,MAAMC,aAAa,GACjB,sFAAsF,GACtFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,MAAM,GAAGC,0BAAa,CAACC,YAAY,GACrCD,0BAAa,CAACC,YAAY,GAC1B,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACV,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,SAASW,0BAA0BA,CAACC,QAAkC,EAAE;EACtE,MAAMC,eAAe,GAAG,IAAIC,+BAAkB,CAACT,MAAM,CAAC;EACtD,IAAIN,iBAAiB,EAAE;IACrBA,iBAAiB,CAACgB,MAAM,CAAC,CAAC;EAC5B;EAEA,IAAId,qBAAQ,CAACe,EAAE,KAAK,SAAS,EAAE;IAC7BjB,iBAAiB,GAAGkB,+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F,CAAC;AAACC,OAAA,CAAAc,yBAAA,GAAAA,yBAAA;AAEF,MAAME,eAAe,GAAG,MAAAA,CAAA,KAA6B;EACnD,MAAMnB,MAAM,GAAG,MAAMvB,MAAM,CAAC2C,iBAAiB,CAAC,CAAC;EAC/C,OAAOpB,MAAM;AACf,CAAC;AAACG,OAAA,CAAAgB,eAAA,GAAAA,eAAA;AAEF,MAAME,OAAO,GAAG,MAAAA,CAAA,KAAY;EAC1B;AAAA,CACD;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXAlB,OAAA,CAAAkB,OAAA,GAAAA,OAAA;AAYA,MAAMC,kBAAkB,GAAG,MAAAA,CAAA,KAA+B;EACxD,IAAI;IACF,MAAMtB,MAAM,GAAG,MAAMvB,MAAM,CAAC8C,cAAc,CAAC,CAAC;IAC5CzB,OAAO,CAACC,GAAG,CAAC,kBAAkBC,MAAM,CAACwB,MAAM,cAAc,CAAC;IAC1D,OAAOxB,MAAM;EACf,CAAC,CAAC,OAAOE,KAAK,EAAE;IACdJ,OAAO,CAACI,KAAK,CAAC,mCAAmC,EAAEA,KAAK,CAAC;IACzD,MAAMA,KAAK;EACb;AACF,CAAC;AAACC,OAAA,CAAAmB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
package/lib/module/CGMConnect.js
CHANGED
|
@@ -98,7 +98,6 @@ const observeTransmitterUnbindStatusHandler = async (token, apiResponse, patient
|
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
100
|
const observeResetLogoutHandler = async () => {
|
|
101
|
-
console.log('observeResetLogoutHandler====');
|
|
102
101
|
try {
|
|
103
102
|
const result = await cgmLib.resetCgmState();
|
|
104
103
|
console.log(result);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DeviceEventEmitter","NativeEventEmitter","NativeModules","Platform","eventSubscription","LINKING_ERROR","select","ios","default","cgmLib","CgmTrackyLib","Proxy","get","Error","initializeCGMEventListener","callback","iosEventEmitter","remove","OS","addListener","eventData","status","removeCGMEventListener","startCGM","token","envType","userData","console","log","result","startCgmTracky","error","reconnectCGM","reconnectCgmTracky","observeAllGlucoseDataHandler","isCleanData","observeAllGlucoseData","deviceStatus","observeDeviceStatus","helpCGM","openHelpSupport","observeTransmitterUnbindStatusHandler","apiResponse","patientId","observeTransmitterUnbindStatus","observeResetLogoutHandler","resetCgmState","getSqliteDBPath","getTrackLibDbPath","stopCGM","getCgmLogFilePaths","getCgmLogFiles","length"],"sources":["CGMConnect.ts"],"sourcesContent":["import {\n DeviceEventEmitter,\n EmitterSubscription,\n NativeEventEmitter,\n NativeModules,\n Platform,\n} from 'react-native';\n\nlet eventSubscription: EmitterSubscription | null = null;\n\nconst LINKING_ERROR =\n `The package 'react-native-mytatva-rn-sdk' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo Go\\n';\n\nconst cgmLib = NativeModules.CgmTrackyLib\n ? NativeModules.CgmTrackyLib\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nfunction initializeCGMEventListener(callback: (eventData: any) => void) {\n const iosEventEmitter = new NativeEventEmitter(cgmLib);\n if (eventSubscription) {\n eventSubscription.remove();\n }\n\n if (Platform.OS === 'android') {\n eventSubscription = DeviceEventEmitter.addListener(\n 'cgmDeviceEvent',\n (eventData: any) => {\n const { status } = eventData;\n if (status === 'WARM_PERIOD_STARTED') {\n callback(eventData);\n } else {\n callback(eventData);\n }\n }\n );\n } else if (Platform.OS === 'ios' && iosEventEmitter) {\n eventSubscription = iosEventEmitter.addListener(\n 'cgmDeviceEvent',\n (eventData: any) => {\n const { status } = eventData;\n if (status === 'WARM_PERIOD_STARTED') {\n callback(eventData);\n } else {\n callback(eventData);\n }\n }\n );\n }\n}\n\nfunction removeCGMEventListener() {\n if (eventSubscription) {\n eventSubscription.remove();\n eventSubscription = null;\n }\n}\n\nconst startCGM = async (token: string, envType: string, userData: any) => {\n console.log('startCGM===');\n try {\n const result = await cgmLib.startCgmTracky(token, envType, userData);\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst reconnectCGM = async (token: string, envType: string, userData: any) => {\n console.log('reconnectCGM====');\n try {\n const result = await cgmLib.reconnectCgmTracky(token, envType, userData);\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeAllGlucoseDataHandler = async (\n token: string,\n isCleanData: boolean,\n envType: string,\n userData: any\n) => {\n console.log('observeAllGlucoseDataHandler====');\n try {\n if (Platform.OS === 'android') {\n const result = await cgmLib.observeAllGlucoseData(\n token,\n isCleanData,\n envType,\n userData\n );\n const deviceStatus = await cgmLib.observeDeviceStatus(token, envType);\n console.log(result);\n console.log(deviceStatus);\n } else if (Platform.OS === 'ios') {\n const result = await cgmLib.observeAllGlucoseData(\n token,\n isCleanData,\n envType\n );\n console.log(result);\n }\n } catch (error) {\n console.log('error====', error);\n console.error(error);\n }\n};\n\nconst helpCGM = async (token: string, envType: string) => {\n console.log('helpCGM====');\n try {\n const result = await cgmLib.openHelpSupport();\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeTransmitterUnbindStatusHandler = async (\n token: string,\n apiResponse: string,\n patientId: string,\n envType: string,\n userData: any\n) => {\n console.log('observeTransmitterUnbindStatusHandler====');\n try {\n const result =\n Platform.OS === 'android'\n ? await cgmLib.observeTransmitterUnbindStatus(\n token,\n apiResponse,\n patientId,\n envType,\n userData\n )\n : await cgmLib.observeTransmitterUnbindStatus(\n token,\n apiResponse,\n patientId,\n envType\n );\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeResetLogoutHandler = async () => {\n console.log('observeResetLogoutHandler====');\n try {\n const result = await cgmLib.resetCgmState();\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst getSqliteDBPath = async (): Promise<string> => {\n const result = await cgmLib.getTrackLibDbPath();\n return result;\n};\n\nconst stopCGM = async () => {\n // Implementation\n};\n\n/**\n * Get all CGM log file paths\n * Returns array of absolute file paths to CGM log files (CSV format)\n * Use react-native-fs or similar in your main app to read these files\n *\n * @returns Promise<string[]> - Array of absolute file paths\n *\n * @example\n * const logPaths = await getCgmLogFilePaths();\n * // Android: ['/storage/emulated/0/Android/data/.../Documents/12345_POCTech.csv']\n * // iOS: ['/var/mobile/Containers/Data/Application/.../Documents/runLog/1_SensorID.csv']\n */\nconst getCgmLogFilePaths = async (): Promise<string[]> => {\n try {\n const result = await cgmLib.getCgmLogFiles();\n console.log(`CGM Log Files: ${result.length} files found`);\n return result;\n } catch (error) {\n console.error('Error getting CGM log file paths:', error);\n throw error;\n }\n};\n\nexport {\n startCGM,\n stopCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath,\n getCgmLogFilePaths,\n};\n"],"mappings":"AAAA,SACEA,kBAAkB,EAElBC,kBAAkB,EAClBC,aAAa,EACbC,QAAQ,QACH,cAAc;AAErB,IAAIC,iBAA6C,GAAG,IAAI;AAExD,MAAMC,aAAa,GACjB,sFAAsF,GACtFF,QAAQ,CAACG,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,MAAM,GAAGP,aAAa,CAACQ,YAAY,GACrCR,aAAa,CAACQ,YAAY,GAC1B,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACR,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,SAASS,0BAA0BA,CAACC,QAAkC,EAAE;EACtE,MAAMC,eAAe,GAAG,IAAIf,kBAAkB,CAACQ,MAAM,CAAC;EACtD,IAAIL,iBAAiB,EAA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AG,MAAAA,CAAA,KAA6B;EACnD,MAAMlB,MAAM,GAAG,MAAMpB,MAAM,CAACuC,iBAAiB,CAAC,CAAC;EAC/C,OAAOnB,MAAM;AACf,CAAC;AAED,MAAMoB,OAAO,GAAG,MAAAA,CAAA,KAAY;EAC1B;AAAA,CACD;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG,MAAAA,CAAA,KAA+B;EACxD,IAAI;IACF,MAAMrB,MAAM,GAAG,MAAMpB,MAAM,CAAC0C,cAAc,CAAC,CAAC;IAC5CxB,OAAO,CAACC,GAAG,CAAC,kBAAkBC,MAAM,CAACuB,MAAM,cAAc,CAAC;IAC1D,OAAOvB,MAAM;EACf,CAAC,CAAC,OAAOE,KAAK,EAAE;IACdJ,OAAO,CAACI,KAAK,CAAC,mCAAmC,EAAEA,KAAK,CAAC;IACzD,MAAMA,KAAK;EACb;AACF,CAAC;AAED,SACER,QAAQ,EACR0B,OAAO,EACPnC,0BAA0B,EAC1BQ,sBAAsB,EACtBY,4BAA4B,EAC5BF,YAAY,EACZO,OAAO,EACPE,qCAAqC,EACrCI,yBAAyB,EACzBE,eAAe,EACfG,kBAAkB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["DeviceEventEmitter","NativeEventEmitter","NativeModules","Platform","eventSubscription","LINKING_ERROR","select","ios","default","cgmLib","CgmTrackyLib","Proxy","get","Error","initializeCGMEventListener","callback","iosEventEmitter","remove","OS","addListener","eventData","status","removeCGMEventListener","startCGM","token","envType","userData","console","log","result","startCgmTracky","error","reconnectCGM","reconnectCgmTracky","observeAllGlucoseDataHandler","isCleanData","observeAllGlucoseData","deviceStatus","observeDeviceStatus","helpCGM","openHelpSupport","observeTransmitterUnbindStatusHandler","apiResponse","patientId","observeTransmitterUnbindStatus","observeResetLogoutHandler","resetCgmState","getSqliteDBPath","getTrackLibDbPath","stopCGM","getCgmLogFilePaths","getCgmLogFiles","length"],"sources":["CGMConnect.ts"],"sourcesContent":["import {\n DeviceEventEmitter,\n EmitterSubscription,\n NativeEventEmitter,\n NativeModules,\n Platform,\n} from 'react-native';\n\nlet eventSubscription: EmitterSubscription | null = null;\n\nconst LINKING_ERROR =\n `The package 'react-native-mytatva-rn-sdk' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo Go\\n';\n\nconst cgmLib = NativeModules.CgmTrackyLib\n ? NativeModules.CgmTrackyLib\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nfunction initializeCGMEventListener(callback: (eventData: any) => void) {\n const iosEventEmitter = new NativeEventEmitter(cgmLib);\n if (eventSubscription) {\n eventSubscription.remove();\n }\n\n if (Platform.OS === 'android') {\n eventSubscription = DeviceEventEmitter.addListener(\n 'cgmDeviceEvent',\n (eventData: any) => {\n const { status } = eventData;\n if (status === 'WARM_PERIOD_STARTED') {\n callback(eventData);\n } else {\n callback(eventData);\n }\n }\n );\n } else if (Platform.OS === 'ios' && iosEventEmitter) {\n eventSubscription = iosEventEmitter.addListener(\n 'cgmDeviceEvent',\n (eventData: any) => {\n const { status } = eventData;\n if (status === 'WARM_PERIOD_STARTED') {\n callback(eventData);\n } else {\n callback(eventData);\n }\n }\n );\n }\n}\n\nfunction removeCGMEventListener() {\n if (eventSubscription) {\n eventSubscription.remove();\n eventSubscription = null;\n }\n}\n\nconst startCGM = async (token: string, envType: string, userData: any) => {\n console.log('startCGM===');\n try {\n const result = await cgmLib.startCgmTracky(token, envType, userData);\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst reconnectCGM = async (token: string, envType: string, userData: any) => {\n console.log('reconnectCGM====');\n try {\n const result = await cgmLib.reconnectCgmTracky(token, envType, userData);\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeAllGlucoseDataHandler = async (\n token: string,\n isCleanData: boolean,\n envType: string,\n userData: any\n) => {\n console.log('observeAllGlucoseDataHandler====');\n try {\n if (Platform.OS === 'android') {\n const result = await cgmLib.observeAllGlucoseData(\n token,\n isCleanData,\n envType,\n userData\n );\n const deviceStatus = await cgmLib.observeDeviceStatus(token, envType);\n console.log(result);\n console.log(deviceStatus);\n } else if (Platform.OS === 'ios') {\n const result = await cgmLib.observeAllGlucoseData(\n token,\n isCleanData,\n envType\n );\n console.log(result);\n }\n } catch (error) {\n console.log('error====', error);\n console.error(error);\n }\n};\n\nconst helpCGM = async (token: string, envType: string) => {\n console.log('helpCGM====');\n try {\n const result = await cgmLib.openHelpSupport();\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeTransmitterUnbindStatusHandler = async (\n token: string,\n apiResponse: string,\n patientId: string,\n envType: string,\n userData: any\n) => {\n console.log('observeTransmitterUnbindStatusHandler====');\n try {\n const result =\n Platform.OS === 'android'\n ? await cgmLib.observeTransmitterUnbindStatus(\n token,\n apiResponse,\n patientId,\n envType,\n userData\n )\n : await cgmLib.observeTransmitterUnbindStatus(\n token,\n apiResponse,\n patientId,\n envType\n );\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst observeResetLogoutHandler = async () => {\n try {\n const result = await cgmLib.resetCgmState();\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst getSqliteDBPath = async (): Promise<string> => {\n const result = await cgmLib.getTrackLibDbPath();\n return result;\n};\n\nconst stopCGM = async () => {\n // Implementation\n};\n\n/**\n * Get all CGM log file paths\n * Returns array of absolute file paths to CGM log files (CSV format)\n * Use react-native-fs or similar in your main app to read these files\n *\n * @returns Promise<string[]> - Array of absolute file paths\n *\n * @example\n * const logPaths = await getCgmLogFilePaths();\n * // Android: ['/storage/emulated/0/Android/data/.../Documents/12345_POCTech.csv']\n * // iOS: ['/var/mobile/Containers/Data/Application/.../Documents/runLog/1_SensorID.csv']\n */\nconst getCgmLogFilePaths = async (): Promise<string[]> => {\n try {\n const result = await cgmLib.getCgmLogFiles();\n console.log(`CGM Log Files: ${result.length} files found`);\n return result;\n } catch (error) {\n console.error('Error getting CGM log file paths:', error);\n throw error;\n }\n};\n\nexport {\n startCGM,\n stopCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath,\n getCgmLogFilePaths,\n};\n"],"mappings":"AAAA,SACEA,kBAAkB,EAElBC,kBAAkB,EAClBC,aAAa,EACbC,QAAQ,QACH,cAAc;AAErB,IAAIC,iBAA6C,GAAG,IAAI;AAExD,MAAMC,aAAa,GACjB,sFAAsF,GACtFF,QAAQ,CAACG,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,MAAM,GAAGP,aAAa,CAACQ,YAAY,GACrCR,aAAa,CAACQ,YAAY,GAC1B,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACR,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,SAASS,0BAA0BA,CAACC,QAAkC,EAAE;EACtE,MAAMC,eAAe,GAAG,IAAIf,kBAAkB,CAACQ,MAAM,CAAC;EACtD,IAAIL,iBAAiB,EAAE;IACrBA,iBAAiB,CAACa,MAAM,CAAC,CAAC;EAC5B;EAEA,IAAId,QAAQ,CAACe,EAAE,KAAK,SAAS,EAAE;IAC7Bd,iBAAiB,GAAGJ,kBAAkB,CAACmB,WAAW,CAChD,gBAAgB,EACfC,SAAc,IAAK;MAClB,MAAM;QAAEC;MAAO,CAAC,GAAGD,SAAS;MAC5B,IAAIC,MAAM,KAAK,qBAAqB,EAAE;QACpCN,QAAQ,CAACK,SAAS,CAAC;MACrB,CAAC,MAAM;QACLL,QAAQ,CAACK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