@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.
Files changed (242) hide show
  1. package/assets/images/Add.svg +5 -0
  2. package/assets/images/AddLocationMaps/Point.svg +3 -0
  3. package/assets/images/CheckCircle.svg +4 -0
  4. package/assets/images/Close.svg +3 -0
  5. package/assets/images/Event.svg +9 -0
  6. package/assets/images/HowToStart.svg +14 -0
  7. package/assets/images/OneTap.svg +14 -0
  8. package/assets/images/Rearrange.svg +3 -0
  9. package/assets/images/Schedule.svg +39 -0
  10. package/assets/images/WeatherChange.svg +49 -0
  11. package/index.js +2 -0
  12. package/package.json +7 -4
  13. package/src/Images/Common/ActiveButton.png +0 -0
  14. package/src/Images/Common/ActiveButton@2x.png +0 -0
  15. package/src/Images/Common/ActiveButton@3x.png +0 -0
  16. package/src/Images/Common/file@2x.png +0 -0
  17. package/src/Images/Common/file@3x.png +0 -0
  18. package/src/Images/Common/fullscreen@2x.png +0 -0
  19. package/src/Images/Common/fullscreen@3x.png +0 -0
  20. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +6 -3
  21. package/src/commons/ActionGroup/StatesGridActionTemplate.js +10 -1
  22. package/src/commons/ActionGroup/ThreeButtonTemplate.js +13 -6
  23. package/src/commons/ActionGroup/ThreeButtonTemplateStyle.js +1 -1
  24. package/src/commons/ActionGroup/TimerActionTemplate.js +158 -33
  25. package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +2 -1
  26. package/src/commons/ActionGroup/hooks/useDropdownAction.js +2 -1
  27. package/src/commons/Automate/ItemAddNewScriptAction.js +30 -0
  28. package/src/commons/Automate/ItemAddNewScriptActionStyles.js +38 -0
  29. package/src/commons/Automate/ItemAutomate.js +63 -0
  30. package/src/commons/Automate/ItemAutomateStyles.js +30 -0
  31. package/src/commons/Automate/ItemScriptAction.js +41 -0
  32. package/src/commons/Automate/ItemScriptActionStyles.js +38 -0
  33. package/src/commons/BottomScrollPicker/index.js +58 -0
  34. package/src/commons/BottomScrollPicker/styles.js +13 -0
  35. package/src/commons/BottomSheet/index.js +36 -0
  36. package/src/commons/BottomSheet/styles.js +37 -0
  37. package/src/commons/Button/index.js +6 -1
  38. package/src/commons/CameraDevice/index.js +22 -10
  39. package/src/commons/ChartLoading/index.js +2 -1
  40. package/src/commons/DateTimeRangeChange/index.js +2 -1
  41. package/src/commons/Device/ConnectedViewHeader.js +3 -1
  42. package/src/commons/Device/DeviceAlertStatus.js +2 -1
  43. package/src/commons/Device/DisconnectedView.js +34 -26
  44. package/src/commons/Device/Emergency/EmergencyButton.js +2 -1
  45. package/src/commons/Device/Emergency/EmergencyDetail.js +2 -1
  46. package/src/commons/Device/FlatListItems.js +2 -1
  47. package/src/commons/Device/FooterInfo.js +2 -1
  48. package/src/commons/Device/HistoryChart.js +2 -1
  49. package/src/commons/Device/HorizontalBarChart.js +3 -3
  50. package/src/commons/Device/PMSensor/PMSensorIndicatior.js +7 -2
  51. package/src/commons/Device/PMSensor/PMSensorIndicatorStyles.js +3 -1
  52. package/src/commons/Device/RainningSensor/CurrentRainSensor.js +3 -1
  53. package/src/commons/Device/SensorConnectedStatus.js +2 -1
  54. package/src/commons/Device/WindDirection/Compass/index.js +1 -1
  55. package/src/commons/Device/WindSpeed/LinearChart/index.js +2 -1
  56. package/src/commons/Device/__test__/DeviceAlertStatus.test.js +2 -1
  57. package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -1
  58. package/src/commons/EmergencyButton/AlertSent.js +3 -2
  59. package/src/commons/Explore/CityItem/index.js +2 -1
  60. package/src/commons/Explore/HeaderExplore/index.js +2 -1
  61. package/src/commons/Explore/HeaderLabel/index.js +2 -1
  62. package/src/commons/Explore/SearchBox/index.js +2 -1
  63. package/src/commons/Header/HeaderCustom.js +36 -10
  64. package/src/commons/Header/Styles/HeaderCustomStyles.js +8 -3
  65. package/src/commons/HeaderAni/index.js +6 -3
  66. package/src/commons/IconComponent/index.js +18 -3
  67. package/src/commons/ImagePicker/index.js +3 -1
  68. package/src/commons/MediaPlayer/index.js +118 -62
  69. package/src/commons/MediaPlayer/styles.js +56 -0
  70. package/src/commons/MediaPlayerDetail/MediaPlayerDetailStyles.js +15 -0
  71. package/src/commons/MediaPlayerDetail/index.js +149 -64
  72. package/src/commons/MenuActionAddnew/index.js +2 -1
  73. package/src/commons/Modal/ModalCustom.js +22 -0
  74. package/src/commons/Modal/ModalFullVideo.js +48 -0
  75. package/src/commons/Modal/Styles/ModalFullVideoStyles.js +26 -0
  76. package/src/commons/Modal/index.js +4 -0
  77. package/src/commons/NavBar/index.js +2 -2
  78. package/src/commons/Sharing/DevicePermissionsCheckbox.js +2 -1
  79. package/src/commons/Sharing/MemberList.js +3 -1
  80. package/src/commons/Sharing/RowMember.js +3 -2
  81. package/src/commons/Sharing/StationDevicePermissions.js +2 -1
  82. package/src/commons/SubUnit/OneTap/ItemOneTap.js +86 -0
  83. package/src/commons/SubUnit/OneTap/ItemOneTapStyles.js +41 -0
  84. package/src/commons/SubUnit/OneTap/OneTapStyles.js +36 -0
  85. package/src/commons/SubUnit/OneTap/index.js +29 -0
  86. package/src/commons/SubUnit/ShortDetail.js +3 -1
  87. package/src/commons/Today/index.js +2 -1
  88. package/src/commons/Unit/SharedUnit.js +2 -1
  89. package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +1 -2
  90. package/src/commons/UnitSummary/AirQuality/index.js +5 -120
  91. package/src/commons/UnitSummary/AirQuality/styles.js +112 -0
  92. package/src/commons/UnitSummary/TotalPowerConsumption/index.js +2 -1
  93. package/src/commons/WheelDateTimePicker/Picker.js +57 -0
  94. package/src/commons/WheelDateTimePicker/index.js +160 -0
  95. package/src/commons/WheelDateTimePicker/styles.js +21 -0
  96. package/src/configs/API.js +25 -3
  97. package/src/configs/Colors.js +1 -0
  98. package/src/configs/Constants.js +4 -0
  99. package/src/configs/Images.js +4 -0
  100. package/src/configs/SCConfig.js +94 -0
  101. package/src/context/SCContext.tsx +5 -11
  102. package/src/context/reducer.ts +2 -0
  103. package/src/hooks/Common/useStatusBar.js +3 -0
  104. package/src/hooks/Common/useTranslations.ts +34 -0
  105. package/src/iot/Monitor.js +2 -1
  106. package/src/iot/RemoteControl/Bluetooth.js +2 -6
  107. package/src/iot/RemoteControl/GoogleHome.js +1 -1
  108. package/src/iot/RemoteControl/Internet.js +1 -1
  109. package/src/iot/RemoteControl/LG.js +57 -15
  110. package/src/iot/RemoteControl/__test__/Bluetooth.test.js +2 -1
  111. package/src/iot/RemoteControl/__test__/GoogleHome.test.js +2 -1
  112. package/src/iot/RemoteControl/__test__/Internet.test.js +2 -1
  113. package/src/iot/RemoteControl/__test__/index.test.js +2 -1
  114. package/src/iot/RemoteControl/index.js +1 -1
  115. package/src/iot/states.js +1 -0
  116. package/src/navigations/AddGatewayStack.js +5 -0
  117. package/src/navigations/AddNewActionStack.js +23 -0
  118. package/src/navigations/SharedStack.js +2 -1
  119. package/src/navigations/UnitStack.js +72 -1
  120. package/src/screens/AQIGuide/index.js +2 -2
  121. package/src/screens/ActivityLog/hooks/index.js +1 -1
  122. package/src/screens/ActivityLog/index.js +2 -1
  123. package/src/screens/AddCommon/SelectSubUnit.js +143 -0
  124. package/src/screens/AddCommon/SelectSubUnitStyles.js +55 -0
  125. package/src/screens/AddCommon/SelectUnit.js +3 -2
  126. package/src/screens/AddLocationMaps/index.js +2 -1
  127. package/src/screens/AddNewAction/Device/DeviceStyles.js +43 -0
  128. package/src/screens/AddNewAction/Device/index.js +33 -0
  129. package/src/screens/AddNewAction/SelectDevice.js +106 -0
  130. package/src/screens/AddNewAction/Styles/SelectDeviceStyles.js +36 -0
  131. package/src/screens/AddNewDevice/ConnectDevices.js +2 -1
  132. package/src/screens/AddNewDevice/ConnectingDevices.js +2 -1
  133. package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +2 -1
  134. package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +2 -1
  135. package/src/screens/AddNewDevice/__test__/ConnectingDevices.test.js +2 -1
  136. package/src/screens/AddNewDevice/hooks/useStateAlertRename.js +2 -1
  137. package/src/screens/AddNewDevice/index.js +23 -4
  138. package/src/screens/AddNewGateway/AddNewGatewayStyles.js +29 -0
  139. package/src/screens/AddNewGateway/ConnectedGateway.js +2 -1
  140. package/src/screens/AddNewGateway/ConnectingGateway.js +100 -25
  141. package/src/screens/AddNewGateway/ConnectingGatewayStyles.js +92 -0
  142. package/src/screens/AddNewGateway/SetupGatewayWifi.js +25 -3
  143. package/src/screens/AddNewGateway/SetupGatewayWifiStyles.js +6 -1
  144. package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +2 -1
  145. package/src/screens/AddNewGateway/__test__/ConnectedGateway.test.js +2 -1
  146. package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +2 -1
  147. package/src/screens/AddNewGateway/hooks/useStateAlertRename.js +2 -1
  148. package/src/screens/AddNewGateway/index.js +28 -110
  149. package/src/screens/AddNewOneTap/AddNewOneTapStyles.js +43 -0
  150. package/src/screens/AddNewOneTap/index.js +67 -0
  151. package/src/screens/AddNewScriptAction/AddNewScriptActionStyles.js +27 -0
  152. package/src/screens/AddNewScriptAction/index.js +92 -0
  153. package/src/screens/AllCamera/Styles/index.js +101 -0
  154. package/src/screens/AllCamera/index.js +208 -0
  155. package/src/screens/Device/HeaderDevice/styles.js +2 -2
  156. package/src/screens/Device/__test__/detail.test.js +2 -1
  157. package/src/screens/Device/detail.js +66 -23
  158. package/src/screens/Device/hooks/useEmergencyButton.js +7 -6
  159. package/src/screens/Device/styles.js +3 -0
  160. package/src/screens/DeviceInfo/index.js +3 -2
  161. package/src/screens/EditActionsList/Styles/indexStyles.js +73 -0
  162. package/src/screens/EditActionsList/index.js +122 -0
  163. package/src/screens/EmergencyContacts/EmergencyContactsAddNew.js +3 -2
  164. package/src/screens/EmergencyContacts/EmergencyContactsList.js +9 -2
  165. package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +2 -1
  166. package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +2 -1
  167. package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +2 -1
  168. package/src/screens/EmergencyContacts/hook.js +3 -2
  169. package/src/screens/Explore/index.js +3 -2
  170. package/src/screens/GuestInfo/components/AccessScheduleItem.js +27 -0
  171. package/src/screens/GuestInfo/components/AccessScheduleSheet.js +193 -0
  172. package/src/screens/GuestInfo/components/HeaderGuestInfo.js +31 -0
  173. package/src/screens/GuestInfo/components/RecurringDetail.js +99 -0
  174. package/src/screens/GuestInfo/components/RowGuestInfo.js +31 -0
  175. package/src/screens/GuestInfo/components/TemporaryDetail.js +46 -0
  176. package/src/screens/GuestInfo/constant.js +59 -0
  177. package/src/screens/GuestInfo/index.js +151 -0
  178. package/src/screens/GuestInfo/styles/AccessScheduleDetailStyles.js +31 -0
  179. package/src/screens/GuestInfo/styles/AccessScheduleItemStyles.js +22 -0
  180. package/src/screens/GuestInfo/styles/HeaderGuestInfoStyles.js +31 -0
  181. package/src/screens/GuestInfo/styles/indexStyles.js +38 -0
  182. package/src/screens/ManageAccess/__test__/ManageAccess.test.js +82 -0
  183. package/src/screens/ManageAccess/hooks/index.js +32 -0
  184. package/src/screens/ManageAccess/index.js +126 -0
  185. package/src/screens/ManageAccess/styles/ManageAccessStyles.js +72 -0
  186. package/src/screens/PlayBackCamera/Styles/TimerStyles.js +22 -0
  187. package/src/screens/PlayBackCamera/Styles/index.js +81 -0
  188. package/src/screens/PlayBackCamera/Timer.js +127 -0
  189. package/src/screens/PlayBackCamera/index.js +233 -0
  190. package/src/screens/ScanChipQR/components/QRScan/index.js +2 -1
  191. package/src/screens/ScanChipQR/hooks/index.js +4 -11
  192. package/src/screens/ScriptDetail/Styles/indexStyles.js +140 -0
  193. package/src/screens/ScriptDetail/index.js +241 -0
  194. package/src/screens/SharedUnit/TabHeader.js +2 -1
  195. package/src/screens/SharedUnit/index.js +3 -2
  196. package/src/screens/Sharing/MemberList.js +2 -1
  197. package/src/screens/Sharing/SelectPermission.js +2 -1
  198. package/src/screens/Sharing/SelectUser.js +3 -2
  199. package/src/screens/Sharing/__test__/MemberList.test.js +2 -1
  200. package/src/screens/Sharing/__test__/SelectUser.test.js +2 -1
  201. package/src/screens/Sharing/hooks/index.js +22 -17
  202. package/src/screens/SubUnit/AddSubUnit.js +14 -72
  203. package/src/screens/SubUnit/AddSubUnitStyles.js +66 -0
  204. package/src/screens/SubUnit/Detail.js +5 -63
  205. package/src/screens/SubUnit/DetailStyles.js +46 -0
  206. package/src/screens/SubUnit/ManageSubUnit.js +5 -4
  207. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +2 -1
  208. package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +2 -1
  209. package/src/screens/SyncLGDevice/AddLGDevice.js +3 -2
  210. package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +2 -1
  211. package/src/screens/TDSGuide/index.js +2 -1
  212. package/src/screens/UVIndexGuide/index.js +2 -1
  213. package/src/screens/Unit/AddMenu.js +3 -2
  214. package/src/screens/Unit/Detail.js +75 -20
  215. package/src/screens/Unit/ManageUnit/index.js +4 -3
  216. package/src/screens/Unit/ManageUnit.js +4 -3
  217. package/src/screens/Unit/MoreMenu.js +3 -2
  218. package/src/screens/Unit/SelectLocation.js +10 -2
  219. package/src/screens/Unit/SelectLocationStyles.js +11 -0
  220. package/src/screens/Unit/components/Header/index.js +2 -1
  221. package/src/screens/Unit/components/ListMyAllUnit/index.js +2 -1
  222. package/src/screens/Unit/components/MyUnit/index.js +2 -1
  223. package/src/screens/Unit/components/SearchLocation/index.js +2 -1
  224. package/src/screens/Unit/components/SharedUnit/index.js +2 -1
  225. package/src/screens/Unit/styles.js +4 -0
  226. package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +2 -1
  227. package/src/screens/UnitSummary/components/PowerConsumption/index.js +2 -1
  228. package/src/screens/UnitSummary/components/Temperature/index.js +2 -1
  229. package/src/screens/UnitSummary/components/TotalPowerConsumption/index.js +2 -1
  230. package/src/screens/UnitSummary/components/UvIndex/index.js +2 -1
  231. package/src/screens/UnitSummary/components/WaterQuality/index.js +2 -1
  232. package/src/screens/UnitSummary/index.js +2 -1
  233. package/src/screens/WaterQualityGuide/index.js +2 -1
  234. package/src/utils/Converter/__test__/time.test.js +3 -1
  235. package/src/utils/Converter/array.js +4 -0
  236. package/src/utils/Converter/time.js +29 -4
  237. package/src/utils/I18n/index.ts +6 -0
  238. package/src/utils/I18n/translations/en.json +51 -2
  239. package/src/utils/I18n/translations/vi.json +48 -1
  240. package/src/utils/I18n/translations.ts +45 -0
  241. package/src/utils/Route/index.js +11 -0
  242. package/src/utils/I18n/index.js +0 -19
@@ -1,35 +1,127 @@
1
- import React, { memo, useCallback, useState } from 'react';
2
- import { Image, View, StyleSheet, Text, TouchableOpacity } from 'react-native';
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 { t } from 'i18n-js';
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 MediaPlayer = memo(({ uri, thumbnail, style }) => {
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
- if (paused) {
13
- setPaused(false);
14
- } else {
15
- setPaused(true);
16
- }
17
- }, [paused]);
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
- <Text style={styles.loadingText}>{t('loading')}</Text>
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
- {paused ? (
121
+ {!started ? (
30
122
  <View style={[styles.player, style]}>
31
123
  <Image
32
- source={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
- <VLCPlayer
46
- autoAspectRatio={true}
47
- videoAspectRatio="21:9"
48
- source={{ uri: uri }}
49
- style={[styles.player, style]}
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
- <View style={[styles.bottomView]}>{paused && <PauseIcon />}</View>
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(({ uri, cameraName, thumbnail, style }) => {
12
- const [paused, setPaused] = useState(true);
13
- const onTapPause = useCallback(() => {
14
- setPaused(false);
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
- const onTapGoDetail = useCallback(() => {
18
- if (!paused) {
19
- setPaused(true);
20
- } else {
21
- // eslint-disable-next-line no-alert
22
- alert(t('feature_under_development'));
23
- }
24
- }, [paused]);
25
- const source = !thumbnail || !thumbnail.uri ? Images.BgDevice : thumbnail;
26
- return (
27
- <View style={styles.wrap}>
28
- <View style={styles.loadingWrap}>
29
- <Text style={styles.loadingText}>{t('loading')}</Text>
30
- </View>
31
- <TouchableOpacity
32
- activeOpacity={1}
33
- style={styles.videoBtn}
34
- onPress={onTapGoDetail}
35
- >
36
- {paused ? (
37
- <View style={[styles.player, style]}>
38
- <Image
39
- source={source}
40
- style={styles.player}
41
- defaultSource={Images.BgDevice}
42
- resizeMode="cover"
43
- />
44
- <View
45
- style={[
46
- StyleSheet.absoluteFillObject,
47
- { backgroundColor: colorOpacity(Colors.Black, 0.3) },
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
- </View>
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
- <View style={styles.buttonView}>
61
- <View style={styles.buttonPause}>
62
- <TouchableOpacity
63
- onPress={onTapPause}
64
- style={styles.btn}
65
- activeOpacity={0.8}
66
- >
67
- {paused && <PauseIcon />}
68
- </TouchableOpacity>
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
- </View>
71
- </TouchableOpacity>
138
+ </TouchableOpacity>
72
139
 
73
- {cameraName && <Text style={styles.cameraName}>{cameraName}</Text>}
74
- </View>
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 { t } from 'i18n-js';
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
+ });
@@ -0,0 +1,4 @@
1
+ import ModalCustom from './ModalCustom';
2
+ import ModalFullVideo from './ModalFullVideo';
3
+
4
+ export { ModalCustom, ModalFullVideo };
@@ -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 { t } from 'i18n-js';
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