react-native-mytatva-rn-sdk 1.2.52 → 1.2.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/mytatvarnsdk/CgmTrackyLibModule.kt +113 -73
- package/android/src/main/java/com/mytatvarnsdk/activity/ConnectSensorActivity.kt +1 -1
- package/android/src/main/java/com/mytatvarnsdk/activity/PermissionActivity.kt +1 -1
- package/android/src/main/java/com/mytatvarnsdk/activity/PlaceSensorActivity.kt +1 -1
- package/android/src/main/java/com/mytatvarnsdk/activity/PlaceTransmitterActivity.kt +1 -1
- package/android/src/main/java/com/mytatvarnsdk/activity/SearchTransmitterActivity.kt +3 -4
- package/android/src/main/java/com/mytatvarnsdk/activity/SensorConnectSuccessActivity.kt +8 -5
- package/android/src/main/java/com/mytatvarnsdk/activity/StartCGMActivity.kt +1 -1
- package/android/src/main/java/com/mytatvarnsdk/network/AuthenticateSDKService.kt +197 -197
- package/android/src/main/java/com/mytatvarnsdk/utils/TatvaEncryptionConfig.kt +1 -1
- package/ios/Database/KLTBluetoothManager.m +4 -0
- package/ios/Database/KLTDatabaseHandler.m +50 -103
- package/ios/Database/KLTLocalSettingManager.h +3 -0
- package/ios/MyReactNativeBridge.m +27 -15
- package/ios/Support/API.swift +8 -8
- package/ios/ViewControllers/AttachTransmitterViewController.swift +1 -1
- package/ios/ViewModel/FinalViewModel.swift +12 -15
- package/lib/commonjs/CGMConnect.js +12 -12
- package/lib/commonjs/CGMConnect.js.map +1 -1
- package/lib/module/CGMConnect.js +12 -12
- package/lib/module/CGMConnect.js.map +1 -1
- package/lib/typescript/CGMConnect.d.ts +5 -5
- package/package.json +2 -2
- package/src/CGMConnect.ts +26 -12
|
@@ -118,6 +118,7 @@
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
// ------------- 保存血糖数据 -------------
|
|
121
|
+
//Save blood glucose data
|
|
121
122
|
- (GlucoseData *)addCT3GlucoseDataWithReceiveData:(ReceiveData *)data {
|
|
122
123
|
GlucoseData *glucose = [NSEntityDescription insertNewObjectForEntityForName:@"GlucoseData" inManagedObjectContext:self.context];
|
|
123
124
|
glucose.userBG = data.userBG;
|
|
@@ -130,20 +131,6 @@
|
|
|
130
131
|
glucose.temperature = data.temperature;
|
|
131
132
|
float algo_k = [[User_Defaults objectForKey:@"algo_k"] floatValue];
|
|
132
133
|
float algo_r = [[User_Defaults objectForKey:@"algo_r"] floatValue];
|
|
133
|
-
|
|
134
|
-
NSString *dateString = data.receiveDateTime;
|
|
135
|
-
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
|
|
136
|
-
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm"];
|
|
137
|
-
[dateFormatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC"]];
|
|
138
|
-
NSDate *date = [dateFormatter dateFromString:dateString];
|
|
139
|
-
if (date) {
|
|
140
|
-
NSTimeInterval timeMillis = [date timeIntervalSince1970] * 1000; // Convert to milliseconds
|
|
141
|
-
NSLog(@"Milliseconds since epoch: %.0f", timeMillis);
|
|
142
|
-
NSNumber *numberFromTimeMillis = [NSNumber numberWithDouble:timeMillis]; // Wrap the NSTimeInterval into an NSNumber
|
|
143
|
-
} else {
|
|
144
|
-
NSLog(@"Invalid date string format");
|
|
145
|
-
}
|
|
146
|
-
|
|
147
134
|
|
|
148
135
|
LatestData *d = nil;
|
|
149
136
|
NSString *localName = data.device.advertise.localName;
|
|
@@ -151,24 +138,13 @@
|
|
|
151
138
|
if (userBG > 0) {
|
|
152
139
|
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];
|
|
153
140
|
} else {
|
|
154
|
-
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] andName:localName
|
|
141
|
+
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] andName:localName];
|
|
155
142
|
}
|
|
156
143
|
d.algorithm = AlgorithmType_CT4;
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
NSLog( @"sensorInfosensorInf %f", d.R);
|
|
161
|
-
|
|
162
|
-
NSLog( @"sensorInfosensorInfosensorInfosensorInfo %@", d.sensorInfo);
|
|
163
|
-
|
|
164
|
-
NSLog(@"算法入参dataId=%@, operatingCurrent=%@, blankCurrent=%@, temperature=%@, algo_k=%@, algo_r=%@, day=%@, hour=%@, minute=%@, localName=%@, algorithm=%@, year=%@, milles=%@", @(d.glucoseId), @(d.Iw), @(d.Ib), @(d.T), @(d.K0), @(d.R), @(d.day), @(d.hour), @(d.minute), d.name, @(d.algorithm), @(d.year), @(d.timeMillis));
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
144
|
|
|
145
|
+
KLTLog(@"算法入参dataId=%@, operatingCurrent=%@, blankCurrent=%@, temperature=%@, algo_k=%@, algo_r=%@, day=%@, hour=%@, minute=%@, localName=%@, newBgValue=%@, algorithm=%@", @(d.glucoseId), @(d.Iw), @(d.Ib), @(d.T), @(d.K0), @(d.R), @(d.day), @(d.hour), @(d.minute), d.name, @(d.newBgValue), @(d.algorithm));
|
|
169
146
|
CurrentGlucose *currentGlucose = [AlgorithmTools algorithmLatestGlucose:d];
|
|
170
147
|
|
|
171
|
-
|
|
172
148
|
if (currentGlucose.errorCode == ERROR_CODE_ALGORITHM_DATA) {
|
|
173
149
|
[self reloadQueryHistoryData];
|
|
174
150
|
|
|
@@ -178,35 +154,11 @@
|
|
|
178
154
|
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] andName:localName];
|
|
179
155
|
}
|
|
180
156
|
d.algorithm = AlgorithmType_CT4;
|
|
181
|
-
|
|
182
157
|
|
|
183
|
-
|
|
158
|
+
KLTLog(@"ERROR_CODE_ALGORITHM_DATA:dataId=%@, operatingCurrent=%@, blankCurrent=%@, temperature=%@, algo_k=%@, algo_r=%@, day=%@, hour=%@, minute=%@, localName=%@, newBgValue=%@, algorithm=%@", @(d.glucoseId), @(d.Iw), @(d.Ib), @(d.T), @(d.K0), @(d.R), @(d.day), @(d.hour), @(d.minute), d.name, @(d.newBgValue), @(d.algorithm));
|
|
184
159
|
currentGlucose = [AlgorithmTools algorithmLatestGlucose:d];
|
|
185
|
-
|
|
186
|
-
NSString *logString = [NSString stringWithFormat:@"glucoseId=%@, Iw=%@, Ib=%@, T=%@,dayCount=%@, hour=%@, minute=%@, milles=%@, GluMG=%@,BGCount=%@, BGICount=%@, errorCode=%@ trend=%@ calibrationStatus=%@, countdownDays=%@, countdownHours=%@, countdownMinutes=%@ ",
|
|
187
|
-
@(d.glucoseId),
|
|
188
|
-
@(d.Iw),
|
|
189
|
-
@(d.Ib),
|
|
190
|
-
@(d.T),
|
|
191
|
-
@(d.day),
|
|
192
|
-
@(d.hour),
|
|
193
|
-
@(d.minute),
|
|
194
|
-
@(d.timeMillis),
|
|
195
|
-
@(currentGlucose.GluMG),
|
|
196
|
-
@(currentGlucose.BGCount),
|
|
197
|
-
@(currentGlucose.BGICount),
|
|
198
|
-
@(currentGlucose.errorCode),
|
|
199
|
-
@(currentGlucose.trend),
|
|
200
|
-
@(currentGlucose.BGMG),
|
|
201
|
-
@(currentGlucose.countdownDays),
|
|
202
|
-
@(currentGlucose.countdownHours),
|
|
203
|
-
@(currentGlucose.countdownHours)
|
|
204
|
-
|
|
205
|
-
];
|
|
206
|
-
|
|
207
160
|
}
|
|
208
161
|
|
|
209
|
-
|
|
210
162
|
glucose.errorCode = @(currentGlucose.errorCode);
|
|
211
163
|
glucose.trend = @(currentGlucose.trend);
|
|
212
164
|
/* glucose.glu 保存 ADC 算法结果 单位mmol */
|
|
@@ -221,29 +173,11 @@
|
|
|
221
173
|
data.calibration = @(currentGlucose.BGMG);
|
|
222
174
|
data.error = @(currentGlucose.errorCode);
|
|
223
175
|
data.trend = @(currentGlucose.trend);
|
|
176
|
+
data.countdownDays = @(currentGlucose.countdownDays);
|
|
177
|
+
data.countdownHours = @(currentGlucose.countdownHours);
|
|
178
|
+
data.countdownMinutes = @(currentGlucose.countdownMinutes);
|
|
224
179
|
|
|
225
|
-
|
|
226
|
-
@(d.glucoseId),
|
|
227
|
-
@(d.Iw),
|
|
228
|
-
@(d.Ib),
|
|
229
|
-
@(d.T),
|
|
230
|
-
@(d.day),
|
|
231
|
-
@(d.hour),
|
|
232
|
-
@(d.minute),
|
|
233
|
-
@(d.timeMillis),
|
|
234
|
-
@(currentGlucose.GluMG),
|
|
235
|
-
@(currentGlucose.BGCount),
|
|
236
|
-
@(currentGlucose.BGICount),
|
|
237
|
-
@(currentGlucose.errorCode),
|
|
238
|
-
@(currentGlucose.trend),
|
|
239
|
-
@(currentGlucose.BGMG),
|
|
240
|
-
@(currentGlucose.countdownDays),
|
|
241
|
-
@(currentGlucose.countdownHours),
|
|
242
|
-
@(currentGlucose.countdownHours)
|
|
243
|
-
|
|
244
|
-
];
|
|
245
|
-
|
|
246
|
-
|
|
180
|
+
[Notification_Center postNotificationName:@"ErrorStatusFromTransmitter" object:data];
|
|
247
181
|
[self.appDelegate saveContext];
|
|
248
182
|
return glucose;
|
|
249
183
|
}
|
|
@@ -304,7 +238,7 @@
|
|
|
304
238
|
|
|
305
239
|
|
|
306
240
|
// 如果不是第一次连接发射器,更新device连接次数和连接时间
|
|
307
|
-
- (void)updateDeviceWithDeviceId:(NSString *)identify
|
|
241
|
+
- (void)updateDeviceWithDeviceId:(NSString *)identify
|
|
308
242
|
scannedTime:(NSString *)scannedTime
|
|
309
243
|
connectTime:(NSString *)connectTime
|
|
310
244
|
disConnectTime:(NSString *)disconnectTime {
|
|
@@ -362,42 +296,56 @@
|
|
|
362
296
|
|
|
363
297
|
// 根据条件查询Receivedata表
|
|
364
298
|
|
|
299
|
+
//- (NSArray *)queryReceiveDataWithDevice:(Device *)currentDevice needUserBG:(BOOL)needUserBG {
|
|
300
|
+
// if (!self.context) {
|
|
301
|
+
// NSLog(@"Core Data context is nil");
|
|
302
|
+
// return @[];
|
|
303
|
+
// }
|
|
304
|
+
//
|
|
305
|
+
// NSEntityDescription *entity = [NSEntityDescription entityForName:@"ReceiveDataInfo" inManagedObjectContext:self.context];
|
|
306
|
+
// if (!entity) {
|
|
307
|
+
// NSLog(@"Entity 'ReceiveDataInfo' not found in Core Data model");
|
|
308
|
+
// return @[];
|
|
309
|
+
// }
|
|
310
|
+
//
|
|
311
|
+
// NSFetchRequest *request = [[NSFetchRequest alloc] init];
|
|
312
|
+
// request.entity = entity;
|
|
313
|
+
//
|
|
314
|
+
// NSPredicate *predicate;
|
|
315
|
+
// if (needUserBG) {
|
|
316
|
+
// predicate = [NSPredicate predicateWithFormat:@"device.identifier = %@ AND initialBeginDate = %@ AND gluADC > 0 AND gluADC != nil AND isDelete == nil", currentDevice.identifier, currentDevice.initialBeginDate];
|
|
317
|
+
// } else {
|
|
318
|
+
// predicate = [NSPredicate predicateWithFormat:@"device.identifier = %@ AND initialBeginDate = %@ AND isDelete == nil", currentDevice.identifier, currentDevice.initialBeginDate];
|
|
319
|
+
// }
|
|
320
|
+
// request.predicate = predicate;
|
|
321
|
+
//
|
|
322
|
+
// NSError *fetchError = nil;
|
|
323
|
+
// NSArray *resendDatas = [self.context executeFetchRequest:request error:&fetchError];
|
|
324
|
+
//
|
|
325
|
+
// if (fetchError) {
|
|
326
|
+
// NSLog(@"❌ Fetch error: %@", fetchError.localizedDescription);
|
|
327
|
+
// return @[];
|
|
328
|
+
// }
|
|
329
|
+
//
|
|
330
|
+
// resendDatas = [resendDatas sortedArrayUsingDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:@"receiveDateTime" ascending:YES]]];
|
|
331
|
+
// NSLog(@"📡 resendDatas: %@", resendDatas);
|
|
332
|
+
//
|
|
333
|
+
// return resendDatas;
|
|
334
|
+
//}
|
|
335
|
+
|
|
365
336
|
- (NSArray *)queryReceiveDataWithDevice:(Device *)currentDevice needUserBG:(BOOL)needUserBG {
|
|
366
|
-
if (!self.context) {
|
|
367
|
-
NSLog(@"Core Data context is nil");
|
|
368
|
-
return @[];
|
|
369
|
-
}
|
|
370
|
-
|
|
371
337
|
NSEntityDescription *entity = [NSEntityDescription entityForName:@"ReceiveDataInfo" inManagedObjectContext:self.context];
|
|
372
|
-
if (!entity) {
|
|
373
|
-
NSLog(@"Entity 'ReceiveDataInfo' not found in Core Data model");
|
|
374
|
-
return @[];
|
|
375
|
-
}
|
|
376
|
-
|
|
377
338
|
NSFetchRequest *request = [[NSFetchRequest alloc] init];
|
|
378
|
-
request.entity = entity;
|
|
379
|
-
|
|
380
339
|
NSPredicate *predicate;
|
|
381
340
|
if (needUserBG) {
|
|
382
|
-
predicate = [NSPredicate predicateWithFormat:@"device.identifier = %@ AND initialBeginDate = %@
|
|
341
|
+
predicate = [NSPredicate predicateWithFormat:@"device.identifier = %@ AND initialBeginDate = %@ && userBG > 0 && userBG != NIL",currentDevice.identifier, currentDevice.initialBeginDate];
|
|
383
342
|
} else {
|
|
384
|
-
predicate = [NSPredicate predicateWithFormat:@"device.identifier = %@ AND initialBeginDate = %@
|
|
343
|
+
predicate = [NSPredicate predicateWithFormat:@"device.identifier = %@ AND initialBeginDate = %@",currentDevice.identifier, currentDevice.initialBeginDate];
|
|
385
344
|
}
|
|
345
|
+
request.entity = entity;
|
|
386
346
|
request.predicate = predicate;
|
|
387
|
-
|
|
388
|
-
NSError *fetchError = nil;
|
|
389
|
-
NSArray *resendDatas = [self.context executeFetchRequest:request error:&fetchError];
|
|
390
|
-
|
|
391
|
-
if (fetchError) {
|
|
392
|
-
NSLog(@"❌ Fetch error: %@", fetchError.localizedDescription);
|
|
393
|
-
return @[];
|
|
394
|
-
}
|
|
395
|
-
|
|
347
|
+
NSArray *resendDatas = [self.context executeFetchRequest:request error:nil];
|
|
396
348
|
resendDatas = [resendDatas sortedArrayUsingDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:@"receiveDateTime" ascending:YES]]];
|
|
397
|
-
NSLog(@"entity: %@", entity);
|
|
398
|
-
NSLog(@"predicate: %@", predicate);
|
|
399
|
-
NSLog(@"📡 resendDatas: %@", resendDatas);
|
|
400
|
-
|
|
401
349
|
return resendDatas;
|
|
402
350
|
}
|
|
403
351
|
|
|
@@ -448,7 +396,6 @@
|
|
|
448
396
|
}
|
|
449
397
|
|
|
450
398
|
// 查询最近一次连接的最大的血糖ID
|
|
451
|
-
//Query the highest blood glucose ID from the most recent connection
|
|
452
399
|
- (NSInteger)getLatestAndMaxGlucoseIdOfDevice:(Device *)currentDevice {
|
|
453
400
|
NSArray *array = [self queryReceiveDataWithDevice:currentDevice needUserBG:NO];
|
|
454
401
|
if (array.count > 0) {
|
|
@@ -31,6 +31,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
31
31
|
@property (nonatomic, assign) BOOL hasNumberPrefix;
|
|
32
32
|
|
|
33
33
|
// 是否能连其他发射器 NO:标识当前已绑定发射器 YES:当前未绑定发射器
|
|
34
|
+
//Can other transmitters be connected
|
|
35
|
+
//NO: Indicates that a transmitter is already bound
|
|
36
|
+
//YES: Indicates that no transmitter is currently bound
|
|
34
37
|
@property (nonatomic, assign) BOOL canConnectOtherDevice;
|
|
35
38
|
|
|
36
39
|
@end
|
|
@@ -434,11 +434,14 @@ RCT_EXPORT_MODULE();
|
|
|
434
434
|
}
|
|
435
435
|
|
|
436
436
|
|
|
437
|
-
RCT_EXPORT_METHOD(startCgmTracky:(NSString *)token)
|
|
437
|
+
RCT_EXPORT_METHOD(startCgmTracky:(NSString *)token envType: (NSString *)envType)
|
|
438
438
|
{
|
|
439
|
-
|
|
440
|
-
[
|
|
441
|
-
|
|
439
|
+
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
|
440
|
+
[defaults setObject:token forKey:@"authToken"];
|
|
441
|
+
[defaults setBool:false forKey:@"isForReconnect"];
|
|
442
|
+
[defaults setObject:envType forKey:@"envType"];
|
|
443
|
+
|
|
444
|
+
[defaults synchronize];
|
|
442
445
|
|
|
443
446
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
444
447
|
UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
|
|
@@ -459,12 +462,14 @@ RCT_EXPORT_METHOD(startCgmTracky:(NSString *)token)
|
|
|
459
462
|
}
|
|
460
463
|
|
|
461
464
|
|
|
462
|
-
RCT_EXPORT_METHOD(reconnectCgmTracky:(NSString *)token) {
|
|
465
|
+
RCT_EXPORT_METHOD(reconnectCgmTracky:(NSString *)token envType: (NSString *)envType) {
|
|
463
466
|
NSLog(@"Received token: %@", token);
|
|
464
|
-
|
|
465
|
-
[
|
|
466
|
-
[
|
|
467
|
-
[
|
|
467
|
+
|
|
468
|
+
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
|
469
|
+
[defaults setObject:token forKey:@"authToken"];
|
|
470
|
+
[defaults setBool:YES forKey:@"isForReconnect"];
|
|
471
|
+
[defaults setObject:envType forKey:@"envType"];
|
|
472
|
+
[defaults synchronize];
|
|
468
473
|
|
|
469
474
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
470
475
|
UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
|
|
@@ -506,10 +511,12 @@ RCT_EXPORT_METHOD(openHelpSupport)
|
|
|
506
511
|
});
|
|
507
512
|
}
|
|
508
513
|
|
|
509
|
-
RCT_EXPORT_METHOD(observeAllGlucoseData:(NSString *)token)
|
|
514
|
+
RCT_EXPORT_METHOD(observeAllGlucoseData:(NSString *)token isForClearData:(BOOL)isForClearData envType:(NSString *)envType)
|
|
510
515
|
{
|
|
511
|
-
|
|
512
|
-
|
|
516
|
+
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
|
517
|
+
[defaults setObject:token forKey:@"authToken"];
|
|
518
|
+
[defaults setObject:envType forKey:@"envType"];
|
|
519
|
+
[defaults synchronize];
|
|
513
520
|
|
|
514
521
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
515
522
|
UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
|
|
@@ -534,6 +541,8 @@ RCT_EXPORT_METHOD(observeAllGlucoseData:(NSString *)token)
|
|
|
534
541
|
|
|
535
542
|
RCT_EXPORT_METHOD(observeTransmitterUnbindStatus:(NSString *)token
|
|
536
543
|
response:(NSString *)responseJsonString
|
|
544
|
+
patientId: (NSString *)patientId
|
|
545
|
+
envType: (NSString *)envType
|
|
537
546
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
538
547
|
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
539
548
|
if (responseJsonString == nil || ![responseJsonString isKindOfClass:[NSString class]]) {
|
|
@@ -553,9 +562,12 @@ RCT_EXPORT_METHOD(observeTransmitterUnbindStatus:(NSString *)token
|
|
|
553
562
|
return;
|
|
554
563
|
}
|
|
555
564
|
|
|
556
|
-
[
|
|
557
|
-
[
|
|
558
|
-
[
|
|
565
|
+
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
|
566
|
+
[defaults setObject:token forKey:@"authToken"];
|
|
567
|
+
[defaults setObject:data forKey:@"CGMStatusItem"];
|
|
568
|
+
[defaults setObject:patientId forKey:@"patientId"];
|
|
569
|
+
[defaults setObject:envType forKey:@"envType"];
|
|
570
|
+
[defaults synchronize];
|
|
559
571
|
|
|
560
572
|
FinalViewModelManager *manager = [FinalViewModelManager shared];
|
|
561
573
|
[manager callForObserveTransmitterUnbindStatusWithCompletion:^(NSDictionary *response, NSError *error) {
|
package/ios/Support/API.swift
CHANGED
|
@@ -11,7 +11,7 @@ import CommonCrypto
|
|
|
11
11
|
let PROD_API_KEY = "lChjFRJce3bxmoS3TSQk5w=="
|
|
12
12
|
let STAGE_API_KEY = "lChjFRJce3bxmoS3TSQk5w=="
|
|
13
13
|
let PROD_BASE_URL = "https://api.mytatva.in/api/v8"
|
|
14
|
-
let STAGE_BASE_URL = "https://api-
|
|
14
|
+
let STAGE_BASE_URL = "https://api-uat.mytatva.in/api/v8"
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
let PROD_ENC_KEY = "9Ddyaf6rfywpiTvTiax2iq6ykKpaxgJ6"
|
|
@@ -23,7 +23,7 @@ let STAGE_ENC_IV = "9Ddyaf6rfywpiTvT"
|
|
|
23
23
|
|
|
24
24
|
let defaultToken = "ILtFcw+xtbuy8IgsBCSyD6nSpgZd5AOz7T+g3N8Tef/INZi+dxwPJhnBc2kfdq2e8Kw2yayjaKjuji64coUJsK7e4QcF7sqXCp3Cy5S2OVE+hONwCipkrn9d1yjsBWIDqfLK9ModJCWdigDj5ZeSwkWYSSeTEVoN3Dc2Y8cuqKUQvN9ZcNGmdRrXz2oo3rm4EHQrXPo1Ijufm0HfcqzSH/Gh0TC5gFKjde/GEXIm5Z2Ju1/TTXVSJg/zxNuOF4iUKNEh4UIFUYxYpnqlALRCdF75J+9WAZ7/LBGyB1Wrx+D7bsrzRiQ5sCTwxE3TCM3s66lYJizX22VIzYKOIrJ6GTOYGTINHeIJKEPEvFceR+cG54ez15V1r77ErQElevItD3xIGe0uDezfnixJYPxPhSEOPOyIpxUFInXBRdGjllHPIevzBqqHeP76nz+1U7mFNs1kofugN+5huT3/tCifTQqFyWuxD+VIhl0UJxhxPMbBgoryANgKCToWrK2FqdJwBtZKwCj3S+yp0rff0fwrbMXXsYytJyVLLY2oNviHtzDa/kih0AnMA3vEbqYkf1PQ6LZv+AmtpNYHKh7kMDrhVE3wVxH4+ga0+sfuxYgfiZXCoQW7yY0wOZTiFbgvL2TQflDZR6ttK5abtyKYV4gl5KqbFLZW+d4pKLQoZb02NbJc+5h5gAH2VclTJc6fbkd0qIWuXyqGIBEc2uYrNl2v3vmVvbcGevSqb900ozo6SbFccQLjLcEon+okmgBIDPvBEZFj8fZgQV4z8/yzayDcfqZQPc9Wrw8JNrFLCd8emvo7QHFfGttnIsAtmR8Yp3x49sjEn3hFW6nEKl9FRtRT1r3LzHmIdokL5tz3nO/T3FzLn5sqfp5QBJKKK2dgJdmAz0KC6vKtJ0PtVR4shL7pqjoZuJimFObYKyQbQudW7gLH8WjqORNG2dsplOLzDQ0y7nQdQ0tWrLJtnAch0p5PyTXtunlkNWeuzrldkqVMTUPaAtGcEnmS4RFncD3C6sq9V6lpBKLdrh99vnH3EX81DTH2Hrqm0bN5Tl3UqzUJ7n/JQCR3phDmOo+Uk81y3z3ikiGZZpZikN7c3DtSP34Vc+cNUosWrChqj1gLL4Eg/jMDxE4+bdAGr03ALxEAj2uLGEsDaZRuio6e8/iMcA0z3oqhtAxQ0nU1ivAK7cHeddjRFtvrNb0l+TgrcQI9UVffMOoGDEfAQNUpT2+R5dIysw=="
|
|
25
25
|
let TOKEN = UserDefaults.standard.string(forKey: "authToken") ?? defaultToken
|
|
26
|
-
|
|
26
|
+
let envType = UserDefaults.standard.string(forKey: "envType") ?? "uat"
|
|
27
27
|
|
|
28
28
|
/*TatvaEncryptionConfig {
|
|
29
29
|
const val STAGE_BASE_URL = "https://api-feature2.mytatva.in/api/v8"
|
|
@@ -96,14 +96,13 @@ class API {
|
|
|
96
96
|
private init() {}
|
|
97
97
|
|
|
98
98
|
func postCGMData(
|
|
99
|
-
environment: TatvaEnvironment,
|
|
100
99
|
data: Payload,
|
|
101
100
|
token: String = TOKEN,
|
|
102
101
|
encryptionKey: String = PROD_ENC_KEY,
|
|
103
102
|
encryptionIv: String = PROD_ENC_IV,
|
|
104
103
|
onSuccess: @escaping () -> Void,
|
|
105
104
|
onFailure: @escaping (Error?) -> Void
|
|
106
|
-
) {
|
|
105
|
+
) {// environment: TatvaEnvironment,
|
|
107
106
|
|
|
108
107
|
print("ios token:", token)
|
|
109
108
|
Task {
|
|
@@ -124,14 +123,14 @@ class API {
|
|
|
124
123
|
print("===>Decrypted (for verification): \(decrypted)")
|
|
125
124
|
}
|
|
126
125
|
|
|
127
|
-
let urlString = (
|
|
126
|
+
let urlString = (envType.lowercased() == "uat" ? STAGE_BASE_URL : PROD_BASE_URL) + "/cgm/logs"
|
|
128
127
|
guard let url = URL(string: urlString) else {
|
|
129
128
|
throw URLError(.badURL)
|
|
130
129
|
}
|
|
131
130
|
|
|
132
131
|
var request = URLRequest(url: url)
|
|
133
132
|
request.httpMethod = "POST"
|
|
134
|
-
request.setValue(
|
|
133
|
+
request.setValue(envType.lowercased() == "uat" ? STAGE_API_KEY : PROD_API_KEY, forHTTPHeaderField: "api-key")
|
|
135
134
|
request.setValue(token, forHTTPHeaderField: "token")
|
|
136
135
|
request.setValue("text/plain", forHTTPHeaderField: "Content-Type")
|
|
137
136
|
request.httpBody = encrypted.data(using: .utf8)
|
|
@@ -172,13 +171,14 @@ class API {
|
|
|
172
171
|
encryptionIv: String = PROD_ENC_IV) {
|
|
173
172
|
if sensorId.isEmpty { return }
|
|
174
173
|
|
|
175
|
-
let
|
|
174
|
+
let urlString = (envType.lowercased() == "uat" ? STAGE_BASE_URL : PROD_BASE_URL) + "/cgm/connection"
|
|
175
|
+
let url = URL(string: urlString)!
|
|
176
176
|
var request = URLRequest(url: url)
|
|
177
177
|
request.httpMethod = "POST"
|
|
178
178
|
|
|
179
179
|
// Set headers
|
|
180
180
|
request.addValue("text/plain", forHTTPHeaderField: "Content-Type")
|
|
181
|
-
request.
|
|
181
|
+
request.setValue(envType.lowercased() == "uat" ? STAGE_API_KEY : PROD_API_KEY, forHTTPHeaderField: "api-key")
|
|
182
182
|
request.addValue(TOKEN, forHTTPHeaderField: "token")
|
|
183
183
|
print("===>url:", "https://api-feature2.mytatva.in/api/v8/cgm/connection")
|
|
184
184
|
print("===>api-key:", PROD_API_KEY)
|
|
@@ -71,7 +71,7 @@ class AttachTransmitterViewController: UIViewController {
|
|
|
71
71
|
let data = KLTDatabaseHandler.shared().queryAllReceiveData() as! [ReceiveData]
|
|
72
72
|
print(data)
|
|
73
73
|
print("===> all data count: ", data.count)
|
|
74
|
-
KLTDatabaseHandler.shared().reloadQueryHistoryData()
|
|
74
|
+
// KLTDatabaseHandler.shared().reloadQueryHistoryData()
|
|
75
75
|
if let device = KLTBluetoothManager.shared().currentDevice {
|
|
76
76
|
let arrayFromInitial = KLTDatabaseHandler.shared().queryReceiveData(with: device, needUserBG: true) as! [ReceiveData]
|
|
77
77
|
print(arrayFromInitial)
|
|
@@ -14,6 +14,7 @@ import Foundation
|
|
|
14
14
|
private override init() {
|
|
15
15
|
super.init()
|
|
16
16
|
viewModel.initialize()
|
|
17
|
+
KLTDatabaseHandler.shared().reloadQueryHistoryData()
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
// @objc public func callForObserveTransmitterUnbindStatus() {
|
|
@@ -351,7 +352,7 @@ class FinalViewModel: NSObject {
|
|
|
351
352
|
let payload = Payload(logs: cgmLogs)
|
|
352
353
|
|
|
353
354
|
print("====================================> called uploadBatch")
|
|
354
|
-
API.shared.postCGMData(
|
|
355
|
+
API.shared.postCGMData(data: payload) {//environment: .stage
|
|
355
356
|
print("====================================> uploaded successfully")
|
|
356
357
|
print("✅ Batch \(index + 1) uploaded successfully")
|
|
357
358
|
KLTDatabaseHandler.shared().deleteReceiveDataArray(batch)
|
|
@@ -366,7 +367,7 @@ class FinalViewModel: NSObject {
|
|
|
366
367
|
let data = KLTDatabaseHandler.shared().queryAllReceiveData() as! [ReceiveData]
|
|
367
368
|
print(data)
|
|
368
369
|
print("===> all data count: ", data.count)
|
|
369
|
-
KLTDatabaseHandler.shared().reloadQueryHistoryData()
|
|
370
|
+
// KLTDatabaseHandler.shared().reloadQueryHistoryData()
|
|
370
371
|
if let device = KLTBluetoothManager.shared().currentDevice {
|
|
371
372
|
let arrayFromInitial = KLTDatabaseHandler.shared().queryReceiveData(with: device, needUserBG: true) as! [ReceiveData]
|
|
372
373
|
print(arrayFromInitial)
|
|
@@ -486,7 +487,6 @@ class FinalViewModel: NSObject {
|
|
|
486
487
|
switch status {
|
|
487
488
|
|
|
488
489
|
case .disconnected:
|
|
489
|
-
print("----device is disconnected--------")
|
|
490
490
|
print("lastBluetoothStatus-------->> \(lastBluetoothStatus)")
|
|
491
491
|
if lastBluetoothStatus == .connected {
|
|
492
492
|
print("===> Previously connected, delaying disconnect for 1 minute")
|
|
@@ -495,8 +495,8 @@ class FinalViewModel: NSObject {
|
|
|
495
495
|
guard let self = self else { return }
|
|
496
496
|
print("lastBluetoothStatus-------->> \(lastBluetoothStatus)")
|
|
497
497
|
if self.lastBluetoothStatus == .disconnected {
|
|
498
|
+
//1 minute passed, confirmed disconnected
|
|
498
499
|
self.debouncer.update(with: CGMConnectionStatus.disconnected)
|
|
499
|
-
print("===> 1 minute passed, confirmed disconnected")
|
|
500
500
|
} else {
|
|
501
501
|
print("===> Status changed in between, ignoring disconnect")
|
|
502
502
|
}
|
|
@@ -524,11 +524,10 @@ class FinalViewModel: NSObject {
|
|
|
524
524
|
startScanTimer = nil
|
|
525
525
|
print("--------------------------- startScanTimer is nil")
|
|
526
526
|
}
|
|
527
|
-
|
|
527
|
+
|
|
528
528
|
debouncer.update(with: CGMConnectionStatus.connected)
|
|
529
529
|
|
|
530
530
|
case .timeOut:
|
|
531
|
-
print("----device is timeOut--------")
|
|
532
531
|
lastBluetoothStatus = .timeOut
|
|
533
532
|
if !KLTLocalSettingManager.shareInstance().canConnectOtherDevice {
|
|
534
533
|
startScanTimer = Timer.scheduledTimer(timeInterval: 20,
|
|
@@ -539,17 +538,14 @@ class FinalViewModel: NSObject {
|
|
|
539
538
|
}
|
|
540
539
|
|
|
541
540
|
case .sensorLostPower:
|
|
542
|
-
print("----device is sensorLostPower--------")
|
|
543
541
|
lastBluetoothStatus = .sensorLostPower
|
|
544
542
|
sensorLostPower()
|
|
545
543
|
|
|
546
544
|
case .updateBindWatchSuccess:
|
|
547
|
-
print("----device is updateBindWatchSuccess--------")
|
|
548
545
|
lastBluetoothStatus = .updateBindWatchSuccess
|
|
549
546
|
startCountDown()
|
|
550
547
|
|
|
551
548
|
case .closed:
|
|
552
|
-
print("----device is closed--------")
|
|
553
549
|
lastBluetoothStatus = .closed
|
|
554
550
|
debouncer.update(with: CGMConnectionStatus.transmitterDisconnect)
|
|
555
551
|
|
|
@@ -566,11 +562,11 @@ class FinalViewModel: NSObject {
|
|
|
566
562
|
// let status = BluetoothManagerStatus(rawValue: newValue) else {
|
|
567
563
|
// return
|
|
568
564
|
// }
|
|
569
|
-
//
|
|
565
|
+
//
|
|
570
566
|
// print("===>device status is -> \(status)")
|
|
571
|
-
//
|
|
567
|
+
//
|
|
572
568
|
// switch status {
|
|
573
|
-
//
|
|
569
|
+
//
|
|
574
570
|
// case .disconnected:
|
|
575
571
|
// if KLTLocalSettingManager.shareInstance().canConnectOtherDevice {
|
|
576
572
|
// // Unbind then disconnect
|
|
@@ -582,9 +578,9 @@ class FinalViewModel: NSObject {
|
|
|
582
578
|
// }
|
|
583
579
|
// //API.shared.sendStatus(status: .disconnected)
|
|
584
580
|
// print("===>device is disconnected")
|
|
585
|
-
//
|
|
581
|
+
//
|
|
586
582
|
// debouncer.update(with: CGMConnectionStatus.disconnected)
|
|
587
|
-
//
|
|
583
|
+
//
|
|
588
584
|
// case .tryToConnect:
|
|
589
585
|
// // if UserDefaults.standard.integer(forKey: "bgmode") != 1 {
|
|
590
586
|
// // DispatchQueue.main.asyncAfter(deadline: .now() + 20) {
|
|
@@ -610,7 +606,7 @@ class FinalViewModel: NSObject {
|
|
|
610
606
|
// repeats: false)
|
|
611
607
|
// }
|
|
612
608
|
// print("===>time out")
|
|
613
|
-
//
|
|
609
|
+
//
|
|
614
610
|
// case .sensorLostPower:
|
|
615
611
|
// sensorLostPower()
|
|
616
612
|
// print("===>sensor lost power")
|
|
@@ -763,3 +759,4 @@ extension String {
|
|
|
763
759
|
return "\(hours):\(minutes):\(seconds)"
|
|
764
760
|
}
|
|
765
761
|
}
|
|
762
|
+
|
|
@@ -54,36 +54,36 @@ function removeCGMEventListener() {
|
|
|
54
54
|
eventSubscription = null;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
const startCGM = async token => {
|
|
58
|
-
console.log('
|
|
57
|
+
const startCGM = async (token, envType) => {
|
|
58
|
+
console.log('startCGM===');
|
|
59
59
|
try {
|
|
60
|
-
const result = await cgmLib.startCgmTracky(token);
|
|
60
|
+
const result = await cgmLib.startCgmTracky(token, envType);
|
|
61
61
|
console.log(result);
|
|
62
62
|
} catch (error) {
|
|
63
63
|
console.error(error);
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
66
|
exports.startCGM = startCGM;
|
|
67
|
-
const reconnectCGM = async token => {
|
|
67
|
+
const reconnectCGM = async (token, envType) => {
|
|
68
68
|
console.log('reconnectCGM====');
|
|
69
69
|
try {
|
|
70
|
-
const result = await cgmLib.reconnectCgmTracky(token);
|
|
70
|
+
const result = await cgmLib.reconnectCgmTracky(token, envType);
|
|
71
71
|
console.log(result);
|
|
72
72
|
} catch (error) {
|
|
73
73
|
console.error(error);
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
76
|
exports.reconnectCGM = reconnectCGM;
|
|
77
|
-
const observeAllGlucoseDataHandler = async token => {
|
|
77
|
+
const observeAllGlucoseDataHandler = async (token, isCleanData, envType) => {
|
|
78
78
|
console.log('observeAllGlucoseDataHandler====');
|
|
79
79
|
try {
|
|
80
80
|
if (_reactNative.Platform.OS === 'android') {
|
|
81
|
-
const result = await cgmLib.observeAllGlucoseData(token);
|
|
82
|
-
const deviceStatus = await cgmLib.observeDeviceStatus(token);
|
|
81
|
+
const result = await cgmLib.observeAllGlucoseData(token, isCleanData, envType);
|
|
82
|
+
const deviceStatus = await cgmLib.observeDeviceStatus(token, envType);
|
|
83
83
|
console.log(result);
|
|
84
84
|
console.log(deviceStatus);
|
|
85
85
|
} else if (_reactNative.Platform.OS === 'ios') {
|
|
86
|
-
const result = await cgmLib.observeAllGlucoseData(token);
|
|
86
|
+
const result = await cgmLib.observeAllGlucoseData(token, isCleanData, envType);
|
|
87
87
|
console.log(result);
|
|
88
88
|
}
|
|
89
89
|
} catch (error) {
|
|
@@ -92,7 +92,7 @@ const observeAllGlucoseDataHandler = async token => {
|
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
94
|
exports.observeAllGlucoseDataHandler = observeAllGlucoseDataHandler;
|
|
95
|
-
const helpCGM = async token => {
|
|
95
|
+
const helpCGM = async (token, envType) => {
|
|
96
96
|
console.log('helpCGM====');
|
|
97
97
|
try {
|
|
98
98
|
const result = await cgmLib.openHelpSupport();
|
|
@@ -102,10 +102,10 @@ const helpCGM = async token => {
|
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
104
|
exports.helpCGM = helpCGM;
|
|
105
|
-
const observeTransmitterUnbindStatusHandler = async (token, apiResponse, patientId) => {
|
|
105
|
+
const observeTransmitterUnbindStatusHandler = async (token, apiResponse, patientId, envType) => {
|
|
106
106
|
console.log('observeTransmitterUnbindStatusHandler====');
|
|
107
107
|
try {
|
|
108
|
-
const result = await cgmLib.observeTransmitterUnbindStatus(token, apiResponse, patientId);
|
|
108
|
+
const result = await cgmLib.observeTransmitterUnbindStatus(token, apiResponse, patientId, envType);
|
|
109
109
|
console.log(result);
|
|
110
110
|
} catch (error) {
|
|
111
111
|
console.error(error);
|
|
@@ -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","console","log","result","startCgmTracky","error","exports","reconnectCGM","reconnectCgmTracky","observeAllGlucoseDataHandler","observeAllGlucoseData","deviceStatus","observeDeviceStatus","helpCGM","openHelpSupport","observeTransmitterUnbindStatusHandler","apiResponse","patientId","observeTransmitterUnbindStatus","observeResetLogoutHandler","resetCgmState","stopCGM"],"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) => {\n console.log('
|
|
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","console","log","result","startCgmTracky","error","exports","reconnectCGM","reconnectCgmTracky","observeAllGlucoseDataHandler","isCleanData","observeAllGlucoseData","deviceStatus","observeDeviceStatus","helpCGM","openHelpSupport","observeTransmitterUnbindStatusHandler","apiResponse","patientId","observeTransmitterUnbindStatus","observeResetLogoutHandler","resetCgmState","stopCGM"],"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) => {\n console.log('startCGM===');\n try {\n const result = await cgmLib.startCgmTracky(token, envType);\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n};\n\nconst reconnectCGM = async (token: string, envType: string) => {\n console.log('reconnectCGM====');\n try {\n const result = await cgmLib.reconnectCgmTracky(token, envType);\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) => {\n console.log('observeAllGlucoseDataHandler====');\n try {\n if (Platform.OS === 'android') {\n const result = await cgmLib.observeAllGlucoseData(\n token,\n isCleanData,\n envType\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) => {\n console.log('observeTransmitterUnbindStatusHandler====');\n try {\n const result = 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 stopCGM = async () => {\n // Implementation\n};\n\nexport {\n startCGM,\n stopCGM,\n initializeCGMEventListener,\n removeCGMEventListener,\n observeAllGlucoseDataHandler,\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