react-native-mytatva-rn-sdk 1.2.8 → 1.2.10
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/ConnectSensorActivity.kt +16 -9
- package/android/src/main/java/com/mytatvarnsdk/activity/PermissionActivity.kt +37 -3
- package/android/src/main/java/com/mytatvarnsdk/activity/SearchTransmitterActivity.kt +416 -408
- package/android/src/main/res/layout/activity_connect_sensor.xml +18 -1
- package/android/src/main/res/layout/activity_search_transmitter.xml +19 -1
- package/ios/MyReactNativeBridge.h +2 -2
- package/ios/MyReactNativeBridge.m +14 -14
- package/ios/Support/Global.swift +1 -1
- package/ios/VisitRnSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/VisitRnSdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/VisitRnSdk.xcodeproj/xcuserdata/sonusharma.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/lib/commonjs/CGMConnect.js +10 -14
- package/lib/commonjs/CGMConnect.js.map +1 -1
- package/lib/module/CGMConnect.js +10 -14
- package/lib/module/CGMConnect.js.map +1 -1
- package/package.json +1 -1
- package/src/CGMConnect.ts +22 -19
- /package/ios/Storyboard/Base.lproj/{Main.storyboard → MainCGM.storyboard} +0 -0
|
@@ -345,6 +345,23 @@
|
|
|
345
345
|
app:layout_constraintStart_toStartOf="parent"
|
|
346
346
|
app:layout_constraintTop_toBottomOf="@id/ivGif" />
|
|
347
347
|
|
|
348
|
+
|
|
349
|
+
<TextView
|
|
350
|
+
android:id="@+id/tvReason"
|
|
351
|
+
android:layout_width="0dp"
|
|
352
|
+
android:layout_height="wrap_content"
|
|
353
|
+
android:layout_marginHorizontal="30dp"
|
|
354
|
+
android:layout_marginVertical="10dp"
|
|
355
|
+
android:fontFamily="@font/roboto_semibold"
|
|
356
|
+
android:gravity="center"
|
|
357
|
+
android:textAlignment="center"
|
|
358
|
+
android:textColor="#667085"
|
|
359
|
+
android:textSize="14sp"
|
|
360
|
+
android:visibility="gone"
|
|
361
|
+
app:layout_constraintEnd_toEndOf="parent"
|
|
362
|
+
app:layout_constraintStart_toStartOf="parent"
|
|
363
|
+
app:layout_constraintTop_toBottomOf="@id/tvFailTitle" />
|
|
364
|
+
|
|
348
365
|
<TextView
|
|
349
366
|
android:id="@+id/tvFailInstructions"
|
|
350
367
|
android:layout_width="0dp"
|
|
@@ -359,7 +376,7 @@
|
|
|
359
376
|
android:textSize="14sp"
|
|
360
377
|
app:layout_constraintEnd_toEndOf="parent"
|
|
361
378
|
app:layout_constraintStart_toStartOf="parent"
|
|
362
|
-
app:layout_constraintTop_toBottomOf="@id/
|
|
379
|
+
app:layout_constraintTop_toBottomOf="@id/tvReason" />
|
|
363
380
|
|
|
364
381
|
<androidx.constraintlayout.widget.ConstraintLayout
|
|
365
382
|
android:id="@+id/clBox"
|
|
@@ -122,6 +122,7 @@
|
|
|
122
122
|
android:layout_height="0dp"
|
|
123
123
|
android:layout_marginTop="16dp"
|
|
124
124
|
android:orientation="vertical"
|
|
125
|
+
android:visibility="visible"
|
|
125
126
|
app:layout_constraintBottom_toTopOf="@+id/commonButton"
|
|
126
127
|
app:layout_constraintEnd_toEndOf="parent"
|
|
127
128
|
app:layout_constraintStart_toStartOf="parent"
|
|
@@ -562,6 +563,23 @@
|
|
|
562
563
|
app:layout_constraintStart_toStartOf="parent"
|
|
563
564
|
app:layout_constraintTop_toBottomOf="@id/ivGif" />
|
|
564
565
|
|
|
566
|
+
|
|
567
|
+
<TextView
|
|
568
|
+
android:id="@+id/tvReason"
|
|
569
|
+
android:layout_width="0dp"
|
|
570
|
+
android:layout_height="wrap_content"
|
|
571
|
+
android:layout_marginHorizontal="30dp"
|
|
572
|
+
android:layout_marginVertical="10dp"
|
|
573
|
+
android:fontFamily="@font/roboto_semibold"
|
|
574
|
+
android:gravity="center"
|
|
575
|
+
android:textAlignment="center"
|
|
576
|
+
android:textColor="#667085"
|
|
577
|
+
android:textSize="14sp"
|
|
578
|
+
android:visibility="gone"
|
|
579
|
+
app:layout_constraintEnd_toEndOf="parent"
|
|
580
|
+
app:layout_constraintStart_toStartOf="parent"
|
|
581
|
+
app:layout_constraintTop_toBottomOf="@id/tvFailTitle" />
|
|
582
|
+
|
|
565
583
|
<TextView
|
|
566
584
|
android:id="@+id/tvFailInstructions"
|
|
567
585
|
android:layout_width="0dp"
|
|
@@ -576,7 +594,7 @@
|
|
|
576
594
|
android:textSize="14sp"
|
|
577
595
|
app:layout_constraintEnd_toEndOf="parent"
|
|
578
596
|
app:layout_constraintStart_toStartOf="parent"
|
|
579
|
-
app:layout_constraintTop_toBottomOf="@id/
|
|
597
|
+
app:layout_constraintTop_toBottomOf="@id/tvReason" />
|
|
580
598
|
|
|
581
599
|
<androidx.constraintlayout.widget.ConstraintLayout
|
|
582
600
|
android:id="@+id/clBox"
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
#import <React/RCTBridgeModule.h>
|
|
16
16
|
#import <React/RCTEventEmitter.h>
|
|
17
17
|
|
|
18
|
-
@interface
|
|
18
|
+
@interface CgmTrackyLib : RCTEventEmitter <RCTBridgeModule>
|
|
19
19
|
|
|
20
20
|
@end
|
|
21
|
-
@interface
|
|
21
|
+
@interface MyEventEmitterManager : RCTEventEmitter <RCTBridgeModule>
|
|
22
22
|
@end
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
#import <React/RCTEventDispatcher.h>
|
|
12
12
|
#import <React/RCTEventEmitter.h>
|
|
13
13
|
|
|
14
|
-
@implementation
|
|
14
|
+
@implementation MyEventEmitterManager
|
|
15
15
|
|
|
16
16
|
RCT_EXPORT_MODULE();
|
|
17
17
|
|
|
@@ -29,9 +29,9 @@ RCT_EXPORT_METHOD(emitEvent:(NSString *)message) {
|
|
|
29
29
|
@end
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
@implementation
|
|
32
|
+
@implementation CgmTrackyLib
|
|
33
33
|
|
|
34
|
-
//
|
|
34
|
+
//static FinalViewModel *sharedViewModel = nil;
|
|
35
35
|
|
|
36
36
|
RCT_EXPORT_MODULE();
|
|
37
37
|
|
|
@@ -83,7 +83,7 @@ RCT_EXPORT_METHOD(startCgmTracky:(NSString *)token)
|
|
|
83
83
|
|
|
84
84
|
// Try to get the topmost navigation controller
|
|
85
85
|
|
|
86
|
-
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"
|
|
86
|
+
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainCGM" bundle:nil];
|
|
87
87
|
UIViewController *nativeVC = [storyboard instantiateViewControllerWithIdentifier:@"StartConnectionViewController"];
|
|
88
88
|
|
|
89
89
|
|
|
@@ -102,7 +102,7 @@ RCT_EXPORT_METHOD(reconnectCgmTracky)
|
|
|
102
102
|
UIViewController *rootVC = keyWindow.rootViewController;
|
|
103
103
|
|
|
104
104
|
// Load the storyboard
|
|
105
|
-
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"
|
|
105
|
+
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainCGM" bundle:nil];
|
|
106
106
|
|
|
107
107
|
// Instantiate the target ViewController
|
|
108
108
|
UIViewController *reconnectVC = [storyboard instantiateViewControllerWithIdentifier:@"ConnectToTransmitterViewController"];
|
|
@@ -128,7 +128,7 @@ RCT_EXPORT_METHOD(openHelpSupport)
|
|
|
128
128
|
UIViewController *rootVC = keyWindow.rootViewController;
|
|
129
129
|
|
|
130
130
|
// Load the storyboard
|
|
131
|
-
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"
|
|
131
|
+
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainCGM" bundle:nil];
|
|
132
132
|
|
|
133
133
|
// Instantiate the target ViewController
|
|
134
134
|
UIViewController *chatWithExpertVC = [storyboard instantiateViewControllerWithIdentifier:@"ChatWithExpertViewController"];
|
|
@@ -145,14 +145,14 @@ RCT_EXPORT_METHOD(openHelpSupport)
|
|
|
145
145
|
|
|
146
146
|
RCT_EXPORT_METHOD(observeAllGlucoseData:(NSString *)token)
|
|
147
147
|
{
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
148
|
+
// [[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
|
|
149
|
+
// [[NSUserDefaults standardUserDefaults] synchronize];
|
|
150
|
+
//
|
|
151
|
+
//
|
|
152
|
+
// if (!sharedViewModel) {
|
|
153
|
+
// sharedViewModel = [[FinalViewModel alloc] init];
|
|
154
|
+
// }
|
|
155
|
+
// [sharedViewModel initialize];
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
@end
|
package/ios/Support/Global.swift
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>SchemeUserState</key>
|
|
6
|
+
<dict>
|
|
7
|
+
<key>VisitRnSdk.xcscheme_^#shared#^_</key>
|
|
8
|
+
<dict>
|
|
9
|
+
<key>orderHint</key>
|
|
10
|
+
<integer>0</integer>
|
|
11
|
+
</dict>
|
|
12
|
+
</dict>
|
|
13
|
+
</dict>
|
|
14
|
+
</plist>
|
|
@@ -9,13 +9,18 @@ exports.reconnectCGM = exports.observeAllGlucoseDataHandler = void 0;
|
|
|
9
9
|
exports.removeCGMEventListener = removeCGMEventListener;
|
|
10
10
|
exports.stopCGM = exports.startCGM = void 0;
|
|
11
11
|
var _reactNative = require("react-native");
|
|
12
|
-
const {
|
|
13
|
-
CgmTrackyLib,
|
|
14
|
-
observeAllGlucoseData
|
|
15
|
-
} = _reactNative.NativeModules;
|
|
16
|
-
const iosEventEmitter = new _reactNative.NativeEventEmitter(CgmTrackyLib);
|
|
17
12
|
let eventSubscription = null;
|
|
13
|
+
const LINKING_ERROR = `The package 'react-native-mytatva-rn-sdk' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
14
|
+
ios: "- You have run 'pod install'\n",
|
|
15
|
+
default: ''
|
|
16
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
17
|
+
const cgmLib = _reactNative.NativeModules.CgmTrackyLib ? _reactNative.NativeModules.CgmTrackyLib : new Proxy({}, {
|
|
18
|
+
get() {
|
|
19
|
+
throw new Error(LINKING_ERROR);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
18
22
|
function initializeCGMEventListener(callback) {
|
|
23
|
+
const iosEventEmitter = new _reactNative.NativeEventEmitter(cgmLib);
|
|
19
24
|
if (eventSubscription) {
|
|
20
25
|
eventSubscription.remove();
|
|
21
26
|
}
|
|
@@ -49,15 +54,6 @@ function removeCGMEventListener() {
|
|
|
49
54
|
eventSubscription = null;
|
|
50
55
|
}
|
|
51
56
|
}
|
|
52
|
-
const LINKING_ERROR = `The package 'react-native-mytatva-rn-sdk' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
53
|
-
ios: "- You have run 'pod install'\n",
|
|
54
|
-
default: ''
|
|
55
|
-
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
56
|
-
const cgmLib = _reactNative.NativeModules.CgmTrackyLib ? _reactNative.NativeModules.CgmTrackyLib : new Proxy({}, {
|
|
57
|
-
get() {
|
|
58
|
-
throw new Error(LINKING_ERROR);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
57
|
const startCGM = async token => {
|
|
62
58
|
console.log('token====startCGM', token);
|
|
63
59
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","
|
|
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","stopCGM"],"sources":["CGMConnect.ts"],"sourcesContent":["import { DeviceEventEmitter, EmitterSubscription, NativeEventEmitter, NativeModules, Platform } from \"react-native\";\n\n\n\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\n\n\nfunction initializeCGMEventListener(\n callback: (eventData: any) => void\n) {\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 } \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\n\n\nconst startCGM = async (token: string) => {\n console.log('token====startCGM', token);\n try {\n const result = await cgmLib.startCgmTracky(token);\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n };\n\n const reconnectCGM = async (token: string) => {\n console.log('reconnectCGM====');\n try {\n const result = await cgmLib.reconnectCgmTracky(token);\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n };\n\n const observeAllGlucoseDataHandler = async (token: string) => {\n console.log('observeAllGlucoseDataHandler====');\n try {\n const result = await cgmLib.observeAllGlucoseData(token);\n const deviceStatus = await cgmLib.observeDeviceStatus(token);\n console.log(result);\n console.log(deviceStatus);\n } catch (error) {\n console.log('error====', error);\n console.error(error);\n }\n };\n\nconst helpCGM = async (token: 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\n\n\nconst stopCGM = async () => {\n // Implementation\n};\n\nexport { startCGM, stopCGM, initializeCGMEventListener, removeCGMEventListener, observeAllGlucoseDataHandler, reconnectCGM, helpCGM };"],"mappings":";;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAIC,iBAA6C,GAAG,IAAI;AAExD,MAAMC,aAAa,GACjB,sFAAsF,GACtFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,MAAM,GAAGC,0BAAa,CAACC,YAAY,GACrCD,0BAAa,CAACC,YAAY,GAC1B,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACV,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAIL,SAASW,0BAA0BA,CACjCC,QAAkC,EAClC;EACA,MAAMC,eAAe,GAAG,IAAIC,+BAAkB,CAACT,MAAM,CAAC;EACtD,IAAIN,iBAAiB,EAAE;IACrBA,iBAAiB,CAACgB,MAAM,CAAC,CAAC;EAC5B;EAE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Y;EAC1B;AAAA,CACD;AAACT,OAAA,CAAAS,OAAA,GAAAA,OAAA","ignoreList":[]}
|
package/lib/module/CGMConnect.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { DeviceEventEmitter, NativeEventEmitter, NativeModules, Platform } from "react-native";
|
|
2
|
-
const {
|
|
3
|
-
CgmTrackyLib,
|
|
4
|
-
observeAllGlucoseData
|
|
5
|
-
} = NativeModules;
|
|
6
|
-
const iosEventEmitter = new NativeEventEmitter(CgmTrackyLib);
|
|
7
2
|
let eventSubscription = null;
|
|
3
|
+
const LINKING_ERROR = `The package 'react-native-mytatva-rn-sdk' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
4
|
+
ios: "- You have run 'pod install'\n",
|
|
5
|
+
default: ''
|
|
6
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
7
|
+
const cgmLib = NativeModules.CgmTrackyLib ? NativeModules.CgmTrackyLib : new Proxy({}, {
|
|
8
|
+
get() {
|
|
9
|
+
throw new Error(LINKING_ERROR);
|
|
10
|
+
}
|
|
11
|
+
});
|
|
8
12
|
function initializeCGMEventListener(callback) {
|
|
13
|
+
const iosEventEmitter = new NativeEventEmitter(cgmLib);
|
|
9
14
|
if (eventSubscription) {
|
|
10
15
|
eventSubscription.remove();
|
|
11
16
|
}
|
|
@@ -39,15 +44,6 @@ function removeCGMEventListener() {
|
|
|
39
44
|
eventSubscription = null;
|
|
40
45
|
}
|
|
41
46
|
}
|
|
42
|
-
const LINKING_ERROR = `The package 'react-native-mytatva-rn-sdk' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
43
|
-
ios: "- You have run 'pod install'\n",
|
|
44
|
-
default: ''
|
|
45
|
-
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
46
|
-
const cgmLib = NativeModules.CgmTrackyLib ? NativeModules.CgmTrackyLib : new Proxy({}, {
|
|
47
|
-
get() {
|
|
48
|
-
throw new Error(LINKING_ERROR);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
47
|
const startCGM = async token => {
|
|
52
48
|
console.log('token====startCGM', token);
|
|
53
49
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DeviceEventEmitter","NativeEventEmitter","NativeModules","Platform","
|
|
1
|
+
{"version":3,"names":["DeviceEventEmitter","NativeEventEmitter","NativeModules","Platform","eventSubscription","LINKING_ERROR","select","ios","default","cgmLib","CgmTrackyLib","Proxy","get","Error","initializeCGMEventListener","callback","iosEventEmitter","remove","OS","addListener","eventData","status","removeCGMEventListener","startCGM","token","console","log","result","startCgmTracky","error","reconnectCGM","reconnectCgmTracky","observeAllGlucoseDataHandler","observeAllGlucoseData","deviceStatus","observeDeviceStatus","helpCGM","openHelpSupport","stopCGM"],"sources":["CGMConnect.ts"],"sourcesContent":["import { DeviceEventEmitter, EmitterSubscription, NativeEventEmitter, NativeModules, Platform } from \"react-native\";\n\n\n\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\n\n\nfunction initializeCGMEventListener(\n callback: (eventData: any) => void\n) {\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 } \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\n\n\nconst startCGM = async (token: string) => {\n console.log('token====startCGM', token);\n try {\n const result = await cgmLib.startCgmTracky(token);\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n };\n\n const reconnectCGM = async (token: string) => {\n console.log('reconnectCGM====');\n try {\n const result = await cgmLib.reconnectCgmTracky(token);\n console.log(result);\n } catch (error) {\n console.error(error);\n }\n };\n\n const observeAllGlucoseDataHandler = async (token: string) => {\n console.log('observeAllGlucoseDataHandler====');\n try {\n const result = await cgmLib.observeAllGlucoseData(token);\n const deviceStatus = await cgmLib.observeDeviceStatus(token);\n console.log(result);\n console.log(deviceStatus);\n } catch (error) {\n console.log('error====', error);\n console.error(error);\n }\n };\n\nconst helpCGM = async (token: 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\n\n\nconst stopCGM = async () => {\n // Implementation\n};\n\nexport { startCGM, stopCGM, initializeCGMEventListener, removeCGMEventListener, observeAllGlucoseDataHandler, reconnectCGM, helpCGM };"],"mappings":"AAAA,SAASA,kBAAkB,EAAuBC,kBAAkB,EAAEC,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAKnH,IAAIC,iBAA6C,GAAG,IAAI;AAExD,MAAMC,aAAa,GACjB,sFAAsF,GACtFF,QAAQ,CAACG,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,MAAM,GAAGP,aAAa,CAACQ,YAAY,GACrCR,aAAa,CAACQ,YAAY,GAC1B,IAAIC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;EACrB,CAAC,CAAC,OAAOE,KAAK,EAAE;IACdJ,OAAO,CAACI,KAAK,CAACA,KAAK,CAAC;EACtB;AACF,CAAC;AAID,MAAMS,OAAO,GAAG,MAAAA,CAAA,KAAY;EAC1B;AAAA,CACD;AAED,SAASf,QAAQ,EAAEe,OAAO,EAAExB,0BAA0B,EAAEQ,sBAAsB,EAAEU,4BAA4B,EAAEF,YAAY,EAAEM,OAAO","ignoreList":[]}
|
package/package.json
CHANGED
package/src/CGMConnect.ts
CHANGED
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
import { DeviceEventEmitter, EmitterSubscription, NativeEventEmitter, NativeModules, Platform } from "react-native";
|
|
2
2
|
|
|
3
|
-
const { CgmTrackyLib, observeAllGlucoseData } = NativeModules;
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
|
|
6
5
|
|
|
7
6
|
let eventSubscription: EmitterSubscription | null = null;
|
|
8
7
|
|
|
8
|
+
const LINKING_ERROR =
|
|
9
|
+
`The package 'react-native-mytatva-rn-sdk' doesn't seem to be linked. Make sure: \n\n` +
|
|
10
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
11
|
+
'- You rebuilt the app after installing the package\n' +
|
|
12
|
+
'- You are not using Expo Go\n';
|
|
13
|
+
|
|
14
|
+
const cgmLib = NativeModules.CgmTrackyLib
|
|
15
|
+
? NativeModules.CgmTrackyLib
|
|
16
|
+
: new Proxy(
|
|
17
|
+
{},
|
|
18
|
+
{
|
|
19
|
+
get() {
|
|
20
|
+
throw new Error(LINKING_ERROR);
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
|
|
9
26
|
|
|
10
27
|
function initializeCGMEventListener(
|
|
11
28
|
callback: (eventData: any) => void
|
|
12
29
|
) {
|
|
30
|
+
const iosEventEmitter = new NativeEventEmitter(cgmLib);
|
|
13
31
|
if (eventSubscription) {
|
|
14
32
|
eventSubscription.remove();
|
|
15
33
|
}
|
|
@@ -26,7 +44,8 @@ function initializeCGMEventListener(
|
|
|
26
44
|
}
|
|
27
45
|
}
|
|
28
46
|
);
|
|
29
|
-
}
|
|
47
|
+
}
|
|
48
|
+
else if (Platform.OS === 'ios' && iosEventEmitter) {
|
|
30
49
|
eventSubscription = iosEventEmitter.addListener(
|
|
31
50
|
'cgmDeviceEvent',
|
|
32
51
|
(eventData: any) => {
|
|
@@ -48,22 +67,6 @@ function removeCGMEventListener() {
|
|
|
48
67
|
}
|
|
49
68
|
}
|
|
50
69
|
|
|
51
|
-
const LINKING_ERROR =
|
|
52
|
-
`The package 'react-native-mytatva-rn-sdk' doesn't seem to be linked. Make sure: \n\n` +
|
|
53
|
-
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
54
|
-
'- You rebuilt the app after installing the package\n' +
|
|
55
|
-
'- You are not using Expo Go\n';
|
|
56
|
-
|
|
57
|
-
const cgmLib = NativeModules.CgmTrackyLib
|
|
58
|
-
? NativeModules.CgmTrackyLib
|
|
59
|
-
: new Proxy(
|
|
60
|
-
{},
|
|
61
|
-
{
|
|
62
|
-
get() {
|
|
63
|
-
throw new Error(LINKING_ERROR);
|
|
64
|
-
},
|
|
65
|
-
}
|
|
66
|
-
);
|
|
67
70
|
|
|
68
71
|
|
|
69
72
|
const startCGM = async (token: string) => {
|
|
File without changes
|