react-native-mytatva-rn-sdk 1.2.41 → 1.2.42

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.
@@ -251,7 +251,7 @@ class CgmTrackyLibModule(reactContext: ReactApplicationContext) :
251
251
  }
252
252
 
253
253
  if (status.isNotEmpty()) {
254
- if (status !== lastDeviceStatus) {
254
+ if (status != lastDeviceStatus) {
255
255
 
256
256
  lastDeviceStatus = status
257
257
 
@@ -10,7 +10,7 @@
10
10
 
11
11
 
12
12
  #endif /* MyReactNativeBridge_h */
13
-
13
+ #import "KLTAppDelegate.h"
14
14
  #import <Foundation/Foundation.h>
15
15
  #import <React/RCTBridgeModule.h>
16
16
  #import <React/RCTEventEmitter.h>
@@ -104,6 +104,7 @@ RCT_EXPORT_METHOD(startCgmTracky:(NSString *)token)
104
104
 
105
105
  // Save token
106
106
  [[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
107
+ [[NSUserDefaults standardUserDefaults] setBool:false forKey:@"isForReconnect"];
107
108
  [[NSUserDefaults standardUserDefaults] synchronize];
108
109
 
109
110
 
@@ -121,38 +122,85 @@ RCT_EXPORT_METHOD(startCgmTracky:(NSString *)token)
121
122
  [rootVC presentViewController:navController animated:YES completion:nil];
122
123
  }
123
124
  });
124
- }
125
+
126
+
127
+ // NSLog(@"Received token: %@", token);
128
+ //
129
+ // [[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
130
+ // [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"isForReconnect"];
131
+ // [[NSUserDefaults standardUserDefaults] synchronize];
132
+ //
133
+ // dispatch_async(dispatch_get_main_queue(), ^{
134
+ // UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
135
+ // UIViewController *rootVC = keyWindow.rootViewController;
136
+ //
137
+ // UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainCGM" bundle:[NSBundle mainBundle]];
138
+ // UIViewController *reconnectVC = [storyboard instantiateViewControllerWithIdentifier:@"StartConnectionViewController"];
139
+ //
140
+ // reconnectVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
141
+ //
142
+ // UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:reconnectVC];
143
+ // navController.modalPresentationStyle = UIModalPresentationOverFullScreen;
144
+ //
145
+ // if (reconnectVC) {
146
+ // [rootVC presentViewController:navController animated:YES completion:nil];
147
+ // }
148
+ // });
125
149
 
150
+ }
126
151
 
127
152
 
128
153
  RCT_EXPORT_METHOD(reconnectCgmTracky:(NSString *)token)
129
154
  {
130
- NSLog(@"Received token: %@", token);
155
+ // NSLog(@"Received token: %@", token);
156
+ //
157
+ // [[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
158
+ // [[NSUserDefaults standardUserDefaults] synchronize];
159
+ // dispatch_async(dispatch_get_main_queue(), ^{
160
+ // UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
161
+ // UIViewController *rootVC = keyWindow.rootViewController;
162
+ // // Load the storyboard
163
+ // UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainCGM" bundle:[NSBundle mainBundle]];
164
+ //
165
+ // // Instantiate the target ViewController
166
+ // UIViewController *reconnectVC = [storyboard instantiateViewControllerWithIdentifier:@"StartConnectionViewController"];
167
+ //
168
+ // // Set presentation style
169
+ // reconnectVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
170
+ // // Set isForReconnect = YES
171
+ // if ([reconnectVC respondsToSelector:@selector(setIsForReconnect:)]) {
172
+ // [reconnectVC setValue:@(YES) forKey:@"isForReconnect"];
173
+ // }
174
+ // // Present it directly without navigation
175
+ //// if (reconnectVC) {
176
+ //// [rootVC presentViewController:reconnectVC animated:YES completion:nil];
177
+ //// }
178
+ //
179
+ // UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:reconnectVC];
180
+ // navController.modalPresentationStyle = UIModalPresentationOverFullScreen;
181
+ // if (reconnectVC) {
182
+ // [rootVC presentViewController:navController animated:YES completion:nil];
183
+ // }
184
+ // });
131
185
 
186
+ NSLog(@"Received token: %@", token);
187
+
132
188
  [[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
189
+ [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"isForReconnect"];
133
190
  [[NSUserDefaults standardUserDefaults] synchronize];
191
+
134
192
  dispatch_async(dispatch_get_main_queue(), ^{
135
193
  UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
136
194
  UIViewController *rootVC = keyWindow.rootViewController;
137
- // Load the storyboard
195
+
138
196
  UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainCGM" bundle:[NSBundle mainBundle]];
139
-
140
- // Instantiate the target ViewController
141
197
  UIViewController *reconnectVC = [storyboard instantiateViewControllerWithIdentifier:@"StartConnectionViewController"];
142
198
 
143
- // Set presentation style
144
199
  reconnectVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
145
- // Set isForReconnect = YES
146
- if ([reconnectVC respondsToSelector:@selector(setIsForReconnect:)]) {
147
- [reconnectVC setValue:@(YES) forKey:@"isForReconnect"];
148
- }
149
- // Present it directly without navigation
150
- // if (reconnectVC) {
151
- // [rootVC presentViewController:reconnectVC animated:YES completion:nil];
152
- // }
153
-
200
+
154
201
  UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:reconnectVC];
155
202
  navController.modalPresentationStyle = UIModalPresentationOverFullScreen;
203
+
156
204
  if (reconnectVC) {
157
205
  [rootVC presentViewController:navController animated:YES completion:nil];
158
206
  }
@@ -173,6 +173,7 @@ class API {
173
173
  if sensorId.isEmpty { return }
174
174
 
175
175
  let url = URL(string: "https://api-feature2.mytatva.in/api/v8/cgm/connection")!
176
+ print("===>Api: https://api-feature2.mytatva.in/api/v8/cgm/connection")
176
177
  var request = URLRequest(url: url)
177
178
  request.httpMethod = "POST"
178
179
 
@@ -55,6 +55,7 @@ class AttachTransmitterViewController: UIViewController {
55
55
  let arrayFromInitial = KLTDatabaseHandler.shared().queryReceiveData(with: device, needUserBG: true) as! [ReceiveData]
56
56
  print(arrayFromInitial)
57
57
  print("===> arrayFromInitial count: ", arrayFromInitial.count)
58
+
58
59
  self.viewModel.uploadData(data: arrayFromInitial)
59
60
  }
60
61
  NotificationCenter.default.post(name: Notification.Name("cgmDeviceEvent"), object: nil, userInfo: ["a":"a"])
@@ -10,12 +10,15 @@ import WebKit
10
10
  import CoreBluetooth
11
11
  import CoreLocation
12
12
 
13
+ @objc(StartConnectionViewController)
13
14
  class StartConnectionViewController: UIViewController {
14
15
 
15
16
  @IBOutlet weak var customTopView: CustomTopUIView!
16
17
  @IBOutlet weak var tableView: UITableView!
17
18
  @IBOutlet weak var startConnectionJourneyButton: CustomOverlayButton!
18
- @objc var isForReconnect: Bool = false
19
+
20
+
21
+ // @objc var isForReconnect: Bool = false
19
22
  var webView: WKWebView!
20
23
  // Declare the CBCentralManager
21
24
  var centralManager: CBCentralManager?
@@ -48,7 +51,7 @@ class StartConnectionViewController: UIViewController {
48
51
  ImageTVC.self,
49
52
  ChargingIndicatorTVC.self])
50
53
  tableView.reloadData()
51
- UserDefaults.standard.set(isLocationEnabled, forKey: "isForReconnect")
54
+ // UserDefaults.standard.set(isLocationEnabled, forKey: "isForReconnect")
52
55
 
53
56
  let isForReconnect = UserDefaults.standard.bool(forKey: "isForReconnect")
54
57
  if isForReconnect{
@@ -56,11 +59,13 @@ class StartConnectionViewController: UIViewController {
56
59
  centralManager = CBCentralManager(delegate: self, queue: nil)
57
60
  // If the switch is turned on, check if Bluetooth is powered on
58
61
  checkBluetoothPermission()
62
+ startConnectionJourneyButton.labelText = "Start Reconnection Journey"
63
+ } else {
64
+ startConnectionJourneyButton.labelText = "Start Connection Journey"
59
65
  }
60
- startConnectionJourneyButton.labelText = "Start Connection Journey"
66
+
61
67
  startConnectionJourneyButton.buttonTapCallback = {
62
-
63
- if isForReconnect{
68
+ if isForReconnect {
64
69
  self.updateBottomButtonState()
65
70
  } else {
66
71
  let vc = ProvidePermissionViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
@@ -111,25 +111,34 @@ import Foundation
111
111
  print("Current date is in range")
112
112
  if ((viewModel.manager.connectedPeripheral == nil) && !KLTLocalSettingManager.shareInstance().canConnectOtherDevice) {
113
113
  viewModel.manager.startScan()
114
- viewModel.debouncer.update(with: .disconnected)
114
+ viewModel.debouncer.update(with: .transmitterDisconnect)
115
115
  } else {
116
116
  print("here")
117
117
  //debouncer.update(with: .connected)
118
118
  //API.shared.sendStatus(status: .connected) 计算 算法入参
119
- if let last = viewModel.manager.currentDevice { }
119
+ if let last = viewModel.manager.currentDevice {
120
+
121
+ }
120
122
  else {
123
+
121
124
  //self.manager.closeBleSensor()
122
125
  //manager.startScan()
123
126
  //self.debouncer.update(with: .disconnected)
124
127
  //debouncer.update(with: .transmitterDisconnectBox)
125
128
  }
129
+
130
+ if KLTBluetoothManager.shared().currentDevice.connectedDateTime == nil && KLTBluetoothManager.shared().currentDevice.disconnectedDateTime == nil {
131
+ viewModel.manager.startScan()
132
+ viewModel.debouncer.update(with: .transmitterDisconnect)
133
+ }
126
134
  }
127
- // if KLTBluetoothManager.shared().currentDevice.initialEndDate != nil {
128
- //
129
135
  }
130
136
 
131
137
  return updatedResponse
132
138
  }
139
+
140
+
141
+
133
142
  }
134
143
 
135
144
  class FinalViewModel: NSObject {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-mytatva-rn-sdk",
3
- "version": "1.2.41",
3
+ "version": "1.2.42",
4
4
  "description": "a package to inject data into visit health pwa",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",