react-native-mytatva-rn-sdk 1.0.0
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/LICENSE +20 -0
- package/README.md +31 -0
- package/android/build.gradle +112 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/visitrnsdk/VisitRnSdkPackage.kt +17 -0
- package/android/src/main/java/com/visitrnsdk/VisitRnSdkViewManager.kt +20 -0
- package/ios/VisitRnSdk.xcodeproj/project.pbxproj +274 -0
- package/ios/VisitRnSdkViewManager.h +20 -0
- package/ios/VisitRnSdkViewManager.m +1240 -0
- package/lib/commonjs/Services.js +35 -0
- package/lib/commonjs/Services.js.map +1 -0
- package/lib/commonjs/constants.js +11 -0
- package/lib/commonjs/constants.js.map +1 -0
- package/lib/commonjs/index.android.js +518 -0
- package/lib/commonjs/index.android.js.map +1 -0
- package/lib/commonjs/index.ios.js +313 -0
- package/lib/commonjs/index.ios.js.map +1 -0
- package/lib/module/Services.js +27 -0
- package/lib/module/Services.js.map +1 -0
- package/lib/module/constants.js +5 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/index.android.js +508 -0
- package/lib/module/index.android.js.map +1 -0
- package/lib/module/index.ios.js +304 -0
- package/lib/module/index.ios.js.map +1 -0
- package/lib/typescript/index.test.d.ts +1 -0
- package/lib/typescript/index.test.d.ts.map +1 -0
- package/package.json +177 -0
- package/react-native-visit-rn-sdk.podspec +42 -0
- package/src/Services.js +37 -0
- package/src/constants.js +4 -0
- package/src/index.android.js +714 -0
- package/src/index.ios.js +376 -0
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
import React, { useRef, useEffect, useState, useCallback } from 'react';
|
|
2
|
+
import { EventRegister } from 'react-native-event-listeners';
|
|
3
|
+
import { SafeAreaView, NativeModules, PermissionsAndroid, BackHandler, Linking, Alert, AppState } from 'react-native';
|
|
4
|
+
import WebView from 'react-native-webview';
|
|
5
|
+
import LocationEnabler from 'react-native-location-enabler';
|
|
6
|
+
import DeviceInfo from 'react-native-device-info';
|
|
7
|
+
import axios from 'axios';
|
|
8
|
+
import constants from './constants';
|
|
9
|
+
export const httpClient = axios.create({
|
|
10
|
+
timeout: 60000
|
|
11
|
+
});
|
|
12
|
+
const {
|
|
13
|
+
PRIORITIES: {
|
|
14
|
+
HIGH_ACCURACY
|
|
15
|
+
},
|
|
16
|
+
useLocationSettings,
|
|
17
|
+
addListener
|
|
18
|
+
} = LocationEnabler;
|
|
19
|
+
const MyTatvaRnSdkView = ({
|
|
20
|
+
cpsid,
|
|
21
|
+
baseUrl,
|
|
22
|
+
errorBaseUrl,
|
|
23
|
+
token,
|
|
24
|
+
moduleName,
|
|
25
|
+
environment,
|
|
26
|
+
magicLink,
|
|
27
|
+
isLoggingEnabled
|
|
28
|
+
}) => {
|
|
29
|
+
const [source, setSource] = useState('');
|
|
30
|
+
const [appState, setAppState] = useState(AppState.currentState);
|
|
31
|
+
const [showPermissionAlreadyDeniedDialog, setShowPermissionAlreadyDeniedDialog] = useState(false);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
var _magicLink$trim;
|
|
34
|
+
if (isLoggingEnabled) {
|
|
35
|
+
console.log('useEffect ran');
|
|
36
|
+
}
|
|
37
|
+
NativeModules.VisitFitnessModule.initiateSDK(isLoggingEnabled);
|
|
38
|
+
if (((magicLink === null || magicLink === void 0 || (_magicLink$trim = magicLink.trim()) === null || _magicLink$trim === void 0 ? void 0 : _magicLink$trim.length) || 0) > 0) {
|
|
39
|
+
setSource(magicLink);
|
|
40
|
+
} else {
|
|
41
|
+
DeviceInfo.getAndroidId().then(deviceId => {
|
|
42
|
+
var buildNumber = DeviceInfo.getBuildNumber();
|
|
43
|
+
let systemVersion = DeviceInfo.getSystemVersion();
|
|
44
|
+
let version = DeviceInfo.getVersion();
|
|
45
|
+
if (isLoggingEnabled) {
|
|
46
|
+
console.log(' baseUrl : ' + baseUrl + 'token: ' + token + ' cpsid: ' + cpsid + ' environment: ' + environment + 'buildNumber:' + buildNumber + ' systemVersion:' + systemVersion + ' version : ' + version + ' deviceId', deviceId);
|
|
47
|
+
}
|
|
48
|
+
var finalEndPoint = `${baseUrl}/partners/v3/generate-magic-link-star-health`;
|
|
49
|
+
if (isLoggingEnabled) {
|
|
50
|
+
console.log('finalEndPoint: ' + finalEndPoint);
|
|
51
|
+
}
|
|
52
|
+
httpClient.post(finalEndPoint, {
|
|
53
|
+
cpsid: cpsid,
|
|
54
|
+
token: token,
|
|
55
|
+
srcClientId: 'Android',
|
|
56
|
+
deviceId: deviceId,
|
|
57
|
+
appVersion: version,
|
|
58
|
+
deviceVersion: systemVersion,
|
|
59
|
+
userEnv: environment
|
|
60
|
+
}).then(response => {
|
|
61
|
+
let data = response.data;
|
|
62
|
+
// let visitMagicLink = data.result; //@Deprecated. Superseded by magic code usage.
|
|
63
|
+
const errorMessage = data.errorMessage;
|
|
64
|
+
const magicCode = data.magicCode;
|
|
65
|
+
const responseReferenceId = data.responseReferenceId;
|
|
66
|
+
let finalBaseUrl = '';
|
|
67
|
+
if (environment.toUpperCase() === 'PROD') {
|
|
68
|
+
finalBaseUrl = constants.PROD_BASE_URL;
|
|
69
|
+
} else {
|
|
70
|
+
finalBaseUrl = constants.STAGE_BASE_URL;
|
|
71
|
+
}
|
|
72
|
+
let finalUrl = `${finalBaseUrl}=${magicCode}`;
|
|
73
|
+
if (data.message === 'success') {
|
|
74
|
+
var _moduleName$trim;
|
|
75
|
+
if (((moduleName === null || moduleName === void 0 || (_moduleName$trim = moduleName.trim()) === null || _moduleName$trim === void 0 ? void 0 : _moduleName$trim.length) || 0) > 0) {
|
|
76
|
+
finalUrl += `&tab=${moduleName}`;
|
|
77
|
+
}
|
|
78
|
+
if (typeof responseReferenceId === 'string' && responseReferenceId.trim().length > 0) {
|
|
79
|
+
finalUrl += `&responseReferenceId=${responseReferenceId}`;
|
|
80
|
+
}
|
|
81
|
+
if (isLoggingEnabled) {
|
|
82
|
+
console.log('magicLink: ' + finalUrl);
|
|
83
|
+
}
|
|
84
|
+
setSource(finalUrl);
|
|
85
|
+
} else {
|
|
86
|
+
var errorUrl = `${errorBaseUrl}/star-health?error=${errorMessage}`;
|
|
87
|
+
setSource(errorUrl);
|
|
88
|
+
if (errorMessage != null) {
|
|
89
|
+
if (errorMessage === 'Please login again') {
|
|
90
|
+
EventRegister.emitEvent('visit-event', {
|
|
91
|
+
message: 'unauthorized-wellness-access',
|
|
92
|
+
errorMessage: errorMessage
|
|
93
|
+
});
|
|
94
|
+
} else if (errorMessage.includes('External Server Error')) {
|
|
95
|
+
EventRegister.emitEvent('visit-event', {
|
|
96
|
+
message: 'external-server-error',
|
|
97
|
+
errorMessage: errorMessage
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (isLoggingEnabled) {
|
|
102
|
+
console.log('erorMessage: ' + data.errorMessage + ' errorUrl: ' + errorUrl);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}).catch(error => {
|
|
106
|
+
var errorUrl = `${errorBaseUrl}/star-health?error=${error}`;
|
|
107
|
+
setSource(errorUrl);
|
|
108
|
+
EventRegister.emitEvent('visit-event', {
|
|
109
|
+
message: 'generate-magic-link-failed',
|
|
110
|
+
errorMessage: `${error}`
|
|
111
|
+
});
|
|
112
|
+
if (isLoggingEnabled) {
|
|
113
|
+
console.log('error: ' + error);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}).catch(err => {
|
|
117
|
+
var errorUrl = `${errorBaseUrl}/star-health?error=${err}`;
|
|
118
|
+
setSource(errorUrl);
|
|
119
|
+
EventRegister.emitEvent('visit-event', {
|
|
120
|
+
message: 'getDeviceInfo-failed',
|
|
121
|
+
errorMessage: `${err}`
|
|
122
|
+
});
|
|
123
|
+
if (isLoggingEnabled) {
|
|
124
|
+
console.log('getDeviceInfo err', err);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}, [cpsid, token, baseUrl, errorBaseUrl, moduleName, environment, magicLink, isLoggingEnabled]);
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
const subscription = AppState.addEventListener('change', handleAppStateChange);
|
|
131
|
+
console.log(`AppState.addEventListener added, current state: ${appState}`);
|
|
132
|
+
return () => {
|
|
133
|
+
subscription.remove();
|
|
134
|
+
};
|
|
135
|
+
}, [appState]); // Include appState in the dependency array to ensure it's up to date.
|
|
136
|
+
|
|
137
|
+
const handleAppStateChange = nextAppState => {
|
|
138
|
+
// console.log(
|
|
139
|
+
// "nextAppState: " + nextAppState + ", previousState: " + appState
|
|
140
|
+
// );
|
|
141
|
+
|
|
142
|
+
// Instead of relying on the old appState, use the nextAppState directly
|
|
143
|
+
if (appState.match(/inactive|background/) && nextAppState === 'active') {
|
|
144
|
+
if (isLoggingEnabled) {
|
|
145
|
+
console.log('App has come to the foreground!');
|
|
146
|
+
}
|
|
147
|
+
getHealthConnectStatus();
|
|
148
|
+
}
|
|
149
|
+
setAppState(nextAppState); // Update the state with the new app state
|
|
150
|
+
};
|
|
151
|
+
const [enabled, requestResolution] = useLocationSettings({
|
|
152
|
+
priority: HIGH_ACCURACY,
|
|
153
|
+
// default BALANCED_POWER_ACCURACY
|
|
154
|
+
alwaysShow: true,
|
|
155
|
+
// default false
|
|
156
|
+
needBle: true // default false
|
|
157
|
+
}, false /* optional: default undefined */);
|
|
158
|
+
const webviewRef = useRef(null);
|
|
159
|
+
const showLocationPermissionAlert = () => {
|
|
160
|
+
Alert.alert('Permission Required', 'Allow location permission from app settings', [{
|
|
161
|
+
text: 'Cancel',
|
|
162
|
+
onPress: () => {
|
|
163
|
+
console.log('Cancel clicked');
|
|
164
|
+
}
|
|
165
|
+
}, {
|
|
166
|
+
text: 'Go to Settings',
|
|
167
|
+
onPress: () => {
|
|
168
|
+
Linking.openSettings();
|
|
169
|
+
}
|
|
170
|
+
}]);
|
|
171
|
+
};
|
|
172
|
+
const requestLocationPermission = async () => {
|
|
173
|
+
try {
|
|
174
|
+
console.log('requestLocationPermission called');
|
|
175
|
+
const isLocationPermissionPresent = await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION);
|
|
176
|
+
console.log('isLocationPermissionPresent: ' + isLocationPermissionPresent + ' showPermissionAlreadyDeniedDialog: ' + showPermissionAlreadyDeniedDialog);
|
|
177
|
+
if (!isLocationPermissionPresent && showPermissionAlreadyDeniedDialog) {
|
|
178
|
+
console.log('showLocationPermissionAlert() called');
|
|
179
|
+
showLocationPermissionAlert();
|
|
180
|
+
} else {
|
|
181
|
+
console.log('requesting location permission');
|
|
182
|
+
const granted = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION, {
|
|
183
|
+
title: 'Need Location Permission',
|
|
184
|
+
message: 'Need access to location permission',
|
|
185
|
+
buttonNeutral: 'Ask Me Later',
|
|
186
|
+
buttonNegative: 'Cancel',
|
|
187
|
+
buttonPositive: 'OK'
|
|
188
|
+
});
|
|
189
|
+
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
|
|
190
|
+
if (isLoggingEnabled) {
|
|
191
|
+
console.log('Location permission granted');
|
|
192
|
+
}
|
|
193
|
+
setShowPermissionAlreadyDeniedDialog(false);
|
|
194
|
+
if (!enabled) {
|
|
195
|
+
requestResolution();
|
|
196
|
+
} else {
|
|
197
|
+
var _webviewRef$current;
|
|
198
|
+
var finalString = `window.checkTheGpsPermission(true)`;
|
|
199
|
+
console.log('requestLocationPermission: ' + finalString);
|
|
200
|
+
(_webviewRef$current = webviewRef.current) === null || _webviewRef$current === void 0 || _webviewRef$current.injectJavaScript(finalString);
|
|
201
|
+
}
|
|
202
|
+
} else {
|
|
203
|
+
setShowPermissionAlreadyDeniedDialog(true);
|
|
204
|
+
console.log('Location permission denied');
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
} catch (e) {
|
|
208
|
+
console.error(e);
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
const showHealthConnectPermissionDeniedDialog = () => {
|
|
212
|
+
Alert.alert('Permission Denied', 'Go to Health Connect App to allow app permission', [{
|
|
213
|
+
text: 'Cancel',
|
|
214
|
+
onPress: () => {
|
|
215
|
+
console.log('Cancel clicked');
|
|
216
|
+
}
|
|
217
|
+
}, {
|
|
218
|
+
text: 'Open Health Connect',
|
|
219
|
+
onPress: () => {
|
|
220
|
+
openHealthConnectApp();
|
|
221
|
+
}
|
|
222
|
+
}]);
|
|
223
|
+
};
|
|
224
|
+
const openHealthConnectApp = async () => {
|
|
225
|
+
NativeModules.VisitFitnessModule.openHealthConnectApp();
|
|
226
|
+
};
|
|
227
|
+
const askForHealthConnectPermission = async () => {
|
|
228
|
+
try {
|
|
229
|
+
const isPermissionGranted = await NativeModules.VisitFitnessModule.askForFitnessPermission();
|
|
230
|
+
if (isLoggingEnabled) {
|
|
231
|
+
console.log('isPermissionGranted: ' + isPermissionGranted);
|
|
232
|
+
}
|
|
233
|
+
if (isPermissionGranted === 'GRANTED') {
|
|
234
|
+
getHealthConnectStatus();
|
|
235
|
+
// getDailyFitnessData();
|
|
236
|
+
} else if (isPermissionGranted === 'CANCELLED') {
|
|
237
|
+
showHealthConnectPermissionDeniedDialog();
|
|
238
|
+
}
|
|
239
|
+
} catch (e) {
|
|
240
|
+
if (isLoggingEnabled) {
|
|
241
|
+
console.error(e);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
const getHealthConnectStatus = async () => {
|
|
246
|
+
try {
|
|
247
|
+
const healthConnectStatus = await NativeModules.VisitFitnessModule.getHealthConnectStatus();
|
|
248
|
+
if (isLoggingEnabled) {
|
|
249
|
+
console.log('getHealthConnectStatus: ' + healthConnectStatus);
|
|
250
|
+
}
|
|
251
|
+
if (healthConnectStatus === 'NOT_SUPPORTED') {
|
|
252
|
+
var _webviewRef$current2;
|
|
253
|
+
(_webviewRef$current2 = webviewRef.current) === null || _webviewRef$current2 === void 0 || _webviewRef$current2.injectJavaScript('window.healthConnectNotSupported()');
|
|
254
|
+
} else if (healthConnectStatus === 'NOT_INSTALLED') {
|
|
255
|
+
var _webviewRef$current3, _webviewRef$current4;
|
|
256
|
+
(_webviewRef$current3 = webviewRef.current) === null || _webviewRef$current3 === void 0 || _webviewRef$current3.injectJavaScript('window.healthConnectNotInstall()');
|
|
257
|
+
(_webviewRef$current4 = webviewRef.current) === null || _webviewRef$current4 === void 0 || _webviewRef$current4.injectJavaScript('window.updateFitnessPermissions(false,0,0)');
|
|
258
|
+
} else if (healthConnectStatus === 'INSTALLED') {
|
|
259
|
+
var _webviewRef$current5, _webviewRef$current6;
|
|
260
|
+
(_webviewRef$current5 = webviewRef.current) === null || _webviewRef$current5 === void 0 || _webviewRef$current5.injectJavaScript('window.healthConnectAvailable()');
|
|
261
|
+
(_webviewRef$current6 = webviewRef.current) === null || _webviewRef$current6 === void 0 || _webviewRef$current6.injectJavaScript('window.updateFitnessPermissions(false,0,0)');
|
|
262
|
+
} else if (healthConnectStatus === 'CONNECTED') {
|
|
263
|
+
getDailyFitnessData();
|
|
264
|
+
}
|
|
265
|
+
} catch (e) {
|
|
266
|
+
if (isLoggingEnabled) {
|
|
267
|
+
console.error(e);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
const getDailyFitnessData = async () => {
|
|
272
|
+
if (isLoggingEnabled) {
|
|
273
|
+
console.log('getDailyFitnessData() called');
|
|
274
|
+
}
|
|
275
|
+
try {
|
|
276
|
+
var _webviewRef$current7;
|
|
277
|
+
const dailyFitnessData = await NativeModules.VisitFitnessModule.requestDailyFitnessData();
|
|
278
|
+
(_webviewRef$current7 = webviewRef.current) === null || _webviewRef$current7 === void 0 || _webviewRef$current7.injectJavaScript(dailyFitnessData);
|
|
279
|
+
} catch (error) {
|
|
280
|
+
if (isLoggingEnabled) {
|
|
281
|
+
console.log(error);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
const requestActivityData = async (type, frequency, timeStamp) => {
|
|
286
|
+
if (isLoggingEnabled) {
|
|
287
|
+
console.log('requestActivityData() called');
|
|
288
|
+
}
|
|
289
|
+
try {
|
|
290
|
+
var _webviewRef$current8;
|
|
291
|
+
const graphData = await NativeModules.VisitFitnessModule.requestActivityDataFromHealthConnect(type, frequency, timeStamp);
|
|
292
|
+
if (isLoggingEnabled) {
|
|
293
|
+
console.log(`requestActivityData() data: ` + graphData);
|
|
294
|
+
}
|
|
295
|
+
(_webviewRef$current8 = webviewRef.current) === null || _webviewRef$current8 === void 0 || _webviewRef$current8.injectJavaScript('window.' + graphData);
|
|
296
|
+
} catch (error) {
|
|
297
|
+
if (isLoggingEnabled) {
|
|
298
|
+
console.log(error);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
const updateApiBaseUrl = async (apiBaseUrl, authtoken, googleFitLastSync, gfHourlyLastSync) => {
|
|
303
|
+
if (isLoggingEnabled) {
|
|
304
|
+
console.log('updateApiBaseUrl() called.');
|
|
305
|
+
}
|
|
306
|
+
try {
|
|
307
|
+
const message = await NativeModules.VisitFitnessModule.updateApiBaseUrl(apiBaseUrl, authtoken, googleFitLastSync, gfHourlyLastSync);
|
|
308
|
+
if (isLoggingEnabled) {
|
|
309
|
+
console.log(message);
|
|
310
|
+
}
|
|
311
|
+
} catch (error) {
|
|
312
|
+
if (isLoggingEnabled) {
|
|
313
|
+
console.log(error);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
const runBeforeFirst = `
|
|
318
|
+
window.isNativeApp = true;
|
|
319
|
+
window.platform = "ANDROID";
|
|
320
|
+
window.setSdkPlatform('ANDROID');
|
|
321
|
+
true; // note: this is required, or you'll sometimes get silent failures
|
|
322
|
+
`;
|
|
323
|
+
const handleMessage = event => {
|
|
324
|
+
var _webviewRef$current9;
|
|
325
|
+
if (event.nativeEvent.data != null) {
|
|
326
|
+
try {
|
|
327
|
+
if (isLoggingEnabled) {
|
|
328
|
+
console.log('Event :' + event.nativeEvent.data);
|
|
329
|
+
}
|
|
330
|
+
const parsedObject = JSON.parse(event.nativeEvent.data);
|
|
331
|
+
if (parsedObject.method != null) {
|
|
332
|
+
switch (parsedObject.method) {
|
|
333
|
+
case 'GET_HEALTH_CONNECT_STATUS':
|
|
334
|
+
getHealthConnectStatus();
|
|
335
|
+
break;
|
|
336
|
+
case 'CONNECT_TO_GOOGLE_FIT':
|
|
337
|
+
askForHealthConnectPermission();
|
|
338
|
+
break;
|
|
339
|
+
case 'UPDATE_PLATFORM':
|
|
340
|
+
(_webviewRef$current9 = webviewRef.current) === null || _webviewRef$current9 === void 0 || _webviewRef$current9.injectJavaScript('window.setSdkPlatform("ANDROID")');
|
|
341
|
+
break;
|
|
342
|
+
case 'UPDATE_API_BASE_URL':
|
|
343
|
+
{
|
|
344
|
+
let apiBaseUrl = parsedObject.apiBaseUrl;
|
|
345
|
+
let authtoken = parsedObject.authtoken;
|
|
346
|
+
let googleFitLastSync = parsedObject.googleFitLastSync;
|
|
347
|
+
let gfHourlyLastSync = parsedObject.gfHourlyLastSync;
|
|
348
|
+
if (isLoggingEnabled) {
|
|
349
|
+
console.log('apiBaseUrl: ' + 'NOT SHOWN' + ' authtoken: ' + 'NOT SHOWN' + ' googleFitLastSync: ' + googleFitLastSync + ' gfHourlyLastSync: ' + gfHourlyLastSync);
|
|
350
|
+
}
|
|
351
|
+
updateApiBaseUrl(apiBaseUrl, authtoken, googleFitLastSync, gfHourlyLastSync);
|
|
352
|
+
}
|
|
353
|
+
break;
|
|
354
|
+
case 'GET_DATA_TO_GENERATE_GRAPH':
|
|
355
|
+
{
|
|
356
|
+
let type = parsedObject.type;
|
|
357
|
+
let frequency = parsedObject.frequency;
|
|
358
|
+
let timeStamp = parsedObject.timestamp;
|
|
359
|
+
if (isLoggingEnabled) {
|
|
360
|
+
console.log('type: ' + type + ' frequency:' + frequency + ' timeStamp: ' + timeStamp);
|
|
361
|
+
}
|
|
362
|
+
requestActivityData(type, frequency, timeStamp);
|
|
363
|
+
}
|
|
364
|
+
break;
|
|
365
|
+
case 'GET_LOCATION_PERMISSIONS':
|
|
366
|
+
console.log('GET_LOCATION_PERMISSIONS');
|
|
367
|
+
requestLocationPermission();
|
|
368
|
+
break;
|
|
369
|
+
case 'OPEN_PDF':
|
|
370
|
+
{
|
|
371
|
+
let pdfUrl = parsedObject.url;
|
|
372
|
+
// console.log("pdfUrl "+pdfUrl);
|
|
373
|
+
|
|
374
|
+
Linking.openURL(pdfUrl);
|
|
375
|
+
}
|
|
376
|
+
break;
|
|
377
|
+
case 'CLOSE_VIEW':
|
|
378
|
+
break;
|
|
379
|
+
default:
|
|
380
|
+
break;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
} catch (exception) {
|
|
384
|
+
console.log('Exception occured:' + exception.message);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
const [canGoBack, setCanGoBack] = useState(false);
|
|
389
|
+
const handleBack = useCallback(() => {
|
|
390
|
+
if (canGoBack && webviewRef.current) {
|
|
391
|
+
var _webviewRef$current10;
|
|
392
|
+
(_webviewRef$current10 = webviewRef.current) === null || _webviewRef$current10 === void 0 || _webviewRef$current10.goBack();
|
|
393
|
+
return true;
|
|
394
|
+
}
|
|
395
|
+
return false;
|
|
396
|
+
}, [canGoBack]);
|
|
397
|
+
useEffect(() => {
|
|
398
|
+
const gpsListener = addListener(({
|
|
399
|
+
locationEnabled
|
|
400
|
+
}) => {
|
|
401
|
+
if (locationEnabled) {
|
|
402
|
+
checkLocationPermissionAndSendCallback();
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
BackHandler.addEventListener('hardwareBackPress', handleBack);
|
|
406
|
+
return () => {
|
|
407
|
+
BackHandler.removeEventListener('hardwareBackPress', handleBack);
|
|
408
|
+
gpsListener.remove();
|
|
409
|
+
};
|
|
410
|
+
}, [handleBack]);
|
|
411
|
+
const checkLocationPermissionAndSendCallback = async () => {
|
|
412
|
+
const isLocationPermissionAvailable = await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION);
|
|
413
|
+
if (isLoggingEnabled) {
|
|
414
|
+
console.log('checkLocationPermissionAndSendCallback() isLocationPermissionAvailable: ' + isLocationPermissionAvailable + 'isGPSPermissionAvailabe: true');
|
|
415
|
+
}
|
|
416
|
+
if (isLocationPermissionAvailable) {
|
|
417
|
+
var _webviewRef$current11;
|
|
418
|
+
var finalString = `window.checkTheGpsPermission(true)`;
|
|
419
|
+
console.log('listener: ' + finalString);
|
|
420
|
+
(_webviewRef$current11 = webviewRef.current) === null || _webviewRef$current11 === void 0 || _webviewRef$current11.injectJavaScript(finalString);
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
return (
|
|
424
|
+
/*#__PURE__*/
|
|
425
|
+
// eslint-disable-next-line react-native/no-inline-styles
|
|
426
|
+
React.createElement(SafeAreaView, {
|
|
427
|
+
style: {
|
|
428
|
+
flex: 1
|
|
429
|
+
}
|
|
430
|
+
}, source ? /*#__PURE__*/React.createElement(WebView, {
|
|
431
|
+
ref: webviewRef,
|
|
432
|
+
source: {
|
|
433
|
+
uri: source,
|
|
434
|
+
headers: {
|
|
435
|
+
platform: 'ANDROID'
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
|
+
onMessage: handleMessage,
|
|
439
|
+
injectedJavaScriptBeforeContentLoaded: runBeforeFirst,
|
|
440
|
+
javaScriptEnabled: true,
|
|
441
|
+
onLoadProgress: event => setCanGoBack(event.nativeEvent.canGoBack),
|
|
442
|
+
onError: errorMessage => {
|
|
443
|
+
EventRegister.emitEvent('visit-event', {
|
|
444
|
+
message: 'web-view-error',
|
|
445
|
+
errorMessage: errorMessage
|
|
446
|
+
});
|
|
447
|
+
if (isLoggingEnabled) {
|
|
448
|
+
console.warn('Webview error: ', errorMessage);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}) : null)
|
|
452
|
+
);
|
|
453
|
+
};
|
|
454
|
+
export const fetchDailyFitnessData = (startTimeStamp, isLoggingEnabled) => {
|
|
455
|
+
return new Promise((resolve, reject) => {
|
|
456
|
+
console.log('fetchDailyFitnessData called: ' + startTimeStamp);
|
|
457
|
+
NativeModules.VisitFitnessModule.fetchDailyFitnessData(startTimeStamp).then(result => {
|
|
458
|
+
resolve(result);
|
|
459
|
+
}).catch(err => reject(err));
|
|
460
|
+
});
|
|
461
|
+
};
|
|
462
|
+
export const fetchHourlyFitnessData = (startTimeStamp, isLoggingEnabled) => {
|
|
463
|
+
return new Promise((resolve, reject) => {
|
|
464
|
+
if (isLoggingEnabled) {
|
|
465
|
+
console.log('fetchHourlyFitnessData called: ' + startTimeStamp);
|
|
466
|
+
}
|
|
467
|
+
NativeModules.VisitFitnessModule.fetchHourlyFitnessData(startTimeStamp).then(result => {
|
|
468
|
+
resolve(result);
|
|
469
|
+
}).catch(err => reject(err));
|
|
470
|
+
});
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
// debounce, deferred
|
|
474
|
+
// function debounce(task, ms) {
|
|
475
|
+
// let t = { promise: null, cancel: (_) => void 0 };
|
|
476
|
+
// return async (...args) => {
|
|
477
|
+
// try {
|
|
478
|
+
// t.cancel();
|
|
479
|
+
// t = deferred(ms);
|
|
480
|
+
// await t.promise;
|
|
481
|
+
// await task(...args);
|
|
482
|
+
// } catch (_) {
|
|
483
|
+
// console.log('cleaning up cancelled promise');
|
|
484
|
+
// }
|
|
485
|
+
// };
|
|
486
|
+
// }
|
|
487
|
+
|
|
488
|
+
// function deferred(ms) {
|
|
489
|
+
// let cancel,
|
|
490
|
+
// promise = new Promise((resolve, reject) => {
|
|
491
|
+
// cancel = reject;
|
|
492
|
+
// setTimeout(resolve, ms);
|
|
493
|
+
// });
|
|
494
|
+
// return { promise, cancel };
|
|
495
|
+
// }
|
|
496
|
+
|
|
497
|
+
export default MyTatvaRnSdkView;
|
|
498
|
+
MyTatvaRnSdkView.defaultProps = {
|
|
499
|
+
cpsid: '',
|
|
500
|
+
token: '',
|
|
501
|
+
baseUrl: '',
|
|
502
|
+
errorBaseUrl: '',
|
|
503
|
+
moduleName: '',
|
|
504
|
+
environment: '',
|
|
505
|
+
magicLink: '',
|
|
506
|
+
isLoggingEnabled: false
|
|
507
|
+
};
|
|
508
|
+
//# sourceMappingURL=index.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useRef","useEffect","useState","useCallback","EventRegister","SafeAreaView","NativeModules","PermissionsAndroid","BackHandler","Linking","Alert","AppState","WebView","LocationEnabler","DeviceInfo","axios","constants","httpClient","create","timeout","PRIORITIES","HIGH_ACCURACY","useLocationSettings","addListener","MyTatvaRnSdkView","cpsid","baseUrl","errorBaseUrl","token","moduleName","environment","magicLink","isLoggingEnabled","source","setSource","appState","setAppState","currentState","showPermissionAlreadyDeniedDialog","setShowPermissionAlreadyDeniedDialog","_magicLink$trim","console","log","VisitFitnessModule","initiateSDK","trim","length","getAndroidId","then","deviceId","buildNumber","getBuildNumber","systemVersion","getSystemVersion","version","getVersion","finalEndPoint","post","srcClientId","appVersion","deviceVersion","userEnv","response","data","errorMessage","magicCode","responseReferenceId","finalBaseUrl","toUpperCase","PROD_BASE_URL","STAGE_BASE_URL","finalUrl","message","_moduleName$trim","errorUrl","emitEvent","includes","catch","error","err","subscription","addEventListener","handleAppStateChange","remove","nextAppState","match","getHealthConnectStatus","enabled","requestResolution","priority","alwaysShow","needBle","webviewRef","showLocationPermissionAlert","alert","text","onPress","openSettings","requestLocationPermission","isLocationPermissionPresent","check","PERMISSIONS","ACCESS_FINE_LOCATION","granted","request","title","buttonNeutral","buttonNegative","buttonPositive","RESULTS","GRANTED","_webviewRef$current","finalString","current","injectJavaScript","e","showHealthConnectPermissionDeniedDialog","openHealthConnectApp","askForHealthConnectPermission","isPermissionGranted","askForFitnessPermission","healthConnectStatus","_webviewRef$current2","_webviewRef$current3","_webviewRef$current4","_webviewRef$current5","_webviewRef$current6","getDailyFitnessData","_webviewRef$current7","dailyFitnessData","requestDailyFitnessData","requestActivityData","type","frequency","timeStamp","_webviewRef$current8","graphData","requestActivityDataFromHealthConnect","updateApiBaseUrl","apiBaseUrl","authtoken","googleFitLastSync","gfHourlyLastSync","runBeforeFirst","handleMessage","event","_webviewRef$current9","nativeEvent","parsedObject","JSON","parse","method","timestamp","pdfUrl","url","openURL","exception","canGoBack","setCanGoBack","handleBack","_webviewRef$current10","goBack","gpsListener","locationEnabled","checkLocationPermissionAndSendCallback","removeEventListener","isLocationPermissionAvailable","_webviewRef$current11","createElement","style","flex","ref","uri","headers","platform","onMessage","injectedJavaScriptBeforeContentLoaded","javaScriptEnabled","onLoadProgress","onError","warn","fetchDailyFitnessData","startTimeStamp","Promise","resolve","reject","result","fetchHourlyFitnessData","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,aAAa,EACbC,kBAAkB,EAClBC,WAAW,EACXC,OAAO,EACPC,KAAK,EACLC,QAAQ,QACH,cAAc;AAErB,OAAOC,OAAO,MAAM,sBAAsB;AAE1C,OAAOC,eAAe,MAAM,+BAA+B;AAE3D,OAAOC,UAAU,MAAM,0BAA0B;AAEjD,OAAOC,KAAK,MAAM,OAAO;AAEzB,OAAOC,SAAS,MAAM,aAAa;AAEnC,OAAO,MAAMC,UAAU,GAAGF,KAAK,CAACG,MAAM,CAAC;EACrCC,OAAO,EAAE;AACX,CAAC,CAAC;AAEF,MAAM;EACJC,UAAU,EAAE;IAAEC;EAAc,CAAC;EAC7BC,mBAAmB;EACnBC;AACF,CAAC,GAAGV,eAAe;AAEnB,MAAMW,gBAAgB,GAAGA,CAAC;EACxBC,KAAK;EACLC,OAAO;EACPC,YAAY;EACZC,KAAK;EACLC,UAAU;EACVC,WAAW;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