react-native-mytatva-rn-sdk 1.2.22 → 1.2.24

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.
@@ -121,11 +121,6 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
121
121
  try {
122
122
  userToken = token
123
123
 
124
- val sharedPreferencesLibraryUtil = SharedPreferencesLibraryUtil(BApplication.getContext())
125
- val information = sharedPreferencesLibraryUtil.qrInformation
126
- if (information != null) {
127
- Log.e("observeTransmitterUnbindStatus", Gson().toJson(information).toString())
128
-
129
124
  authenticateSDKService.getCGMData(
130
125
  environment = if ("uat".uppercase() == "PROD") TATVA_ENVIRONMENT.PROD else TATVA_ENVIRONMENT.STAGE,
131
126
  token = userToken,
@@ -166,7 +161,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
166
161
  }
167
162
  }
168
163
  )
169
- }
164
+
170
165
  } catch (e: Exception) {
171
166
  Log.e("observeTransmitterUnbindStatus", "observeTransmitterUnbindStatus: ${e.message}")
172
167
  }
@@ -267,7 +267,7 @@
267
267
  NSFetchRequest *request = [[NSFetchRequest alloc] init];
268
268
  NSPredicate *predicate;
269
269
  if (needUserBG) {
270
- predicate = [NSPredicate predicateWithFormat:@"device.identifier = %@ AND initialBeginDate = %@ && userBG > 0 && userBG != NIL AND isDelete == NIL",currentDevice.identifier, currentDevice.initialBeginDate];
270
+ predicate = [NSPredicate predicateWithFormat:@"device.identifier = %@ AND initialBeginDate = %@ && gluADC > 0 && gluADC != NIL AND isDelete == NIL",currentDevice.identifier, currentDevice.initialBeginDate];
271
271
  } else {
272
272
  predicate = [NSPredicate predicateWithFormat:@"device.identifier = %@ AND initialBeginDate = %@ AND isDelete == NIL",currentDevice.identifier, currentDevice.initialBeginDate];
273
273
  }
@@ -387,7 +387,7 @@
387
387
  data.TsCount = (int)index + 1;
388
388
 
389
389
  // 校准后的点
390
- NSArray<ReceiveData*> *needUserBgs = [self queryReceiveDataWithDevice:currentDevice needUserBG:NO];
390
+ NSArray<ReceiveData*> *needUserBgs = [self queryReceiveDataWithDevice:currentDevice needUserBG:YES];
391
391
  NSUInteger numberOfUserBgs = needUserBgs.count;
392
392
  if (needUserBgs.count > 0) {
393
393
  bgToGlucoseIds = malloc(sizeof(int) * numberOfUserBgs);
@@ -0,0 +1,7 @@
1
+ //
2
+ // BluetoothManager.swift
3
+ // MyTatvaCare
4
+ //
5
+ // Created by Nirav Ramani on 12/05/25.
6
+ //
7
+
@@ -24,7 +24,7 @@ class StartConnectionViewController: UIViewController {
24
24
  super.viewDidLoad()
25
25
  // Do any additional setup after loading the view.
26
26
  setupLayout()
27
- checkForDevice()
27
+ //checkForDevice()
28
28
  }
29
29
 
30
30
  func setupLayout() {
@@ -43,34 +43,58 @@ class FinalViewModel: NSObject {
43
43
  }
44
44
 
45
45
  @objc public func initialize() {
46
+
46
47
  startCountDown()
48
+
47
49
  if ((manager.connectedPeripheral == nil) && !KLTLocalSettingManager.shareInstance().canConnectOtherDevice) {
48
50
  manager.startScan()
49
51
  } else {
50
- debouncer.update(with: .connected)
52
+ print("here")
53
+ //debouncer.update(with: .connected)
51
54
  //API.shared.sendStatus(status: .connected)
55
+ if let last = manager.currentDevice { }
56
+ else {
57
+ //self.manager.closeBleSensor()
58
+ //manager.startScan()
59
+ debouncer.update(with: .disconnected)
60
+ //debouncer.update(with: .transmitterDisconnectBox)
61
+ }
52
62
  }
53
63
  }
54
64
  func startCountDown() {
65
+
55
66
  // Most recently connected device
56
67
  if let last = manager.currentDevice {
68
+ let eDevice = EDevice.getEnumDevice(last.advertise?.localName ?? "")
69
+ initialPeriod = Int(eDevice.initNumber * 3 * 60)
57
70
  // Calculate initialization countdown time
58
71
  if let beginDate = KLTDateFormatter.shared.getDateFromWholeString(last.initialBeginDate ?? "") {
59
72
  let time = Date().timeIntervalSince(beginDate)
60
- totalSeconds = Double(initialPeriod) - TimeInterval(time)
61
- }
62
- }
63
-
64
- //for countdownlabel
65
- print(String.getTimeString(with: Int(totalSeconds)))
73
+ if Int(time) > self.initialPeriod {
74
+ // Initialization completed, normal use
75
+
76
+ } else {
77
+
78
+ // During initialization, notify the initialization page to restart the countdown
79
+ totalSeconds = Double(initialPeriod) - TimeInterval(time)
80
+
81
+ //for countdownlabel
82
+ print(String.getTimeString(with: Int(totalSeconds)))
83
+
84
+ if countdownTimer != nil {
85
+ countdownTimer?.invalidate()
86
+ countdownTimer = nil
87
+ }
88
+
89
+ countdownTimer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(countdown), userInfo: nil, repeats: true)
66
90
 
67
- if countdownTimer != nil {
68
- countdownTimer?.invalidate()
69
- countdownTimer = nil
91
+ }
92
+ }
93
+ } else {
94
+ // no device is connected
70
95
  }
71
96
 
72
- countdownTimer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(countdown), userInfo: nil, repeats: true)
73
-
97
+
74
98
  addAllObservers()
75
99
  }
76
100
  func addAllObservers() {
@@ -217,7 +241,7 @@ class FinalViewModel: NSObject {
217
241
  startScanTimer?.invalidate()
218
242
  startScanTimer = nil
219
243
 
220
- removeAllObservers()
244
+ //removeAllObservers()
221
245
 
222
246
  //KLTLaunchConfiguration.sharedManager.resetRootViewController(type: .normalUsed)
223
247
  return
@@ -239,7 +263,10 @@ class FinalViewModel: NSObject {
239
263
  return
240
264
  }
241
265
 
266
+ print("===>device status is -> \(status)")
267
+
242
268
  switch status {
269
+
243
270
  case .disconnected:
244
271
  if KLTLocalSettingManager.shareInstance().canConnectOtherDevice {
245
272
  // Unbind then disconnect
@@ -252,6 +279,13 @@ class FinalViewModel: NSObject {
252
279
  //API.shared.sendStatus(status: .disconnected)
253
280
  print("===>device is disconnected")
254
281
  debouncer.update(with: CGMConnectionStatus.disconnected)
282
+ case .tryToConnect:
283
+ // if UserDefaults.standard.integer(forKey: "bgmode") != 1 {
284
+ // DispatchQueue.main.asyncAfter(deadline: .now() + 20) {
285
+ // self.manager.startScan()
286
+ // }
287
+ // }
288
+ break
255
289
  case .connected:
256
290
  if let timer = startScanTimer {
257
291
  timer.invalidate()
@@ -261,23 +295,26 @@ class FinalViewModel: NSObject {
261
295
  print("===>device is connected")
262
296
  debouncer.update(with: CGMConnectionStatus.connected)
263
297
  case .timeOut:
264
- if !KLTLocalSettingManager.shareInstance().canConnectOtherDevice {
265
- startScanTimer = Timer.scheduledTimer(timeInterval: 20,
266
- target: self,
267
- selector: #selector(startScan),
268
- userInfo: nil,
269
- repeats: false)
270
- }
271
-
298
+ // if !KLTLocalSettingManager.shareInstance().canConnectOtherDevice {
299
+ // startScanTimer = Timer.scheduledTimer(timeInterval: 20,
300
+ // target: self,
301
+ // selector: #selector(startScan),
302
+ // userInfo: nil,
303
+ // repeats: false)
304
+ // }
305
+ print("===>time out")
306
+ break
272
307
  case .sensorLostPower:
273
308
  sensorLostPower()
274
-
309
+ print("===>sensor lost power")
275
310
  case .updateBindWatchSuccess:
276
311
  //KLTLaunchConfiguration.sharedManager.bindSuccessRootViewController()
277
- print("Success done")
312
+ startCountDown()
313
+ print("===>Success done")
278
314
  case .closed:
279
315
  debouncer.update(with: CGMConnectionStatus.transmitterDisconnectBox)
280
316
  //API.shared.sendStatus(status: .transmitterDisconnectBox)
317
+ print("===>closed")
281
318
  default:
282
319
  break
283
320
  }
@@ -303,12 +340,7 @@ class FinalViewModel: NSObject {
303
340
 
304
341
  print("initial State all end")
305
342
  // KLTLaunchConfiguration.sharedManager.resetRootViewController(.beforeUse)
306
-
307
-
308
343
  }
309
-
310
-
311
-
312
344
  }
313
345
 
314
346
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-mytatva-rn-sdk",
3
- "version": "1.2.22",
3
+ "version": "1.2.24",
4
4
  "description": "a package to inject data into visit health pwa",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",