@eohjsc/react-native-smart-city 0.2.19 → 0.2.23
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/assets/images/Add.svg +5 -0
- package/assets/images/AddLocationMaps/Point.svg +3 -0
- package/assets/images/CheckCircle.svg +4 -0
- package/assets/images/Close.svg +3 -0
- package/assets/images/Event.svg +9 -0
- package/assets/images/HowToStart.svg +14 -0
- package/assets/images/OneTap.svg +14 -0
- package/assets/images/Rearrange.svg +3 -0
- package/assets/images/Schedule.svg +39 -0
- package/assets/images/WeatherChange.svg +49 -0
- package/index.js +2 -0
- package/package.json +7 -4
- package/src/Images/Common/ActiveButton.png +0 -0
- package/src/Images/Common/ActiveButton@2x.png +0 -0
- package/src/Images/Common/ActiveButton@3x.png +0 -0
- package/src/Images/Common/file@2x.png +0 -0
- package/src/Images/Common/file@3x.png +0 -0
- package/src/Images/Common/fullscreen@2x.png +0 -0
- package/src/Images/Common/fullscreen@3x.png +0 -0
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +6 -3
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +10 -1
- package/src/commons/ActionGroup/ThreeButtonTemplate.js +13 -6
- package/src/commons/ActionGroup/ThreeButtonTemplateStyle.js +1 -1
- package/src/commons/ActionGroup/TimerActionTemplate.js +158 -33
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +2 -1
- package/src/commons/ActionGroup/hooks/useDropdownAction.js +2 -1
- package/src/commons/Automate/ItemAddNewScriptAction.js +30 -0
- package/src/commons/Automate/ItemAddNewScriptActionStyles.js +38 -0
- package/src/commons/Automate/ItemAutomate.js +63 -0
- package/src/commons/Automate/ItemAutomateStyles.js +30 -0
- package/src/commons/Automate/ItemScriptAction.js +41 -0
- package/src/commons/Automate/ItemScriptActionStyles.js +38 -0
- package/src/commons/BottomScrollPicker/index.js +58 -0
- package/src/commons/BottomScrollPicker/styles.js +13 -0
- package/src/commons/BottomSheet/index.js +36 -0
- package/src/commons/BottomSheet/styles.js +37 -0
- package/src/commons/Button/index.js +6 -1
- package/src/commons/CameraDevice/index.js +22 -10
- package/src/commons/ChartLoading/index.js +2 -1
- package/src/commons/DateTimeRangeChange/index.js +2 -1
- package/src/commons/Device/ConnectedViewHeader.js +3 -1
- package/src/commons/Device/DeviceAlertStatus.js +2 -1
- package/src/commons/Device/DisconnectedView.js +34 -26
- package/src/commons/Device/Emergency/EmergencyButton.js +2 -1
- package/src/commons/Device/Emergency/EmergencyDetail.js +2 -1
- package/src/commons/Device/FlatListItems.js +2 -1
- package/src/commons/Device/FooterInfo.js +2 -1
- package/src/commons/Device/HistoryChart.js +2 -1
- package/src/commons/Device/HorizontalBarChart.js +3 -3
- package/src/commons/Device/PMSensor/PMSensorIndicatior.js +7 -2
- package/src/commons/Device/PMSensor/PMSensorIndicatorStyles.js +3 -1
- package/src/commons/Device/RainningSensor/CurrentRainSensor.js +3 -1
- package/src/commons/Device/SensorConnectedStatus.js +2 -1
- package/src/commons/Device/WindDirection/Compass/index.js +1 -1
- package/src/commons/Device/WindSpeed/LinearChart/index.js +2 -1
- package/src/commons/Device/__test__/DeviceAlertStatus.test.js +2 -1
- package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -1
- package/src/commons/EmergencyButton/AlertSent.js +3 -2
- package/src/commons/Explore/CityItem/index.js +2 -1
- package/src/commons/Explore/HeaderExplore/index.js +2 -1
- package/src/commons/Explore/HeaderLabel/index.js +2 -1
- package/src/commons/Explore/SearchBox/index.js +2 -1
- package/src/commons/Header/HeaderCustom.js +36 -10
- package/src/commons/Header/Styles/HeaderCustomStyles.js +8 -3
- package/src/commons/HeaderAni/index.js +6 -3
- package/src/commons/IconComponent/index.js +18 -3
- package/src/commons/ImagePicker/index.js +3 -1
- package/src/commons/MediaPlayer/index.js +118 -62
- package/src/commons/MediaPlayer/styles.js +56 -0
- package/src/commons/MediaPlayerDetail/MediaPlayerDetailStyles.js +15 -0
- package/src/commons/MediaPlayerDetail/index.js +149 -64
- package/src/commons/MenuActionAddnew/index.js +2 -1
- package/src/commons/Modal/ModalCustom.js +22 -0
- package/src/commons/Modal/ModalFullVideo.js +48 -0
- package/src/commons/Modal/Styles/ModalFullVideoStyles.js +26 -0
- package/src/commons/Modal/index.js +4 -0
- package/src/commons/NavBar/index.js +2 -2
- package/src/commons/Sharing/DevicePermissionsCheckbox.js +2 -1
- package/src/commons/Sharing/MemberList.js +3 -1
- package/src/commons/Sharing/RowMember.js +3 -2
- package/src/commons/Sharing/StationDevicePermissions.js +2 -1
- package/src/commons/SubUnit/OneTap/ItemOneTap.js +86 -0
- package/src/commons/SubUnit/OneTap/ItemOneTapStyles.js +41 -0
- package/src/commons/SubUnit/OneTap/OneTapStyles.js +36 -0
- package/src/commons/SubUnit/OneTap/index.js +29 -0
- package/src/commons/SubUnit/ShortDetail.js +3 -1
- package/src/commons/Today/index.js +2 -1
- package/src/commons/Unit/SharedUnit.js +2 -1
- package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +1 -2
- package/src/commons/UnitSummary/AirQuality/index.js +5 -120
- package/src/commons/UnitSummary/AirQuality/styles.js +112 -0
- package/src/commons/UnitSummary/TotalPowerConsumption/index.js +2 -1
- package/src/commons/WheelDateTimePicker/Picker.js +57 -0
- package/src/commons/WheelDateTimePicker/index.js +160 -0
- package/src/commons/WheelDateTimePicker/styles.js +21 -0
- package/src/configs/API.js +25 -3
- package/src/configs/Colors.js +1 -0
- package/src/configs/Constants.js +4 -0
- package/src/configs/Images.js +4 -0
- package/src/configs/SCConfig.js +94 -0
- package/src/context/SCContext.tsx +5 -11
- package/src/context/reducer.ts +2 -0
- package/src/hooks/Common/useStatusBar.js +3 -0
- package/src/hooks/Common/useTranslations.ts +34 -0
- package/src/iot/Monitor.js +2 -1
- package/src/iot/RemoteControl/Bluetooth.js +2 -6
- package/src/iot/RemoteControl/GoogleHome.js +1 -1
- package/src/iot/RemoteControl/Internet.js +1 -1
- package/src/iot/RemoteControl/LG.js +57 -15
- package/src/iot/RemoteControl/__test__/Bluetooth.test.js +2 -1
- package/src/iot/RemoteControl/__test__/GoogleHome.test.js +2 -1
- package/src/iot/RemoteControl/__test__/Internet.test.js +2 -1
- package/src/iot/RemoteControl/__test__/index.test.js +2 -1
- package/src/iot/RemoteControl/index.js +1 -1
- package/src/iot/states.js +1 -0
- package/src/navigations/AddGatewayStack.js +5 -0
- package/src/navigations/AddNewActionStack.js +23 -0
- package/src/navigations/SharedStack.js +2 -1
- package/src/navigations/UnitStack.js +72 -1
- package/src/screens/AQIGuide/index.js +2 -2
- package/src/screens/ActivityLog/hooks/index.js +1 -1
- package/src/screens/ActivityLog/index.js +2 -1
- package/src/screens/AddCommon/SelectSubUnit.js +143 -0
- package/src/screens/AddCommon/SelectSubUnitStyles.js +55 -0
- package/src/screens/AddCommon/SelectUnit.js +3 -2
- package/src/screens/AddLocationMaps/index.js +2 -1
- package/src/screens/AddNewAction/Device/DeviceStyles.js +43 -0
- package/src/screens/AddNewAction/Device/index.js +33 -0
- package/src/screens/AddNewAction/SelectDevice.js +106 -0
- package/src/screens/AddNewAction/Styles/SelectDeviceStyles.js +36 -0
- package/src/screens/AddNewDevice/ConnectDevices.js +2 -1
- package/src/screens/AddNewDevice/ConnectingDevices.js +2 -1
- package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +2 -1
- package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +2 -1
- package/src/screens/AddNewDevice/__test__/ConnectingDevices.test.js +2 -1
- package/src/screens/AddNewDevice/hooks/useStateAlertRename.js +2 -1
- package/src/screens/AddNewDevice/index.js +23 -4
- package/src/screens/AddNewGateway/AddNewGatewayStyles.js +29 -0
- package/src/screens/AddNewGateway/ConnectedGateway.js +2 -1
- package/src/screens/AddNewGateway/ConnectingGateway.js +100 -25
- package/src/screens/AddNewGateway/ConnectingGatewayStyles.js +92 -0
- package/src/screens/AddNewGateway/SetupGatewayWifi.js +25 -3
- package/src/screens/AddNewGateway/SetupGatewayWifiStyles.js +6 -1
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +2 -1
- package/src/screens/AddNewGateway/__test__/ConnectedGateway.test.js +2 -1
- package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +2 -1
- package/src/screens/AddNewGateway/hooks/useStateAlertRename.js +2 -1
- package/src/screens/AddNewGateway/index.js +28 -110
- package/src/screens/AddNewOneTap/AddNewOneTapStyles.js +43 -0
- package/src/screens/AddNewOneTap/index.js +67 -0
- package/src/screens/AddNewScriptAction/AddNewScriptActionStyles.js +27 -0
- package/src/screens/AddNewScriptAction/index.js +92 -0
- package/src/screens/AllCamera/Styles/index.js +101 -0
- package/src/screens/AllCamera/index.js +208 -0
- package/src/screens/Device/HeaderDevice/styles.js +2 -2
- package/src/screens/Device/__test__/detail.test.js +2 -1
- package/src/screens/Device/detail.js +66 -23
- package/src/screens/Device/hooks/useEmergencyButton.js +7 -6
- package/src/screens/Device/styles.js +3 -0
- package/src/screens/DeviceInfo/index.js +3 -2
- package/src/screens/EditActionsList/Styles/indexStyles.js +73 -0
- package/src/screens/EditActionsList/index.js +122 -0
- package/src/screens/EmergencyContacts/EmergencyContactsAddNew.js +3 -2
- package/src/screens/EmergencyContacts/EmergencyContactsList.js +9 -2
- package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +2 -1
- package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +2 -1
- package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +2 -1
- package/src/screens/EmergencyContacts/hook.js +3 -2
- package/src/screens/Explore/index.js +3 -2
- package/src/screens/GuestInfo/components/AccessScheduleItem.js +27 -0
- package/src/screens/GuestInfo/components/AccessScheduleSheet.js +193 -0
- package/src/screens/GuestInfo/components/HeaderGuestInfo.js +31 -0
- package/src/screens/GuestInfo/components/RecurringDetail.js +99 -0
- package/src/screens/GuestInfo/components/RowGuestInfo.js +31 -0
- package/src/screens/GuestInfo/components/TemporaryDetail.js +46 -0
- package/src/screens/GuestInfo/constant.js +59 -0
- package/src/screens/GuestInfo/index.js +151 -0
- package/src/screens/GuestInfo/styles/AccessScheduleDetailStyles.js +31 -0
- package/src/screens/GuestInfo/styles/AccessScheduleItemStyles.js +22 -0
- package/src/screens/GuestInfo/styles/HeaderGuestInfoStyles.js +31 -0
- package/src/screens/GuestInfo/styles/indexStyles.js +38 -0
- package/src/screens/ManageAccess/__test__/ManageAccess.test.js +82 -0
- package/src/screens/ManageAccess/hooks/index.js +32 -0
- package/src/screens/ManageAccess/index.js +126 -0
- package/src/screens/ManageAccess/styles/ManageAccessStyles.js +72 -0
- package/src/screens/PlayBackCamera/Styles/TimerStyles.js +22 -0
- package/src/screens/PlayBackCamera/Styles/index.js +81 -0
- package/src/screens/PlayBackCamera/Timer.js +127 -0
- package/src/screens/PlayBackCamera/index.js +233 -0
- package/src/screens/ScanChipQR/components/QRScan/index.js +2 -1
- package/src/screens/ScanChipQR/hooks/index.js +4 -11
- package/src/screens/ScriptDetail/Styles/indexStyles.js +140 -0
- package/src/screens/ScriptDetail/index.js +241 -0
- package/src/screens/SharedUnit/TabHeader.js +2 -1
- package/src/screens/SharedUnit/index.js +3 -2
- package/src/screens/Sharing/MemberList.js +2 -1
- package/src/screens/Sharing/SelectPermission.js +2 -1
- package/src/screens/Sharing/SelectUser.js +3 -2
- package/src/screens/Sharing/__test__/MemberList.test.js +2 -1
- package/src/screens/Sharing/__test__/SelectUser.test.js +2 -1
- package/src/screens/Sharing/hooks/index.js +22 -17
- package/src/screens/SubUnit/AddSubUnit.js +14 -72
- package/src/screens/SubUnit/AddSubUnitStyles.js +66 -0
- package/src/screens/SubUnit/Detail.js +5 -63
- package/src/screens/SubUnit/DetailStyles.js +46 -0
- package/src/screens/SubUnit/ManageSubUnit.js +5 -4
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +2 -1
- package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +2 -1
- package/src/screens/SyncLGDevice/AddLGDevice.js +3 -2
- package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +2 -1
- package/src/screens/TDSGuide/index.js +2 -1
- package/src/screens/UVIndexGuide/index.js +2 -1
- package/src/screens/Unit/AddMenu.js +3 -2
- package/src/screens/Unit/Detail.js +75 -20
- package/src/screens/Unit/ManageUnit/index.js +4 -3
- package/src/screens/Unit/ManageUnit.js +4 -3
- package/src/screens/Unit/MoreMenu.js +3 -2
- package/src/screens/Unit/SelectLocation.js +10 -2
- package/src/screens/Unit/SelectLocationStyles.js +11 -0
- package/src/screens/Unit/components/Header/index.js +2 -1
- package/src/screens/Unit/components/ListMyAllUnit/index.js +2 -1
- package/src/screens/Unit/components/MyUnit/index.js +2 -1
- package/src/screens/Unit/components/SearchLocation/index.js +2 -1
- package/src/screens/Unit/components/SharedUnit/index.js +2 -1
- package/src/screens/Unit/styles.js +4 -0
- package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +2 -1
- package/src/screens/UnitSummary/components/PowerConsumption/index.js +2 -1
- package/src/screens/UnitSummary/components/Temperature/index.js +2 -1
- package/src/screens/UnitSummary/components/TotalPowerConsumption/index.js +2 -1
- package/src/screens/UnitSummary/components/UvIndex/index.js +2 -1
- package/src/screens/UnitSummary/components/WaterQuality/index.js +2 -1
- package/src/screens/UnitSummary/index.js +2 -1
- package/src/screens/WaterQualityGuide/index.js +2 -1
- package/src/utils/Converter/__test__/time.test.js +3 -1
- package/src/utils/Converter/array.js +4 -0
- package/src/utils/Converter/time.js +29 -4
- package/src/utils/I18n/index.ts +6 -0
- package/src/utils/I18n/translations/en.json +51 -2
- package/src/utils/I18n/translations/vi.json +48 -1
- package/src/utils/I18n/translations.ts +45 -0
- package/src/utils/Route/index.js +11 -0
- package/src/utils/I18n/index.js +0 -19
|
@@ -1,35 +1,127 @@
|
|
|
1
|
-
import React, { memo, useCallback, useState } from 'react';
|
|
2
|
-
import { Image,
|
|
1
|
+
import React, { memo, useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import { Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
|
3
3
|
import { VLCPlayer } from 'react-native-vlc-media-player';
|
|
4
|
-
import {
|
|
4
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
5
5
|
import PauseIcon from '../../../assets/images/Common/Pause.svg';
|
|
6
6
|
import { Colors, Images } from '../../configs';
|
|
7
7
|
import { colorOpacity } from '../../utils/Converter/color';
|
|
8
|
+
import styles from './styles';
|
|
8
9
|
|
|
9
|
-
const
|
|
10
|
+
const PreviewPlayer = memo(({ uri, start }) => {
|
|
11
|
+
const [count, setCount] = useState(0);
|
|
12
|
+
const [load1, setLoad1] = useState(false);
|
|
13
|
+
const [load2, setLoad2] = useState(false);
|
|
14
|
+
const [load3, setLoad3] = useState(false);
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (start) {
|
|
18
|
+
setTimeout(() => {
|
|
19
|
+
setCount(1);
|
|
20
|
+
}, 3000);
|
|
21
|
+
setTimeout(() => {
|
|
22
|
+
setCount(2);
|
|
23
|
+
}, 6000);
|
|
24
|
+
setTimeout(() => {
|
|
25
|
+
setCount(3);
|
|
26
|
+
}, 9000);
|
|
27
|
+
}
|
|
28
|
+
}, [start]);
|
|
29
|
+
|
|
30
|
+
const onLoad1 = useCallback(() => {
|
|
31
|
+
setLoad1(true);
|
|
32
|
+
}, []);
|
|
33
|
+
const onLoad2 = useCallback(() => {
|
|
34
|
+
setLoad2(true);
|
|
35
|
+
}, []);
|
|
36
|
+
const onLoad3 = useCallback(() => {
|
|
37
|
+
setLoad3(true);
|
|
38
|
+
}, []);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<>
|
|
42
|
+
{start && count >= 2 && (
|
|
43
|
+
<Image
|
|
44
|
+
source={{ uri: uri + '?c=2' }}
|
|
45
|
+
// eslint-disable-next-line react-native/no-inline-styles
|
|
46
|
+
style={[styles.previewImage, { zIndex: -3 }]}
|
|
47
|
+
resizeMode="stretch"
|
|
48
|
+
fadeDuration={0}
|
|
49
|
+
onLoad={onLoad3}
|
|
50
|
+
/>
|
|
51
|
+
)}
|
|
52
|
+
{start && count >= 1 && (
|
|
53
|
+
<Image
|
|
54
|
+
source={{ uri: uri + '?c=1' }}
|
|
55
|
+
style={[
|
|
56
|
+
styles.previewImage,
|
|
57
|
+
// eslint-disable-next-line react-native/no-inline-styles
|
|
58
|
+
{ zIndex: -2 },
|
|
59
|
+
load3 ? styles.hideImage : {},
|
|
60
|
+
]}
|
|
61
|
+
resizeMode="stretch"
|
|
62
|
+
fadeDuration={0}
|
|
63
|
+
onLoad={onLoad2}
|
|
64
|
+
/>
|
|
65
|
+
)}
|
|
66
|
+
{start && (
|
|
67
|
+
<Image
|
|
68
|
+
source={{ uri: uri + '?c=0' }}
|
|
69
|
+
style={[
|
|
70
|
+
styles.previewImage,
|
|
71
|
+
// eslint-disable-next-line react-native/no-inline-styles
|
|
72
|
+
{ zIndex: -1 },
|
|
73
|
+
load2 ? styles.hideImage : {},
|
|
74
|
+
]}
|
|
75
|
+
resizeMode="stretch"
|
|
76
|
+
fadeDuration={0}
|
|
77
|
+
onLoad={onLoad1}
|
|
78
|
+
/>
|
|
79
|
+
)}
|
|
80
|
+
<Image
|
|
81
|
+
source={{ uri: uri }}
|
|
82
|
+
style={[
|
|
83
|
+
styles.previewImage,
|
|
84
|
+
// eslint-disable-next-line react-native/no-inline-styles
|
|
85
|
+
{ zIndex: 0 },
|
|
86
|
+
load1 ? styles.hideImage : {},
|
|
87
|
+
]}
|
|
88
|
+
resizeMode="stretch"
|
|
89
|
+
fadeDuration={0}
|
|
90
|
+
/>
|
|
91
|
+
</>
|
|
92
|
+
);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const MediaPlayer = memo(({ uri, previewUri, thumbnail, style }) => {
|
|
96
|
+
const t = useTranslations();
|
|
97
|
+
const [started, setStarted] = useState(false);
|
|
10
98
|
const [paused, setPaused] = useState(true);
|
|
99
|
+
|
|
11
100
|
const onTapPause = useCallback(() => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const source = !thumbnail || !thumbnail.uri ? Images.BgDevice : thumbnail;
|
|
101
|
+
setStarted(true);
|
|
102
|
+
setPaused((p) => !p);
|
|
103
|
+
}, []);
|
|
104
|
+
|
|
105
|
+
const imageSource =
|
|
106
|
+
!thumbnail || !thumbnail.uri ? Images.BgDevice : thumbnail;
|
|
19
107
|
return (
|
|
20
108
|
<View style={styles.wrap}>
|
|
21
109
|
<View style={styles.loadingWrap}>
|
|
22
|
-
|
|
110
|
+
{previewUri ? (
|
|
111
|
+
<PreviewPlayer uri={previewUri} start={started} />
|
|
112
|
+
) : (
|
|
113
|
+
<Text style={styles.loadingText}>{t('loading')}</Text>
|
|
114
|
+
)}
|
|
23
115
|
</View>
|
|
24
116
|
<TouchableOpacity
|
|
25
117
|
activeOpacity={1}
|
|
26
118
|
style={styles.videoBtn}
|
|
27
119
|
onPress={onTapPause}
|
|
28
120
|
>
|
|
29
|
-
{
|
|
121
|
+
{!started ? (
|
|
30
122
|
<View style={[styles.player, style]}>
|
|
31
123
|
<Image
|
|
32
|
-
source={
|
|
124
|
+
source={imageSource}
|
|
33
125
|
style={[styles.player]}
|
|
34
126
|
defaultSource={Images.BgDevice}
|
|
35
127
|
resizeMode="cover"
|
|
@@ -42,58 +134,22 @@ const MediaPlayer = memo(({ uri, thumbnail, style }) => {
|
|
|
42
134
|
/>
|
|
43
135
|
</View>
|
|
44
136
|
) : (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
137
|
+
<>
|
|
138
|
+
<VLCPlayer
|
|
139
|
+
autoAspectRatio={true}
|
|
140
|
+
videoAspectRatio="21:9"
|
|
141
|
+
source={{ uri }}
|
|
142
|
+
style={[styles.player, style]}
|
|
143
|
+
paused={paused}
|
|
144
|
+
/>
|
|
145
|
+
</>
|
|
51
146
|
)}
|
|
52
|
-
|
|
53
|
-
|
|
147
|
+
<View style={styles.bottomView}>
|
|
148
|
+
{(paused || !started) && <PauseIcon />}
|
|
149
|
+
</View>
|
|
54
150
|
</TouchableOpacity>
|
|
55
151
|
</View>
|
|
56
152
|
);
|
|
57
153
|
});
|
|
58
154
|
|
|
59
155
|
export default MediaPlayer;
|
|
60
|
-
|
|
61
|
-
const styles = StyleSheet.create({
|
|
62
|
-
wrap: {
|
|
63
|
-
flex: 1,
|
|
64
|
-
justifyContent: 'center',
|
|
65
|
-
borderRadius: 10,
|
|
66
|
-
backgroundColor: Colors.TextGray,
|
|
67
|
-
overflow: 'hidden',
|
|
68
|
-
},
|
|
69
|
-
loadingWrap: {
|
|
70
|
-
position: 'absolute',
|
|
71
|
-
top: 0,
|
|
72
|
-
left: 0,
|
|
73
|
-
right: 0,
|
|
74
|
-
bottom: 0,
|
|
75
|
-
alignItems: 'center',
|
|
76
|
-
justifyContent: 'center',
|
|
77
|
-
},
|
|
78
|
-
loadingText: {
|
|
79
|
-
color: Colors.White,
|
|
80
|
-
},
|
|
81
|
-
player: {
|
|
82
|
-
zIndex: 0,
|
|
83
|
-
flex: 1,
|
|
84
|
-
borderRadius: 10,
|
|
85
|
-
},
|
|
86
|
-
videoBtn: {
|
|
87
|
-
flex: 1,
|
|
88
|
-
},
|
|
89
|
-
bottomView: {
|
|
90
|
-
alignItems: 'center',
|
|
91
|
-
justifyContent: 'center',
|
|
92
|
-
bottom: 0,
|
|
93
|
-
left: 0,
|
|
94
|
-
height: '100%',
|
|
95
|
-
position: 'absolute',
|
|
96
|
-
width: '100%',
|
|
97
|
-
// backgroundColor: 'rgba(0,0,0,0)',
|
|
98
|
-
},
|
|
99
|
-
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { Colors } from '../../configs';
|
|
3
|
+
|
|
4
|
+
export default StyleSheet.create({
|
|
5
|
+
wrap: {
|
|
6
|
+
flex: 1,
|
|
7
|
+
justifyContent: 'center',
|
|
8
|
+
borderRadius: 10,
|
|
9
|
+
backgroundColor: Colors.TextGray,
|
|
10
|
+
overflow: 'hidden',
|
|
11
|
+
},
|
|
12
|
+
loadingWrap: {
|
|
13
|
+
position: 'absolute',
|
|
14
|
+
top: 0,
|
|
15
|
+
left: 0,
|
|
16
|
+
right: 0,
|
|
17
|
+
bottom: 0,
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
justifyContent: 'center',
|
|
20
|
+
},
|
|
21
|
+
loadingText: {
|
|
22
|
+
color: Colors.White,
|
|
23
|
+
},
|
|
24
|
+
previewImage: {
|
|
25
|
+
position: 'absolute',
|
|
26
|
+
top: 0,
|
|
27
|
+
left: 0,
|
|
28
|
+
right: 0,
|
|
29
|
+
bottom: 0,
|
|
30
|
+
width: '100%',
|
|
31
|
+
height: '100%',
|
|
32
|
+
},
|
|
33
|
+
hideImage: {
|
|
34
|
+
opacity: 0,
|
|
35
|
+
height: 0,
|
|
36
|
+
width: 0,
|
|
37
|
+
},
|
|
38
|
+
player: {
|
|
39
|
+
zIndex: 0,
|
|
40
|
+
borderRadius: 10,
|
|
41
|
+
height: '100%',
|
|
42
|
+
},
|
|
43
|
+
videoBtn: {
|
|
44
|
+
flex: 1,
|
|
45
|
+
},
|
|
46
|
+
bottomView: {
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
justifyContent: 'center',
|
|
49
|
+
bottom: 0,
|
|
50
|
+
left: 0,
|
|
51
|
+
height: '100%',
|
|
52
|
+
position: 'absolute',
|
|
53
|
+
width: '100%',
|
|
54
|
+
// backgroundColor: 'rgba(0,0,0,0)',
|
|
55
|
+
},
|
|
56
|
+
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Colors } from '../../configs';
|
|
2
2
|
import { StyleSheet } from 'react-native';
|
|
3
|
+
import { normalize } from '../../configs/Constants';
|
|
3
4
|
|
|
4
5
|
export default StyleSheet.create({
|
|
5
6
|
wrap: {
|
|
@@ -48,4 +49,18 @@ export default StyleSheet.create({
|
|
|
48
49
|
flexDirection: 'row',
|
|
49
50
|
alignItems: 'center',
|
|
50
51
|
},
|
|
52
|
+
cameraName2: {
|
|
53
|
+
fontSize: normalize(10),
|
|
54
|
+
top: '75%',
|
|
55
|
+
},
|
|
56
|
+
iconFullScreen: {
|
|
57
|
+
position: 'absolute',
|
|
58
|
+
zIndex: 10,
|
|
59
|
+
width: 40,
|
|
60
|
+
height: 40,
|
|
61
|
+
bottom: 5,
|
|
62
|
+
right: 5,
|
|
63
|
+
justifyContent: 'center',
|
|
64
|
+
alignItems: 'center',
|
|
65
|
+
},
|
|
51
66
|
});
|
|
@@ -1,78 +1,163 @@
|
|
|
1
|
-
import React, { memo, useCallback, useState } from 'react';
|
|
1
|
+
import React, { memo, useCallback, useState, useEffect } from 'react';
|
|
2
2
|
import { Image, View, StyleSheet, Text, TouchableOpacity } from 'react-native';
|
|
3
3
|
import { VLCPlayer } from 'react-native-vlc-media-player';
|
|
4
|
+
import { getStatusBarHeight } from 'react-native-iphone-x-helper';
|
|
5
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
4
6
|
|
|
5
|
-
import { t } from 'i18n-js';
|
|
6
7
|
import PauseIcon from '../../../assets/images/Common/Pause.svg';
|
|
7
|
-
import { Colors, Images } from '../../configs';
|
|
8
|
+
import { Colors, Constants, Images } from '../../configs';
|
|
8
9
|
import { colorOpacity } from '../../utils/Converter/color';
|
|
9
10
|
import styles from './MediaPlayerDetailStyles';
|
|
11
|
+
import FImage from '../../commons/FImage';
|
|
10
12
|
|
|
11
|
-
const MediaPlayerDetail = memo(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const MediaPlayerDetail = memo(
|
|
14
|
+
({
|
|
15
|
+
uri,
|
|
16
|
+
cameraName,
|
|
17
|
+
thumbnail,
|
|
18
|
+
style,
|
|
19
|
+
wrapStyles,
|
|
20
|
+
resizeMode = 'none',
|
|
21
|
+
amount,
|
|
22
|
+
handleFullScreen,
|
|
23
|
+
isFullScreen = false,
|
|
24
|
+
isPaused = true,
|
|
25
|
+
goToPlayBack,
|
|
26
|
+
isShowFullScreenIcon = false,
|
|
27
|
+
}) => {
|
|
28
|
+
const t = useTranslations();
|
|
29
|
+
const [paused, setPaused] = useState(isPaused);
|
|
30
|
+
const onTapPause = useCallback(() => {
|
|
31
|
+
setPaused(false);
|
|
32
|
+
}, []);
|
|
16
33
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
34
|
+
const onTapGoDetail = useCallback(() => {
|
|
35
|
+
if (!paused) {
|
|
36
|
+
setPaused(true);
|
|
37
|
+
} else {
|
|
38
|
+
goToPlayBack && goToPlayBack();
|
|
39
|
+
}
|
|
40
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
41
|
+
}, [paused]);
|
|
42
|
+
|
|
43
|
+
const onFullScreen = useCallback(() => {
|
|
44
|
+
handleFullScreen && handleFullScreen({ uri, cameraName, thumbnail });
|
|
45
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
|
+
}, []);
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
setPaused(isPaused);
|
|
50
|
+
}, [isPaused]);
|
|
51
|
+
|
|
52
|
+
const source = !thumbnail || !thumbnail.uri ? Images.BgDevice : thumbnail;
|
|
53
|
+
return (
|
|
54
|
+
<View style={[styles.wrap, wrapStyles]}>
|
|
55
|
+
<View
|
|
56
|
+
style={[
|
|
57
|
+
styles.loadingWrap,
|
|
58
|
+
isFullScreen && { transform: [{ rotate: '90deg' }] },
|
|
59
|
+
]}
|
|
60
|
+
>
|
|
61
|
+
<Text style={styles.loadingText}>{t('loading')}</Text>
|
|
62
|
+
</View>
|
|
63
|
+
<TouchableOpacity
|
|
64
|
+
activeOpacity={1}
|
|
65
|
+
style={styles.videoBtn}
|
|
66
|
+
onPress={onTapGoDetail}
|
|
67
|
+
>
|
|
68
|
+
{paused ? (
|
|
69
|
+
<View style={[styles.player, style]}>
|
|
70
|
+
<FImage
|
|
71
|
+
source={source}
|
|
72
|
+
style={[
|
|
73
|
+
styles.player,
|
|
74
|
+
style,
|
|
75
|
+
isFullScreen && {
|
|
76
|
+
marginLeft: -Constants.width / 2 - getStatusBarHeight(),
|
|
77
|
+
width: Constants.height,
|
|
78
|
+
height: Constants.width,
|
|
79
|
+
transform: [{ rotate: '90deg' }],
|
|
80
|
+
},
|
|
81
|
+
]}
|
|
82
|
+
defaultSource={Images.BgDevice}
|
|
83
|
+
resizeMode="cover"
|
|
84
|
+
/>
|
|
85
|
+
<View
|
|
86
|
+
style={[
|
|
87
|
+
StyleSheet.absoluteFillObject,
|
|
88
|
+
{ backgroundColor: colorOpacity(Colors.Black, 0.3) },
|
|
89
|
+
]}
|
|
90
|
+
/>
|
|
91
|
+
</View>
|
|
92
|
+
) : isFullScreen ? (
|
|
93
|
+
<View style={{ transform: [{ rotate: '90deg' }] }}>
|
|
94
|
+
<VLCPlayer
|
|
95
|
+
autoAspectRatio={true}
|
|
96
|
+
videoAspectRatio={`${Constants.height}:${Constants.width}`}
|
|
97
|
+
source={{ uri }}
|
|
98
|
+
style={[
|
|
99
|
+
{
|
|
100
|
+
width: Constants.height,
|
|
101
|
+
height: Constants.width,
|
|
102
|
+
},
|
|
103
|
+
]}
|
|
104
|
+
/>
|
|
105
|
+
</View>
|
|
106
|
+
) : (
|
|
107
|
+
<VLCPlayer
|
|
108
|
+
autoAspectRatio={true}
|
|
109
|
+
videoAspectRatio={
|
|
110
|
+
!amount
|
|
111
|
+
? '21:9'
|
|
112
|
+
: amount === 1
|
|
113
|
+
? '15:9'
|
|
114
|
+
: amount === 4
|
|
115
|
+
? '5:3'
|
|
116
|
+
: '10:9'
|
|
117
|
+
}
|
|
118
|
+
source={{ uri }}
|
|
119
|
+
style={[styles.player, style]}
|
|
120
|
+
resizeMode={resizeMode}
|
|
49
121
|
/>
|
|
50
|
-
|
|
51
|
-
) : (
|
|
52
|
-
<VLCPlayer
|
|
53
|
-
autoAspectRatio={true}
|
|
54
|
-
videoAspectRatio="21:9"
|
|
55
|
-
source={{ uri: uri }}
|
|
56
|
-
style={[styles.player, style]}
|
|
57
|
-
/>
|
|
58
|
-
)}
|
|
122
|
+
)}
|
|
59
123
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
124
|
+
<View style={styles.buttonView}>
|
|
125
|
+
<View style={styles.buttonPause}>
|
|
126
|
+
<TouchableOpacity
|
|
127
|
+
onPress={onTapPause}
|
|
128
|
+
style={[
|
|
129
|
+
styles.btn,
|
|
130
|
+
isFullScreen && { transform: [{ rotate: '90deg' }] },
|
|
131
|
+
]}
|
|
132
|
+
activeOpacity={0.8}
|
|
133
|
+
>
|
|
134
|
+
{paused && <PauseIcon />}
|
|
135
|
+
</TouchableOpacity>
|
|
136
|
+
</View>
|
|
69
137
|
</View>
|
|
70
|
-
</
|
|
71
|
-
</TouchableOpacity>
|
|
138
|
+
</TouchableOpacity>
|
|
72
139
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
140
|
+
{cameraName && paused && (
|
|
141
|
+
<Text
|
|
142
|
+
style={[
|
|
143
|
+
styles.cameraName,
|
|
144
|
+
amount && amount !== 1 && styles.cameraName2,
|
|
145
|
+
]}
|
|
146
|
+
>
|
|
147
|
+
{cameraName}
|
|
148
|
+
</Text>
|
|
149
|
+
)}
|
|
150
|
+
{isShowFullScreenIcon && (
|
|
151
|
+
<TouchableOpacity
|
|
152
|
+
onPress={onFullScreen}
|
|
153
|
+
style={styles.iconFullScreen}
|
|
154
|
+
>
|
|
155
|
+
<Image source={Images.fullscreen} />
|
|
156
|
+
</TouchableOpacity>
|
|
157
|
+
)}
|
|
158
|
+
</View>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
);
|
|
77
162
|
|
|
78
163
|
export default MediaPlayerDetail;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { memo, useCallback } from 'react';
|
|
2
2
|
import { FlatList, StyleSheet, View } from 'react-native';
|
|
3
3
|
import Modal from 'react-native-modal';
|
|
4
|
-
import {
|
|
4
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
5
5
|
|
|
6
6
|
import { Colors } from '../../configs';
|
|
7
7
|
import Text from '../Text';
|
|
@@ -10,6 +10,7 @@ import ImageButton from '../ImageButton';
|
|
|
10
10
|
const keyExtractor = (item) => item.id.toString();
|
|
11
11
|
const MenuActionAddnew = memo(
|
|
12
12
|
({ visible, hideModal, dataActions, onItemClick }) => {
|
|
13
|
+
const t = useTranslations();
|
|
13
14
|
const numColumns = dataActions.length < 3 ? dataActions.length : 3;
|
|
14
15
|
|
|
15
16
|
const onPress = useCallback(
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Modal from 'react-native-modal';
|
|
3
|
+
import { Colors } from '../../configs';
|
|
4
|
+
|
|
5
|
+
const ModalCustom = (props) => {
|
|
6
|
+
return (
|
|
7
|
+
<Modal
|
|
8
|
+
hasBackdrop
|
|
9
|
+
useNativeDriver
|
|
10
|
+
animationIn={'slideInUp'}
|
|
11
|
+
animationOut={'slideOutDown'}
|
|
12
|
+
animationInTiming={500}
|
|
13
|
+
animationOutTiming={500}
|
|
14
|
+
backdropColor={Colors.BlackTransparent5}
|
|
15
|
+
{...props}
|
|
16
|
+
>
|
|
17
|
+
{props.children}
|
|
18
|
+
</Modal>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default ModalCustom;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { View, TouchableOpacity, Image } from 'react-native';
|
|
3
|
+
import { ModalCustom } from '../../commons/Modal';
|
|
4
|
+
import MediaPlayerDetail from '../../commons/MediaPlayerDetail';
|
|
5
|
+
import { Images } from '../../configs';
|
|
6
|
+
import styles from './Styles/ModalFullVideoStyles';
|
|
7
|
+
import { useHiddenStatusBar } from '../../hooks/Common/useStatusBar';
|
|
8
|
+
|
|
9
|
+
const ModalFullVideo = ({
|
|
10
|
+
animationOut = 'fadeOut',
|
|
11
|
+
isVisible = false,
|
|
12
|
+
modalStyles,
|
|
13
|
+
data,
|
|
14
|
+
resizeMode = 'cover',
|
|
15
|
+
onClose,
|
|
16
|
+
uri,
|
|
17
|
+
}) => {
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
20
|
+
useHiddenStatusBar(isVisible);
|
|
21
|
+
}, [isVisible]);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<ModalCustom
|
|
25
|
+
animationOut={animationOut}
|
|
26
|
+
isVisible={isVisible}
|
|
27
|
+
style={modalStyles}
|
|
28
|
+
>
|
|
29
|
+
<View style={styles.modalContent}>
|
|
30
|
+
<MediaPlayerDetail
|
|
31
|
+
uri={uri || data?.uri}
|
|
32
|
+
thumbnail={data?.thumbnail}
|
|
33
|
+
style={styles.camera}
|
|
34
|
+
wrapStyles={styles.wrapStyles}
|
|
35
|
+
resizeMode={resizeMode}
|
|
36
|
+
cameraName={data?.name}
|
|
37
|
+
isFullScreen={true}
|
|
38
|
+
isPaused={false}
|
|
39
|
+
/>
|
|
40
|
+
<TouchableOpacity onPress={onClose} style={styles.buttonFullScreen}>
|
|
41
|
+
<Image source={Images.fullscreen} />
|
|
42
|
+
</TouchableOpacity>
|
|
43
|
+
</View>
|
|
44
|
+
</ModalCustom>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default ModalFullVideo;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { normalize } from '../../../configs/Constants';
|
|
3
|
+
|
|
4
|
+
export default StyleSheet.create({
|
|
5
|
+
modalContent: {
|
|
6
|
+
position: 'absolute',
|
|
7
|
+
zIndex: 10,
|
|
8
|
+
top: 0,
|
|
9
|
+
left: 0,
|
|
10
|
+
right: 0,
|
|
11
|
+
bottom: 0,
|
|
12
|
+
},
|
|
13
|
+
buttonFullScreen: {
|
|
14
|
+
position: 'absolute',
|
|
15
|
+
zIndex: 10,
|
|
16
|
+
width: normalize(40),
|
|
17
|
+
height: normalize(40),
|
|
18
|
+
bottom: normalize(30),
|
|
19
|
+
left: normalize(20),
|
|
20
|
+
justifyContent: 'center',
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
},
|
|
23
|
+
wrapStyles: {
|
|
24
|
+
borderRadius: 0,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
@@ -10,7 +10,7 @@ import Station from '../../screens/Unit/Station';
|
|
|
10
10
|
import MenuActionMore from '../MenuActionMore';
|
|
11
11
|
|
|
12
12
|
const NavBar = memo(
|
|
13
|
-
({ listMenuItem, listStation, onSnapToItem, indexStation }) => {
|
|
13
|
+
({ listMenuItem, listStation, onSnapToItem, indexStation, style }) => {
|
|
14
14
|
const { childRef, showingPopover, showPopoverWithRef, hidePopover } =
|
|
15
15
|
usePopover();
|
|
16
16
|
const refMenuAction = useRef();
|
|
@@ -18,7 +18,7 @@ const NavBar = memo(
|
|
|
18
18
|
|
|
19
19
|
return (
|
|
20
20
|
<>
|
|
21
|
-
<View style={styles.wrap}>
|
|
21
|
+
<View style={[styles.wrap, style]}>
|
|
22
22
|
<View style={styles.wrapTitle}>
|
|
23
23
|
<Station
|
|
24
24
|
listStation={listStation}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { memo, useState, useCallback } from 'react';
|
|
2
2
|
import { View, StyleSheet, TouchableOpacity } from 'react-native';
|
|
3
|
-
import {
|
|
3
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
4
4
|
import RadioCircle from '../RadioCircle';
|
|
5
5
|
import Text from '../Text';
|
|
6
6
|
import { Colors } from '../../configs';
|
|
@@ -30,6 +30,7 @@ const DevicePermissionsCheckbox = ({
|
|
|
30
30
|
selectedIndexes,
|
|
31
31
|
onSelectIndexes,
|
|
32
32
|
}) => {
|
|
33
|
+
const t = useTranslations();
|
|
33
34
|
const sensorHasData = !!sensor.read_configs.length || !!sensor.actions.length;
|
|
34
35
|
|
|
35
36
|
const [selectIndexes, setSelectIndexes] = useState(selectedIndexes); // [-1] all , [1, 2 ,3] some , [] no
|