react-native-mytatva-rn-sdk 1.0.0 → 1.2.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/android/app/build.gradle +5 -0
- package/android/build.gradle +5 -5
- package/android/gradle.properties +13 -5
- package/android/settings.gradle +9 -0
- package/android/src/main/AndroidManifest.xml +22 -1
- package/android/src/main/AndroidManifestNew.xml +59 -1
- package/android/src/main/java/com/{visitrnsdk/VisitRnSdkPackage.kt → mytatvarnsdk/MyTatvaRnSdkPackage.kt} +2 -2
- package/android/src/main/java/com/{visitrnsdk/VisitRnSdkViewManager.kt → mytatvarnsdk/MyTatvaRnSdkViewManager.kt} +1 -1
- package/lib/commonjs/BcaDeviceListSheet.js +286 -0
- package/lib/commonjs/BcaDeviceListSheet.js.map +1 -0
- package/lib/commonjs/MainWebView.js +68 -0
- package/lib/commonjs/MainWebView.js.map +1 -0
- package/lib/commonjs/ProgressWebView.js +547 -0
- package/lib/commonjs/ProgressWebView.js.map +1 -0
- package/lib/commonjs/Services.js +27 -1
- package/lib/commonjs/Services.js.map +1 -1
- package/lib/commonjs/Sheets.js +7 -0
- package/lib/commonjs/Sheets.js.map +1 -0
- package/lib/commonjs/api/auth.js +167 -0
- package/lib/commonjs/api/auth.js.map +1 -0
- package/lib/commonjs/api/base.js +224 -0
- package/lib/commonjs/api/base.js.map +1 -0
- package/lib/commonjs/api/index.js +12 -0
- package/lib/commonjs/api/index.js.map +1 -0
- package/lib/commonjs/assets/icons/achieve.svg +3 -0
- package/lib/commonjs/assets/icons/heart.svg +3 -0
- package/lib/commonjs/assets/icons/smartWatch.svg +3 -0
- package/lib/commonjs/constants/asyncstorage.js +29 -0
- package/lib/commonjs/constants/asyncstorage.js.map +1 -0
- package/lib/commonjs/constants/constants.js +1373 -0
- package/lib/commonjs/constants/constants.js.map +1 -0
- package/lib/commonjs/constants.js +12 -2
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/commonjs/helpers/Matrics.js +49 -0
- package/lib/commonjs/helpers/Matrics.js.map +1 -0
- package/lib/commonjs/helpers/bluetoothPermissionHelper.js +114 -0
- package/lib/commonjs/helpers/bluetoothPermissionHelper.js.map +1 -0
- package/lib/commonjs/helpers/colors.js +304 -0
- package/lib/commonjs/helpers/colors.js.map +1 -0
- package/lib/commonjs/helpers/common.js +46 -0
- package/lib/commonjs/helpers/common.js.map +1 -0
- package/lib/commonjs/helpers/fonts.js +33 -0
- package/lib/commonjs/helpers/fonts.js.map +1 -0
- package/lib/commonjs/helpers/globalStyles.js +188 -0
- package/lib/commonjs/helpers/globalStyles.js.map +1 -0
- package/lib/commonjs/helpers/icons.js +16 -0
- package/lib/commonjs/helpers/icons.js.map +1 -0
- package/lib/commonjs/index.android.js +163 -414
- package/lib/commonjs/index.android.js.map +1 -1
- package/lib/commonjs/index.ios.js +138 -187
- package/lib/commonjs/index.ios.js.map +1 -1
- package/lib/commonjs/redux/Store.js +42 -0
- package/lib/commonjs/redux/Store.js.map +1 -0
- package/lib/commonjs/redux/hooks.js +8 -0
- package/lib/commonjs/redux/hooks.js.map +1 -0
- package/lib/commonjs/redux/sagas/AuthSaga.js +44 -0
- package/lib/commonjs/redux/sagas/AuthSaga.js.map +1 -0
- package/lib/commonjs/redux/sagas/index.js +15 -0
- package/lib/commonjs/redux/sagas/index.js.map +1 -0
- package/lib/commonjs/redux/slices/authSlice.js +80 -0
- package/lib/commonjs/redux/slices/authSlice.js.map +1 -0
- package/lib/commonjs/redux/slices/index.js +44 -0
- package/lib/commonjs/redux/slices/index.js.map +1 -0
- package/lib/commonjs/types/auth.js +2 -0
- package/lib/commonjs/types/auth.js.map +1 -0
- package/lib/commonjs/types/common.js +2 -0
- package/lib/commonjs/types/common.js.map +1 -0
- package/lib/commonjs/types/index.js +13 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/module/BcaDeviceListSheet.js +277 -0
- package/lib/module/BcaDeviceListSheet.js.map +1 -0
- package/lib/module/MainWebView.js +61 -0
- package/lib/module/MainWebView.js.map +1 -0
- package/lib/module/ProgressWebView.js +536 -0
- package/lib/module/ProgressWebView.js.map +1 -0
- package/lib/module/Services.js +24 -0
- package/lib/module/Services.js.map +1 -1
- package/lib/module/Sheets.js +4 -0
- package/lib/module/Sheets.js.map +1 -0
- package/lib/module/api/auth.js +160 -0
- package/lib/module/api/auth.js.map +1 -0
- package/lib/module/api/base.js +212 -0
- package/lib/module/api/base.js.map +1 -0
- package/lib/module/api/index.js +5 -0
- package/lib/module/api/index.js.map +1 -0
- package/lib/module/assets/icons/achieve.svg +3 -0
- package/lib/module/assets/icons/heart.svg +3 -0
- package/lib/module/assets/icons/smartWatch.svg +3 -0
- package/lib/module/constants/asyncstorage.js +23 -0
- package/lib/module/constants/asyncstorage.js.map +1 -0
- package/lib/module/constants/constants.js +1367 -0
- package/lib/module/constants/constants.js.map +1 -0
- package/lib/module/constants.js +12 -2
- package/lib/module/constants.js.map +1 -1
- package/lib/module/helpers/Matrics.js +44 -0
- package/lib/module/helpers/Matrics.js.map +1 -0
- package/lib/module/helpers/bluetoothPermissionHelper.js +103 -0
- package/lib/module/helpers/bluetoothPermissionHelper.js.map +1 -0
- package/lib/module/helpers/colors.js +298 -0
- package/lib/module/helpers/colors.js.map +1 -0
- package/lib/module/helpers/common.js +34 -0
- package/lib/module/helpers/common.js.map +1 -0
- package/lib/module/helpers/fonts.js +27 -0
- package/lib/module/helpers/fonts.js.map +1 -0
- package/lib/module/helpers/globalStyles.js +181 -0
- package/lib/module/helpers/globalStyles.js.map +1 -0
- package/lib/module/helpers/icons.js +9 -0
- package/lib/module/helpers/icons.js.map +1 -0
- package/lib/module/index.android.js +165 -413
- package/lib/module/index.android.js.map +1 -1
- package/lib/module/index.ios.js +138 -187
- package/lib/module/index.ios.js.map +1 -1
- package/lib/module/redux/Store.js +34 -0
- package/lib/module/redux/Store.js.map +1 -0
- package/lib/module/redux/hooks.js +7 -0
- package/lib/module/redux/hooks.js.map +1 -0
- package/lib/module/redux/sagas/AuthSaga.js +34 -0
- package/lib/module/redux/sagas/AuthSaga.js.map +1 -0
- package/lib/module/redux/sagas/index.js +8 -0
- package/lib/module/redux/sagas/index.js.map +1 -0
- package/lib/module/redux/slices/authSlice.js +68 -0
- package/lib/module/redux/slices/authSlice.js.map +1 -0
- package/lib/module/redux/slices/index.js +24 -0
- package/lib/module/redux/slices/index.js.map +1 -0
- package/lib/module/types/auth.js +2 -0
- package/lib/module/types/auth.js.map +1 -0
- package/lib/module/types/common.js +2 -0
- package/lib/module/types/common.js.map +1 -0
- package/lib/module/types/index.js +4 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/typescript/BcaDeviceListSheet.d.ts +7 -0
- package/lib/typescript/BcaDeviceListSheet.d.ts.map +1 -0
- package/lib/typescript/MainWebView.d.ts +4 -0
- package/lib/typescript/MainWebView.d.ts.map +1 -0
- package/lib/typescript/ProgressWebView.d.ts +4 -0
- package/lib/typescript/ProgressWebView.d.ts.map +1 -0
- package/lib/typescript/Services.d.ts +5 -0
- package/lib/typescript/Services.d.ts.map +1 -0
- package/lib/typescript/Sheets.d.ts +2 -0
- package/lib/typescript/Sheets.d.ts.map +1 -0
- package/lib/typescript/api/auth.d.ts +33 -0
- package/lib/typescript/api/auth.d.ts.map +1 -0
- package/lib/typescript/api/base.d.ts +20 -0
- package/lib/typescript/api/base.d.ts.map +1 -0
- package/lib/typescript/api/index.d.ts +35 -0
- package/lib/typescript/api/index.d.ts.map +1 -0
- package/lib/typescript/constants/asyncstorage.d.ts +23 -0
- package/lib/typescript/constants/asyncstorage.d.ts.map +1 -0
- package/lib/typescript/constants/constants.d.ts +1081 -0
- package/lib/typescript/constants/constants.d.ts.map +1 -0
- package/lib/typescript/constants.d.ts +16 -0
- package/lib/typescript/constants.d.ts.map +1 -0
- package/lib/typescript/helpers/Matrics.d.ts +14 -0
- package/lib/typescript/helpers/Matrics.d.ts.map +1 -0
- package/lib/typescript/helpers/bluetoothPermissionHelper.d.ts +18 -0
- package/lib/typescript/helpers/bluetoothPermissionHelper.d.ts.map +1 -0
- package/lib/typescript/helpers/colors.d.ts +297 -0
- package/lib/typescript/helpers/colors.d.ts.map +1 -0
- package/lib/typescript/helpers/common.d.ts +8 -0
- package/lib/typescript/helpers/common.d.ts.map +1 -0
- package/lib/typescript/helpers/fonts.d.ts +23 -0
- package/lib/typescript/helpers/fonts.d.ts.map +1 -0
- package/lib/typescript/helpers/globalStyles.d.ts +176 -0
- package/lib/typescript/helpers/globalStyles.d.ts.map +1 -0
- package/lib/typescript/helpers/icons.d.ts +6 -0
- package/lib/typescript/helpers/icons.d.ts.map +1 -0
- package/lib/typescript/index.android.d.ts +30 -0
- package/lib/typescript/index.android.d.ts.map +1 -0
- package/lib/typescript/index.ios.d.ts +28 -0
- package/lib/typescript/index.ios.d.ts.map +1 -0
- package/lib/typescript/redux/Store.d.ts +13 -0
- package/lib/typescript/redux/Store.d.ts.map +1 -0
- package/lib/typescript/redux/hooks.d.ts +1 -0
- package/lib/typescript/redux/hooks.d.ts.map +1 -0
- package/lib/typescript/redux/sagas/AuthSaga.d.ts +3 -0
- package/lib/typescript/redux/sagas/AuthSaga.d.ts.map +1 -0
- package/lib/typescript/redux/sagas/index.d.ts +3 -0
- package/lib/typescript/redux/sagas/index.d.ts.map +1 -0
- package/lib/typescript/redux/slices/authSlice.d.ts +5 -0
- package/lib/typescript/redux/slices/authSlice.d.ts.map +1 -0
- package/lib/typescript/redux/slices/index.d.ts +6 -0
- package/lib/typescript/redux/slices/index.d.ts.map +1 -0
- package/lib/typescript/types/auth.d.ts +485 -0
- package/lib/typescript/types/auth.d.ts.map +1 -0
- package/lib/typescript/types/common.d.ts +19 -0
- package/lib/typescript/types/common.d.ts.map +1 -0
- package/lib/typescript/types/index.d.ts +4 -0
- package/lib/typescript/types/index.d.ts.map +1 -0
- package/package.json +38 -8
- package/src/BcaDeviceListSheet.tsx +331 -0
- package/src/MainWebView.tsx +67 -0
- package/src/ProgressWebView.tsx +602 -0
- package/src/Services.js +40 -0
- package/src/Sheets.js +4 -0
- package/src/api/auth.ts +156 -0
- package/src/api/base.ts +247 -0
- package/src/api/index.ts +5 -0
- package/src/assets/icons/achieve.svg +3 -0
- package/src/assets/icons/heart.svg +3 -0
- package/src/assets/icons/smartWatch.svg +3 -0
- package/src/constants/asyncstorage.ts +23 -0
- package/src/constants/constants.ts +1204 -0
- package/src/constants.ts +14 -0
- package/src/helpers/Matrics.ts +48 -0
- package/src/helpers/bluetoothPermissionHelper.ts +198 -0
- package/src/helpers/colors.ts +320 -0
- package/src/helpers/common.ts +46 -0
- package/src/helpers/fonts.ts +28 -0
- package/src/helpers/globalStyles.ts +179 -0
- package/src/helpers/icons.ts +11 -0
- package/src/index.android.js +164 -577
- package/src/index.ios.js +147 -215
- package/src/redux/Store.ts +36 -0
- package/src/redux/hooks.ts +6 -0
- package/src/redux/sagas/AuthSaga.ts +49 -0
- package/src/redux/sagas/index.ts +9 -0
- package/src/redux/slices/authSlice.ts +81 -0
- package/src/redux/slices/index.ts +29 -0
- package/src/types/auth.ts +533 -0
- package/src/types/common.ts +19 -0
- package/src/types/index.ts +8 -0
- package/lib/typescript/index.test.d.ts +0 -1
- package/lib/typescript/index.test.d.ts.map +0 -1
- package/src/constants.js +0 -4
- /package/ios/{VisitRnSdk.xcodeproj → MyTatvaRnSdk.xcodeproj}/project.pbxproj +0 -0
- /package/ios/{VisitRnSdkViewManager.h → MyTatvaRnSdkViewManager.h} +0 -0
- /package/ios/{VisitRnSdkViewManager.m → MyTatvaRnSdkViewManager.m} +0 -0
- /package/{react-native-visit-rn-sdk.podspec → react-native-mytatva-rn-sdk.podspec} +0 -0
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
SafeAreaView,
|
|
8
|
+
Platform,
|
|
9
|
+
Image,
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
import { colors } from './helpers/colors';
|
|
12
|
+
import Matrics from './helpers/Matrics';
|
|
13
|
+
import { Icons } from './helpers/icons';
|
|
14
|
+
import WebView from 'react-native-webview';
|
|
15
|
+
// import { globalStyles } from '../../../../src/helpers/globalStyles';
|
|
16
|
+
import { SheetManager } from 'react-native-actions-sheet';
|
|
17
|
+
|
|
18
|
+
import {
|
|
19
|
+
initializeTrackySDK,
|
|
20
|
+
initializeTracky,
|
|
21
|
+
initializeTrackyEventListener,
|
|
22
|
+
removeTrackyEventListener,
|
|
23
|
+
} from 'react-native-tracky-lib';
|
|
24
|
+
// import { API_URL, APP_MODE } from '@env';
|
|
25
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
26
|
+
import * as actions from './redux/slices';
|
|
27
|
+
import { EventRegister } from 'react-native-event-listeners';
|
|
28
|
+
import constants from './constants';
|
|
29
|
+
import { getDiseaseType, getTherapyArea } from './helpers/common';
|
|
30
|
+
|
|
31
|
+
const ProgressWebView = (props) => {
|
|
32
|
+
// const { url } = props; // Get the URL from the route parameters
|
|
33
|
+
const {
|
|
34
|
+
loading,
|
|
35
|
+
isError,
|
|
36
|
+
webviewRef,
|
|
37
|
+
runBeforeFirst,
|
|
38
|
+
setCanGoBack,
|
|
39
|
+
environment,
|
|
40
|
+
mobileNumber,
|
|
41
|
+
uuid,
|
|
42
|
+
clientSource,
|
|
43
|
+
moduleName,
|
|
44
|
+
} = props;
|
|
45
|
+
const [activeGoodflipTab, setActiveGoodflipTab] = useState(
|
|
46
|
+
'GoodflipProgressAchieveSectionScreen'
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const baseUrl =
|
|
50
|
+
environment.toUpperCase() === 'PROD'
|
|
51
|
+
? constants.PROD_BASE_URL
|
|
52
|
+
: constants.STAGE_BASE_URL;
|
|
53
|
+
const goodflipUrl =
|
|
54
|
+
environment.toUpperCase() === 'PROD'
|
|
55
|
+
? constants.PROD_GOODFLIP_URL
|
|
56
|
+
: constants.STAG_GOODFLIP_URL;
|
|
57
|
+
const appGoodflipUrl =
|
|
58
|
+
environment.toUpperCase() === 'PROD'
|
|
59
|
+
? constants.PROD_APP_GOODFLIP_URL
|
|
60
|
+
: constants.STAG_APP_GOODFLIP_URL;
|
|
61
|
+
|
|
62
|
+
const dispatch = useDispatch();
|
|
63
|
+
const { user } = useSelector((state: any) => state.Auth);
|
|
64
|
+
const [url, setUrl] = useState('');
|
|
65
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
66
|
+
const [hasError, setHasError] = useState(false);
|
|
67
|
+
const [isFreeUser, setIsFreeUser] = useState(false);
|
|
68
|
+
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
setIsFreeUser(user?.data?.paidUser?.toString() !== '1');
|
|
71
|
+
}, [user]);
|
|
72
|
+
|
|
73
|
+
const getAchieveUrl = () => {
|
|
74
|
+
return isFreeUser
|
|
75
|
+
? encodeURIComponent(
|
|
76
|
+
JSON.stringify({
|
|
77
|
+
uuid: '',
|
|
78
|
+
mobileNumber: mobileNumber,
|
|
79
|
+
moduleName: 'locked-progress',
|
|
80
|
+
environment: environment,
|
|
81
|
+
clientSource: clientSource,
|
|
82
|
+
name: user?.data?.name,
|
|
83
|
+
})
|
|
84
|
+
)
|
|
85
|
+
: encodeURIComponent(
|
|
86
|
+
JSON.stringify({
|
|
87
|
+
uuid: '',
|
|
88
|
+
mobileNumber: mobileNumber,
|
|
89
|
+
moduleName: 'achieve',
|
|
90
|
+
environment: environment,
|
|
91
|
+
clientSource: clientSource,
|
|
92
|
+
name: user?.data?.name,
|
|
93
|
+
therapyArea: getTherapyArea(user?.data) || 'metabolism',
|
|
94
|
+
conditionName: getDiseaseType(user?.data) || 'diabetes',
|
|
95
|
+
patientID: user?.data?.patient_id,
|
|
96
|
+
})
|
|
97
|
+
);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const getUrl = () => {
|
|
101
|
+
return encodeURIComponent(
|
|
102
|
+
JSON.stringify({
|
|
103
|
+
uuid: uuid,
|
|
104
|
+
mobileNumber: mobileNumber,
|
|
105
|
+
moduleName: moduleName,
|
|
106
|
+
environment: environment,
|
|
107
|
+
clientSource: clientSource,
|
|
108
|
+
name: user?.data?.name,
|
|
109
|
+
})
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
authenticateUser();
|
|
115
|
+
}, []);
|
|
116
|
+
|
|
117
|
+
const authenticateUser = () => {
|
|
118
|
+
setIsLoading(true);
|
|
119
|
+
const payload = uuid ? { uuid: uuid } : { contact_no: mobileNumber };
|
|
120
|
+
new Promise((resolve, reject) => {
|
|
121
|
+
dispatch(
|
|
122
|
+
actions.authenticateUserRequest({
|
|
123
|
+
payload,
|
|
124
|
+
resolve,
|
|
125
|
+
reject,
|
|
126
|
+
environment: environment,
|
|
127
|
+
})
|
|
128
|
+
);
|
|
129
|
+
})
|
|
130
|
+
.then((res: any) => {
|
|
131
|
+
setIsLoading(false); // API succeeded
|
|
132
|
+
})
|
|
133
|
+
.catch((error) => {
|
|
134
|
+
console.log('error--', error);
|
|
135
|
+
console.error('Error authenticating user:', error);
|
|
136
|
+
setHasError(true); // API failed
|
|
137
|
+
setIsLoading(false);
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
if (user) {
|
|
143
|
+
if (activeGoodflipTab === 'GoodflipProgressAchieveSectionScreen') {
|
|
144
|
+
let achieveUrl = '';
|
|
145
|
+
if (!isFreeUser) {
|
|
146
|
+
achieveUrl = `${goodflipUrl}/metabolism/diabetes/achieve?data=${getAchieveUrl()}`;
|
|
147
|
+
} else {
|
|
148
|
+
achieveUrl = `${goodflipUrl}/locked-progress?data=${getAchieveUrl()}`;
|
|
149
|
+
}
|
|
150
|
+
setUrl(achieveUrl);
|
|
151
|
+
} else if (activeGoodflipTab === 'GoodflipProgressVitalsSectionScreen') {
|
|
152
|
+
setUrl(`${appGoodflipUrl}/progress/vitals?data=${getUrl()}`);
|
|
153
|
+
} else if (activeGoodflipTab === 'GoodflipProgressDeviceSectionScreen') {
|
|
154
|
+
setUrl(
|
|
155
|
+
`${appGoodflipUrl}/progress/progress-device-section?data=${getUrl()}`
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}, [activeGoodflipTab, isFreeUser]);
|
|
160
|
+
|
|
161
|
+
const goodflipTabs = useMemo(() => {
|
|
162
|
+
const tabs = [
|
|
163
|
+
{
|
|
164
|
+
id: 'GoodflipProgressAchieveSectionScreen',
|
|
165
|
+
title: 'Achieve',
|
|
166
|
+
icon: (focused) =>
|
|
167
|
+
focused ? <Icons.AchieveIcon fill={'black'} /> : null,
|
|
168
|
+
url: 'GoodflipProgressAchieveSectionScreen',
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
id: 'GoodflipProgressVitalsSectionScreen',
|
|
172
|
+
title: 'Vitals',
|
|
173
|
+
icon: (focused) =>
|
|
174
|
+
focused ? <Icons.HeartIcon fill={'black'} /> : null,
|
|
175
|
+
url: 'GoodflipProgressVitalsSectionScreen',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
id: 'GoodflipProgressDeviceSectionScreen',
|
|
179
|
+
title: 'Devices',
|
|
180
|
+
icon: (focused) =>
|
|
181
|
+
focused ? <Icons.SmartWatchIcon fill={'black'} /> : null,
|
|
182
|
+
url: 'GoodflipProgressDeviceSectionScreen',
|
|
183
|
+
},
|
|
184
|
+
].filter(Boolean);
|
|
185
|
+
|
|
186
|
+
return tabs;
|
|
187
|
+
}, []);
|
|
188
|
+
|
|
189
|
+
const handleMessage = async (event) => {
|
|
190
|
+
const message = event.nativeEvent.data;
|
|
191
|
+
const webviewData = JSON.parse(message);
|
|
192
|
+
const { data, action } = webviewData;
|
|
193
|
+
const { age, height, gender, dob, userId, subAction } = data;
|
|
194
|
+
|
|
195
|
+
// if (action === 'updateBcaVitals') {
|
|
196
|
+
// dispatch(actions.updateBcaAndSpiromter({isBcaSpirometerChanged: true}));
|
|
197
|
+
// dispatch(
|
|
198
|
+
// actions.updateUserMetaInfoRequest({
|
|
199
|
+
// getBcaReadings: true,
|
|
200
|
+
// updateUserMetaInfo: true,
|
|
201
|
+
// }),
|
|
202
|
+
// );
|
|
203
|
+
// }
|
|
204
|
+
|
|
205
|
+
if (action === 'updateUserInfo') {
|
|
206
|
+
// dispatch(
|
|
207
|
+
// actions.updateUserMetaInfoRequest({
|
|
208
|
+
// getBcaReadings: true,
|
|
209
|
+
// updateUserMetaInfo: true,
|
|
210
|
+
// }),
|
|
211
|
+
// );
|
|
212
|
+
// new Promise((resolve, reject) => {
|
|
213
|
+
// dispatch(
|
|
214
|
+
// actions.patientDetailsRequest({
|
|
215
|
+
// resolve,
|
|
216
|
+
// reject,
|
|
217
|
+
// }),
|
|
218
|
+
// );
|
|
219
|
+
// });
|
|
220
|
+
}
|
|
221
|
+
if (action === 'init_device_bottomsheet') {
|
|
222
|
+
SheetManager.show('bca_device_list_sheet', {
|
|
223
|
+
payload: {
|
|
224
|
+
onPressConnectSmartScaleBtn: (deviceType) => {
|
|
225
|
+
SheetManager.hide('bca_device_list_sheet').then(() => {
|
|
226
|
+
if (deviceType?.device_type === 'GoodFlip') {
|
|
227
|
+
initializeTracky({
|
|
228
|
+
age: Number(age),
|
|
229
|
+
gender: gender,
|
|
230
|
+
height: Number(Number(height).toFixed(0)),
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
});
|
|
237
|
+
} else if (action === 'syncDevice') {
|
|
238
|
+
initializeTracky({
|
|
239
|
+
age: Number(age),
|
|
240
|
+
gender: gender,
|
|
241
|
+
height: Number(height),
|
|
242
|
+
});
|
|
243
|
+
} else if (action === 'buy_now') {
|
|
244
|
+
// try {
|
|
245
|
+
// if (constantsFirebaseData && constantsFirebaseData[0]?.value) {
|
|
246
|
+
// let shopifyBcaUrl = Constants.ONCO_STORE_LINKS.shopify_bca_url;
|
|
247
|
+
// const parsedData = JSON.parse(constantsFirebaseData[0].value);
|
|
248
|
+
// if (parsedData?.shopify_bca_url) {
|
|
249
|
+
// shopifyBcaUrl = parsedData.shopify_bca_url;
|
|
250
|
+
// Navigation.navigate('WebviewScreen', {
|
|
251
|
+
// headerTitle: 'Back',
|
|
252
|
+
// url: shopifyBcaUrl,
|
|
253
|
+
// });
|
|
254
|
+
// }
|
|
255
|
+
// }
|
|
256
|
+
// } catch (error) {
|
|
257
|
+
// console.log('error', error);
|
|
258
|
+
// }
|
|
259
|
+
}
|
|
260
|
+
// else if (action === 'sharePdf') {
|
|
261
|
+
// try {
|
|
262
|
+
// const res = await ReactNativeBlobUtil.config({
|
|
263
|
+
// fileCache: true,
|
|
264
|
+
// }).fetch('GET', data?.url);
|
|
265
|
+
// const resp = await res.readFile('base64');
|
|
266
|
+
// const filename = `SmartScaleReport_${userData?.name}_${moment(
|
|
267
|
+
// data?.datetime,
|
|
268
|
+
// ).format('DDMMYYHHmmss')}`;
|
|
269
|
+
// const options: ShareOptions = {
|
|
270
|
+
// title: `${filename}.pdf`,
|
|
271
|
+
// filename: `${filename}.pdf`,
|
|
272
|
+
// url: `data:application/pdf;base64,${resp}`,
|
|
273
|
+
// };
|
|
274
|
+
|
|
275
|
+
// await Share.open(options);
|
|
276
|
+
// } catch (error) {
|
|
277
|
+
// if (error?.message === 'User did not share') {
|
|
278
|
+
// } else {
|
|
279
|
+
// Popup.error('File could not be generated. Please try again.');
|
|
280
|
+
// }
|
|
281
|
+
// }
|
|
282
|
+
// }
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
console.log('icons', Icons);
|
|
286
|
+
|
|
287
|
+
return (
|
|
288
|
+
<View style={styles.goodflipContainer}>
|
|
289
|
+
{!hasError && (
|
|
290
|
+
<View style={styles.tabsRow}>
|
|
291
|
+
{goodflipTabs.map((tab) => (
|
|
292
|
+
<TouchableOpacity
|
|
293
|
+
key={tab.id}
|
|
294
|
+
style={styles.tabButton}
|
|
295
|
+
onPress={() => setActiveGoodflipTab(tab.id)}
|
|
296
|
+
>
|
|
297
|
+
<View
|
|
298
|
+
style={[
|
|
299
|
+
styles.tabButtonInner,
|
|
300
|
+
{
|
|
301
|
+
backgroundColor:
|
|
302
|
+
activeGoodflipTab === tab.id ? 'honeydew' : 'white',
|
|
303
|
+
},
|
|
304
|
+
]}
|
|
305
|
+
>
|
|
306
|
+
{/* <Image source={require('./assets/icons/smartWatch.svg')} style={{ width: 50, height: 50 }} /> */}
|
|
307
|
+
{/* {tab.icon(activeGoodflipTab === tab.id)} */}
|
|
308
|
+
<Text
|
|
309
|
+
style={[
|
|
310
|
+
styles.tabButtonText,
|
|
311
|
+
activeGoodflipTab === tab.id && styles.activeTabButtonText,
|
|
312
|
+
]}
|
|
313
|
+
>
|
|
314
|
+
{tab.title}
|
|
315
|
+
</Text>
|
|
316
|
+
</View>
|
|
317
|
+
<View
|
|
318
|
+
style={[
|
|
319
|
+
styles.tabBottomBar,
|
|
320
|
+
activeGoodflipTab === tab.id && styles.activeTabBottomBar,
|
|
321
|
+
]}
|
|
322
|
+
/>
|
|
323
|
+
</TouchableOpacity>
|
|
324
|
+
))}
|
|
325
|
+
</View>
|
|
326
|
+
)}
|
|
327
|
+
{hasError && (
|
|
328
|
+
<View style={styles.errorContainer}>
|
|
329
|
+
<Text style={styles.errorText}>Something went wrong</Text>
|
|
330
|
+
</View>
|
|
331
|
+
)}
|
|
332
|
+
{/* <SafeAreaView style={{ flex: 1 }}> */}
|
|
333
|
+
{/* {(isError || loading) && <LoadingIndicator />} */}
|
|
334
|
+
{url && !isError && !loading && !isLoading && !hasError ? (
|
|
335
|
+
<WebView
|
|
336
|
+
ref={webviewRef}
|
|
337
|
+
source={{
|
|
338
|
+
uri: url,
|
|
339
|
+
headers: {
|
|
340
|
+
platform: 'ANDROID',
|
|
341
|
+
},
|
|
342
|
+
}}
|
|
343
|
+
onMessage={handleMessage}
|
|
344
|
+
injectedJavaScriptBeforeContentLoaded={runBeforeFirst}
|
|
345
|
+
javaScriptEnabled={true}
|
|
346
|
+
// onLoadProgress={(event) => setCanGoBack(event.nativeEvent.canGoBack)}
|
|
347
|
+
onError={(errorMessage) => {
|
|
348
|
+
EventRegister.emitEvent('mytatva-event', {
|
|
349
|
+
message: 'web-view-error',
|
|
350
|
+
errorMessage: errorMessage,
|
|
351
|
+
});
|
|
352
|
+
}}
|
|
353
|
+
/>
|
|
354
|
+
) : null}
|
|
355
|
+
{/* </SafeAreaView> */}
|
|
356
|
+
</View>
|
|
357
|
+
);
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
export default ProgressWebView;
|
|
361
|
+
|
|
362
|
+
const styles = StyleSheet.create({
|
|
363
|
+
container: {
|
|
364
|
+
flex: 1,
|
|
365
|
+
// backgroundColor: colors.backgroundColor,
|
|
366
|
+
},
|
|
367
|
+
searchContainer: {
|
|
368
|
+
marginHorizontal: Matrics.s(16),
|
|
369
|
+
marginVertical: Matrics.vs(12),
|
|
370
|
+
flexDirection: 'row',
|
|
371
|
+
alignItems: 'center',
|
|
372
|
+
...(Platform.OS === 'ios' && { paddingVertical: Matrics.vs(12) }),
|
|
373
|
+
paddingHorizontal: Matrics.s(12),
|
|
374
|
+
gap: Matrics.s(8),
|
|
375
|
+
// backgroundColor: colors.white,
|
|
376
|
+
borderRadius: Matrics.vs(12),
|
|
377
|
+
borderWidth: 1,
|
|
378
|
+
// borderColor: colors.lightGrey,
|
|
379
|
+
// ...globalStyles.shadowContainer,
|
|
380
|
+
},
|
|
381
|
+
row: {
|
|
382
|
+
flexDirection: 'row',
|
|
383
|
+
alignItems: 'center',
|
|
384
|
+
gap: Matrics.s(8),
|
|
385
|
+
},
|
|
386
|
+
toastContainer: {
|
|
387
|
+
paddingVertical: Matrics.vs(12),
|
|
388
|
+
paddingHorizontal: Matrics.s(16),
|
|
389
|
+
marginHorizontal: Matrics.s(16),
|
|
390
|
+
width: Matrics.screenWidth - Matrics.s(32),
|
|
391
|
+
position: 'absolute',
|
|
392
|
+
zIndex: 10,
|
|
393
|
+
bottom: Matrics.vs(20),
|
|
394
|
+
// backgroundColor: colors.labelDarkGray,
|
|
395
|
+
borderRadius: Matrics.vs(12),
|
|
396
|
+
flexDirection: 'row',
|
|
397
|
+
alignItems: 'center',
|
|
398
|
+
justifyContent: 'space-between',
|
|
399
|
+
},
|
|
400
|
+
toastTxt: {
|
|
401
|
+
// color: colors.white,
|
|
402
|
+
fontSize: Matrics.mvs(12),
|
|
403
|
+
lineHeight: Matrics.vs(16),
|
|
404
|
+
// fontFamily: fonts.BOLD,
|
|
405
|
+
},
|
|
406
|
+
optionHeader: {
|
|
407
|
+
marginTop: Matrics.vs(24),
|
|
408
|
+
marginBottom: Matrics.vs(12),
|
|
409
|
+
marginHorizontal: Matrics.s(16),
|
|
410
|
+
fontWeight: 'bold',
|
|
411
|
+
// color: colors.labelDarkGray,
|
|
412
|
+
fontSize: Matrics.mvs(18),
|
|
413
|
+
lineHeight: Matrics.mvs(24),
|
|
414
|
+
},
|
|
415
|
+
goalBtn: {
|
|
416
|
+
marginHorizontal: Matrics.s(16),
|
|
417
|
+
paddingVertical: Matrics.vs(10),
|
|
418
|
+
paddingHorizontal: Matrics.s(16),
|
|
419
|
+
flexDirection: 'row',
|
|
420
|
+
alignItems: 'center',
|
|
421
|
+
justifyContent: 'space-between',
|
|
422
|
+
// backgroundColor: colors.white,
|
|
423
|
+
borderRadius: Matrics.vs(12),
|
|
424
|
+
// ...globalStyles.shadowContainer,
|
|
425
|
+
},
|
|
426
|
+
goalText: {
|
|
427
|
+
fontWeight: '700',
|
|
428
|
+
fontSize: Matrics.mvs(14),
|
|
429
|
+
lineHeight: Matrics.mvs(18),
|
|
430
|
+
// color: colors.labelDarkGray,
|
|
431
|
+
},
|
|
432
|
+
disclaimer: {
|
|
433
|
+
// color: colors.inactiveGray,
|
|
434
|
+
fontSize: Matrics.vs(12),
|
|
435
|
+
lineHeight: Matrics.mvs(16),
|
|
436
|
+
// fontFamily: Fonts.REGULAR,
|
|
437
|
+
marginVertical: Matrics.vs(4),
|
|
438
|
+
},
|
|
439
|
+
uploadReportTitleTxt: {
|
|
440
|
+
// fontFamily: Fonts.REGULAR,
|
|
441
|
+
fontSize: Matrics.mvs(12),
|
|
442
|
+
lineHeight: 16,
|
|
443
|
+
// color: colors.labelDarkGray,
|
|
444
|
+
flex: 1,
|
|
445
|
+
},
|
|
446
|
+
uploadReportSubTitleTxt: {
|
|
447
|
+
// fontFamily: Fonts.BOLD,
|
|
448
|
+
fontSize: Matrics.mvs(10),
|
|
449
|
+
lineHeight: 13,
|
|
450
|
+
// color: colors.white,
|
|
451
|
+
flex: 1,
|
|
452
|
+
marginTop: Matrics.vs(2),
|
|
453
|
+
// backgroundColor: 'red',
|
|
454
|
+
},
|
|
455
|
+
healthCheckupContainer: {
|
|
456
|
+
marginVertical: Matrics.vs(25),
|
|
457
|
+
marginHorizontal: Matrics.s(15),
|
|
458
|
+
marginBottom: 0,
|
|
459
|
+
// borderColor: colors.onco.SURFACE_BACKGROUND_TERTIARY,
|
|
460
|
+
},
|
|
461
|
+
// Tabs styles
|
|
462
|
+
tabContainer: {
|
|
463
|
+
flexDirection: 'row',
|
|
464
|
+
alignItems: 'center',
|
|
465
|
+
marginTop: Matrics.vs(6),
|
|
466
|
+
// borderBottomColor: colors.lightGrey,
|
|
467
|
+
borderBottomWidth: 1,
|
|
468
|
+
marginBottom: Matrics.vs(20),
|
|
469
|
+
},
|
|
470
|
+
tab: {
|
|
471
|
+
flex: 1,
|
|
472
|
+
alignItems: 'center',
|
|
473
|
+
justifyContent: 'center',
|
|
474
|
+
paddingVertical: Matrics.vs(6),
|
|
475
|
+
borderBottomWidth: 2,
|
|
476
|
+
// borderBottomColor: colors.transparent,
|
|
477
|
+
},
|
|
478
|
+
tabText: {
|
|
479
|
+
color: '#888888',
|
|
480
|
+
fontSize: Matrics.mvs(14),
|
|
481
|
+
fontWeight: '500',
|
|
482
|
+
lineHeight: Matrics.mvs(18),
|
|
483
|
+
},
|
|
484
|
+
active: {
|
|
485
|
+
borderBottomWidth: 2,
|
|
486
|
+
// borderBottomColor: colors.careplix.button_background_primary,
|
|
487
|
+
},
|
|
488
|
+
activeText: {
|
|
489
|
+
// color: colors.careplix.button_background_primary,
|
|
490
|
+
fontSize: Matrics.mvs(14),
|
|
491
|
+
fontWeight: '700',
|
|
492
|
+
lineHeight: Matrics.mvs(18),
|
|
493
|
+
},
|
|
494
|
+
|
|
495
|
+
// Fibroid styles
|
|
496
|
+
symptomsContainer: {
|
|
497
|
+
paddingTop: Matrics.vs(20),
|
|
498
|
+
overflow: 'hidden',
|
|
499
|
+
},
|
|
500
|
+
bgCircles: {
|
|
501
|
+
width: Matrics.screenWidth,
|
|
502
|
+
minHeight: Matrics.screenWidth,
|
|
503
|
+
},
|
|
504
|
+
detailContainer: {
|
|
505
|
+
paddingHorizontal: Matrics.s(16),
|
|
506
|
+
gap: Matrics.vs(16),
|
|
507
|
+
},
|
|
508
|
+
text1: {
|
|
509
|
+
// ...globalStyles.ONCO_HEADER_1,
|
|
510
|
+
// color: colors.onco.TEXT_PRIMARY,
|
|
511
|
+
},
|
|
512
|
+
text2: {
|
|
513
|
+
// ...globalStyles.ONCO_BODY_REGULAR_1,
|
|
514
|
+
// color: colors.onco.TEXT_PRIMARY,
|
|
515
|
+
},
|
|
516
|
+
fibroidProgressBannerScore: {
|
|
517
|
+
height: Matrics.vs(150),
|
|
518
|
+
width: Matrics.vs(150),
|
|
519
|
+
top: Matrics.vs(12),
|
|
520
|
+
left: Matrics.s(20),
|
|
521
|
+
transform: 'scale(1.1)',
|
|
522
|
+
},
|
|
523
|
+
iconContainer: {
|
|
524
|
+
minHeight: Matrics.vs(200),
|
|
525
|
+
flexDirection: 'row',
|
|
526
|
+
justifyContent: 'space-between',
|
|
527
|
+
},
|
|
528
|
+
careNavigatorGirl: {
|
|
529
|
+
height: Matrics.screenWidth * 0.7,
|
|
530
|
+
width: Matrics.screenWidth * 0.6,
|
|
531
|
+
right: Matrics.vs(12),
|
|
532
|
+
bottom: Matrics.vs(-20),
|
|
533
|
+
},
|
|
534
|
+
flower: {
|
|
535
|
+
width: Matrics.vs(160),
|
|
536
|
+
height: Matrics.vs(160),
|
|
537
|
+
marginVertical: Matrics.vs(8),
|
|
538
|
+
position: 'absolute',
|
|
539
|
+
bottom: Matrics.vs(-40),
|
|
540
|
+
left: Matrics.s(-40),
|
|
541
|
+
},
|
|
542
|
+
goodflipContainer: {
|
|
543
|
+
flex: 1,
|
|
544
|
+
},
|
|
545
|
+
tabsRow: {
|
|
546
|
+
flexDirection: 'row',
|
|
547
|
+
backgroundColor: colors.white,
|
|
548
|
+
paddingTop: Matrics.vs(10),
|
|
549
|
+
alignItems: 'center',
|
|
550
|
+
},
|
|
551
|
+
tabButton: {
|
|
552
|
+
flex: 1,
|
|
553
|
+
alignItems: 'center',
|
|
554
|
+
// backgroundColor: colors.white,
|
|
555
|
+
paddingTop: Matrics.vs(10),
|
|
556
|
+
},
|
|
557
|
+
tabButtonInner: {
|
|
558
|
+
paddingHorizontal: Matrics.s(10),
|
|
559
|
+
paddingVertical: Matrics.vs(6),
|
|
560
|
+
borderRadius: Matrics.mvs(100),
|
|
561
|
+
gap: 8,
|
|
562
|
+
flexDirection: 'row',
|
|
563
|
+
alignItems: 'center',
|
|
564
|
+
},
|
|
565
|
+
tabButtonText: {
|
|
566
|
+
fontSize: Matrics.mvs(15),
|
|
567
|
+
// color: colors.dark_jungle_green,
|
|
568
|
+
// fontFamily: Fonts.ROBOTO_REGULAR,
|
|
569
|
+
},
|
|
570
|
+
activeTabButtonText: {
|
|
571
|
+
// color: colors.brunswick_green,
|
|
572
|
+
// fontFamily: Fonts.ROBOTO_BOLD,
|
|
573
|
+
},
|
|
574
|
+
tabBottomBar: {
|
|
575
|
+
height: Matrics.vs(5),
|
|
576
|
+
width: '50%',
|
|
577
|
+
borderTopRightRadius: Matrics.mvs(100),
|
|
578
|
+
borderTopLeftRadius: Matrics.mvs(100),
|
|
579
|
+
marginTop: Matrics.vs(4),
|
|
580
|
+
// backgroundColor: colors.white,
|
|
581
|
+
},
|
|
582
|
+
activeTabBottomBar: {
|
|
583
|
+
// backgroundColor: colors.illuminating_emerald,
|
|
584
|
+
},
|
|
585
|
+
tabContent: {
|
|
586
|
+
flex: 1,
|
|
587
|
+
// backgroundColor: colors.white,
|
|
588
|
+
},
|
|
589
|
+
errorContainer: {
|
|
590
|
+
flex: 1,
|
|
591
|
+
justifyContent: 'center',
|
|
592
|
+
alignItems: 'center',
|
|
593
|
+
backgroundColor: colors.white,
|
|
594
|
+
},
|
|
595
|
+
errorText: {
|
|
596
|
+
fontSize: Matrics.mvs(16),
|
|
597
|
+
color: '#FF3B30',
|
|
598
|
+
fontWeight: '500',
|
|
599
|
+
textAlign: 'center',
|
|
600
|
+
paddingHorizontal: Matrics.s(20),
|
|
601
|
+
},
|
|
602
|
+
});
|
package/src/Services.js
CHANGED
|
@@ -1,9 +1,49 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
+
import constants from './constants';
|
|
3
|
+
import CRYPTO from 'crypto-js';
|
|
2
4
|
|
|
3
5
|
export const httpClient = axios.create({
|
|
4
6
|
timeout: 60000,
|
|
5
7
|
});
|
|
6
8
|
|
|
9
|
+
export const getEncryptedText = (data, env) => {
|
|
10
|
+
var truncHexKey = CRYPTO.SHA256(env.toUpperCase() === 'PROD' ? constants.PROD_ENC_KEY : constants.STAG_ENC_KEY)
|
|
11
|
+
.toString()
|
|
12
|
+
.substr(0, 32); // hex encode and truncate
|
|
13
|
+
|
|
14
|
+
var key = CRYPTO.enc.Utf8.parse(truncHexKey);
|
|
15
|
+
|
|
16
|
+
var iv = CRYPTO.enc.Utf8.parse(env.toUpperCase() === 'PROD' ? constants.PROD_ENC_IV : constants.STAGE_ENC_IV);
|
|
17
|
+
|
|
18
|
+
var ciphertext = CRYPTO.AES.encrypt(JSON.stringify(data), key, {
|
|
19
|
+
iv: iv,
|
|
20
|
+
mode: CRYPTO.mode.CBC,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
return ciphertext.toString();
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const getDecryptedData = (cipher, env) => {
|
|
27
|
+
var truncHexKey = CRYPTO.SHA256(env.toUpperCase() === 'PROD' ? constants.PROD_ENC_KEY : constants.STAG_ENC_KEY)
|
|
28
|
+
.toString()
|
|
29
|
+
.substr(0, 32); // hex encode and truncate
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
var key = CRYPTO.enc.Utf8.parse(truncHexKey);
|
|
34
|
+
|
|
35
|
+
var iv = CRYPTO.enc.Utf8.parse(env.toUpperCase() === 'PROD' ? constants.PROD_ENC_IV : constants.STAGE_ENC_IV);
|
|
36
|
+
|
|
37
|
+
var decryptedData = CRYPTO.AES.decrypt(cipher, key, {
|
|
38
|
+
iv: iv,
|
|
39
|
+
mode: CRYPTO.mode.CBC,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
return decryptedData.toString(CRYPTO.enc.Utf8);
|
|
45
|
+
};
|
|
46
|
+
|
|
7
47
|
export const getWebViewLink = (
|
|
8
48
|
baseUrl,
|
|
9
49
|
token,
|
package/src/Sheets.js
ADDED