react-native-mytatva-rn-sdk 1.2.48 → 1.2.49
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 +17 -25
- package/android/src/main/java/com/mytatvarnsdk/activity/BtManageActivity.java +345 -345
- package/android/src/main/java/com/mytatvarnsdk/activity/ConnectSensorActivity.kt +17 -38
- package/android/src/main/java/com/mytatvarnsdk/activity/ExitJourneyBottomSheet.kt +51 -51
- package/android/src/main/java/com/mytatvarnsdk/activity/PermissionActivity.kt +10 -5
- package/android/src/main/java/com/mytatvarnsdk/activity/PlaceSensorActivity.kt +4 -5
- package/android/src/main/java/com/mytatvarnsdk/activity/PlaceTransmitterActivity.kt +4 -5
- package/android/src/main/java/com/mytatvarnsdk/activity/QRActivity.kt +96 -92
- package/android/src/main/java/com/mytatvarnsdk/activity/SearchTransmitterActivity.kt +1 -1
- package/android/src/main/java/com/mytatvarnsdk/activity/SensorConnectSuccessActivity.kt +1 -1
- package/android/src/main/java/com/mytatvarnsdk/activity/StartCGMActivity.kt +4 -2
- package/android/src/main/java/com/mytatvarnsdk/activity/VideoActivity.kt +0 -1
- package/android/src/main/java/com/mytatvarnsdk/utils/TatvaEncryptionConfig.kt +0 -5
- package/ios/Database/KLTBluetoothManager.m +9 -4
- package/ios/Database/KLTDatabaseHandler.m +53 -6
- package/ios/MyReactNativeBridge.h +4 -1
- package/ios/MyReactNativeBridge.m +433 -191
- package/ios/Support/API.swift +0 -1
- package/ios/Support/Global.swift +12 -0
- package/ios/ViewControllers/AttachTransmitterViewController.swift +33 -2
- package/ios/ViewControllers/ChatWithExpertViewController.swift +33 -3
- package/ios/ViewControllers/ConnectToSensorViewController.swift +101 -12
- package/ios/ViewControllers/ConnectToTransmitterViewController.swift +121 -5
- package/ios/ViewControllers/ProvidePermissionViewController.swift +37 -5
- package/ios/ViewControllers/PutOnTheSensorViewController.swift +22 -2
- package/ios/ViewControllers/StartConnectionViewController.swift +31 -3
- package/ios/ViewModel/FinalViewModel.swift +155 -48
- package/package.json +1 -1
|
@@ -1,32 +1,222 @@
|
|
|
1
|
+
//#import <Foundation/Foundation.h>
|
|
2
|
+
//#import "MyReactNativeBridge.h"
|
|
3
|
+
//#import <UIKit/UIKit.h>
|
|
4
|
+
//#import <React/RCTBridgeModule.h>
|
|
5
|
+
//#import <React/RCTEventEmitter.h>
|
|
6
|
+
//#import "react_native_mytatva_rn_sdk-Swift.h"
|
|
1
7
|
//
|
|
2
|
-
|
|
3
|
-
// example
|
|
8
|
+
//// ---------------- MyEventEmitterManager ----------------
|
|
4
9
|
//
|
|
5
|
-
|
|
10
|
+
//@implementation MyEventEmitterManager
|
|
6
11
|
//
|
|
12
|
+
//RCT_EXPORT_MODULE();
|
|
13
|
+
//
|
|
14
|
+
//- (NSArray<NSString *> *)supportedEvents {
|
|
15
|
+
// return @[@"cgmDeviceEvent", @"cgmwatchdemoclicked", @"cgmWAsupportclicked", @"cgmstartconnectionlanding", @"cgmWAsupportproceedclicked", @"cgmstartconnectionjourneyclicked", @"cgmpermissionspagelanding", @"cgmpermissionsproceedclicked", @"cgmconnecttransmitterlanding", @"cgmtransmitterdetected", @"cgmtransmitterdetectionfailed", @"cgmtransmitterconnectionsuccessful", @"cgmretryconnecttransmitterclicked", @"cgmconnectsensorscanlanding", @"cgmsensorconnectionsuccessful", @"cgmsensorconnectionfailed", @"cgmretryconnectsensorclicked", @"cgmconnectsensorproceedclicked", @"cgmplacesensorlanding", @"cgmplacetransmitterlanding", @"cgmconnectioncompleteclicked"];
|
|
16
|
+
//}
|
|
17
|
+
//
|
|
18
|
+
//RCT_EXPORT_METHOD(emitEvent:(NSString *)message) {
|
|
19
|
+
// [self sendEventWithName:@"cgmDeviceEvent" body:@{@"status": message}];
|
|
20
|
+
//}
|
|
21
|
+
//
|
|
22
|
+
//@end
|
|
23
|
+
//
|
|
24
|
+
//// ---------------- CgmTrackyLib ----------------
|
|
25
|
+
//
|
|
26
|
+
//UIViewController *globalAttachTransmitterVC = nil;
|
|
27
|
+
//
|
|
28
|
+
//@implementation CgmTrackyLib
|
|
29
|
+
//
|
|
30
|
+
//RCT_EXPORT_MODULE();
|
|
31
|
+
//
|
|
32
|
+
//- (NSArray<NSString *> *)supportedEvents {
|
|
33
|
+
// return @[@"cgmDeviceEvent", @"cgmwatchdemoclicked", @"cgmWAsupportclicked", @"cgmstartconnectionlanding", @"cgmWAsupportproceedclicked", @"cgmstartconnectionjourneyclicked", @"cgmpermissionspagelanding", @"cgmpermissionsproceedclicked", @"cgmconnecttransmitterlanding", @"cgmtransmitterdetected", @"cgmtransmitterdetectionfailed", @"cgmtransmitterconnectionsuccessful", @"cgmretryconnecttransmitterclicked", @"cgmconnectsensorscanlanding", @"cgmsensorconnectionsuccessful", @"cgmsensorconnectionfailed", @"cgmretryconnectsensorclicked", @"cgmconnectsensorproceedclicked", @"cgmplacesensorlanding", @"cgmplacetransmitterlanding", @"cgmconnectioncompleteclicked"];
|
|
34
|
+
//}
|
|
35
|
+
//
|
|
36
|
+
//- (instancetype)init {
|
|
37
|
+
// if (self = [super init]) {
|
|
38
|
+
// for (NSString *eventName in [self supportedEvents]) {
|
|
39
|
+
// [[NSNotificationCenter defaultCenter] addObserver:self
|
|
40
|
+
// selector:@selector(handleNotification:)
|
|
41
|
+
// name:eventName
|
|
42
|
+
// object:nil];
|
|
43
|
+
// }
|
|
44
|
+
// }
|
|
45
|
+
// return self;
|
|
46
|
+
//}
|
|
47
|
+
//
|
|
48
|
+
//- (void)handleNotification:(NSNotification *)notification {
|
|
49
|
+
// NSDictionary *userInfo = notification.userInfo ?: @{};
|
|
50
|
+
// if ([[self supportedEvents] containsObject:notification.name]) {
|
|
51
|
+
// [self sendEventWithName:notification.name body:userInfo];
|
|
52
|
+
// }
|
|
53
|
+
//}
|
|
54
|
+
//
|
|
55
|
+
//- (void)observeTransmitterUnbindStatusInternal:(NSString *)token
|
|
56
|
+
// response:(NSDictionary *)responseDict
|
|
57
|
+
// completion:(void (^)(NSDictionary *response, NSError *error))completion {
|
|
58
|
+
// [[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
|
|
59
|
+
// [[NSUserDefaults standardUserDefaults] synchronize];
|
|
60
|
+
//
|
|
61
|
+
// NSData *jsonData = [NSJSONSerialization dataWithJSONObject:responseDict options:0 error:nil];
|
|
62
|
+
// if (jsonData) {
|
|
63
|
+
// [[NSUserDefaults standardUserDefaults] setObject:jsonData forKey:@"CGMStatusItem"];
|
|
64
|
+
// [[NSUserDefaults standardUserDefaults] synchronize];
|
|
65
|
+
// }
|
|
66
|
+
//
|
|
67
|
+
// FinalViewModelManager *manager = [FinalViewModelManager shared];
|
|
68
|
+
// [manager callForObserveTransmitterUnbindStatusWithCompletion:^(NSDictionary *response, NSError *error) {
|
|
69
|
+
// if (completion) {
|
|
70
|
+
// completion(response, error);
|
|
71
|
+
// }
|
|
72
|
+
// }];
|
|
73
|
+
//}
|
|
74
|
+
//
|
|
75
|
+
//- (void)dealloc {
|
|
76
|
+
// [[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
77
|
+
//}
|
|
78
|
+
//
|
|
79
|
+
//// ---------------- React Methods ----------------
|
|
80
|
+
//
|
|
81
|
+
//RCT_EXPORT_METHOD(startCgmTracky:(NSString *)token) {
|
|
82
|
+
// NSLog(@"Received token: %@", token);
|
|
83
|
+
//
|
|
84
|
+
// [[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
|
|
85
|
+
// [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"isForReconnect"];
|
|
86
|
+
// [[NSUserDefaults standardUserDefaults] synchronize];
|
|
87
|
+
//
|
|
88
|
+
// dispatch_async(dispatch_get_main_queue(), ^{
|
|
89
|
+
// UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
|
|
90
|
+
// UIViewController *rootVC = keyWindow.rootViewController;
|
|
91
|
+
//
|
|
92
|
+
// UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainCGM" bundle:nil];
|
|
93
|
+
// UIViewController *nativeVC = [storyboard instantiateViewControllerWithIdentifier:@"StartConnectionViewController"];
|
|
94
|
+
//
|
|
95
|
+
// if (nativeVC) {
|
|
96
|
+
// UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:nativeVC];
|
|
97
|
+
// navController.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
98
|
+
// [rootVC presentViewController:navController animated:YES completion:nil];
|
|
99
|
+
// }
|
|
100
|
+
// });
|
|
101
|
+
//}
|
|
102
|
+
//
|
|
103
|
+
//RCT_EXPORT_METHOD(reconnectCgmTracky:(NSString *)token) {
|
|
104
|
+
// NSLog(@"Received token: %@", token);
|
|
105
|
+
//
|
|
106
|
+
// [[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
|
|
107
|
+
// [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"isForReconnect"];
|
|
108
|
+
// [[NSUserDefaults standardUserDefaults] synchronize];
|
|
109
|
+
//
|
|
110
|
+
// dispatch_async(dispatch_get_main_queue(), ^{
|
|
111
|
+
// UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
|
|
112
|
+
// UIViewController *rootVC = keyWindow.rootViewController;
|
|
113
|
+
//
|
|
114
|
+
// UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainCGM" bundle:nil];
|
|
115
|
+
// UIViewController *reconnectVC = [storyboard instantiateViewControllerWithIdentifier:@"StartConnectionViewController"];
|
|
116
|
+
//
|
|
117
|
+
// reconnectVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
118
|
+
// UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:reconnectVC];
|
|
119
|
+
// navController.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
120
|
+
//
|
|
121
|
+
// if (reconnectVC) {
|
|
122
|
+
// [rootVC presentViewController:navController animated:YES completion:nil];
|
|
123
|
+
// }
|
|
124
|
+
// });
|
|
125
|
+
//}
|
|
126
|
+
//
|
|
127
|
+
//RCT_EXPORT_METHOD(openHelpSupport) {
|
|
128
|
+
// dispatch_async(dispatch_get_main_queue(), ^{
|
|
129
|
+
// UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
|
|
130
|
+
// UIViewController *rootVC = keyWindow.rootViewController;
|
|
131
|
+
//
|
|
132
|
+
// UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainCGM" bundle:nil];
|
|
133
|
+
// UIViewController *chatWithExpertVC = [storyboard instantiateViewControllerWithIdentifier:@"ChatWithExpertViewController"];
|
|
134
|
+
//
|
|
135
|
+
// if ([chatWithExpertVC respondsToSelector:@selector(setIsOnlyThis:)]) {
|
|
136
|
+
// [chatWithExpertVC setValue:@(YES) forKey:@"isOnlyThis"];
|
|
137
|
+
// }
|
|
138
|
+
//
|
|
139
|
+
// chatWithExpertVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
140
|
+
// if (chatWithExpertVC) {
|
|
141
|
+
// [rootVC presentViewController:chatWithExpertVC animated:YES completion:nil];
|
|
142
|
+
// }
|
|
143
|
+
// });
|
|
144
|
+
//}
|
|
145
|
+
//
|
|
146
|
+
//RCT_EXPORT_METHOD(observeAllGlucoseData:(NSString *)token) {
|
|
147
|
+
// NSLog(@"Received token: %@", token);
|
|
148
|
+
// FinalViewModelManager *manager = [FinalViewModelManager shared];
|
|
149
|
+
// [[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
|
|
150
|
+
// [[NSUserDefaults standardUserDefaults] synchronize];
|
|
151
|
+
//
|
|
152
|
+
// dispatch_async(dispatch_get_main_queue(), ^{
|
|
153
|
+
// UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
|
|
154
|
+
// UIViewController *rootVC = keyWindow.rootViewController;
|
|
155
|
+
//
|
|
156
|
+
// UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainCGM" bundle:nil];
|
|
157
|
+
// globalAttachTransmitterVC = [storyboard instantiateViewControllerWithIdentifier:@"AttachTransmitterViewController"];
|
|
158
|
+
// });
|
|
159
|
+
//}
|
|
160
|
+
//
|
|
161
|
+
//RCT_EXPORT_METHOD(observeTransmitterUnbindStatus:(NSString *)token
|
|
162
|
+
// response:(NSString *)responseJsonString
|
|
163
|
+
// resolver:(RCTPromiseResolveBlock)resolve
|
|
164
|
+
// rejecter:(RCTPromiseRejectBlock)reject) {
|
|
165
|
+
// if (responseJsonString == nil || ![responseJsonString isKindOfClass:[NSString class]]) {
|
|
166
|
+
// NSError *error = [NSError errorWithDomain:@"CgmTrackyLib"
|
|
167
|
+
// code:1001
|
|
168
|
+
// userInfo:@{NSLocalizedDescriptionKey: @"Invalid or nil JSON string passed from JS"}];
|
|
169
|
+
// reject(@"invalid_params", @"Response JSON string is nil or invalid", error);
|
|
170
|
+
// return;
|
|
171
|
+
// }
|
|
172
|
+
//
|
|
173
|
+
// NSData *data = [responseJsonString dataUsingEncoding:NSUTF8StringEncoding];
|
|
174
|
+
// NSError *parseError = nil;
|
|
175
|
+
// NSDictionary *responseDict = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
|
|
176
|
+
//
|
|
177
|
+
// if (parseError || ![responseDict isKindOfClass:[NSDictionary class]]) {
|
|
178
|
+
// reject(@"json_parse_error", @"Failed to parse JSON string to dictionary", parseError);
|
|
179
|
+
// return;
|
|
180
|
+
// }
|
|
181
|
+
//
|
|
182
|
+
// [[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
|
|
183
|
+
// [[NSUserDefaults standardUserDefaults] setObject:data forKey:@"CGMStatusItem"];
|
|
184
|
+
// [[NSUserDefaults standardUserDefaults] synchronize];
|
|
185
|
+
//
|
|
186
|
+
// FinalViewModelManager *manager = [FinalViewModelManager shared];
|
|
187
|
+
// [manager callForObserveTransmitterUnbindStatusWithCompletion:^(NSDictionary *response, NSError *error) {
|
|
188
|
+
// if (error) {
|
|
189
|
+
// reject([NSString stringWithFormat:@"%ld", (long)error.code], error.localizedDescription, error);
|
|
190
|
+
// } else {
|
|
191
|
+
// dispatch_async(dispatch_get_main_queue(), ^{
|
|
192
|
+
// resolve(response ?: @{});
|
|
193
|
+
// });
|
|
194
|
+
// }
|
|
195
|
+
// }];
|
|
196
|
+
//}
|
|
197
|
+
//
|
|
198
|
+
//@end
|
|
7
199
|
|
|
8
200
|
#import <Foundation/Foundation.h>
|
|
9
201
|
#import "MyReactNativeBridge.h"
|
|
10
202
|
#import <UIKit/UIKit.h>
|
|
11
|
-
#import <React/
|
|
203
|
+
#import <React/RCTBridgeModule.h>
|
|
12
204
|
#import <React/RCTEventEmitter.h>
|
|
13
205
|
#import "react_native_mytatva_rn_sdk-Swift.h"
|
|
14
206
|
|
|
15
|
-
#import <React/RCTBridgeModule.h>
|
|
16
|
-
#import <React/RCTEventEmitter.h>
|
|
17
207
|
@implementation MyEventEmitterManager
|
|
18
208
|
|
|
19
209
|
RCT_EXPORT_MODULE();
|
|
20
210
|
|
|
21
211
|
// Define the supported events
|
|
22
212
|
- (NSArray<NSString *> *)supportedEvents {
|
|
23
|
-
|
|
213
|
+
return @[@"cgmDeviceEvent", @"cgmwatchdemoclicked", @"cgmWAsupportclicked", @"cgmstartconnectionlanding", @"cgmWAsupportproceedclicked", @"cgmstartconnectionjourneyclicked", @"cgmpermissionspagelanding", @"cgmpermissionsproceedclicked", @"cgmconnecttransmitterlanding", @"cgmtransmitterdetected", @"cgmtransmitterdetectionfailed", @"cgmtransmitterconnectionsuccessful", @"cgmretryconnecttransmitterclicked", @"cgmconnectsensorscanlanding", @"cgmsensorconnectionsuccessful", @"cgmsensorconnectionfailed", @"cgmretryconnectsensorclicked", @"cgmconnectsensorproceedclicked", @"cgmplacesensorlanding", @"cgmplacetransmitterlanding", @"cgmconnectioncompleteclicked"];
|
|
24
214
|
}
|
|
25
215
|
|
|
26
216
|
// Example method to emit an event from native to JS
|
|
27
217
|
RCT_EXPORT_METHOD(emitEvent:(NSString *)message) {
|
|
28
|
-
|
|
29
|
-
|
|
218
|
+
// Send an event with the name "EventName" and a message payload
|
|
219
|
+
[self sendEventWithName:@"cgmDeviceEvent" body:@{@"status": message}];
|
|
30
220
|
}
|
|
31
221
|
|
|
32
222
|
@end
|
|
@@ -39,164 +229,237 @@ RCT_EXPORT_MODULE();
|
|
|
39
229
|
// This method returns the list of events the module supports
|
|
40
230
|
- (NSArray<NSString *> *)supportedEvents
|
|
41
231
|
{
|
|
42
|
-
return @[@"cgmDeviceEvent", @"cgmwatchdemoclicked", @"cgmWAsupportclicked"];
|
|
232
|
+
return @[@"cgmDeviceEvent", @"cgmwatchdemoclicked", @"cgmWAsupportclicked", @"cgmstartconnectionlanding", @"cgmWAsupportproceedclicked", @"cgmstartconnectionjourneyclicked", @"cgmpermissionspagelanding", @"cgmpermissionsproceedclicked", @"cgmconnecttransmitterlanding", @"cgmtransmitterdetected", @"cgmtransmitterdetectionfailed", @"cgmtransmitterconnectionsuccessful", @"cgmretryconnecttransmitterclicked", @"cgmconnectsensorscanlanding", @"cgmsensorconnectionsuccessful", @"cgmsensorconnectionfailed", @"cgmretryconnectsensorclicked", @"cgmconnectsensorproceedclicked", @"cgmplacesensorlanding", @"cgmplacetransmitterlanding", @"cgmconnectioncompleteclicked"];
|
|
43
233
|
}
|
|
44
234
|
|
|
45
235
|
// Start listening for notifications
|
|
46
236
|
- (instancetype)init
|
|
47
237
|
{
|
|
48
238
|
if (self = [super init]) {
|
|
49
|
-
// Add observer for the notification from UIViewController
|
|
50
239
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
51
240
|
selector:@selector(handleNotification:)
|
|
52
241
|
name:@"cgmDeviceEvent"
|
|
53
242
|
object:nil];
|
|
54
|
-
|
|
243
|
+
|
|
244
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
245
|
+
selector:@selector(handleNotification:)
|
|
246
|
+
name:@"cgmwatchdemoclicked"
|
|
247
|
+
object:nil];
|
|
248
|
+
|
|
55
249
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
250
|
+
selector:@selector(handleNotification:)
|
|
251
|
+
name:@"cgmWAsupportclicked"
|
|
252
|
+
object:nil];
|
|
253
|
+
|
|
254
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
255
|
+
selector:@selector(handleNotification:)
|
|
256
|
+
name:@"cgmstartconnectionlanding"
|
|
257
|
+
object:nil];
|
|
258
|
+
|
|
259
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
260
|
+
selector:@selector(handleNotification:)
|
|
261
|
+
name:@"cgmWAsupportproceedclicked"
|
|
262
|
+
object:nil];
|
|
263
|
+
|
|
61
264
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
265
|
+
selector:@selector(handleNotification:)
|
|
266
|
+
name:@"cgmstartconnectionjourneyclicked"
|
|
267
|
+
object:nil];
|
|
268
|
+
|
|
269
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
270
|
+
selector:@selector(handleNotification:)
|
|
271
|
+
name:@"cgmpermissionspagelanding"
|
|
272
|
+
object:nil];
|
|
273
|
+
|
|
274
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
275
|
+
selector:@selector(handleNotification:)
|
|
276
|
+
name:@"cgmpermissionsproceedclicked"
|
|
277
|
+
object:nil];
|
|
278
|
+
|
|
279
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
280
|
+
selector:@selector(handleNotification:)
|
|
281
|
+
name:@"cgmconnecttransmitterlanding"
|
|
282
|
+
object:nil];
|
|
283
|
+
|
|
284
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
285
|
+
selector:@selector(handleNotification:)
|
|
286
|
+
name:@"cgmtransmitterdetected"
|
|
287
|
+
object:nil];
|
|
288
|
+
|
|
289
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
290
|
+
selector:@selector(handleNotification:)
|
|
291
|
+
name:@"cgmtransmitterdetectionfailed"
|
|
292
|
+
object:nil];
|
|
293
|
+
|
|
294
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
295
|
+
selector:@selector(handleNotification:)
|
|
296
|
+
name:@"cgmtransmitterconnectionsuccessful"
|
|
297
|
+
object:nil];
|
|
298
|
+
|
|
299
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
300
|
+
selector:@selector(handleNotification:)
|
|
301
|
+
name:@"cgmretryconnecttransmitterclicked"
|
|
302
|
+
object:nil];
|
|
303
|
+
|
|
304
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
305
|
+
selector:@selector(handleNotification:)
|
|
306
|
+
name:@"cgmconnectsensorscanlanding"
|
|
307
|
+
object:nil];
|
|
308
|
+
|
|
309
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
310
|
+
selector:@selector(handleNotification:)
|
|
311
|
+
name:@"cgmsensorconnectionsuccessful"
|
|
312
|
+
object:nil];
|
|
313
|
+
|
|
314
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
315
|
+
selector:@selector(handleNotification:)
|
|
316
|
+
name:@"cgmsensorconnectionfailed"
|
|
317
|
+
object:nil];
|
|
318
|
+
|
|
319
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
320
|
+
selector:@selector(handleNotification:)
|
|
321
|
+
name:@"cgmretryconnectsensorclicked"
|
|
322
|
+
object:nil];
|
|
323
|
+
|
|
324
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
325
|
+
selector:@selector(handleNotification:)
|
|
326
|
+
name:@"cgmconnectsensorproceedclicked"
|
|
327
|
+
object:nil];
|
|
328
|
+
|
|
329
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
330
|
+
selector:@selector(handleNotification:)
|
|
331
|
+
name:@"cgmplacesensorlanding"
|
|
332
|
+
object:nil];
|
|
333
|
+
|
|
334
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
335
|
+
selector:@selector(handleNotification:)
|
|
336
|
+
name:@"cgmplacetransmitterlanding"
|
|
337
|
+
object:nil];
|
|
338
|
+
|
|
339
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
340
|
+
selector:@selector(handleNotification:)
|
|
341
|
+
name:@"cgmconnectioncompleteclicked"
|
|
342
|
+
object:nil];
|
|
65
343
|
}
|
|
66
344
|
return self;
|
|
67
345
|
}
|
|
68
346
|
|
|
69
347
|
|
|
348
|
+
|
|
70
349
|
// Handle the incoming notification and emit the event to React Native
|
|
71
|
-
|
|
72
|
-
{
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
[self sendEventWithName:@"cgmDeviceEvent" body:@{@"status": @"WARM_PERIOD_STARTED"}];
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
350
|
+
//- (void)handleNotification:(NSNotification *)notification
|
|
351
|
+
//{
|
|
352
|
+
// // Extract data from the notification
|
|
353
|
+
// NSDictionary *userInfo = notification.userInfo;
|
|
354
|
+
//
|
|
355
|
+
// // Send the data to React Native via event emitter
|
|
356
|
+
// [self sendEventWithName:@"cgmDeviceEvent" body:@{@"status": @"WARM_PERIOD_STARTED"}];
|
|
357
|
+
//}
|
|
358
|
+
|
|
82
359
|
|
|
83
|
-
|
|
84
|
-
- (void)observeTransmitterUnbindStatusInternal:(NSString *)token
|
|
85
|
-
response:(NSDictionary *)responseDict
|
|
86
|
-
completion:(void (^)(NSDictionary *response, NSError *error))completion;
|
|
360
|
+
- (void)handleNotification:(NSNotification *)notification
|
|
87
361
|
{
|
|
88
|
-
|
|
89
|
-
[[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
|
|
90
|
-
[[NSUserDefaults standardUserDefaults] synchronize];
|
|
362
|
+
NSString *name = notification.name;
|
|
91
363
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
[
|
|
364
|
+
if ([name isEqualToString:@"cgmDeviceEvent"]) {
|
|
365
|
+
[self sendEventWithName:@"cgmDeviceEvent" body:@{@"status": @"WARM_PERIOD_STARTED"}];
|
|
366
|
+
}
|
|
367
|
+
else if ([name isEqualToString:@"cgmwatchdemoclicked"]) {
|
|
368
|
+
[self sendEventWithName:@"cgmwatchdemoclicked" body:@{@"status": @"cgm_watch_demo_clicked"}];
|
|
369
|
+
}
|
|
370
|
+
else if ([name isEqualToString:@"cgmWAsupportclicked"]) {
|
|
371
|
+
[self sendEventWithName:@"cgmWAsupportclicked" body:@{@"status": @"cgm_wa_support_clicked"}];
|
|
372
|
+
}
|
|
373
|
+
else if ([name isEqualToString:@"cgmstartconnectionlanding"]) {
|
|
374
|
+
[self sendEventWithName:@"cgmstartconnectionlanding" body:@{@"status": @"cgm_start_connection_landing"}];
|
|
375
|
+
}
|
|
376
|
+
else if ([name isEqualToString:@"cgmWAsupportproceedclicked"]) {
|
|
377
|
+
[self sendEventWithName:@"cgmWAsupportproceedclicked" body:@{@"status": @"cgm_wa_support_proceed_clicked"}];
|
|
378
|
+
}
|
|
379
|
+
else if ([name isEqualToString:@"cgmstartconnectionjourneyclicked"]) {
|
|
380
|
+
[self sendEventWithName:@"cgmstartconnectionjourneyclicked" body:@{@"status": @"cgm_start_connection_journey_clicked"}];
|
|
381
|
+
}
|
|
382
|
+
else if ([name isEqualToString:@"cgmpermissionspagelanding"]) {
|
|
383
|
+
[self sendEventWithName:@"cgmpermissionspagelanding" body:@{@"status": @"cgm_permissions_page_landing"}];
|
|
384
|
+
}
|
|
385
|
+
else if ([name isEqualToString:@"cgmpermissionsproceedclicked"]) {
|
|
386
|
+
[self sendEventWithName:@"cgmpermissionsproceedclicked" body:@{@"status": @"cgm_permissions_proceed_clicked"}];
|
|
387
|
+
}
|
|
388
|
+
else if ([name isEqualToString:@"cgmconnecttransmitterlanding"]) {
|
|
389
|
+
[self sendEventWithName:@"cgmconnecttransmitterlanding" body:@{@"status": @"cgm_connect_transmitter_landing"}];
|
|
390
|
+
}
|
|
391
|
+
else if ([name isEqualToString:@"cgmtransmitterdetected"]) {
|
|
392
|
+
[self sendEventWithName:@"cgmtransmitterdetected" body:@{@"status": @"cgm_transmitter_detected"}];
|
|
393
|
+
}
|
|
394
|
+
else if ([name isEqualToString:@"cgmtransmitterdetectionfailed"]) {
|
|
395
|
+
[self sendEventWithName:@"cgmtransmitterdetectionfailed" body:@{@"status": @"cgm_transmitter_detection_failed"}];
|
|
396
|
+
}
|
|
397
|
+
else if ([name isEqualToString:@"cgmtransmitterconnectionsuccessful"]) {
|
|
398
|
+
[self sendEventWithName:@"cgmtransmitterconnectionsuccessful" body:@{@"status": @"cgm_transmitter_connection_successful"}];
|
|
399
|
+
}
|
|
400
|
+
else if ([name isEqualToString:@"cgmretryconnecttransmitterclicked"]) {
|
|
401
|
+
[self sendEventWithName:@"cgmretryconnecttransmitterclicked" body:@{@"status": @"cgm_retry_connect_transmitter_clicked"}];
|
|
402
|
+
}
|
|
403
|
+
else if ([name isEqualToString:@"cgmconnectsensorscanlanding"]) {
|
|
404
|
+
[self sendEventWithName:@"cgmconnectsensorscanlanding" body:@{@"status": @"cgm_connect_sensor_scan_landing"}];
|
|
405
|
+
}
|
|
406
|
+
else if ([name isEqualToString:@"cgmsensorconnectionsuccessful"]) {
|
|
407
|
+
[self sendEventWithName:@"cgmsensorconnectionsuccessful" body:@{@"status": @"cgm_sensor_connection_successful"}];
|
|
408
|
+
}
|
|
409
|
+
else if ([name isEqualToString:@"cgmsensorconnectionfailed"]) {
|
|
410
|
+
[self sendEventWithName:@"cgmsensorconnectionfailed" body:@{@"status": @"cgm_sensor_connection_failed"}];
|
|
411
|
+
}
|
|
412
|
+
else if ([name isEqualToString:@"cgmretryconnectsensorclicked"]) {
|
|
413
|
+
[self sendEventWithName:@"cgmretryconnectsensorclicked" body:@{@"status": @"cgm_retry_connect_sensor_clicked"}];
|
|
414
|
+
}
|
|
415
|
+
else if ([name isEqualToString:@"cgmconnectsensorproceedclicked"]) {
|
|
416
|
+
[self sendEventWithName:@"cgmconnectsensorproceedclicked" body:@{@"status": @"cgm_connect_sensor_proceed_clicked"}];
|
|
417
|
+
}
|
|
418
|
+
else if ([name isEqualToString:@"cgmplacesensorlanding"]) {
|
|
419
|
+
[self sendEventWithName:@"cgmplacesensorlanding" body:@{@"status": @"cgm_place_sensor_landing"}];
|
|
420
|
+
}
|
|
421
|
+
else if ([name isEqualToString:@"cgmplacetransmitterlanding"]) {
|
|
422
|
+
[self sendEventWithName:@"cgmplacetransmitterlanding" body:@{@"status": @"cgm_place_transmitter_landing"}];
|
|
423
|
+
}
|
|
424
|
+
else if ([name isEqualToString:@"cgmconnectioncompleteclicked"]) {
|
|
425
|
+
[self sendEventWithName:@"cgmconnectioncompleteclicked" body:@{@"status": @"cgm_connection_complete_clicked"}];
|
|
97
426
|
}
|
|
98
|
-
|
|
99
|
-
// Call Swift method which reads CGMStatusItem from UserDefaults
|
|
100
|
-
FinalViewModelManager *manager = [FinalViewModelManager shared];
|
|
101
|
-
[manager callForObserveTransmitterUnbindStatusWithCompletion:^(NSDictionary *response, NSError *error) {
|
|
102
|
-
if (completion) {
|
|
103
|
-
completion(response, error);
|
|
104
|
-
}
|
|
105
|
-
}];
|
|
106
427
|
}
|
|
107
428
|
|
|
429
|
+
|
|
108
430
|
// Clean up the observer when the module is deallocated
|
|
109
431
|
- (void)dealloc
|
|
110
432
|
{
|
|
111
|
-
|
|
433
|
+
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
112
434
|
}
|
|
113
435
|
|
|
114
436
|
|
|
115
437
|
RCT_EXPORT_METHOD(startCgmTracky:(NSString *)token)
|
|
116
438
|
{
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
// Save token
|
|
120
|
-
[[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
|
|
439
|
+
[[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
|
|
121
440
|
[[NSUserDefaults standardUserDefaults] setBool:false forKey:@"isForReconnect"];
|
|
122
|
-
|
|
441
|
+
[[NSUserDefaults standardUserDefaults] synchronize];
|
|
123
442
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
|
|
128
|
-
UIViewController *rootVC = keyWindow.rootViewController;
|
|
129
|
-
|
|
130
|
-
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainCGM" bundle:nil];
|
|
131
|
-
UIViewController *nativeVC = [storyboard instantiateViewControllerWithIdentifier:@"StartConnectionViewController"];
|
|
132
|
-
|
|
133
|
-
if (nativeVC) {
|
|
134
|
-
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:nativeVC];
|
|
135
|
-
navController.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
136
|
-
[rootVC presentViewController:navController animated:YES completion:nil];
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
|
|
443
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
444
|
+
UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
|
|
445
|
+
UIViewController *rootVC = keyWindow.rootViewController;
|
|
140
446
|
|
|
141
|
-
//
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
//
|
|
154
|
-
// reconnectVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
155
|
-
//
|
|
156
|
-
// UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:reconnectVC];
|
|
157
|
-
// navController.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
158
|
-
//
|
|
159
|
-
// if (reconnectVC) {
|
|
160
|
-
// [rootVC presentViewController:navController animated:YES completion:nil];
|
|
161
|
-
// }
|
|
162
|
-
// });
|
|
163
|
-
|
|
447
|
+
// Try to get the topmost navigation controller
|
|
448
|
+
|
|
449
|
+
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainCGM" bundle:nil];
|
|
450
|
+
UIViewController *nativeVC = [storyboard instantiateViewControllerWithIdentifier:@"StartConnectionViewController"];
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:nativeVC];
|
|
454
|
+
navController.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
455
|
+
if (nativeVC) {
|
|
456
|
+
[rootVC presentViewController:navController animated:YES completion:nil];
|
|
457
|
+
}
|
|
458
|
+
});
|
|
164
459
|
}
|
|
165
460
|
|
|
166
461
|
|
|
167
|
-
RCT_EXPORT_METHOD(reconnectCgmTracky:(NSString *)token)
|
|
168
|
-
{
|
|
169
|
-
// NSLog(@"Received token: %@", token);
|
|
170
|
-
//
|
|
171
|
-
// [[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
|
|
172
|
-
// [[NSUserDefaults standardUserDefaults] synchronize];
|
|
173
|
-
// dispatch_async(dispatch_get_main_queue(), ^{
|
|
174
|
-
// UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
|
|
175
|
-
// UIViewController *rootVC = keyWindow.rootViewController;
|
|
176
|
-
// // Load the storyboard
|
|
177
|
-
// UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainCGM" bundle:[NSBundle mainBundle]];
|
|
178
|
-
//
|
|
179
|
-
// // Instantiate the target ViewController
|
|
180
|
-
// UIViewController *reconnectVC = [storyboard instantiateViewControllerWithIdentifier:@"StartConnectionViewController"];
|
|
181
|
-
//
|
|
182
|
-
// // Set presentation style
|
|
183
|
-
// reconnectVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
184
|
-
// // Set isForReconnect = YES
|
|
185
|
-
// if ([reconnectVC respondsToSelector:@selector(setIsForReconnect:)]) {
|
|
186
|
-
// [reconnectVC setValue:@(YES) forKey:@"isForReconnect"];
|
|
187
|
-
// }
|
|
188
|
-
// // Present it directly without navigation
|
|
189
|
-
//// if (reconnectVC) {
|
|
190
|
-
//// [rootVC presentViewController:reconnectVC animated:YES completion:nil];
|
|
191
|
-
//// }
|
|
192
|
-
//
|
|
193
|
-
// UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:reconnectVC];
|
|
194
|
-
// navController.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
195
|
-
// if (reconnectVC) {
|
|
196
|
-
// [rootVC presentViewController:navController animated:YES completion:nil];
|
|
197
|
-
// }
|
|
198
|
-
// });
|
|
199
|
-
|
|
462
|
+
RCT_EXPORT_METHOD(reconnectCgmTracky:(NSString *)token) {
|
|
200
463
|
NSLog(@"Received token: %@", token);
|
|
201
464
|
|
|
202
465
|
[[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
|
|
@@ -207,11 +470,10 @@ RCT_EXPORT_METHOD(reconnectCgmTracky:(NSString *)token)
|
|
|
207
470
|
UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
|
|
208
471
|
UIViewController *rootVC = keyWindow.rootViewController;
|
|
209
472
|
|
|
210
|
-
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainCGM" bundle:
|
|
473
|
+
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainCGM" bundle:nil];
|
|
211
474
|
UIViewController *reconnectVC = [storyboard instantiateViewControllerWithIdentifier:@"StartConnectionViewController"];
|
|
212
|
-
|
|
213
|
-
reconnectVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
214
475
|
|
|
476
|
+
reconnectVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
215
477
|
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:reconnectVC];
|
|
216
478
|
navController.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
217
479
|
|
|
@@ -221,75 +483,59 @@ RCT_EXPORT_METHOD(reconnectCgmTracky:(NSString *)token)
|
|
|
221
483
|
});
|
|
222
484
|
}
|
|
223
485
|
|
|
486
|
+
|
|
224
487
|
RCT_EXPORT_METHOD(openHelpSupport)
|
|
225
488
|
{
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}
|
|
245
|
-
});
|
|
489
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
490
|
+
UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
|
|
491
|
+
UIViewController *rootVC = keyWindow.rootViewController;
|
|
492
|
+
|
|
493
|
+
// Load the storyboard
|
|
494
|
+
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainCGM" bundle:nil];
|
|
495
|
+
|
|
496
|
+
// Instantiate the target ViewController
|
|
497
|
+
UIViewController *chatWithExpertVC = [storyboard instantiateViewControllerWithIdentifier:@"ChatWithExpertViewController"];
|
|
498
|
+
|
|
499
|
+
// Set presentation style
|
|
500
|
+
chatWithExpertVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
501
|
+
|
|
502
|
+
// Present it directly without navigation
|
|
503
|
+
if (chatWithExpertVC) {
|
|
504
|
+
[rootVC presentViewController:chatWithExpertVC animated:YES completion:nil];
|
|
505
|
+
}
|
|
506
|
+
});
|
|
246
507
|
}
|
|
247
508
|
|
|
248
509
|
RCT_EXPORT_METHOD(observeAllGlucoseData:(NSString *)token)
|
|
249
510
|
{
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
FinalViewModelManager *manager = [FinalViewModelManager shared];
|
|
253
|
-
[[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
|
|
254
|
-
[[NSUserDefaults standardUserDefaults] synchronize];
|
|
511
|
+
[[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
|
|
512
|
+
[[NSUserDefaults standardUserDefaults] synchronize];
|
|
255
513
|
|
|
256
514
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
// Load the storyboard
|
|
261
|
-
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainCGM" bundle:nil];
|
|
262
|
-
|
|
263
|
-
// Instantiate the target ViewController
|
|
264
|
-
globalAttachTransmitterVC = [storyboard instantiateViewControllerWithIdentifier:@"AttachTransmitterViewController"];
|
|
265
|
-
|
|
266
|
-
// Set presentation style
|
|
267
|
-
// chatWithExpertVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
268
|
-
|
|
269
|
-
// Present it directly without navigation
|
|
270
|
-
//if (chatWithExpertVC) {
|
|
271
|
-
// [rootVC presentViewController:chatWithExpertVC animated:YES completion:nil];
|
|
272
|
-
// }
|
|
273
|
-
});
|
|
274
|
-
}
|
|
515
|
+
UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
|
|
516
|
+
UIViewController *rootVC = keyWindow.rootViewController;
|
|
275
517
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
//
|
|
280
|
-
|
|
281
|
-
// [[NSUserDefaults standardUserDefaults] synchronize];
|
|
282
|
-
// FinalViewModelManager *manager = [FinalViewModelManager shared];
|
|
283
|
-
// [manager callForObserveTransmitterUnbindStatus];
|
|
284
|
-
//}
|
|
518
|
+
// Load the storyboard
|
|
519
|
+
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainCGM" bundle:nil];
|
|
520
|
+
|
|
521
|
+
// Instantiate the target ViewController
|
|
522
|
+
globalAttachTransmitterVC = [storyboard instantiateViewControllerWithIdentifier:@"AttachTransmitterViewController"];
|
|
285
523
|
|
|
524
|
+
// Set presentation style
|
|
525
|
+
// chatWithExpertVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
526
|
+
|
|
527
|
+
// Present it directly without navigation
|
|
528
|
+
//if (chatWithExpertVC) {
|
|
529
|
+
// [rootVC presentViewController:chatWithExpertVC animated:YES completion:nil];
|
|
530
|
+
// }
|
|
531
|
+
});
|
|
532
|
+
}
|
|
286
533
|
|
|
287
534
|
|
|
288
535
|
RCT_EXPORT_METHOD(observeTransmitterUnbindStatus:(NSString *)token
|
|
289
536
|
response:(NSString *)responseJsonString
|
|
290
537
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
291
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
292
|
-
{
|
|
538
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
293
539
|
if (responseJsonString == nil || ![responseJsonString isKindOfClass:[NSString class]]) {
|
|
294
540
|
NSError *error = [NSError errorWithDomain:@"CgmTrackyLib"
|
|
295
541
|
code:1001
|
|
@@ -298,7 +544,6 @@ RCT_EXPORT_METHOD(observeTransmitterUnbindStatus:(NSString *)token
|
|
|
298
544
|
return;
|
|
299
545
|
}
|
|
300
546
|
|
|
301
|
-
// Parse JSON string to NSDictionary
|
|
302
547
|
NSData *data = [responseJsonString dataUsingEncoding:NSUTF8StringEncoding];
|
|
303
548
|
NSError *parseError = nil;
|
|
304
549
|
NSDictionary *responseDict = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
|
|
@@ -308,14 +553,10 @@ RCT_EXPORT_METHOD(observeTransmitterUnbindStatus:(NSString *)token
|
|
|
308
553
|
return;
|
|
309
554
|
}
|
|
310
555
|
|
|
311
|
-
// Save token
|
|
312
556
|
[[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
|
|
313
|
-
|
|
314
|
-
// Save response data
|
|
315
557
|
[[NSUserDefaults standardUserDefaults] setObject:data forKey:@"CGMStatusItem"];
|
|
316
558
|
[[NSUserDefaults standardUserDefaults] synchronize];
|
|
317
559
|
|
|
318
|
-
// Call manager logic
|
|
319
560
|
FinalViewModelManager *manager = [FinalViewModelManager shared];
|
|
320
561
|
[manager callForObserveTransmitterUnbindStatusWithCompletion:^(NSDictionary *response, NSError *error) {
|
|
321
562
|
if (error) {
|
|
@@ -328,4 +569,5 @@ RCT_EXPORT_METHOD(observeTransmitterUnbindStatus:(NSString *)token
|
|
|
328
569
|
}];
|
|
329
570
|
}
|
|
330
571
|
|
|
572
|
+
|
|
331
573
|
@end
|