react-native-mytatva-rn-sdk 1.2.85 → 1.2.87

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.
@@ -79,6 +79,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
79
79
  private val isBatchProcessing = AtomicBoolean(false)
80
80
  private var lastDeviceStatus: String? = null
81
81
  private var glucoseObserver: Observer<PocGlucose?>? = null
82
+ private var deviceObserver: Observer<PocDevice?>? = null
82
83
  private var isObserving = false
83
84
  private val processedGlucoseIds = ConcurrentHashMap.newKeySet<Int>()
84
85
  private val pendingDataQueue = ConcurrentLinkedQueue<PocGlucose>()
@@ -93,14 +94,14 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
93
94
  val factory =
94
95
  ViewModelProvider.AndroidViewModelFactory.getInstance(reactContext.applicationContext as Application)
95
96
  mModel = ViewModelProvider(viewModelStore, factory)[MainActivityModel::class.java]
96
- authenticateSDKService = AuthenticateSDKService(scope = scope)
97
+ authenticateSDKService = AuthenticateSDKService(scope = apiScope)
97
98
  }
98
99
 
99
100
  companion object {
100
101
  var mReactContext: ReactApplicationContext? = null
101
102
  var userToken: String = ""
102
103
  var env: String = ""
103
- var supportProgramType: String = ""
104
+ var lastConnectCgm: String = ""
104
105
  }
105
106
 
106
107
  override fun getName(): String {
@@ -110,17 +111,17 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
110
111
  private fun updateUserData(data: ReadableMap?) {
111
112
  currentUserData = data
112
113
  // Always reset so stale values from a previous user don't persist
113
- supportProgramType = ""
114
+ lastConnectCgm = ""
114
115
  try {
115
116
  if (data != null && data.hasKey("patient_meta_info")) {
116
117
  val patientMetaInfo = data.getMap("patient_meta_info")
117
- if (patientMetaInfo != null && patientMetaInfo.hasKey("support_program_type")) {
118
- supportProgramType = patientMetaInfo.getString("support_program_type") ?: ""
119
- Log.d("updateUserData", "supportProgramType: $supportProgramType")
118
+ if (patientMetaInfo != null && patientMetaInfo.hasKey("last_connect_cgm")) {
119
+ lastConnectCgm = patientMetaInfo.getString("last_connect_cgm") ?: ""
120
+ Log.d("updateUserData", "lastConnectCgm: $lastConnectCgm")
120
121
  }
121
122
  }
122
123
  } catch (e: Exception) {
123
- Log.e("updateUserData", "Error extracting support_program_type: ${e.message}")
124
+ Log.e("updateUserData", "Error extracting last_connect_cgm: ${e.message}")
124
125
  }
125
126
  }
126
127
 
@@ -130,17 +131,27 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
130
131
  userToken = token
131
132
  env = envType
132
133
 
133
- // Reset previous state
134
134
  lastDeviceStatus = null
135
135
  debounceJob?.cancel()
136
136
 
137
137
  Handler(Looper.getMainLooper()).post {
138
- mModel.device.observeForever { device ->
138
+ // Remove any previously registered observer to prevent accumulation
139
+ // across multiple calls (e.g. each app relaunch calls this again)
140
+ deviceObserver?.let { mModel.device.removeObserver(it) }
141
+
142
+ deviceObserver = Observer { device ->
139
143
  if (device != null) {
140
- postEventDataToAPI(device, "", device.qrMessage ?: "", envType)
144
+ val sensorId = device.qrMessage?.takeIf { it.isNotEmpty() }
145
+ ?: prefsHelper?.qrInformation?.sensor
146
+ if (!sensorId.isNullOrEmpty()) {
147
+ postEventDataToAPI(device, "", sensorId, envType)
148
+ } else {
149
+ Log.w("observeDeviceStatus", "sensorId is null/empty, skipping API call")
150
+ }
141
151
  Log.d("observeDeviceStatus: ", device.toString())
142
152
  }
143
153
  }
154
+ deviceObserver?.let { mModel.device.observeForever(it) }
144
155
  }
145
156
  } catch (e: Exception) {
146
157
  Log.e("observeDeviceStatus", "observeDeviceStatus: ${e.message}")
@@ -225,16 +236,16 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
225
236
  val startDate = sensor.startDate
226
237
  val endDate = sensor.endDate
227
238
  val sensorId = sensor.sensorId
228
- /* val currentPatientId = patientId
229
- val lastPatientId = prefsHelper?.lastPatientId
230
- val lastSensorId = prefsHelper?.qrInformation?.sensor */
239
+ /* val currentPatientId = patientId
240
+ val lastPatientId = prefsHelper?.lastPatientId
241
+ val lastSensorId = prefsHelper?.qrInformation?.sensor */
231
242
 
232
243
 
233
- /* if (lastPatientId != null && lastSensorId != null && lastPatientId.isNotEmpty() && lastSensorId.isNotEmpty() && (lastPatientId != currentPatientId || lastSensorId != sensorId)) {
234
- Log.d("delete1111", "deleting database");
235
- mModel.clearAllGlucoseAndDeviceData()
236
- return
237
- } */
244
+ /* if (lastPatientId != null && lastSensorId != null && lastPatientId.isNotEmpty() && lastSensorId.isNotEmpty() && (lastPatientId != currentPatientId || lastSensorId != sensorId)) {
245
+ Log.d("delete1111", "deleting database");
246
+ mModel.clearAllGlucoseAndDeviceData()
247
+ return
248
+ } */
238
249
 
239
250
  if (isCurrentDateInRange(startDate, endDate)) {
240
251
  println("Current date is in range")
@@ -250,9 +261,9 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
250
261
  pocDevice.qrMessage, envType
251
262
  )
252
263
  } else {
253
- /* prefsHelper?.lastPatientId = currentPatientId
254
- prefsHelper?.qrInformation?.sensor = sensorId
255
- */
264
+ /* prefsHelper?.lastPatientId = currentPatientId
265
+ prefsHelper?.qrInformation?.sensor = sensorId
266
+ */
256
267
  }
257
268
  } else {
258
269
  postEventDataToAPI(
@@ -337,6 +348,8 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
337
348
  sensorId: String?,
338
349
  envType: String
339
350
  ) {
351
+
352
+ Log.d("sensor id====", sensorId.toString())
340
353
  Log.d("Device event Status", "Last Device event lastDeviceStatus API: $lastDeviceStatus")
341
354
 
342
355
  if (status.isNotEmpty() && status != lastDeviceStatus) {
@@ -356,7 +369,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
356
369
  put("status", status)
357
370
  put("rawData", rawData)
358
371
  }
359
-
372
+ Log.d("commingg", "Yuppp")
360
373
  authenticateSDKService.postDeviceData(
361
374
  environment = if (envType.lowercase() == "uat") TATVA_ENVIRONMENT.STAGE else TATVA_ENVIRONMENT.PROD,
362
375
  data = obj.toString(),
@@ -753,6 +766,8 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
753
766
  }
754
767
  }
755
768
  } else {
769
+ Log.d("observeAllGlucoseData", "ydgdfgf")
770
+ Log.d("observeAllGlucoseData", "Processing ${pendingData.size} pending items")
756
771
  // No batch needed, but process pending data if any
757
772
  if (pendingData.isNotEmpty()) {
758
773
  Log.d("observeAllGlucoseData", "Processing ${pendingData.size} pending items")
@@ -848,31 +863,24 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
848
863
  Log.d("resetCgmState", "Resetting CGM state for logout")
849
864
 
850
865
  try {
851
- // Stop all observations
866
+ // Stop all observations (also removes glucoseObserver + deviceObserver)
852
867
  stopObservingGlucoseData()
853
868
 
854
- // Cancel all coroutines
855
869
  debounceJob?.cancel()
856
870
  debounceJob = null
857
871
 
858
872
  uploadJob?.cancel()
859
873
  uploadJob = null
860
874
 
861
- // Reset user token
862
875
  userToken = ""
863
-
864
- // Reset device status
865
876
  lastDeviceStatus = null
866
877
 
867
- // Clear processed IDs and pending queue
868
878
  processedGlucoseIds.clear()
869
879
  pendingDataQueue.clear()
870
880
 
871
- // Reset batch processing flag
872
881
  isBatchProcessing.set(false)
873
882
 
874
- // Clear any cached data if needed
875
- prefsHelper?.clearQRInformation() // if you have such method
883
+ prefsHelper?.clearQRInformation()
876
884
 
877
885
  } catch (e: Exception) {
878
886
  Log.e("resetCgmState", "Error resetting CGM state: ${e.message}")
@@ -950,8 +958,40 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
950
958
  return true
951
959
  }
952
960
 
961
+ // Filter out records already uploaded in a previous session.
962
+ // processedGlucoseIds is in-memory and resets on process restart, so we use the
963
+ // persisted lastSyncData.glucoseId as an additional cross-restart dedup boundary.
964
+ //
965
+ // IMPORTANT: glucoseId resets to 0 when a new sensor is attached, so the filter
966
+ // must ONLY apply when the record belongs to the SAME device session (same deviceId).
967
+ // If the deviceId differs (new sensor), all records pass through unconditionally.
968
+ val lastSyncData = prefsHelper?.lastSyncData
969
+ val lastSyncedGlucoseId = lastSyncData?.glucoseId
970
+ val lastSyncedDeviceId = lastSyncData?.deviceId
971
+
972
+ val filteredList = if (lastSyncedGlucoseId != null && lastSyncedDeviceId != null) {
973
+ dataList.filter { item ->
974
+ // Different device/sensor → always include (glucoseIds restarted from 0)
975
+ item.deviceId != lastSyncedDeviceId ||
976
+ item.glucoseId == null ||
977
+ item.glucoseId!! > lastSyncedGlucoseId
978
+ }.also {
979
+ val skipped = dataList.size - it.size
980
+ if (skipped > 0) {
981
+ Log.d("processBatchDataSynchronously", "Skipped $skipped already-synced records (deviceId=$lastSyncedDeviceId, glucoseId <= $lastSyncedGlucoseId)")
982
+ }
983
+ }
984
+ } else {
985
+ dataList
986
+ }
987
+
988
+ if (filteredList.isEmpty()) {
989
+ Log.d("processBatchDataSynchronously", "No new data after glucoseId filter, skipping upload")
990
+ return true
991
+ }
992
+
953
993
  val batchSize = 40
954
- val chunks = dataList.chunked(batchSize)
994
+ val chunks = filteredList.chunked(batchSize)
955
995
  var lastSyncedRecord: PocGlucose? = null
956
996
  var allBatchesSuccessful = true
957
997
 
@@ -1082,27 +1122,25 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
1082
1122
  Log.d("stopObservingGlucoseData", "Stopping glucose data observation")
1083
1123
 
1084
1124
  try {
1085
- // Cancel any ongoing coroutines
1086
1125
  debounceJob?.cancel()
1087
1126
  debounceJob = null
1088
1127
 
1089
- // Remove observer on main thread with completion callback
1090
- glucoseObserver?.let { observer ->
1091
- Handler(Looper.getMainLooper()).post {
1092
- try {
1093
- mModel.latestGlucose.removeObserver(observer)
1094
- isObserving = false
1095
- Log.d("stopObservingGlucoseData", "Observer removed successfully")
1096
- } catch (e: Exception) {
1097
- Log.e("stopObservingGlucoseData", "Error removing observer: ${e.message}")
1098
- }
1128
+ Handler(Looper.getMainLooper()).post {
1129
+ try {
1130
+ glucoseObserver?.let { mModel.latestGlucose.removeObserver(it) }
1131
+ isObserving = false
1132
+ Log.d("stopObservingGlucoseData", "Glucose observer removed successfully")
1133
+
1134
+ // Also remove device observer to prevent accumulation
1135
+ deviceObserver?.let { mModel.device.removeObserver(it) }
1136
+ Log.d("stopObservingGlucoseData", "Device observer removed successfully")
1137
+ } catch (e: Exception) {
1138
+ Log.e("stopObservingGlucoseData", "Error removing observers: ${e.message}")
1099
1139
  }
1100
1140
  }
1101
1141
 
1102
- // Reset observer reference
1103
1142
  glucoseObserver = null
1104
-
1105
- // Reset last device status
1143
+ deviceObserver = null
1106
1144
  lastDeviceStatus = null
1107
1145
 
1108
1146
  } catch (e: Exception) {
@@ -299,10 +299,10 @@ class ConnectSensorActivity : BaseBleActivity() {
299
299
  if (requestCode == REQUEST_QR && resultCode == RESULT_OK && data != null) {
300
300
  val device: PocDevice? = data.getParcelableExtra("device")
301
301
  if (device != null) {
302
- val supportProgramType = CgmTrackyLibModule.supportProgramType
303
- Log.d("ConnectSensor", "supportProgramType: $supportProgramType")
302
+ val lastConnectCgm = CgmTrackyLibModule.lastConnectCgm
303
+ Log.d("ConnectSensor", "lastConnectCgm: $lastConnectCgm")
304
304
 
305
- if (supportProgramType.equals("Diasens", ignoreCase = true)) {
305
+ if (lastConnectCgm.equals("Diasens", ignoreCase = true)) {
306
306
  // Diasens user - validate sensor ID against API
307
307
  validateDiasensSensor(device)
308
308
  } else {
@@ -1,7 +1,7 @@
1
1
  package com.mytatvarnsdk.utils
2
2
 
3
3
  object TatvaEncryptionConfig {
4
- const val STAGE_BASE_URL = "https://api-uat.mytatva.in/api/v8"
4
+ const val STAGE_BASE_URL = "https://api-dev.mytatva.in/api/v8"
5
5
  const val PROD_BASE_URL = "https://api.mytatva.in/api/v8"
6
6
 
7
7
  const val PROD_ENC_KEY = "9Ddyaf6rfywpiTvTiax2iq6ykKpaxgJ6"
@@ -683,6 +683,8 @@
683
683
 
684
684
  if (self.centralManager.state != CBManagerStatePoweredOn) {
685
685
  NSLog(@"Bluetooth is not powered on. Aborting scan.");
686
+ // Do not change status here – just wait for BluetoothEnable notification
687
+ // The UI layer listens for BluetoothEnable and will start scan once BLE is ready.
686
688
  return;
687
689
  }
688
690
 
@@ -54,7 +54,8 @@
54
54
  - (NSArray *)queryReceiveDataWithDevice:(Device *)currentDevice needUserBG:(BOOL)needUserBG;
55
55
  - (NSArray *)queryAllReceiveData;
56
56
 
57
- - (void)reloadQueryHistoryData;
57
+ - (void)reloadQueryHistoryData:(BOOL)calculateError2Data;
58
+ - (void)handleReceiveDataForError2Data;
58
59
  - (void)deleteSQLiteDataArray;
59
60
  - (BOOL)hasDeviceData;
60
61
  @end
@@ -162,7 +162,7 @@
162
162
  CurrentGlucose *currentGlucose = [AlgorithmTools algorithmLatestGlucose:d];
163
163
 
164
164
  if (currentGlucose.errorCode == ERROR_CODE_ALGORITHM_DATA) {
165
- [self reloadQueryHistoryData];
165
+ [self reloadQueryHistoryData:YES];
166
166
 
167
167
  if (userBG > 0) {
168
168
  d = [[LatestData alloc] initWithParameters:glucose.dataId.intValue andIw:[glucose.operatingCurrent floatValue] andIb:[glucose.blankCurrent floatValue] andT:[glucose.temperature floatValue] andK0:algo_k andR:algo_r andDay:[data.day intValue] andHour:[data.hour intValue] andMinute:[data.minute intValue] andNewBgToGlucoseId:glucose.dataId.intValue andNewBgValue:userBG andName:localName];
@@ -513,9 +513,11 @@
513
513
  return endNumber;
514
514
  }
515
515
 
516
+
517
+
516
518
  #pragma mark - APP重启后需要手动调用历史数据
517
- //After restarting the app, is it necessary to manually request historical data?
518
- - (void)reloadQueryHistoryData {
519
+
520
+ - (void)reloadQueryHistoryData:(BOOL)calculateError2Data {
519
521
  Device *currentDevice = KLTBluetoothManager.sharedManager.currentDevice;
520
522
  if (nil == currentDevice) {
521
523
  return;
@@ -524,6 +526,9 @@
524
526
  if (0 == arrayFromInitial.count) {
525
527
  return;
526
528
  }
529
+ if (calculateError2Data && arrayFromInitial.count > 1) {
530
+ arrayFromInitial = [arrayFromInitial subarrayWithRange:NSMakeRange(0, arrayFromInitial.count-1)];
531
+ }
527
532
  float *Iws = nil;
528
533
  float *Ibs = nil;
529
534
  float *Ts = nil;
@@ -540,7 +545,7 @@
540
545
  Ibs[index] = [receive.blankCurrent floatValue];
541
546
  Ts[index] = [receive.temperature floatValue];
542
547
  }
543
-
548
+
544
549
  ReceiveData *firstData = arrayFromInitial.firstObject;
545
550
  NSDate *receiveDate = [NSString getDateTimeWithString:firstData.receiveDateTime];
546
551
  NSCalendar *calendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
@@ -548,7 +553,7 @@
548
553
  data.startDay = (int)[comp day]; // 开始初始化的日期,日
549
554
  data.startHour = (int)[comp hour]; // 开始初始化的日期,小时
550
555
  data.startMinute = (int)[comp minute]; // 开始初始化的日期,分钟
551
-
556
+
552
557
  data.glucoseId = (int)index;
553
558
  data.Iws = Iws;
554
559
  data.IwsCount = (int)index + 1;
@@ -581,7 +586,7 @@
581
586
  float algo_r = [[User_Defaults objectForKey:@"algo_r"] floatValue];
582
587
  data.K0 = algo_k;
583
588
  data.R = algo_r;
584
-
589
+
585
590
  CurrentGlucose *currentGlucose = [AlgorithmTools algorithmGlucose:data];
586
591
  KLTLog(@"rerunADCAlgo: algorithm=%@, currentGlucose.errorCode = %@", @(data.algorithm), @(currentGlucose.errorCode));
587
592
  if (Iws != nil) {
@@ -606,4 +611,180 @@
606
611
  }
607
612
  }
608
613
 
614
+
615
+ - (void)handleReceiveDataForError2Data {
616
+
617
+ Device *currentDevice = KLTBluetoothManager.sharedManager.currentDevice;
618
+
619
+ if (!currentDevice) {
620
+ NSLog(@"handleReceiveDataForError2Data: no currentDevice");
621
+ return;
622
+ }
623
+
624
+ if (currentDevice.identifier.length == 0 ||
625
+ currentDevice.initialBeginDate.length == 0) {
626
+ NSLog(@"handleReceiveDataForError2Data: missing identifier or initialBeginDate");
627
+ return;
628
+ }
629
+
630
+ NSManagedObjectContext *context = self.context;
631
+ NSError *error = nil;
632
+
633
+ // STEP 1: find first ReceiveData with error == 2
634
+ NSFetchRequest *request = [[NSFetchRequest alloc] init];
635
+ request.entity = [NSEntityDescription entityForName:@"ReceiveDataInfo"
636
+ inManagedObjectContext:context];
637
+
638
+ NSPredicate *errorPredicate =
639
+ [NSPredicate predicateWithFormat:
640
+ @"device.identifier = %@ AND initialBeginDate = %@ AND error = 2",
641
+ currentDevice.identifier,
642
+ currentDevice.initialBeginDate];
643
+
644
+ request.predicate = errorPredicate;
645
+ request.sortDescriptors =
646
+ @[[NSSortDescriptor sortDescriptorWithKey:@"glucoseId" ascending:YES]];
647
+
648
+ NSArray<ReceiveData *> *errorDatas =
649
+ [context executeFetchRequest:request error:&error];
650
+
651
+ if (error) {
652
+ NSLog(@"handleReceiveDataForError2Data fetch error: %@", error);
653
+ return;
654
+ }
655
+
656
+ if (errorDatas.count == 0) {
657
+ NSLog(@"handleReceiveDataForError2Data: no error=2 records");
658
+ return;
659
+ }
660
+
661
+ ReceiveData *firstErrorData = errorDatas.firstObject;
662
+
663
+ NSLog(@"First error2 packet glucoseId=%@", firstErrorData.glucoseId);
664
+
665
+ // STEP 2: delete ReceiveData >= first error packet
666
+ NSFetchRequest *deleteRequest = [[NSFetchRequest alloc] init];
667
+ deleteRequest.entity =
668
+ [NSEntityDescription entityForName:@"ReceiveDataInfo"
669
+ inManagedObjectContext:context];
670
+
671
+ NSPredicate *deletePredicate =
672
+ [NSPredicate predicateWithFormat:
673
+ @"device.identifier = %@ AND initialBeginDate = %@ AND glucoseId >= %@",
674
+ currentDevice.identifier,
675
+ currentDevice.initialBeginDate,
676
+ firstErrorData.glucoseId];
677
+
678
+ deleteRequest.predicate = deletePredicate;
679
+
680
+ NSArray<ReceiveData *> *toDelete =
681
+ [context executeFetchRequest:deleteRequest error:&error];
682
+
683
+ if (error) {
684
+ NSLog(@"handleReceiveDataForError2Data delete fetch error: %@", error);
685
+ return;
686
+ }
687
+
688
+ for (ReceiveData *obj in toDelete) {
689
+ [context deleteObject:obj];
690
+ }
691
+
692
+ [self.appDelegate saveContext];
693
+
694
+ NSLog(@"handleReceiveDataForError2Data: deleted %lu ReceiveData packets",
695
+ (unsigned long)toDelete.count);
696
+ }
697
+
698
+ //After restarting the app, is it necessary to manually request historical data?
699
+ // - (void)reloadQueryHistoryData {
700
+ // Device *currentDevice = KLTBluetoothManager.sharedManager.currentDevice;
701
+ // if (nil == currentDevice) {
702
+ // return;
703
+ // }
704
+ // NSArray<ReceiveData*> *arrayFromInitial = [self queryReceiveDataWithDevice:currentDevice needUserBG:NO];
705
+ // if (0 == arrayFromInitial.count) {
706
+ // return;
707
+ // }
708
+ // float *Iws = nil;
709
+ // float *Ibs = nil;
710
+ // float *Ts = nil;
711
+ // int *bgToGlucoseIds = nil;
712
+ // int *bgValues = nil;
713
+ // HistoryData *data = [[HistoryData alloc] init];
714
+ // unsigned long index = 0;
715
+ // Iws = malloc(sizeof(float) * arrayFromInitial.count);
716
+ // Ibs = malloc(sizeof(float) * arrayFromInitial.count);
717
+ // Ts = malloc(sizeof(float) * arrayFromInitial.count);
718
+ // for (ReceiveData *receive in arrayFromInitial) {
719
+ // index = [receive.glucoseId intValue];
720
+ // Iws[index] = [receive.operatingCurrent floatValue];
721
+ // Ibs[index] = [receive.blankCurrent floatValue];
722
+ // Ts[index] = [receive.temperature floatValue];
723
+ // }
724
+
725
+ // ReceiveData *firstData = arrayFromInitial.firstObject;
726
+ // NSDate *receiveDate = [NSString getDateTimeWithString:firstData.receiveDateTime];
727
+ // NSCalendar *calendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
728
+ // NSDateComponents *comp = [calendar components: NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute fromDate:receiveDate];
729
+ // data.startDay = (int)[comp day]; // 开始初始化的日期,日
730
+ // data.startHour = (int)[comp hour]; // 开始初始化的日期,小时
731
+ // data.startMinute = (int)[comp minute]; // 开始初始化的日期,分钟
732
+
733
+ // data.glucoseId = (int)index;
734
+ // data.Iws = Iws;
735
+ // data.IwsCount = (int)index + 1;
736
+ // data.Ibs = Ibs;
737
+ // data.IbsCount = (int)index + 1;
738
+ // data.Ts = Ts;
739
+ // data.TsCount = (int)index + 1;
740
+
741
+ // // 校准后的点
742
+ // //Point after calibration
743
+ // NSArray<ReceiveData*> *needUserBgs = [self queryReceiveDataWithDevice:currentDevice needUserBG:YES];
744
+ // NSUInteger numberOfUserBgs = needUserBgs.count;
745
+ // if (needUserBgs.count > 0) {
746
+ // bgToGlucoseIds = malloc(sizeof(int) * numberOfUserBgs);
747
+ // bgValues = malloc(sizeof(int) * numberOfUserBgs);
748
+ // for (int i = 0; i < numberOfUserBgs; i++) {
749
+ // ReceiveData *receiveModel = needUserBgs[i];
750
+ // bgToGlucoseIds[i] = receiveModel.glucoseId.intValue;
751
+ // bgValues[i] = roundf(receiveModel.userBG.floatValue * 18);
752
+ // KLTLog(@"newBgToGlucoseIds: bgToGlucoseIds=%@, userBG=%@", receiveModel.glucoseId, receiveModel.userBG);
753
+ // }
754
+ // data.newBgToGlucoseIds = bgToGlucoseIds;
755
+ // data.newBgToGlucoseIdsCount = (int)numberOfUserBgs;
756
+ // data.newBgValues = bgValues;
757
+ // data.newBgValuesCount = (int)numberOfUserBgs;
758
+ // }
759
+
760
+ // [data setTransmitterName:currentDevice.advertise.localName];
761
+ // float algo_k = [[User_Defaults objectForKey:@"algo_k"] floatValue];
762
+ // float algo_r = [[User_Defaults objectForKey:@"algo_r"] floatValue];
763
+ // data.K0 = algo_k;
764
+ // data.R = algo_r;
765
+
766
+ // CurrentGlucose *currentGlucose = [AlgorithmTools algorithmGlucose:data];
767
+ // KLTLog(@"rerunADCAlgo: algorithm=%@, currentGlucose.errorCode = %@", @(data.algorithm), @(currentGlucose.errorCode));
768
+ // if (Iws != nil) {
769
+ // free(Iws);
770
+ // Iws = nil;
771
+ // }
772
+ // if (Ibs != nil) {
773
+ // free(Ibs);
774
+ // Ibs = nil;
775
+ // }
776
+ // if (Ts != nil) {
777
+ // free(Ts);
778
+ // Ts = nil;
779
+ // }
780
+ // if (bgToGlucoseIds != nil) {
781
+ // free(bgToGlucoseIds);
782
+ // bgToGlucoseIds = nil;
783
+ // }
784
+ // if (bgValues != nil) {
785
+ // free(bgValues);
786
+ // bgValues = nil;
787
+ // }
788
+ // }
789
+
609
790
  @end
@@ -0,0 +1,22 @@
1
+ //
2
+ // KLTStartUp.h
3
+ // KaiLiTe
4
+ //
5
+ // Created by yuwell on 2025/3/25.
6
+ // Copyright © 2025 boosal. All rights reserved.
7
+ //
8
+
9
+ #import <Foundation/Foundation.h>
10
+
11
+ NS_ASSUME_NONNULL_BEGIN
12
+
13
+ @interface KLTStartUp : NSObject
14
+
15
+ + (KLTStartUp *)shared;
16
+ - (void)setup;
17
+ + (instancetype)new NS_UNAVAILABLE;
18
+ - (instancetype)init NS_UNAVAILABLE;
19
+
20
+ @end
21
+
22
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,80 @@
1
+
2
+ //
3
+ // KLTStartUp.m
4
+ // KaiLiTe
5
+ //
6
+ // Created by yuwell on 2025/3/25.
7
+ // Copyright © 2025 boosal. All rights reserved.
8
+ //
9
+
10
+ #import "KLTStartUp.h"
11
+ #import "KLTDatabaseHandler.h"
12
+ #import "KLTBluetoothManager.h"
13
+
14
+ @implementation KLTStartUp
15
+
16
+ + (KLTStartUp *)shared {
17
+ static KLTStartUp *shared = nil;
18
+ static dispatch_once_t onceToken;
19
+ dispatch_once(&onceToken, ^{
20
+ shared = [[KLTStartUp alloc] init];
21
+ });
22
+ return shared;
23
+ }
24
+
25
+ - (instancetype)init {
26
+ self = [super init];
27
+ if (self) {
28
+ }
29
+ return self;
30
+ }
31
+
32
+ #pragma mark - 初始化
33
+
34
+ - (void)setup {
35
+
36
+ NSLog(@"KLTStartUp setup begin");
37
+
38
+
39
+
40
+ [self handleAlgorithmException];
41
+
42
+ NSLog(@"KLTStartUp setup finished");
43
+ }
44
+
45
+ #pragma mark - 处理算法异常数据 (ErrorCode = 2)
46
+
47
+ - (void)handleAlgorithmException {
48
+
49
+ Device *currentDevice = KLTBluetoothManager.sharedManager.currentDevice;
50
+
51
+ if (!currentDevice) {
52
+ NSLog(@"KLTStartUp: currentDevice is nil");
53
+ return;
54
+ }
55
+
56
+ if (currentDevice.identifier.length == 0 ||
57
+ currentDevice.initialBeginDate.length == 0) {
58
+
59
+ NSLog(@"KLTStartUp: device session invalid");
60
+ return;
61
+ }
62
+
63
+ NSLog(@"KLTStartUp: start algorithm recovery for device %@", currentDevice.identifier);
64
+
65
+ /*
66
+ Step 1
67
+ Delete corrupted ReceiveData starting from first errorCode = 2
68
+ */
69
+ [[KLTDatabaseHandler shared] handleReceiveDataForError2Data];
70
+
71
+ /*
72
+ Step 2
73
+ Rebuild algorithm history
74
+ */
75
+ [[KLTDatabaseHandler shared] reloadQueryHistoryData:NO];
76
+
77
+ NSLog(@"KLTStartUp: algorithm recovery completed");
78
+ }
79
+
80
+ @end
@@ -444,18 +444,18 @@ RCT_EXPORT_METHOD(startCgmTracky:(NSString *)token envType:(NSString *)envType
444
444
  [defaults setBool:false forKey:@"isForReconnect"];
445
445
  [defaults setObject:envType forKey:@"envType"];
446
446
 
447
- // Extract and store supportProgramType from userData
448
- NSString *supportProgramType = @"";
447
+ // Extract and store lastConnectCgm from userData
448
+ NSString *lastConnectCgm = @"";
449
449
  if (userData != nil) {
450
450
  NSDictionary *patientMetaInfo = userData[@"patient_meta_info"];
451
451
  if (patientMetaInfo != nil && [patientMetaInfo isKindOfClass:[NSDictionary class]]) {
452
- NSString *programType = patientMetaInfo[@"support_program_type"];
453
- if (programType != nil && [programType isKindOfClass:[NSString class]]) {
454
- supportProgramType = programType;
452
+ NSString *rawValue = patientMetaInfo[@"last_connect_cgm"];
453
+ if (rawValue != nil && [rawValue isKindOfClass:[NSString class]]) {
454
+ lastConnectCgm = rawValue;
455
455
  }
456
456
  }
457
457
  }
458
- [defaults setObject:supportProgramType forKey:@"supportProgramType"];
458
+ [defaults setObject:lastConnectCgm forKey:@"lastConnectCgm"];
459
459
 
460
460
  [defaults synchronize];
461
461
 
@@ -486,18 +486,18 @@ RCT_EXPORT_METHOD(reconnectCgmTracky:(NSString *)token envType:(NSString *)envT
486
486
  [defaults setBool:YES forKey:@"isForReconnect"];
487
487
  [defaults setObject:envType forKey:@"envType"];
488
488
 
489
- // Extract and store supportProgramType from userData
490
- NSString *supportProgramType = @"";
489
+ // Extract and store lastConnectCgm from userData
490
+ NSString *lastConnectCgm = @"";
491
491
  if (userData != nil) {
492
492
  NSDictionary *patientMetaInfo = userData[@"patient_meta_info"];
493
493
  if (patientMetaInfo != nil && [patientMetaInfo isKindOfClass:[NSDictionary class]]) {
494
- NSString *programType = patientMetaInfo[@"support_program_type"];
495
- if (programType != nil && [programType isKindOfClass:[NSString class]]) {
496
- supportProgramType = programType;
494
+ NSString *rawValue = patientMetaInfo[@"last_connect_cgm"];
495
+ if (rawValue != nil && [rawValue isKindOfClass:[NSString class]]) {
496
+ lastConnectCgm = rawValue;
497
497
  }
498
498
  }
499
499
  }
500
- [defaults setObject:supportProgramType forKey:@"supportProgramType"];
500
+ [defaults setObject:lastConnectCgm forKey:@"lastConnectCgm"];
501
501
 
502
502
  [defaults synchronize];
503
503
 
@@ -21,3 +21,4 @@
21
21
  #import "KLTBluetoothManager.h"
22
22
  #import "KLTLocalSettingManager.h"
23
23
  #import "KLTUserDefautKeyDefine.h"
24
+ #import "KLTStartUp.h"
@@ -12,7 +12,7 @@ let PROD_API_KEY = "lChjFRJce3bxmoS3TSQk5w=="
12
12
  let STAGE_API_KEY = "lChjFRJce3bxmoS3TSQk5w=="
13
13
 
14
14
  let PROD_BASE_URL = "https://api.mytatva.in/api/v8"
15
- let STAGE_BASE_URL = "https://api-uat.mytatva.in/api/v8"
15
+ let STAGE_BASE_URL = "https://api-dev.mytatva.in/api/v8"
16
16
 
17
17
 
18
18
  let PROD_ENC_KEY = "9Ddyaf6rfywpiTvTiax2iq6ykKpaxgJ6"
@@ -252,9 +252,9 @@ class ConnectToSensorViewController: UIViewController {
252
252
  UserDefaults.standard.set(data.r, forKey: "algo_r")
253
253
  UserDefaults.standard.synchronize()
254
254
 
255
- let supportProgramType = UserDefaults.standard.string(forKey: "supportProgramType") ?? ""
255
+ let lastConnectCgm = UserDefaults.standard.string(forKey: "lastConnectCgm") ?? ""
256
256
 
257
- if supportProgramType.lowercased() == "diasens" {
257
+ if lastConnectCgm.lowercased() == "diasens" {
258
258
  // Diasens user - validate sensor via API before connecting
259
259
  validateDiasensSensor(sensorId: value)
260
260
  } else {
@@ -56,18 +56,41 @@ class ConnectToTransmitterViewController: UIViewController, KLTBluetoothDelegate
56
56
 
57
57
  var foundDevices: NSMutableArray = []
58
58
  let manager = KLTBluetoothManager.shared()
59
-
59
+ private var bluetoothEnableObserver: NSObjectProtocol?
60
+
60
61
  override func viewDidLoad() {
61
62
  super.viewDidLoad()
62
- // Do any additional setup after loading the view.
63
63
  setupLayout()
64
64
  }
65
+
66
+ deinit {
67
+ if let observer = bluetoothEnableObserver {
68
+ NotificationCenter.default.removeObserver(observer)
69
+ }
70
+ }
65
71
 
66
72
  func setupLayout() {
67
73
  manager?.addObserver(self, forKeyPath: "status", options: [.new], context: nil)
68
74
 
69
75
  //BluetoothManager.shared.delegate = self
70
76
  manager?.bluetoothDelegate = self
77
+
78
+ // FIX: On first launch BLE state can be "unknown" so startScan aborts silently.
79
+ // Listen for BluetoothEnable and start scan as soon as BLE is powered on.
80
+ bluetoothEnableObserver = NotificationCenter.default.addObserver(
81
+ forName: NSNotification.Name("BluetoothEnable"),
82
+ object: nil,
83
+ queue: .main
84
+ ) { [weak self] notification in
85
+ guard let self = self else { return }
86
+ let isOn = (notification.object as? NSNumber)?.boolValue ?? false
87
+ if isOn && self.screenType == .searching {
88
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
89
+ self.manager?.startScan()
90
+ }
91
+ }
92
+ }
93
+
71
94
  manager?.startScan()
72
95
  //BluetoothManager.shared.startScanning()
73
96
  tableView.delegate = self
@@ -13,8 +13,11 @@ import Foundation
13
13
 
14
14
  private override init() {
15
15
  super.init()
16
- viewModel.initialize()
17
- KLTDatabaseHandler.shared().reloadQueryHistoryData()
16
+ // viewModel.initialize()
17
+ // KLTDatabaseHandler.shared().reloadQueryHistoryData()
18
+ KLTStartUp.shared().setup()
19
+ viewModel.initialize()
20
+ viewModel.syncDeviceStatus()
18
21
  }
19
22
 
20
23
  // @objc public func callForObserveTransmitterUnbindStatus() {
@@ -178,6 +181,8 @@ class FinalViewModel: NSObject {
178
181
 
179
182
  var lastBluetoothStatus: BluetoothManagerStatus = .disconnected
180
183
  var delayedDisconnectTimer: Timer?
184
+
185
+ private var isUploading = false
181
186
 
182
187
 
183
188
  @objc public override init() {
@@ -194,6 +199,16 @@ class FinalViewModel: NSObject {
194
199
  }
195
200
  }
196
201
 
202
+ func syncDeviceStatus() {
203
+ if manager.currentDevice != nil {
204
+ if manager.currentDevice.disconnectedDateTime == nil && manager.currentDevice.connectedDateTime != nil{
205
+ debouncer.update(with: .connected)
206
+ } else if manager.currentDevice.disconnectedDateTime == nil && manager.currentDevice.connectedDateTime != nil{
207
+ debouncer.update(with: .disconnected)
208
+ }
209
+ }
210
+ }
211
+
197
212
  @objc public func initialize() {
198
213
  //getStatus()
199
214
  startCountDown()
@@ -401,11 +416,11 @@ class FinalViewModel: NSObject {
401
416
 
402
417
 
403
418
  func uploadData(data: [GlucoseData]) {
419
+ isUploading = true
404
420
  let batchSize = 40
405
421
  let batches = stride(from: 0, to: data.count, by: batchSize).map {
406
422
  Array(data[$0..<min($0 + batchSize, data.count)])
407
423
  }
408
-
409
424
  uploadBatch(batches: batches, index: 0)
410
425
  }
411
426
 
@@ -416,6 +431,7 @@ class FinalViewModel: NSObject {
416
431
  NotificationCenter.default.post(name: Notification.Name("CheckErrorStatusFromLastBatchData"), object: batches.last?.last)
417
432
  }
418
433
  print("✅ All batches uploaded")
434
+ isUploading = false
419
435
  return
420
436
  }
421
437
 
@@ -447,7 +463,7 @@ class FinalViewModel: NSObject {
447
463
  self.uploadBatch(batches: batches, index: index + 1)
448
464
  } onFailure: { error in
449
465
  print("❌ Failed to upload batch \(index + 1): \(String(describing: error?.localizedDescription))")
450
- // Optionally retry or stop here
466
+ self.isUploading = false
451
467
  }
452
468
  }
453
469
 
@@ -480,20 +496,24 @@ class FinalViewModel: NSObject {
480
496
 
481
497
 
482
498
  @objc func updateData(_ notification: Notification) {
483
- // Safely cast to [ReceiveData]
499
+ // Prevent concurrent duplicate uploads triggered by rapid KLTUpdateDataNotify posts
500
+ // (e.g. multiple 0x22 resend packets firing the notification in quick succession)
501
+ guard !isUploading else {
502
+ print("⚠️ Upload already in progress — skipping duplicate updateData call")
503
+ return
504
+ }
505
+
484
506
  guard let data = KLTDatabaseHandler.shared().queryAllReceiveData() as? [ReceiveData] else {
485
507
  print("⚠️ Failed to cast queryAllReceiveData() to [ReceiveData]")
486
508
  return
487
509
  }
488
510
  print("===> all data count: \(data.count)")
489
511
 
490
- // Ensure device exists
491
512
  guard let device = KLTBluetoothManager.shared().currentDevice else {
492
513
  print("⚠️ No current device found")
493
514
  return
494
515
  }
495
516
 
496
- // Get glucose data array
497
517
  guard let arrayFromInitial = KLTDatabaseHandler.shared().queryGlucoseData(with: device) else {
498
518
  print("⚠️ Failed to cast queryGlucoseData to [GlucoseData]")
499
519
  return
@@ -501,7 +521,6 @@ class FinalViewModel: NSObject {
501
521
 
502
522
  print("======================> arrayFromInitial count: \(arrayFromInitial.count)")
503
523
 
504
- // Call upload
505
524
  self.uploadData(data: arrayFromInitial)
506
525
  }
507
526
 
@@ -1 +1 @@
1
- {"version":3,"names":["_MyTatvaRnSdkView","_interopRequireDefault","require","_MyTatvaRnSdkView2","_reactNative","_CGMConnect","e","__esModule","default","MyTatvaRnSdkView","exports","Platform","select","ios","MyTatvaRnSdkViewIOS","android","MyTatvaRnSdkViewAndroid","_default","startCGM","initializeCGMEventListener","removeCGMEventListener","observeAllGlucoseDataHandler","reconnectCGM","helpCGM","observeTransmitterUnbindStatusHandler","observeResetLogoutHandler","getSqliteDBPath","getCgmLogFilePaths"],"sources":["index.js"],"sourcesContent":["import MyTatvaRnSdkViewAndroid from './MyTatvaRnSdkView.android';\nimport MyTatvaRnSdkViewIOS from './MyTatvaRnSdkView.ios';\nimport { Platform } from 'react-native';\nimport { startCGM, initializeCGMEventListener, removeCGMEventListener, observeAllGlucoseDataHandler, reconnectCGM, helpCGM, observeTransmitterUnbindStatusHandler, observeResetLogoutHandler, getSqliteDBPath, getCgmLogFilePaths } from './CGMConnect';\n// ... other imports\n\n// Export the platform-specific component\nexport const MyTatvaRnSdkView = Platform.select({\n ios: MyTatvaRnSdkViewIOS,\n android: MyTatvaRnSdkViewAndroid,\n});\n\n// Export individual functions\nexport {\n startCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath,\n getCgmLogFilePaths\n // ... other functions\n};\n\n// Export a default object with everything\nexport default {\n MyTatvaRnSdkView,\n startCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath,\n getCgmLogFilePaths,\n};"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAAwP,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AACxP;;AAEA;AACO,MAAMG,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAGE,qBAAQ,CAACC,MAAM,CAAC;EAC9CC,GAAG,EAAEC,0BAAmB;EACxBC,OAAO,EAAEC;AACX,CAAC,CAAC;;AAEF;AAeA;AAAA,IAAAC,QAAA,GAAAP,OAAA,CAAAF,OAAA,GACe;EACbC,gBAAgB;EAChBS,QAAQ,EAARA,oBAAQ;EACRC,0BAA0B,EAA1BA,sCAA0B;EAC1BC,sBAAsB,EAAtBA,kCAAsB;EACtBC,4BAA4B,EAA5BA,wCAA4B;EAC5BC,YAAY,EAAZA,wBAAY;EACZC,OAAO,EAAPA,mBAAO;EACPC,qCAAqC,EAArCA,iDAAqC;EACrCC,yBAAyB,EAAzBA,qCAAyB;EACzBC,eAAe,EAAfA,2BAAe;EACfC,kBAAkB,EAAlBA;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_MyTatvaRnSdkView","_interopRequireDefault","require","_MyTatvaRnSdkView2","_reactNative","_CGMConnect","e","__esModule","default","MyTatvaRnSdkView","exports","Platform","select","ios","MyTatvaRnSdkViewIOS","android","MyTatvaRnSdkViewAndroid","_default","startCGM","initializeCGMEventListener","removeCGMEventListener","observeAllGlucoseDataHandler","reconnectCGM","helpCGM","observeTransmitterUnbindStatusHandler","observeResetLogoutHandler","getSqliteDBPath","getCgmLogFilePaths"],"sources":["index.js"],"sourcesContent":["import MyTatvaRnSdkViewAndroid from './MyTatvaRnSdkView.android';\nimport MyTatvaRnSdkViewIOS from './MyTatvaRnSdkView.ios';\nimport { Platform } from 'react-native';\nimport { startCGM, initializeCGMEventListener, removeCGMEventListener, observeAllGlucoseDataHandler, reconnectCGM, helpCGM, observeTransmitterUnbindStatusHandler, observeResetLogoutHandler, getSqliteDBPath, getCgmLogFilePaths } from './CGMConnect';\n// ... other imports\n\n// Export the platform-specific component\nexport const MyTatvaRnSdkView = Platform.select({\n ios: MyTatvaRnSdkViewIOS,\n android: MyTatvaRnSdkViewAndroid,\n});\n\n// Export individual functions\nexport {\n startCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath,\n getCgmLogFilePaths\n};\n\n// Export a default object with everything\nexport default {\n MyTatvaRnSdkView,\n startCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath,\n getCgmLogFilePaths\n};"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAAwP,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AACxP;;AAEA;AACO,MAAMG,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAGE,qBAAQ,CAACC,MAAM,CAAC;EAC9CC,GAAG,EAAEC,0BAAmB;EACxBC,OAAO,EAAEC;AACX,CAAC,CAAC;;AAEF;AAcA;AAAA,IAAAC,QAAA,GAAAP,OAAA,CAAAF,OAAA,GACe;EACbC,gBAAgB;EAChBS,QAAQ,EAARA,oBAAQ;EACRC,0BAA0B,EAA1BA,sCAA0B;EAC1BC,sBAAsB,EAAtBA,kCAAsB;EACtBC,4BAA4B,EAA5BA,wCAA4B;EAC5BC,YAAY,EAAZA,wBAAY;EACZC,OAAO,EAAPA,mBAAO;EACPC,qCAAqC,EAArCA,iDAAqC;EACrCC,yBAAyB,EAAzBA,qCAAyB;EACzBC,eAAe,EAAfA,2BAAe;EACfC,kBAAkB,EAAlBA;AACF,CAAC","ignoreList":[]}
@@ -11,9 +11,7 @@ export const MyTatvaRnSdkView = Platform.select({
11
11
  });
12
12
 
13
13
  // Export individual functions
14
- export { startCGM, initializeCGMEventListener, removeCGMEventListener, observeAllGlucoseDataHandler, reconnectCGM, helpCGM, observeTransmitterUnbindStatusHandler, observeResetLogoutHandler, getSqliteDBPath, getCgmLogFilePaths
15
- // ... other functions
16
- };
14
+ export { startCGM, initializeCGMEventListener, removeCGMEventListener, observeAllGlucoseDataHandler, reconnectCGM, helpCGM, observeTransmitterUnbindStatusHandler, observeResetLogoutHandler, getSqliteDBPath, getCgmLogFilePaths };
17
15
 
18
16
  // Export a default object with everything
19
17
  export default {
@@ -1 +1 @@
1
- {"version":3,"names":["MyTatvaRnSdkViewAndroid","MyTatvaRnSdkViewIOS","Platform","startCGM","initializeCGMEventListener","removeCGMEventListener","observeAllGlucoseDataHandler","reconnectCGM","helpCGM","observeTransmitterUnbindStatusHandler","observeResetLogoutHandler","getSqliteDBPath","getCgmLogFilePaths","MyTatvaRnSdkView","select","ios","android"],"sources":["index.js"],"sourcesContent":["import MyTatvaRnSdkViewAndroid from './MyTatvaRnSdkView.android';\nimport MyTatvaRnSdkViewIOS from './MyTatvaRnSdkView.ios';\nimport { Platform } from 'react-native';\nimport { startCGM, initializeCGMEventListener, removeCGMEventListener, observeAllGlucoseDataHandler, reconnectCGM, helpCGM, observeTransmitterUnbindStatusHandler, observeResetLogoutHandler, getSqliteDBPath, getCgmLogFilePaths } from './CGMConnect';\n// ... other imports\n\n// Export the platform-specific component\nexport const MyTatvaRnSdkView = Platform.select({\n ios: MyTatvaRnSdkViewIOS,\n android: MyTatvaRnSdkViewAndroid,\n});\n\n// Export individual functions\nexport {\n startCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath,\n getCgmLogFilePaths\n // ... other functions\n};\n\n// Export a default object with everything\nexport default {\n MyTatvaRnSdkView,\n startCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath,\n getCgmLogFilePaths,\n};"],"mappings":"AAAA,OAAOA,uBAAuB,MAAM,4BAA4B;AAChE,OAAOC,mBAAmB,MAAM,wBAAwB;AACxD,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,QAAQ,EAAEC,0BAA0B,EAAEC,sBAAsB,EAAEC,4BAA4B,EAAEC,YAAY,EAAEC,OAAO,EAAEC,qCAAqC,EAAEC,yBAAyB,EAAEC,eAAe,EAAEC,kBAAkB,QAAQ,cAAc;AACvP;;AAEA;AACA,OAAO,MAAMC,gBAAgB,GAAGX,QAAQ,CAACY,MAAM,CAAC;EAC9CC,GAAG,EAAEd,mBAAmB;EACxBe,OAAO,EAAEhB;AACX,CAAC,CAAC;;AAEF;AACA,SACEG,QAAQ,EACRC,0BAA0B,EAC1BC,sBAAsB,EACtBC,4BAA4B,EAC5BC,YAAY,EACZC,OAAO,EACPC,qCAAqC,EACrCC,yBAAyB,EACzBC,eAAe,EACfC;AACA;AAAA;;AAGF;AACA,eAAe;EACbC,gBAAgB;EAChBV,QAAQ;EACRC,0BAA0B;EAC1BC,sBAAsB;EACtBC,4BAA4B;EAC5BC,YAAY;EACZC,OAAO;EACPC,qCAAqC;EACrCC,yBAAyB;EACzBC,eAAe;EACfC;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["MyTatvaRnSdkViewAndroid","MyTatvaRnSdkViewIOS","Platform","startCGM","initializeCGMEventListener","removeCGMEventListener","observeAllGlucoseDataHandler","reconnectCGM","helpCGM","observeTransmitterUnbindStatusHandler","observeResetLogoutHandler","getSqliteDBPath","getCgmLogFilePaths","MyTatvaRnSdkView","select","ios","android"],"sources":["index.js"],"sourcesContent":["import MyTatvaRnSdkViewAndroid from './MyTatvaRnSdkView.android';\nimport MyTatvaRnSdkViewIOS from './MyTatvaRnSdkView.ios';\nimport { Platform } from 'react-native';\nimport { startCGM, initializeCGMEventListener, removeCGMEventListener, observeAllGlucoseDataHandler, reconnectCGM, helpCGM, observeTransmitterUnbindStatusHandler, observeResetLogoutHandler, getSqliteDBPath, getCgmLogFilePaths } from './CGMConnect';\n// ... other imports\n\n// Export the platform-specific component\nexport const MyTatvaRnSdkView = Platform.select({\n ios: MyTatvaRnSdkViewIOS,\n android: MyTatvaRnSdkViewAndroid,\n});\n\n// Export individual functions\nexport {\n startCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath,\n getCgmLogFilePaths\n};\n\n// Export a default object with everything\nexport default {\n MyTatvaRnSdkView,\n startCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\n reconnectCGM,\n helpCGM,\n observeTransmitterUnbindStatusHandler,\n observeResetLogoutHandler,\n getSqliteDBPath,\n getCgmLogFilePaths\n};"],"mappings":"AAAA,OAAOA,uBAAuB,MAAM,4BAA4B;AAChE,OAAOC,mBAAmB,MAAM,wBAAwB;AACxD,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,QAAQ,EAAEC,0BAA0B,EAAEC,sBAAsB,EAAEC,4BAA4B,EAAEC,YAAY,EAAEC,OAAO,EAAEC,qCAAqC,EAAEC,yBAAyB,EAAEC,eAAe,EAAEC,kBAAkB,QAAQ,cAAc;AACvP;;AAEA;AACA,OAAO,MAAMC,gBAAgB,GAAGX,QAAQ,CAACY,MAAM,CAAC;EAC9CC,GAAG,EAAEd,mBAAmB;EACxBe,OAAO,EAAEhB;AACX,CAAC,CAAC;;AAEF;AACA,SACEG,QAAQ,EACRC,0BAA0B,EAC1BC,sBAAsB,EACtBC,4BAA4B,EAC5BC,YAAY,EACZC,OAAO,EACPC,qCAAqC,EACrCC,yBAAyB,EACzBC,eAAe,EACfC,kBAAkB;;AAGpB;AACA,eAAe;EACbC,gBAAgB;EAChBV,QAAQ;EACRC,0BAA0B;EAC1BC,sBAAsB;EACtBC,4BAA4B;EAC5BC,YAAY;EACZC,OAAO;EACPC,qCAAqC;EACrCC,yBAAyB;EACzBC,eAAe;EACfC;AACF,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-mytatva-rn-sdk",
3
- "version": "1.2.85",
3
+ "version": "1.2.87",
4
4
  "description": "a package to inject data into visit health pwa",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
package/src/index.js CHANGED
@@ -22,7 +22,6 @@ export {
22
22
  observeResetLogoutHandler,
23
23
  getSqliteDBPath,
24
24
  getCgmLogFilePaths
25
- // ... other functions
26
25
  };
27
26
 
28
27
  // Export a default object with everything
@@ -37,5 +36,5 @@ export default {
37
36
  observeTransmitterUnbindStatusHandler,
38
37
  observeResetLogoutHandler,
39
38
  getSqliteDBPath,
40
- getCgmLogFilePaths,
39
+ getCgmLogFilePaths
41
40
  };