react-native-mytatva-rn-sdk 1.0.0 → 1.1.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 +39 -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,331 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Alert,
|
|
3
|
+
Image,
|
|
4
|
+
Platform,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
Switch,
|
|
7
|
+
Text,
|
|
8
|
+
TouchableOpacity,
|
|
9
|
+
View,
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
import React, { useCallback, useEffect, useState, useRef } from 'react';
|
|
12
|
+
import ActionSheet from 'react-native-actions-sheet';
|
|
13
|
+
import Matrics from './helpers/Matrics';
|
|
14
|
+
import {
|
|
15
|
+
checkBluetoothPermission,
|
|
16
|
+
managePermission,
|
|
17
|
+
} from './helpers/bluetoothPermissionHelper';
|
|
18
|
+
import { RESULTS } from 'react-native-permissions';
|
|
19
|
+
|
|
20
|
+
const DeviceList = [
|
|
21
|
+
{
|
|
22
|
+
// image: Images.GoodFlipBcaDevice,
|
|
23
|
+
device_type: 'GoodFlip',
|
|
24
|
+
title: 'GoodFlip device',
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
const colors = {
|
|
29
|
+
gun_powder: '#49454F',
|
|
30
|
+
mountain_meadow: '#12B76A',
|
|
31
|
+
solitude: '#E4E7EC',
|
|
32
|
+
royal_blue_goodflip: '#444CE7',
|
|
33
|
+
alice_blue: '#EEF4FF',
|
|
34
|
+
auro_metal_saurus: '#667085',
|
|
35
|
+
anti_flash_white: '#F2F4F7',
|
|
36
|
+
illuminating_emerald: '#299D6B',
|
|
37
|
+
aero_blue: '#CBF0E0',
|
|
38
|
+
honeydew: '#E6FAF1',
|
|
39
|
+
sea_green: '#2A805A',
|
|
40
|
+
dark_jungle_green: '#101828',
|
|
41
|
+
cosmic_cobalt: '#2D3282',
|
|
42
|
+
brunswick_green: '#1D4D38',
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const BcaDeviceListSheet = ({ sheetId, payload }) => {
|
|
46
|
+
const { onPressConnectSmartScaleBtn } = payload;
|
|
47
|
+
|
|
48
|
+
const [devices, setDevices] = useState([]);
|
|
49
|
+
const [closeOnTouchBackdrop, setCloseOnTouchBackdrop] = useState(false);
|
|
50
|
+
const [bluetoothIsEnable, setBluetoothIsEnable] = useState(false);
|
|
51
|
+
const [selectedDevice, setSelectedDevice] = useState(DeviceList[0]);
|
|
52
|
+
const actionSheetRef = useRef(null);
|
|
53
|
+
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
checkBleEnable();
|
|
56
|
+
// handlePageViewEvent(Constants.SCREEN_NAME.BCABluetoothToggle);
|
|
57
|
+
}, []);
|
|
58
|
+
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
checkDeviceIsAvailable();
|
|
61
|
+
}, []);
|
|
62
|
+
|
|
63
|
+
const onChange = (position: number) => {
|
|
64
|
+
if (position == 0) {
|
|
65
|
+
setCloseOnTouchBackdrop(true);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const checkDeviceIsAvailable = () => {
|
|
70
|
+
const tempDevideList = [];
|
|
71
|
+
tempDevideList.push(DeviceList[0]);
|
|
72
|
+
setDevices(tempDevideList);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const checkBleEnable = async () => {
|
|
76
|
+
const permission = await checkBluetoothPermission();
|
|
77
|
+
if (permission.status !== RESULTS.GRANTED) {
|
|
78
|
+
setBluetoothIsEnable(false);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const onPressSwitch = async (value) => {
|
|
83
|
+
if (value) {
|
|
84
|
+
const permission = await checkBluetoothPermission();
|
|
85
|
+
await managePermission(permission, value, () => {
|
|
86
|
+
setBluetoothIsEnable(true);
|
|
87
|
+
});
|
|
88
|
+
} else {
|
|
89
|
+
setBluetoothIsEnable(false);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const renderHeader = useCallback(() => {
|
|
94
|
+
return (
|
|
95
|
+
<View style={styles.headerContainer}>
|
|
96
|
+
<Text style={styles.syncSmartScaleTxt}>Sync Smart Scale</Text>
|
|
97
|
+
<TouchableOpacity
|
|
98
|
+
activeOpacity={0.8}
|
|
99
|
+
onPress={() => actionSheetRef.current?.hide()}
|
|
100
|
+
>
|
|
101
|
+
{/* Remove or properly implement the icon component */}
|
|
102
|
+
</TouchableOpacity>
|
|
103
|
+
</View>
|
|
104
|
+
);
|
|
105
|
+
}, []);
|
|
106
|
+
|
|
107
|
+
const renderRightContainer = useCallback(() => {
|
|
108
|
+
return (
|
|
109
|
+
<View
|
|
110
|
+
style={[
|
|
111
|
+
styles.rightContainer,
|
|
112
|
+
{
|
|
113
|
+
paddingLeft: Matrics.s((devices ?? []).length ? 15 : 0),
|
|
114
|
+
},
|
|
115
|
+
]}
|
|
116
|
+
>
|
|
117
|
+
{renderStep2Container()}
|
|
118
|
+
</View>
|
|
119
|
+
);
|
|
120
|
+
}, [selectedDevice, bluetoothIsEnable, devices]);
|
|
121
|
+
|
|
122
|
+
const renderStep2Container = useCallback(() => {
|
|
123
|
+
return (
|
|
124
|
+
<View>
|
|
125
|
+
<Text style={styles.inOrderToConnectTxt}>
|
|
126
|
+
In order to connect with the GoodFlip smart scale, you need to turn on
|
|
127
|
+
the Bluetooth on your device
|
|
128
|
+
</Text>
|
|
129
|
+
|
|
130
|
+
<View style={styles.switchButtonContainer}>
|
|
131
|
+
<Text style={styles.turnOnBluetoothTxt}>Turn on Bluetooth</Text>
|
|
132
|
+
<Switch
|
|
133
|
+
trackColor={{
|
|
134
|
+
false: '#F2F4F7',
|
|
135
|
+
true: '#299D6B',
|
|
136
|
+
}}
|
|
137
|
+
thumbColor={'white'}
|
|
138
|
+
ios_backgroundColor={'#F2F4F7'}
|
|
139
|
+
onValueChange={onPressSwitch}
|
|
140
|
+
value={bluetoothIsEnable}
|
|
141
|
+
/>
|
|
142
|
+
</View>
|
|
143
|
+
</View>
|
|
144
|
+
);
|
|
145
|
+
}, [bluetoothIsEnable, devices]);
|
|
146
|
+
|
|
147
|
+
const renderBottomBtn = useCallback(() => {
|
|
148
|
+
return (
|
|
149
|
+
<TouchableOpacity
|
|
150
|
+
onPress={() => {
|
|
151
|
+
onPressConnectSmartScaleBtn(selectedDevice);
|
|
152
|
+
}}
|
|
153
|
+
activeOpacity={0.8}
|
|
154
|
+
disabled={!bluetoothIsEnable || !selectedDevice}
|
|
155
|
+
style={[
|
|
156
|
+
styles.connectWithSmartSmartScaleButtonContainer,
|
|
157
|
+
{
|
|
158
|
+
backgroundColor:
|
|
159
|
+
!bluetoothIsEnable || !selectedDevice
|
|
160
|
+
? colors.aero_blue
|
|
161
|
+
: colors.illuminating_emerald,
|
|
162
|
+
shadowColor:
|
|
163
|
+
!bluetoothIsEnable || !selectedDevice
|
|
164
|
+
? colors.honeydew
|
|
165
|
+
: colors.sea_green,
|
|
166
|
+
},
|
|
167
|
+
]}
|
|
168
|
+
>
|
|
169
|
+
<Text style={styles.connectWithSmartScaleTxt}>
|
|
170
|
+
Connect With Smart Scale1
|
|
171
|
+
</Text>
|
|
172
|
+
{/* Remove or properly implement the icon component */}
|
|
173
|
+
</TouchableOpacity>
|
|
174
|
+
);
|
|
175
|
+
}, [selectedDevice, bluetoothIsEnable]);
|
|
176
|
+
|
|
177
|
+
return (
|
|
178
|
+
<ActionSheet
|
|
179
|
+
id={sheetId}
|
|
180
|
+
ref={actionSheetRef}
|
|
181
|
+
containerStyle={styles.sheet}
|
|
182
|
+
onChange={onChange}
|
|
183
|
+
isModal={true}
|
|
184
|
+
snapPoints={[100]}
|
|
185
|
+
initialSnapIndex={0}
|
|
186
|
+
useBottomSafeAreaPadding={
|
|
187
|
+
Platform.OS === 'ios' ? !closeOnTouchBackdrop : true
|
|
188
|
+
}
|
|
189
|
+
gestureEnabled={false}
|
|
190
|
+
drawUnderStatusBar={false}
|
|
191
|
+
defaultOverlayOpacity={0.3}
|
|
192
|
+
closeOnTouchBackdrop={closeOnTouchBackdrop}
|
|
193
|
+
>
|
|
194
|
+
<View style={styles.smallHeight}>
|
|
195
|
+
<View style={styles.mainContainer}>
|
|
196
|
+
{renderHeader()}
|
|
197
|
+
<View style={{ flexDirection: 'row' }}>{renderRightContainer()}</View>
|
|
198
|
+
</View>
|
|
199
|
+
{renderBottomBtn()}
|
|
200
|
+
</View>
|
|
201
|
+
</ActionSheet>
|
|
202
|
+
);
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export default BcaDeviceListSheet;
|
|
206
|
+
|
|
207
|
+
const styles = StyleSheet.create({
|
|
208
|
+
sheet: {
|
|
209
|
+
borderTopRightRadius: 20,
|
|
210
|
+
borderTopLeftRadius: 20,
|
|
211
|
+
paddingBottom: Matrics.vs(Platform.OS === 'android' ? 20 : 5),
|
|
212
|
+
},
|
|
213
|
+
smallHeight: {
|
|
214
|
+
paddingHorizontal: Matrics.s(15),
|
|
215
|
+
paddingVertical: Matrics.s(15),
|
|
216
|
+
},
|
|
217
|
+
mainContainer: {
|
|
218
|
+
marginBottom: Matrics.vs(40),
|
|
219
|
+
},
|
|
220
|
+
headerContainer: {
|
|
221
|
+
flexDirection: 'row',
|
|
222
|
+
alignItems: 'center',
|
|
223
|
+
justifyContent: 'space-between',
|
|
224
|
+
marginBottom: Matrics.vs(20),
|
|
225
|
+
},
|
|
226
|
+
syncSmartScaleTxt: {
|
|
227
|
+
// fontFamily: Fonts.ROBOTO_SEMI_BOLD,
|
|
228
|
+
fontSize: Matrics.mvs(18),
|
|
229
|
+
color: '#101828',
|
|
230
|
+
},
|
|
231
|
+
mainStepContainer: {
|
|
232
|
+
backgroundColor: 'E4E7EC',
|
|
233
|
+
borderRadius: Matrics.mvs(100),
|
|
234
|
+
alignItems: 'center',
|
|
235
|
+
justifyContent: 'space-between',
|
|
236
|
+
marginBottom: Matrics.vs(15),
|
|
237
|
+
overflow: 'hidden',
|
|
238
|
+
},
|
|
239
|
+
gradientContainer: {
|
|
240
|
+
height: Matrics.vs(30),
|
|
241
|
+
alignItems: 'center',
|
|
242
|
+
},
|
|
243
|
+
stepContainer: {
|
|
244
|
+
height: Matrics.mvs(14),
|
|
245
|
+
width: Matrics.mvs(14),
|
|
246
|
+
backgroundColor: 'white',
|
|
247
|
+
borderRadius: Matrics.mvs(100),
|
|
248
|
+
marginHorizontal: Matrics.s(1),
|
|
249
|
+
},
|
|
250
|
+
rightContainer: {
|
|
251
|
+
flex: 1,
|
|
252
|
+
paddingLeft: Matrics.s(15),
|
|
253
|
+
},
|
|
254
|
+
step1Container: {
|
|
255
|
+
gap: 15,
|
|
256
|
+
paddingBottom: Matrics.vs(30),
|
|
257
|
+
},
|
|
258
|
+
stepHeaderTxt: {
|
|
259
|
+
// fontFamily: Fonts.ROBOTO_REGULAR,
|
|
260
|
+
fontSize: Matrics.mvs(12),
|
|
261
|
+
color: '#101828',
|
|
262
|
+
},
|
|
263
|
+
selectYourSmartScaleTxt: {
|
|
264
|
+
// fontFamily: Fonts.ROBOTO_SEMI_BOLD,
|
|
265
|
+
fontSize: Matrics.mvs(16),
|
|
266
|
+
color: '#101828',
|
|
267
|
+
},
|
|
268
|
+
deviceItemContainer: {
|
|
269
|
+
flexDirection: 'row',
|
|
270
|
+
alignItems: 'center',
|
|
271
|
+
justifyContent: 'space-between',
|
|
272
|
+
borderWidth: 1,
|
|
273
|
+
borderRadius: Matrics.mvs(8),
|
|
274
|
+
paddingVertical: Matrics.vs(10),
|
|
275
|
+
paddingHorizontal: Matrics.s(13),
|
|
276
|
+
},
|
|
277
|
+
deviceItemDetailsContainer: {
|
|
278
|
+
flexDirection: 'row',
|
|
279
|
+
alignItems: 'center',
|
|
280
|
+
gap: 15,
|
|
281
|
+
},
|
|
282
|
+
deviceImageContainer: {
|
|
283
|
+
height: Matrics.mvs(50),
|
|
284
|
+
width: Matrics.mvs(50),
|
|
285
|
+
resizeMode: 'contain',
|
|
286
|
+
},
|
|
287
|
+
deviceNameTxt: {
|
|
288
|
+
// fontFamily: Fonts.ROBOTO_BOLD,
|
|
289
|
+
fontSize: Matrics.mvs(16),
|
|
290
|
+
color: '#101828',
|
|
291
|
+
},
|
|
292
|
+
switchButtonContainer: {
|
|
293
|
+
borderWidth: 1,
|
|
294
|
+
borderRadius: Matrics.mvs(16),
|
|
295
|
+
paddingVertical: Matrics.vs(10),
|
|
296
|
+
paddingHorizontal: Matrics.s(13),
|
|
297
|
+
borderColor: '#E4E7EC',
|
|
298
|
+
flexDirection: 'row',
|
|
299
|
+
alignItems: 'center',
|
|
300
|
+
justifyContent: 'space-between',
|
|
301
|
+
},
|
|
302
|
+
turnOnBluetoothTxt: {
|
|
303
|
+
// fontFamily: Fonts.ROBOTO_SEMI_BOLD,
|
|
304
|
+
fontSize: Matrics.mvs(16),
|
|
305
|
+
color: '#2D3282',
|
|
306
|
+
},
|
|
307
|
+
connectWithSmartSmartScaleButtonContainer: {
|
|
308
|
+
flexDirection: 'row',
|
|
309
|
+
alignItems: 'center',
|
|
310
|
+
justifyContent: 'center',
|
|
311
|
+
|
|
312
|
+
borderRadius: Matrics.mvs(8),
|
|
313
|
+
paddingVertical: Matrics.vs(15),
|
|
314
|
+
shadowOffset: { height: 12, width: 0 },
|
|
315
|
+
shadowOpacity: 1,
|
|
316
|
+
shadowRadius: 1,
|
|
317
|
+
gap: 15,
|
|
318
|
+
elevation: 8,
|
|
319
|
+
},
|
|
320
|
+
connectWithSmartScaleTxt: {
|
|
321
|
+
fontSize: Matrics.mvs(16),
|
|
322
|
+
// fontFamily: Fonts.ROBOTO_BOLD,
|
|
323
|
+
color: 'white',
|
|
324
|
+
},
|
|
325
|
+
inOrderToConnectTxt: {
|
|
326
|
+
// fontFamily: Fonts.ROBOTO_REGULAR,
|
|
327
|
+
fontSize: Matrics.mvs(14),
|
|
328
|
+
color: '#667085',
|
|
329
|
+
marginBottom: Matrics.vs(25),
|
|
330
|
+
},
|
|
331
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ActivityIndicator, SafeAreaView } from 'react-native';
|
|
3
|
+
import { EventRegister } from 'react-native-event-listeners';
|
|
4
|
+
import WebView from 'react-native-webview';
|
|
5
|
+
|
|
6
|
+
const MainWebView = (props) => {
|
|
7
|
+
const {
|
|
8
|
+
url,
|
|
9
|
+
source,
|
|
10
|
+
loading,
|
|
11
|
+
isError,
|
|
12
|
+
webviewRef,
|
|
13
|
+
handleMessage,
|
|
14
|
+
runBeforeFirst,
|
|
15
|
+
setCanGoBack,
|
|
16
|
+
} = props; // Get the URL and other parameters from the route
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<SafeAreaView style={{ flex: 1 }}>
|
|
20
|
+
{(isError || loading) && <LoadingIndicator />}
|
|
21
|
+
{source && !isError && !loading ? (
|
|
22
|
+
<WebView
|
|
23
|
+
ref={webviewRef}
|
|
24
|
+
source={{
|
|
25
|
+
uri: source,
|
|
26
|
+
headers: {
|
|
27
|
+
platform: 'ANDROID',
|
|
28
|
+
},
|
|
29
|
+
}}
|
|
30
|
+
onMessage={handleMessage}
|
|
31
|
+
injectedJavaScriptBeforeContentLoaded={runBeforeFirst}
|
|
32
|
+
javaScriptEnabled={true}
|
|
33
|
+
onLoadProgress={(event) => setCanGoBack(event.nativeEvent.canGoBack)}
|
|
34
|
+
onError={(errorMessage) => {
|
|
35
|
+
EventRegister.emitEvent('mytatva-event', {
|
|
36
|
+
message: 'web-view-error',
|
|
37
|
+
errorMessage: errorMessage,
|
|
38
|
+
});
|
|
39
|
+
}}
|
|
40
|
+
/>
|
|
41
|
+
) : null}
|
|
42
|
+
</SafeAreaView>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default MainWebView;
|
|
47
|
+
|
|
48
|
+
const LoadingIndicator = () => {
|
|
49
|
+
return (
|
|
50
|
+
<ActivityIndicator
|
|
51
|
+
color="#000"
|
|
52
|
+
size="large"
|
|
53
|
+
// eslint-disable-next-line react-native/no-inline-styles
|
|
54
|
+
style={{
|
|
55
|
+
flex: 1,
|
|
56
|
+
zIndex: 100,
|
|
57
|
+
position: 'absolute',
|
|
58
|
+
backgroundColor: '#fff',
|
|
59
|
+
opacity: 0.4,
|
|
60
|
+
width: '100%',
|
|
61
|
+
height: '100%',
|
|
62
|
+
justifyContent: 'center',
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
}}
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
};
|