react-native-visit-rn-sdk 6.0.1 → 6.0.3
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/README.md +89 -10
- package/android/src/main/java/com/visitrnsdk/VisitRnSdkLocationModule.kt +37 -0
- package/android/src/main/java/com/visitrnsdk/VisitRnSdkPackage.kt +1 -1
- package/lib/commonjs/components/VideoCallComponent.js +11 -16
- package/lib/commonjs/components/VideoCallComponent.js.map +1 -1
- package/lib/commonjs/index.android.js +177 -146
- package/lib/commonjs/index.android.js.map +1 -1
- package/lib/commonjs/index.ios.js +74 -48
- package/lib/commonjs/index.ios.js.map +1 -1
- package/lib/commonjs/index.js +6 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/shims.d.js +2 -0
- package/lib/commonjs/shims.d.js.map +1 -0
- package/lib/commonjs/types.js +2 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/components/VideoCallComponent.js +11 -16
- package/lib/module/components/VideoCallComponent.js.map +1 -1
- package/lib/module/index.android.js +179 -149
- package/lib/module/index.android.js.map +1 -1
- package/lib/module/index.ios.js +75 -49
- package/lib/module/index.ios.js.map +1 -1
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/shims.d.js +2 -0
- package/lib/module/shims.d.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/components/VideoCallComponent.d.ts +79 -0
- package/lib/typescript/components/VideoCallComponent.d.ts.map +1 -0
- package/lib/typescript/index.android.d.ts +5 -0
- package/lib/typescript/index.android.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +17 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/index.ios.d.ts +5 -0
- package/lib/typescript/index.ios.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +24 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/package.json +20 -11
- package/react-native-visit-rn-sdk.podspec +1 -1
- package/src/components/VideoCallComponent.tsx +1484 -0
- package/src/index.android.tsx +459 -0
- package/src/index.ios.tsx +238 -0
- package/src/index.tsx +25 -0
- package/src/shims.d.ts +49 -0
- package/src/types.ts +25 -0
- package/lib/typescript/index.test.d.ts +0 -1
- package/lib/typescript/index.test.d.ts.map +0 -1
- package/src/components/VideoCallComponent.js +0 -1305
- package/src/index.android.js +0 -342
- package/src/index.ios.js +0 -168
|
@@ -1,93 +1,171 @@
|
|
|
1
|
-
import React, { useRef, useEffect, useState, useCallback } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import React, { forwardRef, useRef, useEffect, useState, useCallback, useImperativeHandle } from 'react';
|
|
2
|
+
import { Alert, AppState, BackHandler, Linking, NativeModules, SafeAreaView } from 'react-native';
|
|
3
|
+
import { check, openSettings, PERMISSIONS, request, RESULTS } from 'react-native-permissions';
|
|
4
4
|
import WebView from 'react-native-webview';
|
|
5
|
-
import LocationEnabler from '@visit-health/react-native-location-enabler';
|
|
6
5
|
import VideoCallComponent from './components/VideoCallComponent';
|
|
6
|
+
// react-native-webview typings can collapse to `never` under React 17 @types.
|
|
7
|
+
const SdkWebView = WebView;
|
|
8
|
+
const LOCATION_SOURCE_SETTINGS = 'android.settings.LOCATION_SOURCE_SETTINGS';
|
|
9
|
+
const GENERAL_SETTINGS = 'android.settings.SETTINGS';
|
|
7
10
|
const {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
ssoLink,
|
|
16
|
-
isLoggingEnabled
|
|
17
|
-
}) => {
|
|
11
|
+
VisitRnSdkLocation
|
|
12
|
+
} = NativeModules;
|
|
13
|
+
const VisitRnSdkView = /*#__PURE__*/forwardRef(function VisitRnSdkView({
|
|
14
|
+
ssoLink = '',
|
|
15
|
+
isLoggingEnabled = false,
|
|
16
|
+
onEvent
|
|
17
|
+
}, ref) {
|
|
18
18
|
const source = typeof ssoLink === 'string' ? ssoLink.trim() : '';
|
|
19
|
-
const [showPermissionAlreadyDeniedDialog, setShowPermissionAlreadyDeniedDialog] = useState(false);
|
|
20
|
-
const [enabled, requestResolution] = useLocationSettings({
|
|
21
|
-
priority: HIGH_ACCURACY,
|
|
22
|
-
// default BALANCED_POWER_ACCURACY
|
|
23
|
-
alwaysShow: true,
|
|
24
|
-
// default false
|
|
25
|
-
needBle: true // default false
|
|
26
|
-
}, false /* optional: default undefined */);
|
|
27
19
|
const webviewRef = useRef(null);
|
|
28
20
|
const videoCallRef = useRef(null);
|
|
29
|
-
const
|
|
30
|
-
|
|
21
|
+
const locationFlowInProgressRef = useRef(false);
|
|
22
|
+
const pendingSettingsRef = useRef(null);
|
|
23
|
+
const appStateRef = useRef(AppState.currentState);
|
|
24
|
+
const [canGoBack, setCanGoBack] = useState(false);
|
|
25
|
+
const warn = useCallback((message, error) => {
|
|
26
|
+
if (isLoggingEnabled) {
|
|
27
|
+
console.warn(message, error);
|
|
28
|
+
}
|
|
29
|
+
}, [isLoggingEnabled]);
|
|
30
|
+
const finishLocationFlow = useCallback(granted => {
|
|
31
|
+
var _webviewRef$current;
|
|
32
|
+
locationFlowInProgressRef.current = false;
|
|
33
|
+
pendingSettingsRef.current = null;
|
|
34
|
+
(_webviewRef$current = webviewRef.current) === null || _webviewRef$current === void 0 || _webviewRef$current.injectJavaScript(`window.checkTheGpsPermission(${granted}); true;`);
|
|
35
|
+
}, []);
|
|
36
|
+
const showLocationPermissionSettingsAlert = useCallback(() => {
|
|
37
|
+
Alert.alert('Location permission required', 'Allow location access in app settings to continue.', [{
|
|
31
38
|
text: 'Cancel',
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
39
|
+
style: 'cancel',
|
|
40
|
+
onPress: () => finishLocationFlow(false)
|
|
35
41
|
}, {
|
|
36
|
-
text: '
|
|
37
|
-
onPress: () => {
|
|
38
|
-
|
|
42
|
+
text: 'Open Settings',
|
|
43
|
+
onPress: async () => {
|
|
44
|
+
pendingSettingsRef.current = 'location-permission';
|
|
45
|
+
try {
|
|
46
|
+
await openSettings();
|
|
47
|
+
} catch (error) {
|
|
48
|
+
warn('Unable to open application settings.', error);
|
|
49
|
+
finishLocationFlow(false);
|
|
50
|
+
}
|
|
39
51
|
}
|
|
40
|
-
}]
|
|
41
|
-
|
|
42
|
-
|
|
52
|
+
}], {
|
|
53
|
+
cancelable: false
|
|
54
|
+
});
|
|
55
|
+
}, [finishLocationFlow, warn]);
|
|
56
|
+
const openLocationServicesSettings = useCallback(async () => {
|
|
57
|
+
pendingSettingsRef.current = 'location-services';
|
|
58
|
+
try {
|
|
59
|
+
await Linking.sendIntent(LOCATION_SOURCE_SETTINGS);
|
|
60
|
+
} catch (locationSettingsError) {
|
|
61
|
+
warn('Unable to open Location Services settings; opening general settings.', locationSettingsError);
|
|
62
|
+
try {
|
|
63
|
+
await Linking.sendIntent(GENERAL_SETTINGS);
|
|
64
|
+
} catch (generalSettingsError) {
|
|
65
|
+
warn('Unable to open Android settings.', generalSettingsError);
|
|
66
|
+
finishLocationFlow(false);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}, [finishLocationFlow, warn]);
|
|
70
|
+
const checkLocationServices = useCallback(async ({
|
|
71
|
+
promptIfDisabled
|
|
72
|
+
}) => {
|
|
43
73
|
try {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
74
|
+
if (!(VisitRnSdkLocation !== null && VisitRnSdkLocation !== void 0 && VisitRnSdkLocation.isLocationServicesEnabled)) {
|
|
75
|
+
throw new Error('VisitRnSdkLocation native module is unavailable.');
|
|
76
|
+
}
|
|
77
|
+
const isEnabled = await VisitRnSdkLocation.isLocationServicesEnabled();
|
|
78
|
+
if (isEnabled) {
|
|
79
|
+
finishLocationFlow(true);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (!promptIfDisabled) {
|
|
83
|
+
finishLocationFlow(false);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
Alert.alert('Turn on Location Services', 'Enable Location Services in phone settings to continue.', [{
|
|
87
|
+
text: 'Cancel',
|
|
88
|
+
style: 'cancel',
|
|
89
|
+
onPress: () => finishLocationFlow(false)
|
|
90
|
+
}, {
|
|
91
|
+
text: 'Open Settings',
|
|
92
|
+
onPress: openLocationServicesSettings
|
|
93
|
+
}], {
|
|
94
|
+
cancelable: false
|
|
95
|
+
});
|
|
96
|
+
} catch (error) {
|
|
97
|
+
warn('Unable to check Location Services.', error);
|
|
98
|
+
finishLocationFlow(false);
|
|
99
|
+
}
|
|
100
|
+
}, [finishLocationFlow, openLocationServicesSettings, warn]);
|
|
101
|
+
const requestLocationPermission = useCallback(async () => {
|
|
102
|
+
if (locationFlowInProgressRef.current || pendingSettingsRef.current !== null) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
locationFlowInProgressRef.current = true;
|
|
106
|
+
try {
|
|
107
|
+
let permissionStatus = await check(PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION);
|
|
108
|
+
if (permissionStatus === RESULTS.DENIED) {
|
|
109
|
+
permissionStatus = await request(PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION);
|
|
110
|
+
}
|
|
111
|
+
if (permissionStatus === RESULTS.GRANTED) {
|
|
112
|
+
await checkLocationServices({
|
|
113
|
+
promptIfDisabled: true
|
|
58
114
|
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (!enabled) {
|
|
65
|
-
requestResolution();
|
|
66
|
-
} else {
|
|
67
|
-
var _webviewRef$current;
|
|
68
|
-
var finalString = `window.checkTheGpsPermission(true)`;
|
|
69
|
-
console.log('requestLocationPermission: ' + finalString);
|
|
70
|
-
(_webviewRef$current = webviewRef.current) === null || _webviewRef$current === void 0 || _webviewRef$current.injectJavaScript(finalString);
|
|
71
|
-
}
|
|
72
|
-
} else {
|
|
73
|
-
var _webviewRef$current2;
|
|
74
|
-
setShowPermissionAlreadyDeniedDialog(true);
|
|
75
|
-
console.log('Location permission denied');
|
|
76
|
-
var finalString = `window.checkTheGpsPermission(false)`;
|
|
77
|
-
console.log('requestLocationPermission: ' + finalString);
|
|
78
|
-
(_webviewRef$current2 = webviewRef.current) === null || _webviewRef$current2 === void 0 || _webviewRef$current2.injectJavaScript(finalString);
|
|
79
|
-
}
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (permissionStatus === RESULTS.BLOCKED) {
|
|
118
|
+
showLocationPermissionSettingsAlert();
|
|
119
|
+
return;
|
|
80
120
|
}
|
|
81
|
-
|
|
82
|
-
|
|
121
|
+
finishLocationFlow(false);
|
|
122
|
+
} catch (error) {
|
|
123
|
+
warn('Unable to check or request location permission.', error);
|
|
124
|
+
finishLocationFlow(false);
|
|
83
125
|
}
|
|
84
|
-
};
|
|
126
|
+
}, [checkLocationServices, finishLocationFlow, showLocationPermissionSettingsAlert, warn]);
|
|
127
|
+
const recheckAfterSettings = useCallback(async () => {
|
|
128
|
+
const settingsType = pendingSettingsRef.current;
|
|
129
|
+
if (!settingsType) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
pendingSettingsRef.current = null;
|
|
133
|
+
try {
|
|
134
|
+
const permissionStatus = await check(PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION);
|
|
135
|
+
if (permissionStatus !== RESULTS.GRANTED) {
|
|
136
|
+
finishLocationFlow(false);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
await checkLocationServices({
|
|
140
|
+
promptIfDisabled: settingsType === 'location-permission'
|
|
141
|
+
});
|
|
142
|
+
} catch (error) {
|
|
143
|
+
warn('Unable to recheck location access after settings.', error);
|
|
144
|
+
finishLocationFlow(false);
|
|
145
|
+
}
|
|
146
|
+
}, [checkLocationServices, finishLocationFlow, warn]);
|
|
85
147
|
const runBeforeFirst = `
|
|
86
148
|
window.isNativeApp = true;
|
|
87
149
|
window.platform = "ANDROID";
|
|
88
150
|
window.setSdkPlatform('ANDROID');
|
|
89
151
|
true; // note: this is required, or you'll sometimes get silent failures
|
|
90
152
|
`;
|
|
153
|
+
const sendEvent = useCallback((eventName, properties) => {
|
|
154
|
+
var _webviewRef$current2;
|
|
155
|
+
if (typeof eventName !== 'string' || (eventName === null || eventName === void 0 ? void 0 : eventName.trim()) === '') {
|
|
156
|
+
if (isLoggingEnabled) {
|
|
157
|
+
console.warn('sendEvent requires a non-empty eventName.');
|
|
158
|
+
}
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
(_webviewRef$current2 = webviewRef.current) === null || _webviewRef$current2 === void 0 || _webviewRef$current2.injectJavaScript(`window.sendEventToVisit(${JSON.stringify(eventName)}, ${JSON.stringify(properties ?? {})}); true;`);
|
|
162
|
+
}, [isLoggingEnabled]);
|
|
163
|
+
useImperativeHandle(ref, () => ({
|
|
164
|
+
sendEvent
|
|
165
|
+
}), [sendEvent]);
|
|
166
|
+
const emitHostEvent = useCallback((eventName, properties) => {
|
|
167
|
+
onEvent === null || onEvent === void 0 || onEvent(eventName, properties);
|
|
168
|
+
}, [onEvent]);
|
|
91
169
|
const startVideoConsultation = useCallback(parsedObject => {
|
|
92
170
|
var _videoCallRef$current;
|
|
93
171
|
const roomName = parsedObject === null || parsedObject === void 0 ? void 0 : parsedObject.roomName;
|
|
@@ -113,10 +191,10 @@ const VisitRnSdkView = ({
|
|
|
113
191
|
var _webviewRef$current3;
|
|
114
192
|
if (event.nativeEvent.data != null) {
|
|
115
193
|
try {
|
|
194
|
+
const parsedObject = JSON.parse(event.nativeEvent.data);
|
|
116
195
|
if (isLoggingEnabled) {
|
|
117
|
-
console.log('
|
|
196
|
+
console.log('Received WebView method:', parsedObject.method);
|
|
118
197
|
}
|
|
119
|
-
const parsedObject = JSON.parse(event.nativeEvent.data);
|
|
120
198
|
if (parsedObject.method != null) {
|
|
121
199
|
switch (parsedObject.method) {
|
|
122
200
|
case 'startVideoCall':
|
|
@@ -126,73 +204,58 @@ const VisitRnSdkView = ({
|
|
|
126
204
|
(_webviewRef$current3 = webviewRef.current) === null || _webviewRef$current3 === void 0 || _webviewRef$current3.injectJavaScript('window.setSdkPlatform("ANDROID")');
|
|
127
205
|
break;
|
|
128
206
|
case 'GET_LOCATION_PERMISSIONS':
|
|
129
|
-
console.log('GET_LOCATION_PERMISSIONS');
|
|
130
207
|
requestLocationPermission();
|
|
131
208
|
break;
|
|
132
209
|
case 'OPEN_PDF':
|
|
133
|
-
{
|
|
134
|
-
|
|
135
|
-
// console.log("pdfUrl "+pdfUrl);
|
|
136
|
-
|
|
137
|
-
Linking.openURL(pdfUrl);
|
|
210
|
+
if (parsedObject.url) {
|
|
211
|
+
Linking.openURL(parsedObject.url);
|
|
138
212
|
}
|
|
139
213
|
break;
|
|
140
|
-
case 'OPEN_FACE_SCAN_FLOW':
|
|
141
|
-
EventRegister.emitEvent('visit-event', {
|
|
142
|
-
message: 'OPEN_FACE_SCAN_FLOW'
|
|
143
|
-
});
|
|
144
|
-
break;
|
|
145
214
|
case 'CLOSE_VIEW':
|
|
146
215
|
break;
|
|
216
|
+
case 'sendEventToHost':
|
|
217
|
+
{
|
|
218
|
+
const eventName = typeof parsedObject.eventName === 'string' ? parsedObject.eventName : '';
|
|
219
|
+
if (eventName) {
|
|
220
|
+
const properties = {
|
|
221
|
+
...parsedObject
|
|
222
|
+
};
|
|
223
|
+
delete properties.method;
|
|
224
|
+
delete properties.eventName;
|
|
225
|
+
emitHostEvent(eventName, properties);
|
|
226
|
+
}
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
147
229
|
default:
|
|
148
230
|
break;
|
|
149
231
|
}
|
|
150
232
|
}
|
|
151
|
-
} catch (
|
|
152
|
-
|
|
233
|
+
} catch (error) {
|
|
234
|
+
warn('Unable to handle WebView message.', error);
|
|
153
235
|
}
|
|
154
236
|
}
|
|
155
237
|
};
|
|
156
|
-
const [canGoBack, setCanGoBack] = useState(false);
|
|
157
238
|
const handleBack = useCallback(() => {
|
|
158
239
|
if (canGoBack && webviewRef.current) {
|
|
159
|
-
|
|
160
|
-
(_webviewRef$current4 = webviewRef.current) === null || _webviewRef$current4 === void 0 || _webviewRef$current4.goBack();
|
|
240
|
+
webviewRef.current.goBack();
|
|
161
241
|
return true;
|
|
162
242
|
}
|
|
163
243
|
return false;
|
|
164
244
|
}, [canGoBack]);
|
|
165
|
-
const checkLocationPermissionAndSendCallback = useCallback(async () => {
|
|
166
|
-
const isLocationPermissionAvailable = await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION);
|
|
167
|
-
if (isLoggingEnabled) {
|
|
168
|
-
console.log('checkLocationPermissionAndSendCallback() isLocationPermissionAvailable: ' + isLocationPermissionAvailable + 'isGPSPermissionAvailabe: true');
|
|
169
|
-
}
|
|
170
|
-
if (isLocationPermissionAvailable) {
|
|
171
|
-
var _webviewRef$current5;
|
|
172
|
-
var finalString = `window.checkTheGpsPermission(true)`;
|
|
173
|
-
console.log('listener: ' + finalString);
|
|
174
|
-
(_webviewRef$current5 = webviewRef.current) === null || _webviewRef$current5 === void 0 || _webviewRef$current5.injectJavaScript(finalString);
|
|
175
|
-
}
|
|
176
|
-
}, [isLoggingEnabled]);
|
|
177
245
|
useEffect(() => {
|
|
178
|
-
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
if (
|
|
183
|
-
|
|
246
|
+
const backSub = BackHandler.addEventListener('hardwareBackPress', handleBack);
|
|
247
|
+
const appStateSub = AppState.addEventListener('change', nextAppState => {
|
|
248
|
+
const wasInBackground = /inactive|background/.test(appStateRef.current);
|
|
249
|
+
appStateRef.current = nextAppState;
|
|
250
|
+
if (wasInBackground && nextAppState === 'active' && pendingSettingsRef.current) {
|
|
251
|
+
recheckAfterSettings();
|
|
184
252
|
}
|
|
185
253
|
});
|
|
186
|
-
|
|
187
|
-
// Subscribe to Android hardware back press
|
|
188
|
-
const backSub = BackHandler.addEventListener('hardwareBackPress', handleBack);
|
|
189
|
-
|
|
190
|
-
// Cleanup subscriptions on unmount
|
|
191
254
|
return () => {
|
|
192
255
|
backSub === null || backSub === void 0 || backSub.remove();
|
|
193
|
-
|
|
256
|
+
appStateSub === null || appStateSub === void 0 || appStateSub.remove();
|
|
194
257
|
};
|
|
195
|
-
}, [handleBack,
|
|
258
|
+
}, [handleBack, recheckAfterSettings]);
|
|
196
259
|
return (
|
|
197
260
|
/*#__PURE__*/
|
|
198
261
|
// eslint-disable-next-line react-native/no-inline-styles
|
|
@@ -200,7 +263,7 @@ const VisitRnSdkView = ({
|
|
|
200
263
|
style: {
|
|
201
264
|
flex: 1
|
|
202
265
|
}
|
|
203
|
-
}, source ? /*#__PURE__*/React.createElement(
|
|
266
|
+
}, source ? /*#__PURE__*/React.createElement(SdkWebView, {
|
|
204
267
|
ref: webviewRef,
|
|
205
268
|
source: {
|
|
206
269
|
uri: source,
|
|
@@ -213,10 +276,6 @@ const VisitRnSdkView = ({
|
|
|
213
276
|
javaScriptEnabled: true,
|
|
214
277
|
onLoadProgress: event => setCanGoBack(event.nativeEvent.canGoBack),
|
|
215
278
|
onError: errorMessage => {
|
|
216
|
-
EventRegister.emitEvent('visit-event', {
|
|
217
|
-
message: 'web-view-error',
|
|
218
|
-
errorMessage: errorMessage
|
|
219
|
-
});
|
|
220
279
|
if (isLoggingEnabled) {
|
|
221
280
|
console.warn('Webview error: ', errorMessage);
|
|
222
281
|
}
|
|
@@ -240,35 +299,6 @@ const VisitRnSdkView = ({
|
|
|
240
299
|
}
|
|
241
300
|
}))
|
|
242
301
|
);
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
// debounce, deferred
|
|
246
|
-
// function debounce(task, ms) {
|
|
247
|
-
// let t = { promise: null, cancel: (_) => void 0 };
|
|
248
|
-
// return async (...args) => {
|
|
249
|
-
// try {
|
|
250
|
-
// t.cancel();
|
|
251
|
-
// t = deferred(ms);
|
|
252
|
-
// await t.promise;
|
|
253
|
-
// await task(...args);
|
|
254
|
-
// } catch (_) {
|
|
255
|
-
// console.log('cleaning up cancelled promise');
|
|
256
|
-
// }
|
|
257
|
-
// };
|
|
258
|
-
// }
|
|
259
|
-
|
|
260
|
-
// function deferred(ms) {
|
|
261
|
-
// let cancel,
|
|
262
|
-
// promise = new Promise((resolve, reject) => {
|
|
263
|
-
// cancel = reject;
|
|
264
|
-
// setTimeout(resolve, ms);
|
|
265
|
-
// });
|
|
266
|
-
// return { promise, cancel };
|
|
267
|
-
// }
|
|
268
|
-
|
|
302
|
+
});
|
|
269
303
|
export default VisitRnSdkView;
|
|
270
|
-
VisitRnSdkView.defaultProps = {
|
|
271
|
-
ssoLink: '',
|
|
272
|
-
isLoggingEnabled: false
|
|
273
|
-
};
|
|
274
304
|
//# sourceMappingURL=index.android.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useRef","useEffect","useState","useCallback","EventRegister","SafeAreaView","PermissionsAndroid","BackHandler","Linking","Alert","WebView","LocationEnabler","VideoCallComponent","PRIORITIES","HIGH_ACCURACY","useLocationSettings","addListener","VisitRnSdkView","ssoLink","isLoggingEnabled","source","trim","showPermissionAlreadyDeniedDialog","setShowPermissionAlreadyDeniedDialog","enabled","requestResolution","priority","alwaysShow","needBle","webviewRef","videoCallRef","showLocationPermissionAlert","alert","text","onPress","console","log","openSettings","requestLocationPermission","isLocationPermissionPresent","check","PERMISSIONS","ACCESS_FINE_LOCATION","granted","request","title","message","buttonNeutral","buttonNegative","buttonPositive","RESULTS","GRANTED","_webviewRef$current","finalString","current","injectJavaScript","_webviewRef$current2","e","error","runBeforeFirst","startVideoConsultation","parsedObject","_videoCallRef$current","roomName","accessToken","token","rawDoctorName","doctorName","visibleDoctorName","indexOf","replace","userName","warn","startVideoCall","handleMessage","event","_webviewRef$current3","nativeEvent","data","JSON","parse","method","pdfUrl","url","openURL","emitEvent","exception","canGoBack","setCanGoBack","handleBack","_webviewRef$current4","goBack","checkLocationPermissionAndSendCallback","isLocationPermissionAvailable","_webviewRef$current5","locationSub","locationEnabled","backSub","addEventListener","remove","createElement","style","flex","ref","uri","headers","platform","onMessage","injectedJavaScriptBeforeContentLoaded","javaScriptEnabled","onLoadProgress","onError","errorMessage","onCallConnected","info","onCallEnded","defaultProps"],"sourceRoot":"../../src","sources":["index.android.js"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,MAAM,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,WAAW,QAAQ,OAAO;AACvE,SAASC,aAAa,QAAQ,8BAA8B;AAE5D,SACEC,YAAY,EACZC,kBAAkB,EAClBC,WAAW,EACXC,OAAO,EACPC,KAAK,QACA,cAAc;AAErB,OAAOC,OAAO,MAAM,sBAAsB;AAE1C,OAAOC,eAAe,MAAM,6CAA6C;AAEzE,OAAOC,kBAAkB,MAAM,iCAAiC;AAEhE,MAAM;EACJC,UAAU,EAAE;IAAEC;EAAc,CAAC;EAC7BC,mBAAmB;EACnBC;AACF,CAAC,GAAGL,eAAe;AAEnB,MAAMM,cAAc,GAAGA,CAAC;EAAEC,OAAO;EAAEC;AAAiB,CAAC,KAAK;EACxD,MAAMC,MAAM,GAAG,OAAOF,OAAO,KAAK,QAAQ,GAAGA,OAAO,CAACG,IAAI,CAAC,CAAC,GAAG,EAAE;EAEhE,MAAM,CACJC,iCAAiC,EACjCC,oCAAoC,CACrC,GAAGrB,QAAQ,CAAC,KAAK,CAAC;EAEnB,MAAM,CAACsB,OAAO,EAAEC,iBAAiB,CAAC,GAAGV,mBAAmB,CACtD;IACEW,QAAQ,EAAEZ,aAAa;IAAE;IACzBa,UAAU,EAAE,IAAI;IAAE;IAClBC,OAAO,EAAE,IAAI,CAAE;EACjB,CAAC,EACD,KAAK,CAAC,iCACR,CAAC;EAED,MAAMC,UAAU,GAAG7B,MAAM,CAAC,IAAI,CAAC;EAC/B,MAAM8B,YAAY,G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;MACzBkC,qCAAqC,EAAEjD,cAAe;MACtDkD,iBAAiB,EAAE,IAAK;MACxBC,cAAc,EAAGnC,KAAK,IAAKa,YAAY,CAACb,KAAK,CAACE,WAAW,CAACU,SAAS,CAAE;MACrEwB,OAAO,EAAGC,YAAY,IAAK;QACzB5G,aAAa,CAACiF,SAAS,CAAC,aAAa,EAAE;UACrCvC,OAAO,EAAE,gBAAgB;UACzBkE,YAAY,EAAEA;QAChB,CAAC,CAAC;QACF,IAAI7F,gBAAgB,EAAE;UACpBgB,OAAO,CAACqC,IAAI,CAAC,iBAAiB,EAAEwC,YAAY,CAAC;QAC/C;MACF;IAAE,CACH,CAAC,GACA,IAAI,eACRjH,KAAA,CAAAqG,aAAA,CAACxF,kBAAkB;MACjB2F,GAAG,EAAEzE,YAAa;MAClBmF,eAAe,EAAGC,IAAI,IAAK;QACzB,IAAI/F,gBAAgB,EAAE;UACpBgB,OAAO,CAACC,GAAG,CAAC,uBAAuB,EAAE8E,IAAI,CAAC;QAC5C;MACF,CAAE;MACFC,WAAW,EAAGD,IAAI,IAAK;QACrB,IAAI/F,gBAAgB,EAAE;UACpBgB,OAAO,CAACC,GAAG,CAAC,mBAAmB,EAAE8E,IAAI,CAAC;QACxC;MACF,CAAE;MACFH,OAAO,EAAGrD,KAAK,IAAK;QAClB,IAAIvC,gBAAgB,EAAE;UACpBgB,OAAO,CAACuB,KAAK,CAAC,mBAAmB,EAAEA,KAAK,CAAC;QAC3C;MACF;IAAE,CACH,CACW;EAAC;AAEnB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,eAAezC,cAAc;AAE7BA,cAAc,CAACmG,YAAY,GAAG;EAC5BlG,OAAO,EAAE,EAAE;EACXC,gBAAgB,EAAE;AACpB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","forwardRef","useRef","useEffect","useState","useCallback","useImperativeHandle","Alert","AppState","BackHandler","Linking","NativeModules","SafeAreaView","check","openSettings","PERMISSIONS","request","RESULTS","WebView","VideoCallComponent","SdkWebView","LOCATION_SOURCE_SETTINGS","GENERAL_SETTINGS","VisitRnSdkLocation","VisitRnSdkView","ssoLink","isLoggingEnabled","onEvent","ref","source","trim","webviewRef","videoCallRef","locationFlowInProgressRef","pendingSettingsRef","appStateRef","currentState","canGoBack","setCanGoBack","warn","message","error","console","finishLocationFlow","granted","_webviewRef$current","current","injectJavaScript","showLocationPermissionSettingsAlert","alert","text","style","onPress","cancelable","openLocationServicesSettings","sendIntent","locationSettingsError","generalSettingsError","checkLocationServices","promptIfDisabled","isLocationServicesEnabled","Error","isEnabled","requestLocationPermission","permissionStatus","ANDROID","ACCESS_FINE_LOCATION","DENIED","GRANTED","BLOCKED","recheckAfterSettings","settingsType","runBeforeFirst","sendEvent","eventName","properties","_webviewRef$current2","JSON","stringify","emitHostEvent","startVideoConsultation","parsedObject","_videoCallRef$current","roomName","accessToken","token","rawDoctorName","doctorName","visibleDoctorName","indexOf","replace","userName","startVideoCall","handleMessage","event","_webviewRef$current3","nativeEvent","data","parse","log","method","url","openURL","handleBack","goBack","backSub","addEventListener","appStateSub","nextAppState","wasInBackground","test","remove","createElement","flex","uri","headers","platform","onMessage","injectedJavaScriptBeforeContentLoaded","javaScriptEnabled","onLoadProgress","onError","errorMessage","onCallConnected","info","onCallEnded"],"sourceRoot":"../../src","sources":["index.android.tsx"],"mappings":"AAAA,OAAOA,KAAK,IACVC,UAAU,EACVC,MAAM,EACNC,SAAS,EACTC,QAAQ,EACRC,WAAW,EACXC,mBAAmB,QAEd,OAAO;AACd,SACEC,KAAK,EACLC,QAAQ,EACRC,WAAW,EACXC,OAAO,EACPC,aAAa,EACbC,YAAY,QAGP,cAAc;AACrB,SACEC,KAAK,EACLC,YAAY,EACZC,WAAW,EACXC,OAAO,EACPC,OAAO,QACF,0BAA0B;AACjC,OAAOC,OAAO,MAAoC,sBAAs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AAC7F,kBAAkB;MACjBS,GAAG,EAAEI,YAAa;MAClB2F,eAAe,EAAGC,IAAI,IAAK;QACzB,IAAIlG,gBAAgB,EAAE;UACpBgB,OAAO,CAACyD,GAAG,CAAC,uBAAuB,EAAEyB,IAAI,CAAC;QAC5C;MACF,CAAE;MACFC,WAAW,EAAGD,IAAI,IAAK;QACrB,IAAIlG,gBAAgB,EAAE;UACpBgB,OAAO,CAACyD,GAAG,CAAC,mBAAmB,EAAEyB,IAAI,CAAC;QACxC;MACF,CAAE;MACFH,OAAO,EAAGhF,KAAK,IAAK;QAClB,IAAIf,gBAAgB,EAAE;UACpBgB,OAAO,CAACD,KAAK,CAAC,mBAAmB,EAAEA,KAAK,CAAC;QAC3C;MACF;IAAE,CACH,CACW;EAAC;AAEnB,CACF,CAAC;AAED,eAAejB,cAAc","ignoreList":[]}
|
package/lib/module/index.ios.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import React, { useRef, useCallback } from 'react';
|
|
1
|
+
import React, { forwardRef, useRef, useCallback, useImperativeHandle } from 'react';
|
|
2
2
|
import { StyleSheet, SafeAreaView, Linking, Dimensions } from 'react-native';
|
|
3
|
-
import { EventRegister } from 'react-native-event-listeners';
|
|
4
3
|
import { WebView } from 'react-native-webview';
|
|
5
4
|
import VideoCallComponent from './components/VideoCallComponent';
|
|
5
|
+
// react-native-webview typings can collapse to `never` under React 17 @types.
|
|
6
|
+
const SdkWebView = WebView;
|
|
6
7
|
const escapeChars = {
|
|
7
8
|
lt: '<',
|
|
8
9
|
gt: '>',
|
|
@@ -25,11 +26,11 @@ str.replace(/\&([^;]+);/g, (entity, entityCode) => {
|
|
|
25
26
|
return entity;
|
|
26
27
|
}
|
|
27
28
|
});
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
})
|
|
29
|
+
const VisitRnSdkView = /*#__PURE__*/forwardRef(function VisitRnSdkView({
|
|
30
|
+
ssoLink = '',
|
|
31
|
+
isLoggingEnabled = false,
|
|
32
|
+
onEvent
|
|
33
|
+
}, ref) {
|
|
33
34
|
const source = typeof ssoLink === 'string' ? ssoLink.trim() : '';
|
|
34
35
|
const webviewRef = useRef(null);
|
|
35
36
|
const videoCallRef = useRef(null);
|
|
@@ -39,6 +40,22 @@ const VisitRnSdkView = ({
|
|
|
39
40
|
window.setSdkPlatform('IOS');
|
|
40
41
|
true; // note: this is required, or you'll sometimes get silent failures
|
|
41
42
|
`;
|
|
43
|
+
const sendEvent = useCallback((eventName, properties) => {
|
|
44
|
+
var _webviewRef$current;
|
|
45
|
+
if (typeof eventName !== 'string' || eventName.trim() === '') {
|
|
46
|
+
if (isLoggingEnabled) {
|
|
47
|
+
console.warn('sendEvent requires a non-empty eventName.');
|
|
48
|
+
}
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
(_webviewRef$current = webviewRef.current) === null || _webviewRef$current === void 0 || _webviewRef$current.injectJavaScript(`window.sendEventToVisit(${JSON.stringify(eventName)}, ${JSON.stringify(properties ?? {})}); true;`);
|
|
52
|
+
}, [isLoggingEnabled]);
|
|
53
|
+
useImperativeHandle(ref, () => ({
|
|
54
|
+
sendEvent
|
|
55
|
+
}), [sendEvent]);
|
|
56
|
+
const emitHostEvent = useCallback((eventName, properties) => {
|
|
57
|
+
onEvent === null || onEvent === void 0 || onEvent(eventName, properties);
|
|
58
|
+
}, [onEvent]);
|
|
42
59
|
const startVideoConsultation = useCallback(payload => {
|
|
43
60
|
var _videoCallRef$current;
|
|
44
61
|
const roomName = payload === null || payload === void 0 ? void 0 : payload.roomName;
|
|
@@ -60,37 +77,54 @@ const VisitRnSdkView = ({
|
|
|
60
77
|
userName
|
|
61
78
|
});
|
|
62
79
|
}, [isLoggingEnabled]);
|
|
63
|
-
const handleMessage =
|
|
64
|
-
var _webviewRef$
|
|
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
|
-
|
|
80
|
+
const handleMessage = event => {
|
|
81
|
+
var _webviewRef$current2, _webviewRef$current3;
|
|
82
|
+
try {
|
|
83
|
+
const data = JSON.parse(unescapeHTML(event.nativeEvent.data));
|
|
84
|
+
const {
|
|
85
|
+
method,
|
|
86
|
+
url
|
|
87
|
+
} = data;
|
|
88
|
+
if (isLoggingEnabled) {
|
|
89
|
+
console.log('Received WebView method:', method);
|
|
90
|
+
}
|
|
91
|
+
switch (method) {
|
|
92
|
+
case 'startVideoCall':
|
|
93
|
+
startVideoConsultation(data);
|
|
94
|
+
break;
|
|
95
|
+
case 'UPDATE_PLATFORM':
|
|
96
|
+
(_webviewRef$current2 = webviewRef.current) === null || _webviewRef$current2 === void 0 || _webviewRef$current2.injectJavaScript('window.setSdkPlatform("IOS")');
|
|
97
|
+
break;
|
|
98
|
+
case 'OPEN_PDF':
|
|
99
|
+
if (url) {
|
|
100
|
+
Linking.openURL(url);
|
|
101
|
+
}
|
|
102
|
+
break;
|
|
103
|
+
case 'CLOSE_VIEW':
|
|
104
|
+
break;
|
|
105
|
+
case 'GET_LOCATION_PERMISSIONS':
|
|
106
|
+
(_webviewRef$current3 = webviewRef.current) === null || _webviewRef$current3 === void 0 || _webviewRef$current3.injectJavaScript('window.checkTheGpsPermission(true)');
|
|
107
|
+
break;
|
|
108
|
+
case 'sendEventToHost':
|
|
109
|
+
{
|
|
110
|
+
const eventName = typeof data.eventName === 'string' ? data.eventName : '';
|
|
111
|
+
if (eventName) {
|
|
112
|
+
const properties = {
|
|
113
|
+
...data
|
|
114
|
+
};
|
|
115
|
+
delete properties.method;
|
|
116
|
+
delete properties.eventName;
|
|
117
|
+
emitHostEvent(eventName, properties);
|
|
118
|
+
}
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
default:
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
} catch (error) {
|
|
125
|
+
if (isLoggingEnabled) {
|
|
126
|
+
console.warn('Unable to handle WebView message.', error);
|
|
127
|
+
}
|
|
94
128
|
}
|
|
95
129
|
};
|
|
96
130
|
const {
|
|
@@ -107,20 +141,16 @@ const VisitRnSdkView = ({
|
|
|
107
141
|
height,
|
|
108
142
|
width
|
|
109
143
|
}
|
|
110
|
-
}, source ? /*#__PURE__*/React.createElement(
|
|
144
|
+
}, source ? /*#__PURE__*/React.createElement(SdkWebView, {
|
|
111
145
|
ref: webviewRef,
|
|
112
146
|
source: {
|
|
113
147
|
uri: source
|
|
114
148
|
},
|
|
115
149
|
style: styles.webView,
|
|
116
|
-
|
|
150
|
+
javaScriptEnabled: true,
|
|
117
151
|
onMessage: handleMessage,
|
|
118
152
|
injectedJavaScriptBeforeContentLoaded: runBeforeFirst,
|
|
119
153
|
onError: errorMessage => {
|
|
120
|
-
EventRegister.emitEvent(visitEvent, {
|
|
121
|
-
message: 'web-view-error',
|
|
122
|
-
errorMessage: errorMessage
|
|
123
|
-
});
|
|
124
154
|
if (isLoggingEnabled) {
|
|
125
155
|
console.warn('Webview error: ', errorMessage);
|
|
126
156
|
}
|
|
@@ -144,15 +174,11 @@ const VisitRnSdkView = ({
|
|
|
144
174
|
}
|
|
145
175
|
}))
|
|
146
176
|
);
|
|
147
|
-
};
|
|
177
|
+
});
|
|
148
178
|
const styles = StyleSheet.create({
|
|
149
179
|
webView: {
|
|
150
180
|
flex: 1
|
|
151
181
|
}
|
|
152
182
|
});
|
|
153
|
-
VisitRnSdkView.defaultProps = {
|
|
154
|
-
ssoLink: '',
|
|
155
|
-
isLoggingEnabled: false
|
|
156
|
-
};
|
|
157
183
|
export default VisitRnSdkView;
|
|
158
184
|
//# sourceMappingURL=index.ios.js.map
|