react-native-mytatva-rn-sdk 1.2.34 → 1.2.35
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/activity/SearchTransmitterActivity.kt +5 -1
- package/android/src/main/java/com/mytatvarnsdk/activity/StartCGMActivity.kt +0 -2
- package/android/src/main/res/color/radio_text_selector.xml +1 -1
- package/android/src/main/res/layout/activity_help.xml +0 -3
- package/android/src/main/res/values/styles.xml +103 -102
- package/ios/MyReactNativeBridge.m +113 -13
- package/ios/Storyboard/MainCGM.storyboard +44 -44
- package/ios/Support/Global.swift +11 -0
- package/ios/Support/GlobalYouTubePlayerView.swift +33 -0
- package/ios/TableViewCell/NoteTVC/NoteTVC.swift +37 -13
- package/ios/TableViewCell/NoteTVC/NoteTVC.xib +2 -2
- package/ios/TableViewCell/VIdeoTVC/VideoTVC.swift +10 -4
- package/ios/TableViewCell/WatchVideoTVC/WatchVideoTVC.swift +12 -0
- package/ios/TableViewCell/WatchVideoTVC/WatchVideoTVC.xib +11 -11
- package/ios/ViewControllers/AttachTransmitterViewController.swift +12 -0
- package/ios/ViewControllers/ChatWithExpertViewController.swift +1 -0
- package/ios/ViewControllers/ConnectToSensorViewController.swift +18 -0
- package/ios/ViewControllers/ConnectToTransmitterViewController.swift +15 -1
- package/ios/ViewControllers/ProvidePermissionViewController.swift +7 -0
- package/ios/ViewControllers/PutOnTheSensorViewController.swift +15 -1
- package/ios/ViewControllers/StartConnectionViewController.swift +12 -0
- package/ios/ViewModel/FinalViewModel.swift +138 -25
- package/ios/icon.xcassets/do_not_throw_sensor.imageset/Contents.json +23 -0
- package/ios/icon.xcassets/do_not_throw_sensor.imageset/image with cross.png +0 -0
- package/ios/icon.xcassets/do_not_throw_sensor.imageset/image with cross@2x.png +0 -0
- package/ios/icon.xcassets/do_not_throw_sensor.imageset/image with cross@3x.png +0 -0
- package/package.json +1 -1
|
@@ -531,7 +531,11 @@ class SearchTransmitterActivity : BaseBleActivity() {
|
|
|
531
531
|
|
|
532
532
|
Log.d("onDeviceConnect--->", "onDeviceConnect: " + transmitterDeviceInfo.toString())
|
|
533
533
|
if (enumDevice.getEnumDevice(transmitterDeviceInfo!!.pocDevice.name).isAbleScanQRCode) {
|
|
534
|
-
|
|
534
|
+
if (isForReconnect) {
|
|
535
|
+
proceedToNextStep()
|
|
536
|
+
} else {
|
|
537
|
+
bindSuccess()
|
|
538
|
+
}
|
|
535
539
|
} else {
|
|
536
540
|
bind(transmitterDeviceInfo!!.pocDevice)
|
|
537
541
|
}
|
|
@@ -103,8 +103,6 @@ class StartCGMActivity : AppCompatActivity() {
|
|
|
103
103
|
// Add location permissions
|
|
104
104
|
requiredPermissions.addAll(PermissionUtils.LOCAL_PERMISSION)
|
|
105
105
|
|
|
106
|
-
// Add camera permission
|
|
107
|
-
requiredPermissions.addAll(PermissionUtils.CAMERA_PERMISSION)
|
|
108
106
|
|
|
109
107
|
return requiredPermissions.all {
|
|
110
108
|
ContextCompat.checkSelfPermission(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
2
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
|
3
|
-
<item android:color="
|
|
3
|
+
<item android:color="#000000" android:state_checked="true"/>
|
|
4
4
|
<item android:color="#333333"/>
|
|
5
5
|
</selector>
|
|
@@ -102,7 +102,6 @@
|
|
|
102
102
|
android:layout_width="wrap_content"
|
|
103
103
|
android:layout_height="wrap_content"
|
|
104
104
|
android:layout_marginBottom="12dp"
|
|
105
|
-
android:drawableStart="@drawable/custom_radio_icon_selector"
|
|
106
105
|
android:drawablePadding="10dp"
|
|
107
106
|
android:text="Purchasing New CGM" />
|
|
108
107
|
|
|
@@ -112,7 +111,6 @@
|
|
|
112
111
|
android:layout_width="wrap_content"
|
|
113
112
|
android:layout_height="wrap_content"
|
|
114
113
|
android:layout_marginBottom="12dp"
|
|
115
|
-
android:drawableStart="@drawable/custom_radio_icon_selector"
|
|
116
114
|
android:drawablePadding="10dp"
|
|
117
115
|
android:text="Connecting My CGM" />
|
|
118
116
|
|
|
@@ -121,7 +119,6 @@
|
|
|
121
119
|
style="@style/CustomRadioButton"
|
|
122
120
|
android:layout_width="wrap_content"
|
|
123
121
|
android:layout_height="wrap_content"
|
|
124
|
-
android:drawableStart="@drawable/custom_radio_icon_selector"
|
|
125
122
|
android:drawablePadding="10dp"
|
|
126
123
|
android:text="Having troubles after connection" />
|
|
127
124
|
</RadioGroup>
|
|
@@ -1,109 +1,110 @@
|
|
|
1
1
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
<item name="android:button">@
|
|
3
|
+
<style name="MyTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
|
4
|
+
<!-- <style name="MyTheme" parent="@android:style/Theme.Holo.NoActionBar.Fullscreen">-->
|
|
5
|
+
<!-- 底部导航栏透明,但是会有一层灰度-->
|
|
6
|
+
<!-- <item name="android:windowTranslucentNavigation">false</item>-->
|
|
7
|
+
|
|
8
|
+
<!-- <item name="android:windowFullscreen">true</item>-->
|
|
9
|
+
<!-- 顶部状态栏透明,但是会有一层灰度-->
|
|
10
|
+
<!-- <item name="android:windowTranslucentStatus">false</item>-->
|
|
11
|
+
<!-- 界面控件文字显示在顶部状态栏直下,底部导航栏之上-->
|
|
12
|
+
<!-- <item name="android:fitsSystemWindows">true</item>-->
|
|
13
|
+
<!-- ActionBar 标题栏的颜色-->
|
|
14
|
+
<!-- <item name="android:windowBackground">@drawable/star</item>-->
|
|
15
|
+
<item name="colorPrimary">@color/transparent</item>
|
|
16
|
+
<!-- 顶部状态栏的背景颜色-->
|
|
17
|
+
<item name="colorPrimaryDark">@color/color_33353F67</item>
|
|
18
|
+
<!-- statusBarColor 比 colorPrimaryDark高级,同时存在时会覆盖 colorPrimaryDark-->
|
|
19
|
+
<item name="android:statusBarColor">@color/color_33353F67</item>
|
|
20
|
+
<!-- 底部导航栏的颜色-->
|
|
21
|
+
<item name="android:navigationBarColor">@color/color_33353F67</item>
|
|
22
|
+
<!-- 默认控件的颜色 比如说CheckBox 等-->
|
|
23
|
+
<item name="colorAccent">@color/colorAccent</item>
|
|
24
|
+
<!-- 默认按钮的颜色-->
|
|
25
|
+
<item name="colorButtonNormal">@color/colorAccent</item>
|
|
26
|
+
<!-- 默认文字的颜色-->
|
|
27
|
+
<item name="android:textColor">@color/textColor</item>
|
|
28
|
+
<!-- 是否默认文字全部大写-->
|
|
29
|
+
<item name="textAllCaps">false</item>
|
|
30
|
+
|
|
31
|
+
<item name="android:autofilledHighlight" tools:targetApi="o">@color/transparent</item>
|
|
32
|
+
|
|
33
|
+
<item name="android:windowAnimationStyle">@style/Animation.None</item>
|
|
34
|
+
|
|
35
|
+
</style>
|
|
36
|
+
|
|
37
|
+
<style name="Animation.None" parent="@android:style/Animation">
|
|
38
|
+
<item name="android:activityOpenEnterAnimation">@null</item>
|
|
39
|
+
<item name="android:activityOpenExitAnimation">@null</item>
|
|
40
|
+
<item name="android:activityCloseEnterAnimation">@null</item>
|
|
41
|
+
<item name="android:activityCloseExitAnimation">@null</item>
|
|
42
|
+
</style>
|
|
43
|
+
|
|
44
|
+
<style name="AnimBottom" parent="@android:style/Animation">
|
|
45
|
+
<item name="android:windowEnterAnimation">@anim/pop_up_in</item>
|
|
46
|
+
<item name="android:windowExitAnimation">@anim/pop_down_out</item>
|
|
47
|
+
</style>
|
|
48
|
+
|
|
49
|
+
<style name="AnimSide" parent="@android:style/Animation">
|
|
50
|
+
<item name="android:windowEnterAnimation">@anim/pop_left_right</item>
|
|
51
|
+
<item name="android:windowExitAnimation">@anim/pop_right_left</item>
|
|
52
|
+
</style>
|
|
53
|
+
|
|
54
|
+
<style name="WarnDialog" parent="android:style/Theme.Dialog">
|
|
55
|
+
<!--背景颜色及和透明程度-->
|
|
56
|
+
<item name="android:background">@android:color/transparent</item>
|
|
57
|
+
<item name="android:windowBackground">@android:color/transparent</item>
|
|
58
|
+
<!--是否去除标题 -->
|
|
59
|
+
<item name="android:windowNoTitle">true</item>
|
|
60
|
+
<!--是否去除边框-->
|
|
61
|
+
<item name="android:windowFrame">@null</item>
|
|
62
|
+
<!--是否浮现在activity之上-->
|
|
63
|
+
<item name="android:windowIsFloating">true</item>
|
|
64
|
+
<!--是否模糊-->
|
|
65
|
+
<item name="android:backgroundDimEnabled">true</item>
|
|
66
|
+
</style>
|
|
67
|
+
|
|
68
|
+
<declare-styleable name="MaxHeightRecyclerView">
|
|
69
|
+
<attr name="maxHeight" format="dimension" />
|
|
70
|
+
</declare-styleable>
|
|
71
|
+
|
|
72
|
+
<style name="RoundedCornerImage">
|
|
73
|
+
<item name="cornerFamily">rounded</item>
|
|
74
|
+
<item name="cornerSize">20dp</item>
|
|
75
|
+
</style>
|
|
76
|
+
|
|
77
|
+
<style name="CustomBottomSheetDialogTheme" parent="Theme.MaterialComponents.Light.BottomSheetDialog">
|
|
78
|
+
<item name="bottomSheetStyle">@style/CustomBottomSheetStyle</item>
|
|
79
|
+
<item name="android:windowIsFloating">false</item>
|
|
80
|
+
<item name="android:windowSoftInputMode">adjustResize</item>
|
|
81
|
+
</style>
|
|
82
|
+
|
|
83
|
+
<!-- Style for the bottom sheet itself -->
|
|
84
|
+
<style name="CustomBottomSheetStyle" parent="Widget.MaterialComponents.BottomSheet">
|
|
85
|
+
<item name="android:background">@android:color/transparent</item>
|
|
86
|
+
<item name="behavior_peekHeight">0dp</item>
|
|
87
|
+
<item name="behavior_fitToContents">true</item>
|
|
88
|
+
<item name="behavior_hideable">true</item>
|
|
89
|
+
<item name="behavior_skipCollapsed">true</item>
|
|
90
|
+
<item name="shapeAppearance">@style/CustomShapeAppearance</item>
|
|
91
|
+
</style>
|
|
92
|
+
|
|
93
|
+
<!-- Shape appearance for rounded corners -->
|
|
94
|
+
<style name="CustomShapeAppearance" parent="">
|
|
95
|
+
<item name="cornerFamily">rounded</item>
|
|
96
|
+
<item name="cornerSizeTopLeft">16dp</item>
|
|
97
|
+
<item name="cornerSizeTopRight">16dp</item>
|
|
98
|
+
<item name="cornerSizeBottomLeft">0dp</item>
|
|
99
|
+
<item name="cornerSizeBottomRight">0dp</item>
|
|
100
|
+
</style>
|
|
101
|
+
|
|
102
|
+
<style name="CustomRadioButton" parent="Widget.AppCompat.CompoundButton.RadioButton">
|
|
103
|
+
<item name="android:button">@drawable/custom_radio_icon_selector</item>
|
|
104
104
|
<item name="android:padding">10dp</item>
|
|
105
105
|
<item name="android:fontFamily">@font/roboto_regular</item>
|
|
106
|
-
|
|
106
|
+
<item name="android:textColor">@color/radio_text_selector</item>
|
|
107
|
+
</style>
|
|
107
108
|
|
|
108
109
|
|
|
109
110
|
</resources>
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
#import <React/RCTEventDispatcher.h>
|
|
12
12
|
#import <React/RCTEventEmitter.h>
|
|
13
13
|
#import "react_native_mytatva_rn_sdk-Swift.h"
|
|
14
|
+
|
|
15
|
+
#import <React/RCTBridgeModule.h>
|
|
16
|
+
#import <React/RCTEventEmitter.h>
|
|
14
17
|
@implementation MyEventEmitterManager
|
|
15
18
|
|
|
16
19
|
RCT_EXPORT_MODULE();
|
|
@@ -63,6 +66,31 @@ RCT_EXPORT_MODULE();
|
|
|
63
66
|
[self sendEventWithName:@"cgmDeviceEvent" body:@{@"status": @"WARM_PERIOD_STARTED"}];
|
|
64
67
|
}
|
|
65
68
|
|
|
69
|
+
// Private helper
|
|
70
|
+
- (void)observeTransmitterUnbindStatusInternal:(NSString *)token
|
|
71
|
+
response:(NSDictionary *)responseDict
|
|
72
|
+
completion:(void (^)(NSDictionary *response, NSError *error))completion;
|
|
73
|
+
{
|
|
74
|
+
// Save token
|
|
75
|
+
[[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
|
|
76
|
+
[[NSUserDefaults standardUserDefaults] synchronize];
|
|
77
|
+
|
|
78
|
+
// Save CGM status item to UserDefaults (if needed by Swift)
|
|
79
|
+
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:responseDict options:0 error:nil];
|
|
80
|
+
if (jsonData) {
|
|
81
|
+
[[NSUserDefaults standardUserDefaults] setObject:jsonData forKey:@"CGMStatusItem"];
|
|
82
|
+
[[NSUserDefaults standardUserDefaults] synchronize];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Call Swift method which reads CGMStatusItem from UserDefaults
|
|
86
|
+
FinalViewModelManager *manager = [FinalViewModelManager shared];
|
|
87
|
+
[manager callForObserveTransmitterUnbindStatusWithCompletion:^(NSDictionary *response, NSError *error) {
|
|
88
|
+
if (completion) {
|
|
89
|
+
completion(response, error);
|
|
90
|
+
}
|
|
91
|
+
}];
|
|
92
|
+
}
|
|
93
|
+
|
|
66
94
|
// Clean up the observer when the module is deallocated
|
|
67
95
|
- (void)dealloc
|
|
68
96
|
{
|
|
@@ -72,29 +100,62 @@ RCT_EXPORT_MODULE();
|
|
|
72
100
|
|
|
73
101
|
RCT_EXPORT_METHOD(startCgmTracky:(NSString *)token)
|
|
74
102
|
{
|
|
103
|
+
// NSLog(@"Received token: %@", token);
|
|
104
|
+
//
|
|
105
|
+
// // Save token
|
|
106
|
+
// [[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
|
|
107
|
+
// [[NSUserDefaults standardUserDefaults] synchronize];
|
|
108
|
+
//
|
|
109
|
+
//
|
|
110
|
+
// // Show native view
|
|
111
|
+
// dispatch_async(dispatch_get_main_queue(), ^{
|
|
112
|
+
// UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
|
|
113
|
+
// UIViewController *rootVC = keyWindow.rootViewController;
|
|
114
|
+
//
|
|
115
|
+
// UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainCGM" bundle:nil];
|
|
116
|
+
// UIViewController *nativeVC = [storyboard instantiateViewControllerWithIdentifier:@"StartConnectionViewController"];
|
|
117
|
+
//
|
|
118
|
+
// if (nativeVC) {
|
|
119
|
+
// UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:nativeVC];
|
|
120
|
+
// navController.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
121
|
+
// [rootVC presentViewController:navController animated:YES completion:nil];
|
|
122
|
+
// }
|
|
123
|
+
// });
|
|
124
|
+
|
|
75
125
|
NSLog(@"Received token: %@", token);
|
|
76
126
|
|
|
77
127
|
[[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
|
|
78
128
|
[[NSUserDefaults standardUserDefaults] synchronize];
|
|
79
|
-
[self observeTransmitterUnbindStatus:token];
|
|
80
129
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
81
130
|
UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
|
|
82
131
|
UIViewController *rootVC = keyWindow.rootViewController;
|
|
132
|
+
// Load the storyboard
|
|
133
|
+
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainCGM" bundle:[NSBundle mainBundle]];
|
|
83
134
|
|
|
84
|
-
//
|
|
85
|
-
|
|
86
|
-
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainCGM" bundle:nil];
|
|
87
|
-
UIViewController *nativeVC = [storyboard instantiateViewControllerWithIdentifier:@"StartConnectionViewController"];
|
|
135
|
+
// Instantiate the target ViewController
|
|
136
|
+
UIViewController *reconnectVC = [storyboard instantiateViewControllerWithIdentifier:@"StartConnectionViewController"];
|
|
88
137
|
|
|
138
|
+
// Set presentation style
|
|
139
|
+
reconnectVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
140
|
+
// Set isForReconnect = YES
|
|
141
|
+
if ([reconnectVC respondsToSelector:@selector(setIsForReconnect:)]) {
|
|
142
|
+
[reconnectVC setValue:@(YES) forKey:@"isForReconnect"];
|
|
143
|
+
}
|
|
144
|
+
// Present it directly without navigation
|
|
145
|
+
// if (reconnectVC) {
|
|
146
|
+
// [rootVC presentViewController:reconnectVC animated:YES completion:nil];
|
|
147
|
+
// }
|
|
89
148
|
|
|
90
|
-
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:
|
|
149
|
+
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:reconnectVC];
|
|
91
150
|
navController.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
|
92
|
-
if (
|
|
151
|
+
if (reconnectVC) {
|
|
93
152
|
[rootVC presentViewController:navController animated:YES completion:nil];
|
|
94
153
|
}
|
|
95
154
|
});
|
|
96
155
|
}
|
|
97
156
|
|
|
157
|
+
|
|
158
|
+
|
|
98
159
|
RCT_EXPORT_METHOD(reconnectCgmTracky:(NSString *)token)
|
|
99
160
|
{
|
|
100
161
|
NSLog(@"Received token: %@", token);
|
|
@@ -182,13 +243,52 @@ RCT_EXPORT_METHOD(observeAllGlucoseData:(NSString *)token)
|
|
|
182
243
|
});
|
|
183
244
|
}
|
|
184
245
|
|
|
246
|
+
//RCT_EXPORT_METHOD(observeTransmitterUnbindStatus:(NSString *)token)
|
|
247
|
+
//{
|
|
248
|
+
// NSLog(@"Received token: %@", token);
|
|
249
|
+
// [[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
|
|
250
|
+
// [[NSUserDefaults standardUserDefaults] synchronize];
|
|
251
|
+
// FinalViewModelManager *manager = [FinalViewModelManager shared];
|
|
252
|
+
// [manager callForObserveTransmitterUnbindStatus];
|
|
253
|
+
//}
|
|
185
254
|
|
|
186
|
-
RCT_EXPORT_METHOD(observeTransmitterUnbindStatus:(NSString *)token)
|
|
255
|
+
RCT_EXPORT_METHOD(observeTransmitterUnbindStatus:(NSString *)token response:(NSString *)responseJsonString)
|
|
187
256
|
{
|
|
188
|
-
|
|
189
|
-
[
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
257
|
+
// Optional: Parse the JSON string if needed
|
|
258
|
+
NSData *jsonData = [responseJsonString dataUsingEncoding:NSUTF8StringEncoding];
|
|
259
|
+
NSError *jsonError;
|
|
260
|
+
NSDictionary *responseDict = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&jsonError];
|
|
261
|
+
|
|
262
|
+
if (jsonError) {
|
|
263
|
+
NSLog(@"Failed to parse JSON: %@", jsonError.localizedDescription);
|
|
264
|
+
[self sendEventWithName:@"observeTransmitterUnbindStatusHandler" body:@{
|
|
265
|
+
@"token": token ?: @"",
|
|
266
|
+
@"success": @NO,
|
|
267
|
+
@"error": @"Invalid JSON response from JS"
|
|
268
|
+
}];
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// Now you have responseDict, you can use it
|
|
273
|
+
[self observeTransmitterUnbindStatusInternal:token response:responseDict completion:^(NSDictionary *response, NSError *error) {
|
|
274
|
+
if (error) {
|
|
275
|
+
NSDictionary *errorPayload = @{
|
|
276
|
+
@"token": token ?: @"",
|
|
277
|
+
@"success": @NO,
|
|
278
|
+
@"error": error.localizedDescription ?: @"Unknown error"
|
|
279
|
+
};
|
|
280
|
+
[self sendEventWithName:@"observeTransmitterUnbindStatusHandler" body:errorPayload];
|
|
281
|
+
} else {
|
|
282
|
+
NSDictionary *successPayload = @{
|
|
283
|
+
@"token": token ?: @"",
|
|
284
|
+
@"responseFromBackend": response ?: @{},
|
|
285
|
+
@"responseFromJS": responseDict ?: @{},
|
|
286
|
+
@"success": @YES
|
|
287
|
+
};
|
|
288
|
+
[self sendEventWithName:@"observeTransmitterUnbindStatusHandler" body:successPayload];
|
|
289
|
+
}
|
|
290
|
+
}];
|
|
291
|
+
|
|
193
292
|
}
|
|
293
|
+
|
|
194
294
|
@end
|