@eohjsc/react-native-smart-city 0.2.56 → 0.2.60

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 (126) hide show
  1. package/assets/images/Map/MarkerGeolocation.svg +4 -0
  2. package/assets/images/SonosSpeaker/buttonpause-active.svg +3 -0
  3. package/assets/images/SonosSpeaker/buttonpause-notactive.svg +3 -0
  4. package/assets/images/SonosSpeaker/picture-main-notactive.svg +5 -0
  5. package/assets/images/SonosSpeaker/picture-main.svg +6 -0
  6. package/assets/images/SonosSpeaker/picture-volume.svg +3 -0
  7. package/package.json +4 -22
  8. package/src/Images/Common/buttonLeftCurtain.png +0 -0
  9. package/src/Images/Common/buttonPause-center-curtain.png +0 -0
  10. package/src/Images/Common/buttonRightCurtain.png +0 -0
  11. package/src/commons/ActionGroup/CurtainButtonTemplate.js +139 -0
  12. package/src/commons/ActionGroup/CurtainButtonTemplateStyle.js +58 -0
  13. package/src/commons/ActionGroup/__test__/CurtainButtonTemplate.test.js +72 -0
  14. package/src/commons/ActionGroup/index.js +3 -0
  15. package/src/commons/Auth/__test__/AccountList.test.js +33 -0
  16. package/src/commons/CameraDevice/index.js +2 -0
  17. package/src/commons/CardShadow/index.js +1 -1
  18. package/src/commons/CardShadow/styles.js +1 -3
  19. package/src/commons/DateTimeRangeChange/DateTimeButton.js +1 -1
  20. package/src/commons/DateTimeRangeChange/index.js +2 -2
  21. package/src/commons/Device/HistoryChart.js +21 -55
  22. package/src/commons/Device/HorizontalBarChart.js +46 -30
  23. package/src/commons/Device/LinearChart.js +0 -34
  24. package/src/commons/Device/PMSensor/PMSensorIndicatior.js +1 -1
  25. package/src/commons/Device/PMSensor/PMSensorIndicatorStyles.js +2 -1
  26. package/src/commons/Device/SonosSpeaker/__test__/SonosSpeaker.test.js +57 -0
  27. package/src/commons/Device/SonosSpeaker/index.js +88 -0
  28. package/src/commons/Device/SonosSpeaker/styles.js +57 -0
  29. package/src/commons/Form/CurrencyInput.js +169 -0
  30. package/src/commons/Form/__test__/CurrencyInput.test.js +65 -0
  31. package/src/commons/FourButtonFilterHistory/__test__/FourButtonFilterHistory.test.js +48 -0
  32. package/src/commons/FourButtonFilterHistory/index.js +72 -0
  33. package/src/commons/FourButtonFilterHistory/styles.js +22 -0
  34. package/src/commons/MediaPlayerDetail/Styles/MediaPlayerDetailStyles.js +14 -0
  35. package/src/commons/MediaPlayerDetail/index.js +204 -161
  36. package/src/commons/SearchLocation/index.js +0 -1
  37. package/src/commons/Sharing/RowMember.js +7 -2
  38. package/src/commons/Sharing/__test__/RowMember.test.js +42 -0
  39. package/src/commons/SubUnit/ShortDetail.js +12 -6
  40. package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +1 -1
  41. package/src/commons/UnitSummary/ConfigHistoryChart.js +2 -1
  42. package/src/configs/API.js +13 -3
  43. package/src/configs/Constants.js +14 -4
  44. package/src/configs/Images.js +3 -0
  45. package/src/configs/SCConfig.js +8 -0
  46. package/src/context/actionType.ts +5 -0
  47. package/src/context/mockStore.ts +3 -0
  48. package/src/context/reducer.ts +14 -0
  49. package/src/iot/RemoteControl/Bluetooth.js +14 -0
  50. package/src/iot/RemoteControl/index.js +0 -1
  51. package/src/navigations/UnitStack.js +42 -4
  52. package/src/screens/ActivityLog/FilterPopup.js +1 -1
  53. package/src/screens/ActivityLog/ItemLog.js +11 -2
  54. package/src/screens/ActivityLog/__test__/ItemLog.test.js +46 -0
  55. package/src/screens/ActivityLog/hooks/index.js +1 -0
  56. package/src/screens/ActivityLog/index.js +0 -1
  57. package/src/screens/AddCommon/SelectSubUnit.js +24 -2
  58. package/src/screens/AddCommon/SelectUnit.js +12 -0
  59. package/src/screens/AddLocationMaps/index.js +139 -44
  60. package/src/screens/AddLocationMaps/indexStyle.js +14 -12
  61. package/src/screens/AddNewAction/SelectAction.js +1 -0
  62. package/src/screens/Automate/MultiUnits.js +8 -8
  63. package/src/screens/Automate/__test__/MultiUnits.test.js +2 -2
  64. package/src/screens/Automate/__test__/index.test.js +2 -0
  65. package/src/screens/Automate/index.js +4 -2
  66. package/src/screens/Device/__test__/detail.test.js +3 -7
  67. package/src/screens/Device/components/SensorDisplayItem.js +10 -10
  68. package/src/screens/Device/detail.js +65 -15
  69. package/src/screens/Device/hooks/useDisconnectedDevice.js +32 -26
  70. package/src/screens/Device/styles.js +3 -3
  71. package/src/screens/EmergencySetting/__test__/DropDownItem.test.js +59 -0
  72. package/src/screens/EmergencySetting/__test__/index.test.js +27 -0
  73. package/src/screens/EmergencySetting/components/DropDownItem.js +54 -0
  74. package/src/screens/EmergencySetting/index.js +90 -0
  75. package/src/screens/EmergencySetting/styles/DropDownItem.js +38 -0
  76. package/src/screens/EmergencySetting/styles.js +19 -0
  77. package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +126 -0
  78. package/src/screens/MoveToAnotherSubUnit/index.js +88 -0
  79. package/src/screens/MoveToAnotherSubUnit/styles/MoveToAnotherSubUnitStyles.js +50 -0
  80. package/src/screens/Notification/__test__/Notification.test.js +3 -3
  81. package/src/screens/Notification/components/NotificationItem.js +3 -6
  82. package/src/screens/Notification/index.js +2 -2
  83. package/src/screens/ScriptDetail/Styles/indexStyles.js +0 -1
  84. package/src/screens/ScriptDetail/__test__/index.test.js +13 -0
  85. package/src/screens/ScriptDetail/index.js +20 -17
  86. package/src/screens/SelectUnit/index.js +2 -0
  87. package/src/screens/Sharing/MemberList.js +2 -9
  88. package/src/screens/SubUnit/AddSubUnit.js +79 -59
  89. package/src/screens/SubUnit/AddSubUnitStyles.js +0 -2
  90. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +4 -3
  91. package/src/screens/TDSGuide/index.js +6 -4
  92. package/src/screens/Unit/ChooseLocation.js +96 -0
  93. package/src/screens/Unit/ChooseLocationStyles.js +26 -0
  94. package/src/screens/Unit/Detail.js +14 -2
  95. package/src/screens/Unit/ManageUnit.js +4 -5
  96. package/src/screens/Unit/SelectAddress.js +240 -0
  97. package/src/screens/Unit/SelectAddressStyles.js +48 -0
  98. package/src/screens/Unit/SmartAccountItem.js +1 -1
  99. package/src/screens/Unit/Summaries.js +5 -1
  100. package/src/screens/Unit/__test__/ChooseLocation.test.js +112 -0
  101. package/src/screens/Unit/__test__/SelectAddress.test.js +216 -0
  102. package/src/screens/Unit/components/MyUnitDevice/index.js +21 -5
  103. package/src/screens/Unit/hook/useStateAlertRemove.js +3 -1
  104. package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +2 -2
  105. package/src/screens/UnitSummary/components/PowerConsumption/index.js +3 -2
  106. package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +1 -3
  107. package/src/screens/UnitSummary/index.js +3 -2
  108. package/src/screens/WaterQualityGuide/index.js +1 -0
  109. package/src/utils/Apis/axios.js +17 -5
  110. package/src/utils/I18n/translations/en.json +19 -4
  111. package/src/utils/I18n/translations/vi.json +22 -7
  112. package/src/utils/Route/index.js +4 -1
  113. package/src/utils/Utils.js +22 -2
  114. package/assets/images/AddLocationMaps/PinLocation.svg +0 -3
  115. package/assets/images/AddLocationMaps/Point.svg +0 -3
  116. package/src/commons/ThreeButtonHistory/CalendarHeader.js +0 -35
  117. package/src/commons/ThreeButtonHistory/CalendarHeaderStyles.js +0 -17
  118. package/src/commons/ThreeButtonHistory/SelectMonth.js +0 -53
  119. package/src/commons/ThreeButtonHistory/SelectMonthStyles.js +0 -29
  120. package/src/commons/ThreeButtonHistory/__test__/SelectMonth.test.js +0 -37
  121. package/src/commons/ThreeButtonHistory/__test__/ThreeButtonHistory.test.js +0 -231
  122. package/src/commons/ThreeButtonHistory/index.js +0 -281
  123. package/src/commons/ThreeButtonHistory/styles.js +0 -65
  124. package/src/screens/Unit/ManageUnit/index.js +0 -286
  125. package/src/screens/Unit/SelectLocation.js +0 -161
  126. package/src/screens/Unit/SelectLocationStyles.js +0 -114
@@ -0,0 +1,72 @@
1
+ import React, { memo, useCallback, useMemo } from 'react';
2
+ import { View, TouchableOpacity } from 'react-native';
3
+ import Text from '../Text';
4
+ import { Colors } from '../../configs';
5
+ import styles from './styles';
6
+
7
+ const FourButtonFilterHistory = memo(({ groupBy, setGroupBy }) => {
8
+ const listItem = useMemo(
9
+ () => [
10
+ {
11
+ title: 'D',
12
+ data: 'date',
13
+ },
14
+
15
+ {
16
+ title: 'W',
17
+ data: 'week',
18
+ },
19
+
20
+ {
21
+ title: 'M',
22
+ data: 'month',
23
+ },
24
+
25
+ {
26
+ title: 'Y',
27
+ data: 'year',
28
+ },
29
+ ],
30
+ []
31
+ );
32
+
33
+ const ItemButton = memo(({ title, onPress, isSelected }) => {
34
+ return (
35
+ <TouchableOpacity
36
+ onPress={onPress}
37
+ style={[styles.button, isSelected && styles.selectedButton]}
38
+ >
39
+ <View>
40
+ <Text bold color={isSelected && Colors.Primary}>
41
+ {title}
42
+ </Text>
43
+ </View>
44
+ </TouchableOpacity>
45
+ );
46
+ }, []);
47
+
48
+ const onPressButton = useCallback(
49
+ (data) => () => {
50
+ setGroupBy(data);
51
+ },
52
+ [setGroupBy]
53
+ );
54
+
55
+ return (
56
+ <View style={styles.row}>
57
+ {listItem &&
58
+ listItem.map((item, index) => {
59
+ return (
60
+ <ItemButton
61
+ key={index}
62
+ title={item.title}
63
+ onPress={onPressButton(item.data)}
64
+ isSelected={item.data === groupBy}
65
+ />
66
+ );
67
+ })}
68
+ </View>
69
+ );
70
+ });
71
+
72
+ export default FourButtonFilterHistory;
@@ -0,0 +1,22 @@
1
+ import { StyleSheet } from 'react-native';
2
+ import { Colors } from '../../configs';
3
+
4
+ export default StyleSheet.create({
5
+ row: {
6
+ flexDirection: 'row',
7
+ alignItems: 'center',
8
+ backgroundColor: Colors.Gray4,
9
+ borderRadius: 5,
10
+ padding: 2,
11
+ },
12
+ button: {
13
+ width: 31,
14
+ height: 28,
15
+ alignItems: 'center',
16
+ justifyContent: 'center',
17
+ borderRadius: 5,
18
+ },
19
+ selectedButton: {
20
+ backgroundColor: Colors.White,
21
+ },
22
+ });
@@ -68,4 +68,18 @@ export default StyleSheet.create({
68
68
  right: 0,
69
69
  bottom: 0,
70
70
  },
71
+ firstOpenCamera: {
72
+ zIndex: -9999,
73
+ position: 'absolute',
74
+ width: 1,
75
+ height: 1,
76
+ },
77
+ loading: {
78
+ position: 'absolute',
79
+ zIndex: 10,
80
+ width: '100%',
81
+ height: '100%',
82
+ justifyContent: 'center',
83
+ alignItems: 'center',
84
+ },
71
85
  });
@@ -1,7 +1,21 @@
1
- import React, { memo, useCallback, useState, useEffect } from 'react';
2
- import { Image, View, StyleSheet, Text, TouchableOpacity } from 'react-native';
1
+ import React, {
2
+ memo,
3
+ useCallback,
4
+ useState,
5
+ useEffect,
6
+ useContext,
7
+ useMemo,
8
+ } from 'react';
9
+ import {
10
+ Image,
11
+ View,
12
+ StyleSheet,
13
+ Text,
14
+ TouchableOpacity,
15
+ Platform,
16
+ ActivityIndicator,
17
+ } from 'react-native';
3
18
  import { VLCPlayer } from 'react-native-vlc-media-player';
4
- import { getStatusBarHeight } from 'react-native-iphone-x-helper';
5
19
  import { useTranslations } from '../../hooks/Common/useTranslations';
6
20
 
7
21
  import PauseIcon from '../../../assets/images/Common/Pause.svg';
@@ -10,174 +24,203 @@ import { colorOpacity } from '../../utils/Converter/color';
10
24
  import styles from './Styles/MediaPlayerDetailStyles';
11
25
  import FImage from '../../commons/FImage';
12
26
  import { TESTID } from '../../configs/Constants';
27
+ import { SCContext, useSCContextSelector } from '../../context';
28
+ import { Action } from '../../context/actionType';
13
29
 
14
- const MediaPlayerDetail = memo(
15
- ({
16
- uri,
17
- cameraName,
18
- thumbnail,
19
- style,
20
- wrapStyles,
21
- resizeMode = 'none',
22
- amount,
23
- handleFullScreen,
24
- isFullScreen = false,
25
- isPaused = true,
26
- goToPlayBack,
27
- isShowFullScreenIcon = false,
28
- }) => {
29
- const t = useTranslations();
30
- const [paused, setPaused] = useState(isPaused);
31
- const onTapPause = useCallback(() => {
32
- setPaused(false);
33
- }, []);
30
+ const MediaPlayerDetail = ({
31
+ uri,
32
+ cameraName,
33
+ thumbnail,
34
+ style,
35
+ wrapStyles,
36
+ amount,
37
+ handleFullScreen,
38
+ isPaused = true,
39
+ goToPlayBack,
40
+ isShowFullScreenIcon = false,
41
+ width,
42
+ height,
43
+ }) => {
44
+ const { setAction } = useContext(SCContext);
45
+ const isFirstOpenCamera = useSCContextSelector(
46
+ (state) => state.app.isFirstOpenCamera
47
+ );
48
+ const t = useTranslations();
49
+ const [paused, setPaused] = useState(isPaused);
34
50
 
35
- const onTapGoDetail = useCallback(() => {
36
- if (!paused) {
37
- setPaused(true);
38
- } else {
39
- goToPlayBack && goToPlayBack();
40
- }
41
- // eslint-disable-next-line react-hooks/exhaustive-deps
42
- }, [paused]);
51
+ const onTapPause = useCallback(() => {
52
+ !isFirstOpenCamera && setPaused(false);
53
+ }, [isFirstOpenCamera]);
43
54
 
44
- const onFullScreen = useCallback(() => {
45
- handleFullScreen && handleFullScreen({ uri, cameraName, thumbnail });
46
- // eslint-disable-next-line react-hooks/exhaustive-deps
47
- }, []);
55
+ const onTapGoDetail = useCallback(() => {
56
+ if (!paused) {
57
+ setPaused(true);
58
+ } else {
59
+ goToPlayBack && goToPlayBack();
60
+ }
61
+ // eslint-disable-next-line react-hooks/exhaustive-deps
62
+ }, [paused]);
48
63
 
49
- useEffect(() => {
50
- setPaused(isPaused);
51
- }, [isPaused]);
64
+ const onFullScreen = useCallback(() => {
65
+ handleFullScreen && handleFullScreen({ uri, cameraName, thumbnail });
66
+ // eslint-disable-next-line react-hooks/exhaustive-deps
67
+ }, []);
52
68
 
53
- const source = !thumbnail || !thumbnail.uri ? Images.BgDevice : thumbnail;
69
+ const getWidthHeight = useCallback(() => {
70
+ let width = 0,
71
+ height = 0;
72
+ switch (amount) {
73
+ case 1:
74
+ width = Constants.width;
75
+ height = 224;
76
+ break;
77
+ case 4:
78
+ width = Constants.width / 2;
79
+ height = 112;
80
+ break;
81
+ case 6:
82
+ width = Constants.width / 3;
83
+ height = 112;
84
+ break;
85
+ default:
86
+ width = Constants.width - 28;
87
+ height = 162;
88
+ break;
89
+ }
90
+ return {
91
+ width,
92
+ height,
93
+ };
94
+ }, [amount]);
95
+
96
+ const renderCamera = useMemo(() => {
54
97
  return (
55
- <View style={[styles.wrap, wrapStyles]}>
56
- <View
98
+ <VLCPlayer
99
+ autoAspectRatio={true}
100
+ videoAspectRatio={
101
+ width && height
102
+ ? `${width}:${height}`
103
+ : `${getWidthHeight().width}:${getWidthHeight().height}`
104
+ }
105
+ source={{
106
+ initType: 2,
107
+ hwDecoderEnabled: 1,
108
+ hwDecoderForced: 1,
109
+ uri,
110
+ initOptions: [
111
+ '--no-audio',
112
+ '--rtsp-tcp',
113
+ '--network-caching=150',
114
+ '--rtsp-caching=150',
115
+ '--no-stats',
116
+ '--tcp-caching=150',
117
+ '--realrtsp-caching=150',
118
+ ],
119
+ }}
120
+ style={[
121
+ styles.player,
122
+ style,
123
+ {
124
+ width: width || getWidthHeight().width,
125
+ height: height || getWidthHeight().height,
126
+ },
127
+ isFirstOpenCamera && styles.firstOpenCamera,
128
+ ]}
129
+ isLive={true}
130
+ />
131
+ );
132
+ // eslint-disable-next-line react-hooks/exhaustive-deps
133
+ }, [uri, isFirstOpenCamera]);
134
+
135
+ useEffect(() => {
136
+ setPaused(isPaused);
137
+ }, [isPaused]);
138
+
139
+ useEffect(() => {
140
+ if (isFirstOpenCamera) {
141
+ const to = setTimeout(() => {
142
+ setAction(Action.IS_FIRST_OPEN_CAMERA, false);
143
+ clearTimeout(to);
144
+ }, 1000);
145
+ }
146
+ // eslint-disable-next-line react-hooks/exhaustive-deps
147
+ }, [isFirstOpenCamera]);
148
+
149
+ const source = !thumbnail || !thumbnail.uri ? Images.BgDevice : thumbnail;
150
+ return (
151
+ <View style={[styles.wrap, wrapStyles]}>
152
+ {isFirstOpenCamera && Platform.OS === 'ios' && (
153
+ <>
154
+ {renderCamera}
155
+ <View style={styles.loading}>
156
+ <ActivityIndicator size={'small'} color={Colors.Primary} />
157
+ </View>
158
+ </>
159
+ )}
160
+ <View style={[styles.loadingWrap]}>
161
+ <Text style={styles.loadingText}>{t('loading')}</Text>
162
+ </View>
163
+ <TouchableOpacity
164
+ activeOpacity={1}
165
+ style={styles.videoBtn}
166
+ onPress={onTapGoDetail}
167
+ >
168
+ {paused ? (
169
+ <View style={[styles.player, style]}>
170
+ <FImage
171
+ source={source}
172
+ style={[styles.player, style]}
173
+ defaultSource={Images.BgDevice}
174
+ resizeMode="cover"
175
+ />
176
+ <View
177
+ style={[
178
+ StyleSheet.absoluteFillObject,
179
+ { backgroundColor: colorOpacity(Colors.Black, 0.3) },
180
+ ]}
181
+ />
182
+ </View>
183
+ ) : (
184
+ !isFirstOpenCamera && renderCamera
185
+ )}
186
+
187
+ <View style={styles.buttonView}>
188
+ <View style={styles.buttonPause}>
189
+ <TouchableOpacity
190
+ onPress={onTapPause}
191
+ style={[styles.btn]}
192
+ activeOpacity={0.8}
193
+ >
194
+ {paused && <PauseIcon />}
195
+ </TouchableOpacity>
196
+ </View>
197
+ </View>
198
+ </TouchableOpacity>
199
+
200
+ {cameraName && paused && (
201
+ <Text
57
202
  style={[
58
- styles.loadingWrap,
59
- isFullScreen && { transform: [{ rotate: '90deg' }] },
203
+ styles.cameraName,
204
+ amount && amount !== 1 && styles.cameraName2,
60
205
  ]}
61
206
  >
62
- <Text style={styles.loadingText}>{t('loading')}</Text>
63
- </View>
207
+ {cameraName}
208
+ </Text>
209
+ )}
210
+ {isShowFullScreenIcon && (
64
211
  <TouchableOpacity
65
- activeOpacity={1}
66
- style={styles.videoBtn}
67
- onPress={onTapGoDetail}
212
+ onPress={onFullScreen}
213
+ style={[
214
+ styles.iconFullScreen,
215
+ (amount === 4 || amount === 6) && styles.iconFullScreen2,
216
+ ]}
217
+ testID={TESTID.SUB_UNIT_FULL_CAMERA}
68
218
  >
69
- {paused ? (
70
- <View style={[styles.player, style]}>
71
- <FImage
72
- source={source}
73
- style={[
74
- styles.player,
75
- style,
76
- isFullScreen && {
77
- marginLeft: -Constants.width / 2 - getStatusBarHeight(),
78
- width: Constants.height,
79
- height: Constants.width,
80
- transform: [{ rotate: '90deg' }],
81
- },
82
- ]}
83
- defaultSource={Images.BgDevice}
84
- resizeMode="cover"
85
- />
86
- <View
87
- style={[
88
- StyleSheet.absoluteFillObject,
89
- { backgroundColor: colorOpacity(Colors.Black, 0.3) },
90
- ]}
91
- />
92
- </View>
93
- ) : isFullScreen ? (
94
- <View style={{ transform: [{ rotate: '90deg' }] }}>
95
- <VLCPlayer
96
- autoAspectRatio={true}
97
- videoAspectRatio={`${Constants.height}:${Constants.width}`}
98
- source={{ uri }}
99
- style={[
100
- {
101
- width: Constants.height,
102
- height: Constants.width,
103
- },
104
- ]}
105
- />
106
- </View>
107
- ) : (
108
- <VLCPlayer
109
- autoAspectRatio={true}
110
- videoAspectRatio={
111
- !amount
112
- ? '21:9'
113
- : amount === 1
114
- ? '15:9'
115
- : amount === 4
116
- ? '5:3'
117
- : '10:9'
118
- }
119
- source={{
120
- initType: 2,
121
- hwDecoderEnabled: 1,
122
- hwDecoderForced: 1,
123
- uri,
124
- initOptions: [
125
- '--no-audio',
126
- '--rtsp-tcp',
127
- '--network-caching=150',
128
- '--rtsp-caching=150',
129
- '--no-stats',
130
- '--tcp-caching=150',
131
- '--realrtsp-caching=150',
132
- ],
133
- }}
134
- style={[styles.player, style]}
135
- resizeMode={resizeMode}
136
- isLive={true}
137
- />
138
- )}
139
-
140
- <View style={styles.buttonView}>
141
- <View style={styles.buttonPause}>
142
- <TouchableOpacity
143
- onPress={onTapPause}
144
- style={[
145
- styles.btn,
146
- isFullScreen && { transform: [{ rotate: '90deg' }] },
147
- ]}
148
- activeOpacity={0.8}
149
- >
150
- {paused && <PauseIcon />}
151
- </TouchableOpacity>
152
- </View>
153
- </View>
219
+ <Image source={Images.fullscreen} />
154
220
  </TouchableOpacity>
221
+ )}
222
+ </View>
223
+ );
224
+ };
155
225
 
156
- {cameraName && paused && (
157
- <Text
158
- style={[
159
- styles.cameraName,
160
- amount && amount !== 1 && styles.cameraName2,
161
- ]}
162
- >
163
- {cameraName}
164
- </Text>
165
- )}
166
- {isShowFullScreenIcon && (
167
- <TouchableOpacity
168
- onPress={onFullScreen}
169
- style={[
170
- styles.iconFullScreen,
171
- (amount === 4 || amount === 6) && styles.iconFullScreen2,
172
- ]}
173
- testID={TESTID.SUB_UNIT_FULL_CAMERA}
174
- >
175
- <Image source={Images.fullscreen} />
176
- </TouchableOpacity>
177
- )}
178
- </View>
179
- );
180
- }
181
- );
182
-
183
- export default MediaPlayerDetail;
226
+ export default memo(MediaPlayerDetail);
@@ -23,7 +23,6 @@ const SearchBarLocation = memo(({ input, onTextInput }) => {
23
23
  onChangeText={onTextInput}
24
24
  placeholder={t('choose_location')}
25
25
  placeholderTextColor={Colors.Gray6}
26
- underlineColorAndroid={null}
27
26
  />
28
27
  </View>
29
28
  );
@@ -5,6 +5,7 @@ import { useTranslations } from '../../hooks/Common/useTranslations';
5
5
 
6
6
  import { Colors } from '../../configs';
7
7
  import Text from '../../commons/Text';
8
+ import { shortEmailName } from '../../utils/Utils';
8
9
 
9
10
  import BtnRemoveMember from './BtnRemoveMember';
10
11
 
@@ -34,7 +35,9 @@ const RowMember = memo(
34
35
  [currentUserId, member.id, ownerId, t]
35
36
  );
36
37
  const paddingBottom = role ? 16 : 23;
37
-
38
+ if (member?.id === ownerId && member?.share_id) {
39
+ return null;
40
+ }
38
41
  return (
39
42
  <View style={styles.rowContainer}>
40
43
  <View
@@ -46,7 +49,9 @@ const RowMember = memo(
46
49
  <IconOutline name={'user'} size={20} color={Colors.White} />
47
50
  </View>
48
51
  <View style={[styles.infoContainer, { paddingBottom: paddingBottom }]}>
49
- <Text style={styles.textName}>{member.name ?? 'N/A'}</Text>
52
+ <Text style={styles.textName}>
53
+ {member?.name || shortEmailName(member.email) || ''}
54
+ </Text>
50
55
  {!!role && (
51
56
  <Text style={[styles.textRole, { color: roleColor }]}>{role}</Text>
52
57
  )}
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import renderer, { act } from 'react-test-renderer';
3
+ import RowMember from '../RowMember';
4
+ import Text from '../../Text';
5
+ import { SCProvider } from '../../../context';
6
+ import { mockSCStore } from '../../../context/mockStore';
7
+
8
+ const wrapComponent = (member, ownerId, currentUserId, mockFunc) => (
9
+ <SCProvider initState={mockSCStore({})}>
10
+ <RowMember
11
+ member={member}
12
+ ownerId={ownerId}
13
+ currentUserId={currentUserId}
14
+ onPressRemove={mockFunc}
15
+ />
16
+ </SCProvider>
17
+ );
18
+
19
+ describe('RowMember', () => {
20
+ let tree;
21
+ const mockFunc = jest.fn();
22
+ test('RowMember owner have name', () => {
23
+ const dataMember = { id: 1, name: 'CEO' };
24
+ act(() => {
25
+ tree = renderer.create(wrapComponent(dataMember, 1, 1, mockFunc));
26
+ });
27
+ const instance = tree.root;
28
+ const textInputs = instance.findAllByType(Text);
29
+ expect(textInputs.length).toBe(2);
30
+ expect(textInputs[0].props.children).toEqual('CEO');
31
+ });
32
+ test('RowMember owner dont have name show start of email ', () => {
33
+ const dataMember = { id: 1, name: '', email: 'abc@gmail.com' };
34
+ act(() => {
35
+ tree = renderer.create(wrapComponent(dataMember, 1, 1, mockFunc));
36
+ });
37
+ const instance = tree.root;
38
+ const textInputs = instance.findAllByType(Text);
39
+ expect(textInputs.length).toBe(2);
40
+ expect(textInputs[0].props.children).toEqual('abc');
41
+ });
42
+ });
@@ -9,10 +9,10 @@ import { Section } from '../Section';
9
9
  import Text from '../Text';
10
10
  import ItemDevice from '../Device/ItemDevice';
11
11
  import ItemAddNew from '../Device/ItemAddNew';
12
- import MediaPlayer from '../MediaPlayer';
13
12
  import { standardizeCameraScreenSize } from '../../utils/Utils';
14
13
  import Routes from '../../utils/Route';
15
14
  import FastImage from 'react-native-fast-image';
15
+ import MediaPlayerDetail from '../MediaPlayerDetail';
16
16
 
17
17
  const { standardizeWidth, standardizeHeight } = standardizeCameraScreenSize(
18
18
  Device.screenWidth - 32
@@ -21,23 +21,29 @@ const { standardizeWidth, standardizeHeight } = standardizeCameraScreenSize(
21
21
  const ShortDetailSubUnit = ({ unit, station, isGGHomeConnected }) => {
22
22
  const t = useTranslations();
23
23
  const { navigate } = useNavigation();
24
+
24
25
  const renderCamera = () => {
25
26
  if (station?.camera) {
26
27
  return (
27
28
  <View
28
29
  style={[
29
30
  styles.boxImage,
30
- { width: standardizeWidth, height: standardizeHeight },
31
+ {
32
+ width: standardizeWidth,
33
+ height: standardizeHeight,
34
+ },
31
35
  ]}
32
36
  testID={TESTID.SUB_UNIT_CAMERA_VIEW}
33
37
  >
34
- <MediaPlayer
38
+ <MediaPlayerDetail
35
39
  uri={station.camera.uri}
36
- previewUri={station.camera.preview_uri}
37
40
  thumbnail={{
38
41
  uri: station.background,
39
42
  }}
40
- key={`camera-${station.camera.id}`}
43
+ key={`camera-device-${station?.camera?.id}`}
44
+ cameraName={station?.camera?.name}
45
+ width={standardizeWidth}
46
+ height={standardizeHeight}
41
47
  />
42
48
  </View>
43
49
  );
@@ -78,7 +84,7 @@ const ShortDetailSubUnit = ({ unit, station, isGGHomeConnected }) => {
78
84
  const itemAddNewTitle = t(
79
85
  station?.isFavorites
80
86
  ? 'add_to_favorites'
81
- : station?.name === SubUnitName.scenario
87
+ : station?.name === SubUnitName.smart
82
88
  ? 'add_script'
83
89
  : 'add_new'
84
90
  );
@@ -163,7 +163,7 @@ const SegmentedRoundDisplay = ({
163
163
  <Text
164
164
  x={svgWidth / 2 + 50}
165
165
  fontWeight="normal"
166
- fontSize={valueText.toString().length >= 6 ? 46 : 56}
166
+ fontSize={valueText.toString().length >= 6 ? 35 : 56}
167
167
  y={svgHeight / 2 + 30}
168
168
  fill={filledArcColor}
169
169
  textAnchor="middle"
@@ -45,7 +45,8 @@ const ConfigHistoryChart = memo(({ configs }) => {
45
45
  }
46
46
  };
47
47
  fetchData();
48
- }, [startDate, endDate, configs]);
48
+ // eslint-disable-next-line react-hooks/exhaustive-deps
49
+ }, [startDate, endDate]);
49
50
 
50
51
  if (!chartData.length) {
51
52
  return false;