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
|
@@ -5,97 +5,175 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _reactNativeEventListeners = require("react-native-event-listeners");
|
|
9
8
|
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativePermissions = require("react-native-permissions");
|
|
10
10
|
var _reactNativeWebview = _interopRequireDefault(require("react-native-webview"));
|
|
11
|
-
var _reactNativeLocationEnabler = _interopRequireDefault(require("@visit-health/react-native-location-enabler"));
|
|
12
11
|
var _VideoCallComponent = _interopRequireDefault(require("./components/VideoCallComponent"));
|
|
13
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
13
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
|
+
// react-native-webview typings can collapse to `never` under React 17 @types.
|
|
15
|
+
const SdkWebView = _reactNativeWebview.default;
|
|
16
|
+
const LOCATION_SOURCE_SETTINGS = 'android.settings.LOCATION_SOURCE_SETTINGS';
|
|
17
|
+
const GENERAL_SETTINGS = 'android.settings.SETTINGS';
|
|
15
18
|
const {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
ssoLink,
|
|
24
|
-
isLoggingEnabled
|
|
25
|
-
}) => {
|
|
19
|
+
VisitRnSdkLocation
|
|
20
|
+
} = _reactNative.NativeModules;
|
|
21
|
+
const VisitRnSdkView = /*#__PURE__*/(0, _react.forwardRef)(function VisitRnSdkView({
|
|
22
|
+
ssoLink = '',
|
|
23
|
+
isLoggingEnabled = false,
|
|
24
|
+
onEvent
|
|
25
|
+
}, ref) {
|
|
26
26
|
const source = typeof ssoLink === 'string' ? ssoLink.trim() : '';
|
|
27
|
-
const [showPermissionAlreadyDeniedDialog, setShowPermissionAlreadyDeniedDialog] = (0, _react.useState)(false);
|
|
28
|
-
const [enabled, requestResolution] = useLocationSettings({
|
|
29
|
-
priority: HIGH_ACCURACY,
|
|
30
|
-
// default BALANCED_POWER_ACCURACY
|
|
31
|
-
alwaysShow: true,
|
|
32
|
-
// default false
|
|
33
|
-
needBle: true // default false
|
|
34
|
-
}, false /* optional: default undefined */);
|
|
35
27
|
const webviewRef = (0, _react.useRef)(null);
|
|
36
28
|
const videoCallRef = (0, _react.useRef)(null);
|
|
37
|
-
const
|
|
38
|
-
|
|
29
|
+
const locationFlowInProgressRef = (0, _react.useRef)(false);
|
|
30
|
+
const pendingSettingsRef = (0, _react.useRef)(null);
|
|
31
|
+
const appStateRef = (0, _react.useRef)(_reactNative.AppState.currentState);
|
|
32
|
+
const [canGoBack, setCanGoBack] = (0, _react.useState)(false);
|
|
33
|
+
const warn = (0, _react.useCallback)((message, error) => {
|
|
34
|
+
if (isLoggingEnabled) {
|
|
35
|
+
console.warn(message, error);
|
|
36
|
+
}
|
|
37
|
+
}, [isLoggingEnabled]);
|
|
38
|
+
const finishLocationFlow = (0, _react.useCallback)(granted => {
|
|
39
|
+
var _webviewRef$current;
|
|
40
|
+
locationFlowInProgressRef.current = false;
|
|
41
|
+
pendingSettingsRef.current = null;
|
|
42
|
+
(_webviewRef$current = webviewRef.current) === null || _webviewRef$current === void 0 || _webviewRef$current.injectJavaScript(`window.checkTheGpsPermission(${granted}); true;`);
|
|
43
|
+
}, []);
|
|
44
|
+
const showLocationPermissionSettingsAlert = (0, _react.useCallback)(() => {
|
|
45
|
+
_reactNative.Alert.alert('Location permission required', 'Allow location access in app settings to continue.', [{
|
|
39
46
|
text: 'Cancel',
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
47
|
+
style: 'cancel',
|
|
48
|
+
onPress: () => finishLocationFlow(false)
|
|
43
49
|
}, {
|
|
44
|
-
text: '
|
|
45
|
-
onPress: () => {
|
|
46
|
-
|
|
50
|
+
text: 'Open Settings',
|
|
51
|
+
onPress: async () => {
|
|
52
|
+
pendingSettingsRef.current = 'location-permission';
|
|
53
|
+
try {
|
|
54
|
+
await (0, _reactNativePermissions.openSettings)();
|
|
55
|
+
} catch (error) {
|
|
56
|
+
warn('Unable to open application settings.', error);
|
|
57
|
+
finishLocationFlow(false);
|
|
58
|
+
}
|
|
47
59
|
}
|
|
48
|
-
}]
|
|
49
|
-
|
|
50
|
-
|
|
60
|
+
}], {
|
|
61
|
+
cancelable: false
|
|
62
|
+
});
|
|
63
|
+
}, [finishLocationFlow, warn]);
|
|
64
|
+
const openLocationServicesSettings = (0, _react.useCallback)(async () => {
|
|
65
|
+
pendingSettingsRef.current = 'location-services';
|
|
66
|
+
try {
|
|
67
|
+
await _reactNative.Linking.sendIntent(LOCATION_SOURCE_SETTINGS);
|
|
68
|
+
} catch (locationSettingsError) {
|
|
69
|
+
warn('Unable to open Location Services settings; opening general settings.', locationSettingsError);
|
|
70
|
+
try {
|
|
71
|
+
await _reactNative.Linking.sendIntent(GENERAL_SETTINGS);
|
|
72
|
+
} catch (generalSettingsError) {
|
|
73
|
+
warn('Unable to open Android settings.', generalSettingsError);
|
|
74
|
+
finishLocationFlow(false);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}, [finishLocationFlow, warn]);
|
|
78
|
+
const checkLocationServices = (0, _react.useCallback)(async ({
|
|
79
|
+
promptIfDisabled
|
|
80
|
+
}) => {
|
|
81
|
+
try {
|
|
82
|
+
if (!(VisitRnSdkLocation !== null && VisitRnSdkLocation !== void 0 && VisitRnSdkLocation.isLocationServicesEnabled)) {
|
|
83
|
+
throw new Error('VisitRnSdkLocation native module is unavailable.');
|
|
84
|
+
}
|
|
85
|
+
const isEnabled = await VisitRnSdkLocation.isLocationServicesEnabled();
|
|
86
|
+
if (isEnabled) {
|
|
87
|
+
finishLocationFlow(true);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (!promptIfDisabled) {
|
|
91
|
+
finishLocationFlow(false);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
_reactNative.Alert.alert('Turn on Location Services', 'Enable Location Services in phone settings to continue.', [{
|
|
95
|
+
text: 'Cancel',
|
|
96
|
+
style: 'cancel',
|
|
97
|
+
onPress: () => finishLocationFlow(false)
|
|
98
|
+
}, {
|
|
99
|
+
text: 'Open Settings',
|
|
100
|
+
onPress: openLocationServicesSettings
|
|
101
|
+
}], {
|
|
102
|
+
cancelable: false
|
|
103
|
+
});
|
|
104
|
+
} catch (error) {
|
|
105
|
+
warn('Unable to check Location Services.', error);
|
|
106
|
+
finishLocationFlow(false);
|
|
107
|
+
}
|
|
108
|
+
}, [finishLocationFlow, openLocationServicesSettings, warn]);
|
|
109
|
+
const requestLocationPermission = (0, _react.useCallback)(async () => {
|
|
110
|
+
if (locationFlowInProgressRef.current || pendingSettingsRef.current !== null) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
locationFlowInProgressRef.current = true;
|
|
51
114
|
try {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
console.log('requesting location permission');
|
|
60
|
-
const granted = await _reactNative.PermissionsAndroid.request(_reactNative.PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION, {
|
|
61
|
-
title: 'Need Location Permission',
|
|
62
|
-
message: 'Need access to location permission',
|
|
63
|
-
buttonNeutral: 'Ask Me Later',
|
|
64
|
-
buttonNegative: 'Cancel',
|
|
65
|
-
buttonPositive: 'OK'
|
|
115
|
+
let permissionStatus = await (0, _reactNativePermissions.check)(_reactNativePermissions.PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION);
|
|
116
|
+
if (permissionStatus === _reactNativePermissions.RESULTS.DENIED) {
|
|
117
|
+
permissionStatus = await (0, _reactNativePermissions.request)(_reactNativePermissions.PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION);
|
|
118
|
+
}
|
|
119
|
+
if (permissionStatus === _reactNativePermissions.RESULTS.GRANTED) {
|
|
120
|
+
await checkLocationServices({
|
|
121
|
+
promptIfDisabled: true
|
|
66
122
|
});
|
|
67
|
-
|
|
68
|
-
if (isLoggingEnabled) {
|
|
69
|
-
console.log('Location permission granted');
|
|
70
|
-
}
|
|
71
|
-
setShowPermissionAlreadyDeniedDialog(false);
|
|
72
|
-
if (!enabled) {
|
|
73
|
-
requestResolution();
|
|
74
|
-
} else {
|
|
75
|
-
var _webviewRef$current;
|
|
76
|
-
var finalString = `window.checkTheGpsPermission(true)`;
|
|
77
|
-
console.log('requestLocationPermission: ' + finalString);
|
|
78
|
-
(_webviewRef$current = webviewRef.current) === null || _webviewRef$current === void 0 || _webviewRef$current.injectJavaScript(finalString);
|
|
79
|
-
}
|
|
80
|
-
} else {
|
|
81
|
-
var _webviewRef$current2;
|
|
82
|
-
setShowPermissionAlreadyDeniedDialog(true);
|
|
83
|
-
console.log('Location permission denied');
|
|
84
|
-
var finalString = `window.checkTheGpsPermission(false)`;
|
|
85
|
-
console.log('requestLocationPermission: ' + finalString);
|
|
86
|
-
(_webviewRef$current2 = webviewRef.current) === null || _webviewRef$current2 === void 0 || _webviewRef$current2.injectJavaScript(finalString);
|
|
87
|
-
}
|
|
123
|
+
return;
|
|
88
124
|
}
|
|
89
|
-
|
|
90
|
-
|
|
125
|
+
if (permissionStatus === _reactNativePermissions.RESULTS.BLOCKED) {
|
|
126
|
+
showLocationPermissionSettingsAlert();
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
finishLocationFlow(false);
|
|
130
|
+
} catch (error) {
|
|
131
|
+
warn('Unable to check or request location permission.', error);
|
|
132
|
+
finishLocationFlow(false);
|
|
91
133
|
}
|
|
92
|
-
};
|
|
134
|
+
}, [checkLocationServices, finishLocationFlow, showLocationPermissionSettingsAlert, warn]);
|
|
135
|
+
const recheckAfterSettings = (0, _react.useCallback)(async () => {
|
|
136
|
+
const settingsType = pendingSettingsRef.current;
|
|
137
|
+
if (!settingsType) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
pendingSettingsRef.current = null;
|
|
141
|
+
try {
|
|
142
|
+
const permissionStatus = await (0, _reactNativePermissions.check)(_reactNativePermissions.PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION);
|
|
143
|
+
if (permissionStatus !== _reactNativePermissions.RESULTS.GRANTED) {
|
|
144
|
+
finishLocationFlow(false);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
await checkLocationServices({
|
|
148
|
+
promptIfDisabled: settingsType === 'location-permission'
|
|
149
|
+
});
|
|
150
|
+
} catch (error) {
|
|
151
|
+
warn('Unable to recheck location access after settings.', error);
|
|
152
|
+
finishLocationFlow(false);
|
|
153
|
+
}
|
|
154
|
+
}, [checkLocationServices, finishLocationFlow, warn]);
|
|
93
155
|
const runBeforeFirst = `
|
|
94
156
|
window.isNativeApp = true;
|
|
95
157
|
window.platform = "ANDROID";
|
|
96
158
|
window.setSdkPlatform('ANDROID');
|
|
97
159
|
true; // note: this is required, or you'll sometimes get silent failures
|
|
98
160
|
`;
|
|
161
|
+
const sendEvent = (0, _react.useCallback)((eventName, properties) => {
|
|
162
|
+
var _webviewRef$current2;
|
|
163
|
+
if (typeof eventName !== 'string' || (eventName === null || eventName === void 0 ? void 0 : eventName.trim()) === '') {
|
|
164
|
+
if (isLoggingEnabled) {
|
|
165
|
+
console.warn('sendEvent requires a non-empty eventName.');
|
|
166
|
+
}
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
(_webviewRef$current2 = webviewRef.current) === null || _webviewRef$current2 === void 0 || _webviewRef$current2.injectJavaScript(`window.sendEventToVisit(${JSON.stringify(eventName)}, ${JSON.stringify(properties ?? {})}); true;`);
|
|
170
|
+
}, [isLoggingEnabled]);
|
|
171
|
+
(0, _react.useImperativeHandle)(ref, () => ({
|
|
172
|
+
sendEvent
|
|
173
|
+
}), [sendEvent]);
|
|
174
|
+
const emitHostEvent = (0, _react.useCallback)((eventName, properties) => {
|
|
175
|
+
onEvent === null || onEvent === void 0 || onEvent(eventName, properties);
|
|
176
|
+
}, [onEvent]);
|
|
99
177
|
const startVideoConsultation = (0, _react.useCallback)(parsedObject => {
|
|
100
178
|
var _videoCallRef$current;
|
|
101
179
|
const roomName = parsedObject === null || parsedObject === void 0 ? void 0 : parsedObject.roomName;
|
|
@@ -121,10 +199,10 @@ const VisitRnSdkView = ({
|
|
|
121
199
|
var _webviewRef$current3;
|
|
122
200
|
if (event.nativeEvent.data != null) {
|
|
123
201
|
try {
|
|
202
|
+
const parsedObject = JSON.parse(event.nativeEvent.data);
|
|
124
203
|
if (isLoggingEnabled) {
|
|
125
|
-
console.log('
|
|
204
|
+
console.log('Received WebView method:', parsedObject.method);
|
|
126
205
|
}
|
|
127
|
-
const parsedObject = JSON.parse(event.nativeEvent.data);
|
|
128
206
|
if (parsedObject.method != null) {
|
|
129
207
|
switch (parsedObject.method) {
|
|
130
208
|
case 'startVideoCall':
|
|
@@ -134,73 +212,58 @@ const VisitRnSdkView = ({
|
|
|
134
212
|
(_webviewRef$current3 = webviewRef.current) === null || _webviewRef$current3 === void 0 || _webviewRef$current3.injectJavaScript('window.setSdkPlatform("ANDROID")');
|
|
135
213
|
break;
|
|
136
214
|
case 'GET_LOCATION_PERMISSIONS':
|
|
137
|
-
console.log('GET_LOCATION_PERMISSIONS');
|
|
138
215
|
requestLocationPermission();
|
|
139
216
|
break;
|
|
140
217
|
case 'OPEN_PDF':
|
|
141
|
-
{
|
|
142
|
-
|
|
143
|
-
// console.log("pdfUrl "+pdfUrl);
|
|
144
|
-
|
|
145
|
-
_reactNative.Linking.openURL(pdfUrl);
|
|
218
|
+
if (parsedObject.url) {
|
|
219
|
+
_reactNative.Linking.openURL(parsedObject.url);
|
|
146
220
|
}
|
|
147
221
|
break;
|
|
148
|
-
case 'OPEN_FACE_SCAN_FLOW':
|
|
149
|
-
_reactNativeEventListeners.EventRegister.emitEvent('visit-event', {
|
|
150
|
-
message: 'OPEN_FACE_SCAN_FLOW'
|
|
151
|
-
});
|
|
152
|
-
break;
|
|
153
222
|
case 'CLOSE_VIEW':
|
|
154
223
|
break;
|
|
224
|
+
case 'sendEventToHost':
|
|
225
|
+
{
|
|
226
|
+
const eventName = typeof parsedObject.eventName === 'string' ? parsedObject.eventName : '';
|
|
227
|
+
if (eventName) {
|
|
228
|
+
const properties = {
|
|
229
|
+
...parsedObject
|
|
230
|
+
};
|
|
231
|
+
delete properties.method;
|
|
232
|
+
delete properties.eventName;
|
|
233
|
+
emitHostEvent(eventName, properties);
|
|
234
|
+
}
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
155
237
|
default:
|
|
156
238
|
break;
|
|
157
239
|
}
|
|
158
240
|
}
|
|
159
|
-
} catch (
|
|
160
|
-
|
|
241
|
+
} catch (error) {
|
|
242
|
+
warn('Unable to handle WebView message.', error);
|
|
161
243
|
}
|
|
162
244
|
}
|
|
163
245
|
};
|
|
164
|
-
const [canGoBack, setCanGoBack] = (0, _react.useState)(false);
|
|
165
246
|
const handleBack = (0, _react.useCallback)(() => {
|
|
166
247
|
if (canGoBack && webviewRef.current) {
|
|
167
|
-
|
|
168
|
-
(_webviewRef$current4 = webviewRef.current) === null || _webviewRef$current4 === void 0 || _webviewRef$current4.goBack();
|
|
248
|
+
webviewRef.current.goBack();
|
|
169
249
|
return true;
|
|
170
250
|
}
|
|
171
251
|
return false;
|
|
172
252
|
}, [canGoBack]);
|
|
173
|
-
const checkLocationPermissionAndSendCallback = (0, _react.useCallback)(async () => {
|
|
174
|
-
const isLocationPermissionAvailable = await _reactNative.PermissionsAndroid.check(_reactNative.PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION);
|
|
175
|
-
if (isLoggingEnabled) {
|
|
176
|
-
console.log('checkLocationPermissionAndSendCallback() isLocationPermissionAvailable: ' + isLocationPermissionAvailable + 'isGPSPermissionAvailabe: true');
|
|
177
|
-
}
|
|
178
|
-
if (isLocationPermissionAvailable) {
|
|
179
|
-
var _webviewRef$current5;
|
|
180
|
-
var finalString = `window.checkTheGpsPermission(true)`;
|
|
181
|
-
console.log('listener: ' + finalString);
|
|
182
|
-
(_webviewRef$current5 = webviewRef.current) === null || _webviewRef$current5 === void 0 || _webviewRef$current5.injectJavaScript(finalString);
|
|
183
|
-
}
|
|
184
|
-
}, [isLoggingEnabled]);
|
|
185
253
|
(0, _react.useEffect)(() => {
|
|
186
|
-
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
if (
|
|
191
|
-
|
|
254
|
+
const backSub = _reactNative.BackHandler.addEventListener('hardwareBackPress', handleBack);
|
|
255
|
+
const appStateSub = _reactNative.AppState.addEventListener('change', nextAppState => {
|
|
256
|
+
const wasInBackground = /inactive|background/.test(appStateRef.current);
|
|
257
|
+
appStateRef.current = nextAppState;
|
|
258
|
+
if (wasInBackground && nextAppState === 'active' && pendingSettingsRef.current) {
|
|
259
|
+
recheckAfterSettings();
|
|
192
260
|
}
|
|
193
261
|
});
|
|
194
|
-
|
|
195
|
-
// Subscribe to Android hardware back press
|
|
196
|
-
const backSub = _reactNative.BackHandler.addEventListener('hardwareBackPress', handleBack);
|
|
197
|
-
|
|
198
|
-
// Cleanup subscriptions on unmount
|
|
199
262
|
return () => {
|
|
200
263
|
backSub === null || backSub === void 0 || backSub.remove();
|
|
201
|
-
|
|
264
|
+
appStateSub === null || appStateSub === void 0 || appStateSub.remove();
|
|
202
265
|
};
|
|
203
|
-
}, [handleBack,
|
|
266
|
+
}, [handleBack, recheckAfterSettings]);
|
|
204
267
|
return (
|
|
205
268
|
/*#__PURE__*/
|
|
206
269
|
// eslint-disable-next-line react-native/no-inline-styles
|
|
@@ -208,7 +271,7 @@ const VisitRnSdkView = ({
|
|
|
208
271
|
style: {
|
|
209
272
|
flex: 1
|
|
210
273
|
}
|
|
211
|
-
}, source ? /*#__PURE__*/_react.default.createElement(
|
|
274
|
+
}, source ? /*#__PURE__*/_react.default.createElement(SdkWebView, {
|
|
212
275
|
ref: webviewRef,
|
|
213
276
|
source: {
|
|
214
277
|
uri: source,
|
|
@@ -221,10 +284,6 @@ const VisitRnSdkView = ({
|
|
|
221
284
|
javaScriptEnabled: true,
|
|
222
285
|
onLoadProgress: event => setCanGoBack(event.nativeEvent.canGoBack),
|
|
223
286
|
onError: errorMessage => {
|
|
224
|
-
_reactNativeEventListeners.EventRegister.emitEvent('visit-event', {
|
|
225
|
-
message: 'web-view-error',
|
|
226
|
-
errorMessage: errorMessage
|
|
227
|
-
});
|
|
228
287
|
if (isLoggingEnabled) {
|
|
229
288
|
console.warn('Webview error: ', errorMessage);
|
|
230
289
|
}
|
|
@@ -248,34 +307,6 @@ const VisitRnSdkView = ({
|
|
|
248
307
|
}
|
|
249
308
|
}))
|
|
250
309
|
);
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
// debounce, deferred
|
|
254
|
-
// function debounce(task, ms) {
|
|
255
|
-
// let t = { promise: null, cancel: (_) => void 0 };
|
|
256
|
-
// return async (...args) => {
|
|
257
|
-
// try {
|
|
258
|
-
// t.cancel();
|
|
259
|
-
// t = deferred(ms);
|
|
260
|
-
// await t.promise;
|
|
261
|
-
// await task(...args);
|
|
262
|
-
// } catch (_) {
|
|
263
|
-
// console.log('cleaning up cancelled promise');
|
|
264
|
-
// }
|
|
265
|
-
// };
|
|
266
|
-
// }
|
|
267
|
-
|
|
268
|
-
// function deferred(ms) {
|
|
269
|
-
// let cancel,
|
|
270
|
-
// promise = new Promise((resolve, reject) => {
|
|
271
|
-
// cancel = reject;
|
|
272
|
-
// setTimeout(resolve, ms);
|
|
273
|
-
// });
|
|
274
|
-
// return { promise, cancel };
|
|
275
|
-
// }
|
|
310
|
+
});
|
|
276
311
|
var _default = exports.default = VisitRnSdkView;
|
|
277
|
-
VisitRnSdkView.defaultProps = {
|
|
278
|
-
ssoLink: '',
|
|
279
|
-
isLoggingEnabled: false
|
|
280
|
-
};
|
|
281
312
|
//# sourceMappingURL=index.android.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNativeEventListeners","_reactNative","_reactNativeWebview","_interopRequireDefault","_reactNativeLocationEnabler","_VideoCallComponent","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","PRIORITIES","HIGH_ACCURACY","useLocationSettings","addListener","LocationEnabler","VisitRnSdkView","ssoLink","isLoggingEnabled","source","trim","showPermissionAlreadyDeniedDialog","setShowPermissionAlreadyDeniedDialog","useState","enabled","requestResolution","priority","alwaysShow","needBle","webviewRef","useRef","videoCallRef","showLocationPermissionAlert","Alert","alert","text","onPress","console","log","Linking","openSettings","requestLocationPermission","isLocationPermissionPresent","PermissionsAndroid","check","PERMISSIONS","ACCESS_FINE_LOCATION","granted","request","title","message","buttonNeutral","buttonNegative","buttonPositive","RESULTS","GRANTED","_webviewRef$current","finalString","current","injectJavaScript","_webviewRef$current2","error","runBeforeFirst","startVideoConsultation","useCallback","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","EventRegister","emitEvent","exception","canGoBack","setCanGoBack","handleBack","_webviewRef$current4","goBack","checkLocationPermissionAndSendCallback","isLocationPermissionAvailable","_webviewRef$current5","useEffect","locationSub","locationEnabled","backSub","BackHandler","addEventListener","remove","createElement","SafeAreaView","style","flex","ref","uri","headers","platform","onMessage","injectedJavaScriptBeforeContentLoaded","javaScriptEnabled","onLoadProgress","onError","errorMessage","onCallConnected","info","onCallEnded","_default","exports","defaultProps"],"sourceRoot":"../../src","sources":["index.android.js"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,0BAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAF,OAAA;AAQA,IAAAG,mBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA,IAAAK,2BAAA,GAAAD,sBAAA,CAAAJ,OAAA;AAEA,IAAAM,mBAAA,GAAAF,sBAAA,CAAAJ,OAAA;AAAiE,SAAAI,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAZ,uBAAA,YAAAA,CAAAQ,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GAAA,CAAA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_interopRequireWildcard","require","_reactNative","_reactNativePermissions","_reactNativeWebview","_interopRequireDefault","_VideoCallComponent","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","SdkWebView","WebView","LOCATION_SOURCE_SETTINGS","GENERAL_SETTINGS","VisitRnSdkLocation","NativeModules","VisitRnSdkView","forwardRef","ssoLink","isLoggingEnabled","onEvent","ref","source","trim","webviewRef","useRef","videoCallRef","locationFlowInProgressRef","pendingSettingsRef","appStateRef","AppState","currentState","canGoBack","setCanGoBack","useState","warn","useCallback","message","error","console","finishLocationFlow","granted","_webviewRef$current","current","injectJavaScript","showLocationPermissionSettingsAlert","Alert","alert","text","style","onPress","openSettings","cancelable","openLocationServicesSettings","Linking","sendIntent","locationSettingsError","generalSettingsError","checkLocationServices","promptIfDisabled","isLocationServicesEnabled","Error","isEnabled","requestLocationPermission","permissionStatus","check","PERMISSIONS","ANDROID","ACCESS_FINE_LOCATION","RESULTS","DENIED","request","GRANTED","BLOCKED","recheckAfterSettings","settingsType","runBeforeFirst","sendEvent","eventName","properties","_webviewRef$current2","JSON","stringify","useImperativeHandle","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","useEffect","backSub","BackHandler","addEventListener","appStateSub","nextAppState","wasInBackground","test","remove","createElement","SafeAreaView","flex","uri","headers","platform","onMessage","injectedJavaScriptBeforeContentLoaded","javaScriptEnabled","onLoadProgress","onError","errorMessage","onCallConnected","info","onCallEnded","_default","exports"],"sourceRoot":"../../src","sources":["index.android.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AASA,IAAAC,YAAA,GAAAD,OAAA;AAUA,IAAAE,uBAAA,GAAAF,OAAA;AAOA,IAAAG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,CAAC;QAC/C;MACF;IAAE,CACH,CAAC,GACA,IAAI,eACRnJ,MAAA,CAAAU,OAAA,CAAA8H,aAAA,CAACjI,mBAAA,CAAAG,OAAkB;MACjB4B,GAAG,EAAEK,YAAa;MAClByG,eAAe,EAAGC,IAAI,IAAK;QACzB,IAAIjH,gBAAgB,EAAE;UACpBoB,OAAO,CAACiE,GAAG,CAAC,uBAAuB,EAAE4B,IAAI,CAAC;QAC5C;MACF,CAAE;MACFC,WAAW,EAAGD,IAAI,IAAK;QACrB,IAAIjH,gBAAgB,EAAE;UACpBoB,OAAO,CAACiE,GAAG,CAAC,mBAAmB,EAAE4B,IAAI,CAAC;QACxC;MACF,CAAE;MACFH,OAAO,EAAG3F,KAAK,IAAK;QAClB,IAAInB,gBAAgB,EAAE;UACpBoB,OAAO,CAACD,KAAK,CAAC,mBAAmB,EAAEA,KAAK,CAAC;QAC3C;MACF;IAAE,CACH,CACW;EAAC;AAEnB,CACF,CAAC;AAAC,IAAAgG,QAAA,GAAAC,OAAA,CAAA9I,OAAA,GAEauB,cAAc","ignoreList":[]}
|
|
@@ -6,11 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
-
var _reactNativeEventListeners = require("react-native-event-listeners");
|
|
10
9
|
var _reactNativeWebview = require("react-native-webview");
|
|
11
10
|
var _VideoCallComponent = _interopRequireDefault(require("./components/VideoCallComponent"));
|
|
12
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
12
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
+
// react-native-webview typings can collapse to `never` under React 17 @types.
|
|
14
|
+
const SdkWebView = _reactNativeWebview.WebView;
|
|
14
15
|
const escapeChars = {
|
|
15
16
|
lt: '<',
|
|
16
17
|
gt: '>',
|
|
@@ -33,11 +34,11 @@ str.replace(/\&([^;]+);/g, (entity, entityCode) => {
|
|
|
33
34
|
return entity;
|
|
34
35
|
}
|
|
35
36
|
});
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
})
|
|
37
|
+
const VisitRnSdkView = /*#__PURE__*/(0, _react.forwardRef)(function VisitRnSdkView({
|
|
38
|
+
ssoLink = '',
|
|
39
|
+
isLoggingEnabled = false,
|
|
40
|
+
onEvent
|
|
41
|
+
}, ref) {
|
|
41
42
|
const source = typeof ssoLink === 'string' ? ssoLink.trim() : '';
|
|
42
43
|
const webviewRef = (0, _react.useRef)(null);
|
|
43
44
|
const videoCallRef = (0, _react.useRef)(null);
|
|
@@ -47,6 +48,22 @@ const VisitRnSdkView = ({
|
|
|
47
48
|
window.setSdkPlatform('IOS');
|
|
48
49
|
true; // note: this is required, or you'll sometimes get silent failures
|
|
49
50
|
`;
|
|
51
|
+
const sendEvent = (0, _react.useCallback)((eventName, properties) => {
|
|
52
|
+
var _webviewRef$current;
|
|
53
|
+
if (typeof eventName !== 'string' || eventName.trim() === '') {
|
|
54
|
+
if (isLoggingEnabled) {
|
|
55
|
+
console.warn('sendEvent requires a non-empty eventName.');
|
|
56
|
+
}
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
(_webviewRef$current = webviewRef.current) === null || _webviewRef$current === void 0 || _webviewRef$current.injectJavaScript(`window.sendEventToVisit(${JSON.stringify(eventName)}, ${JSON.stringify(properties ?? {})}); true;`);
|
|
60
|
+
}, [isLoggingEnabled]);
|
|
61
|
+
(0, _react.useImperativeHandle)(ref, () => ({
|
|
62
|
+
sendEvent
|
|
63
|
+
}), [sendEvent]);
|
|
64
|
+
const emitHostEvent = (0, _react.useCallback)((eventName, properties) => {
|
|
65
|
+
onEvent === null || onEvent === void 0 || onEvent(eventName, properties);
|
|
66
|
+
}, [onEvent]);
|
|
50
67
|
const startVideoConsultation = (0, _react.useCallback)(payload => {
|
|
51
68
|
var _videoCallRef$current;
|
|
52
69
|
const roomName = payload === null || payload === void 0 ? void 0 : payload.roomName;
|
|
@@ -68,37 +85,54 @@ const VisitRnSdkView = ({
|
|
|
68
85
|
userName
|
|
69
86
|
});
|
|
70
87
|
}, [isLoggingEnabled]);
|
|
71
|
-
const handleMessage =
|
|
72
|
-
var _webviewRef$
|
|
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
|
-
|
|
88
|
+
const handleMessage = event => {
|
|
89
|
+
var _webviewRef$current2, _webviewRef$current3;
|
|
90
|
+
try {
|
|
91
|
+
const data = JSON.parse(unescapeHTML(event.nativeEvent.data));
|
|
92
|
+
const {
|
|
93
|
+
method,
|
|
94
|
+
url
|
|
95
|
+
} = data;
|
|
96
|
+
if (isLoggingEnabled) {
|
|
97
|
+
console.log('Received WebView method:', method);
|
|
98
|
+
}
|
|
99
|
+
switch (method) {
|
|
100
|
+
case 'startVideoCall':
|
|
101
|
+
startVideoConsultation(data);
|
|
102
|
+
break;
|
|
103
|
+
case 'UPDATE_PLATFORM':
|
|
104
|
+
(_webviewRef$current2 = webviewRef.current) === null || _webviewRef$current2 === void 0 || _webviewRef$current2.injectJavaScript('window.setSdkPlatform("IOS")');
|
|
105
|
+
break;
|
|
106
|
+
case 'OPEN_PDF':
|
|
107
|
+
if (url) {
|
|
108
|
+
_reactNative.Linking.openURL(url);
|
|
109
|
+
}
|
|
110
|
+
break;
|
|
111
|
+
case 'CLOSE_VIEW':
|
|
112
|
+
break;
|
|
113
|
+
case 'GET_LOCATION_PERMISSIONS':
|
|
114
|
+
(_webviewRef$current3 = webviewRef.current) === null || _webviewRef$current3 === void 0 || _webviewRef$current3.injectJavaScript('window.checkTheGpsPermission(true)');
|
|
115
|
+
break;
|
|
116
|
+
case 'sendEventToHost':
|
|
117
|
+
{
|
|
118
|
+
const eventName = typeof data.eventName === 'string' ? data.eventName : '';
|
|
119
|
+
if (eventName) {
|
|
120
|
+
const properties = {
|
|
121
|
+
...data
|
|
122
|
+
};
|
|
123
|
+
delete properties.method;
|
|
124
|
+
delete properties.eventName;
|
|
125
|
+
emitHostEvent(eventName, properties);
|
|
126
|
+
}
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
default:
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
} catch (error) {
|
|
133
|
+
if (isLoggingEnabled) {
|
|
134
|
+
console.warn('Unable to handle WebView message.', error);
|
|
135
|
+
}
|
|
102
136
|
}
|
|
103
137
|
};
|
|
104
138
|
const {
|
|
@@ -115,20 +149,16 @@ const VisitRnSdkView = ({
|
|
|
115
149
|
height,
|
|
116
150
|
width
|
|
117
151
|
}
|
|
118
|
-
}, source ? /*#__PURE__*/_react.default.createElement(
|
|
152
|
+
}, source ? /*#__PURE__*/_react.default.createElement(SdkWebView, {
|
|
119
153
|
ref: webviewRef,
|
|
120
154
|
source: {
|
|
121
155
|
uri: source
|
|
122
156
|
},
|
|
123
157
|
style: styles.webView,
|
|
124
|
-
|
|
158
|
+
javaScriptEnabled: true,
|
|
125
159
|
onMessage: handleMessage,
|
|
126
160
|
injectedJavaScriptBeforeContentLoaded: runBeforeFirst,
|
|
127
161
|
onError: errorMessage => {
|
|
128
|
-
_reactNativeEventListeners.EventRegister.emitEvent(visitEvent, {
|
|
129
|
-
message: 'web-view-error',
|
|
130
|
-
errorMessage: errorMessage
|
|
131
|
-
});
|
|
132
162
|
if (isLoggingEnabled) {
|
|
133
163
|
console.warn('Webview error: ', errorMessage);
|
|
134
164
|
}
|
|
@@ -152,15 +182,11 @@ const VisitRnSdkView = ({
|
|
|
152
182
|
}
|
|
153
183
|
}))
|
|
154
184
|
);
|
|
155
|
-
};
|
|
185
|
+
});
|
|
156
186
|
const styles = _reactNative.StyleSheet.create({
|
|
157
187
|
webView: {
|
|
158
188
|
flex: 1
|
|
159
189
|
}
|
|
160
190
|
});
|
|
161
|
-
VisitRnSdkView.defaultProps = {
|
|
162
|
-
ssoLink: '',
|
|
163
|
-
isLoggingEnabled: false
|
|
164
|
-
};
|
|
165
191
|
var _default = exports.default = VisitRnSdkView;
|
|
166
192
|
//# sourceMappingURL=index.ios.js.map
|