@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.
- package/assets/images/Map/MarkerGeolocation.svg +4 -0
- package/assets/images/SonosSpeaker/buttonpause-active.svg +3 -0
- package/assets/images/SonosSpeaker/buttonpause-notactive.svg +3 -0
- package/assets/images/SonosSpeaker/picture-main-notactive.svg +5 -0
- package/assets/images/SonosSpeaker/picture-main.svg +6 -0
- package/assets/images/SonosSpeaker/picture-volume.svg +3 -0
- package/package.json +4 -22
- package/src/Images/Common/buttonLeftCurtain.png +0 -0
- package/src/Images/Common/buttonPause-center-curtain.png +0 -0
- package/src/Images/Common/buttonRightCurtain.png +0 -0
- package/src/commons/ActionGroup/CurtainButtonTemplate.js +139 -0
- package/src/commons/ActionGroup/CurtainButtonTemplateStyle.js +58 -0
- package/src/commons/ActionGroup/__test__/CurtainButtonTemplate.test.js +72 -0
- package/src/commons/ActionGroup/index.js +3 -0
- package/src/commons/Auth/__test__/AccountList.test.js +33 -0
- package/src/commons/CameraDevice/index.js +2 -0
- package/src/commons/CardShadow/index.js +1 -1
- package/src/commons/CardShadow/styles.js +1 -3
- package/src/commons/DateTimeRangeChange/DateTimeButton.js +1 -1
- package/src/commons/DateTimeRangeChange/index.js +2 -2
- package/src/commons/Device/HistoryChart.js +21 -55
- package/src/commons/Device/HorizontalBarChart.js +46 -30
- package/src/commons/Device/LinearChart.js +0 -34
- package/src/commons/Device/PMSensor/PMSensorIndicatior.js +1 -1
- package/src/commons/Device/PMSensor/PMSensorIndicatorStyles.js +2 -1
- package/src/commons/Device/SonosSpeaker/__test__/SonosSpeaker.test.js +57 -0
- package/src/commons/Device/SonosSpeaker/index.js +88 -0
- package/src/commons/Device/SonosSpeaker/styles.js +57 -0
- package/src/commons/Form/CurrencyInput.js +169 -0
- package/src/commons/Form/__test__/CurrencyInput.test.js +65 -0
- package/src/commons/FourButtonFilterHistory/__test__/FourButtonFilterHistory.test.js +48 -0
- package/src/commons/FourButtonFilterHistory/index.js +72 -0
- package/src/commons/FourButtonFilterHistory/styles.js +22 -0
- package/src/commons/MediaPlayerDetail/Styles/MediaPlayerDetailStyles.js +14 -0
- package/src/commons/MediaPlayerDetail/index.js +204 -161
- package/src/commons/SearchLocation/index.js +0 -1
- package/src/commons/Sharing/RowMember.js +7 -2
- package/src/commons/Sharing/__test__/RowMember.test.js +42 -0
- package/src/commons/SubUnit/ShortDetail.js +12 -6
- package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +1 -1
- package/src/commons/UnitSummary/ConfigHistoryChart.js +2 -1
- package/src/configs/API.js +13 -3
- package/src/configs/Constants.js +14 -4
- package/src/configs/Images.js +3 -0
- package/src/configs/SCConfig.js +8 -0
- package/src/context/actionType.ts +5 -0
- package/src/context/mockStore.ts +3 -0
- package/src/context/reducer.ts +14 -0
- package/src/iot/RemoteControl/Bluetooth.js +14 -0
- package/src/iot/RemoteControl/index.js +0 -1
- package/src/navigations/UnitStack.js +42 -4
- package/src/screens/ActivityLog/FilterPopup.js +1 -1
- package/src/screens/ActivityLog/ItemLog.js +11 -2
- package/src/screens/ActivityLog/__test__/ItemLog.test.js +46 -0
- package/src/screens/ActivityLog/hooks/index.js +1 -0
- package/src/screens/ActivityLog/index.js +0 -1
- package/src/screens/AddCommon/SelectSubUnit.js +24 -2
- package/src/screens/AddCommon/SelectUnit.js +12 -0
- package/src/screens/AddLocationMaps/index.js +139 -44
- package/src/screens/AddLocationMaps/indexStyle.js +14 -12
- package/src/screens/AddNewAction/SelectAction.js +1 -0
- package/src/screens/Automate/MultiUnits.js +8 -8
- package/src/screens/Automate/__test__/MultiUnits.test.js +2 -2
- package/src/screens/Automate/__test__/index.test.js +2 -0
- package/src/screens/Automate/index.js +4 -2
- package/src/screens/Device/__test__/detail.test.js +3 -7
- package/src/screens/Device/components/SensorDisplayItem.js +10 -10
- package/src/screens/Device/detail.js +65 -15
- package/src/screens/Device/hooks/useDisconnectedDevice.js +32 -26
- package/src/screens/Device/styles.js +3 -3
- package/src/screens/EmergencySetting/__test__/DropDownItem.test.js +59 -0
- package/src/screens/EmergencySetting/__test__/index.test.js +27 -0
- package/src/screens/EmergencySetting/components/DropDownItem.js +54 -0
- package/src/screens/EmergencySetting/index.js +90 -0
- package/src/screens/EmergencySetting/styles/DropDownItem.js +38 -0
- package/src/screens/EmergencySetting/styles.js +19 -0
- package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +126 -0
- package/src/screens/MoveToAnotherSubUnit/index.js +88 -0
- package/src/screens/MoveToAnotherSubUnit/styles/MoveToAnotherSubUnitStyles.js +50 -0
- package/src/screens/Notification/__test__/Notification.test.js +3 -3
- package/src/screens/Notification/components/NotificationItem.js +3 -6
- package/src/screens/Notification/index.js +2 -2
- package/src/screens/ScriptDetail/Styles/indexStyles.js +0 -1
- package/src/screens/ScriptDetail/__test__/index.test.js +13 -0
- package/src/screens/ScriptDetail/index.js +20 -17
- package/src/screens/SelectUnit/index.js +2 -0
- package/src/screens/Sharing/MemberList.js +2 -9
- package/src/screens/SubUnit/AddSubUnit.js +79 -59
- package/src/screens/SubUnit/AddSubUnitStyles.js +0 -2
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +4 -3
- package/src/screens/TDSGuide/index.js +6 -4
- package/src/screens/Unit/ChooseLocation.js +96 -0
- package/src/screens/Unit/ChooseLocationStyles.js +26 -0
- package/src/screens/Unit/Detail.js +14 -2
- package/src/screens/Unit/ManageUnit.js +4 -5
- package/src/screens/Unit/SelectAddress.js +240 -0
- package/src/screens/Unit/SelectAddressStyles.js +48 -0
- package/src/screens/Unit/SmartAccountItem.js +1 -1
- package/src/screens/Unit/Summaries.js +5 -1
- package/src/screens/Unit/__test__/ChooseLocation.test.js +112 -0
- package/src/screens/Unit/__test__/SelectAddress.test.js +216 -0
- package/src/screens/Unit/components/MyUnitDevice/index.js +21 -5
- package/src/screens/Unit/hook/useStateAlertRemove.js +3 -1
- package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +2 -2
- package/src/screens/UnitSummary/components/PowerConsumption/index.js +3 -2
- package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +1 -3
- package/src/screens/UnitSummary/index.js +3 -2
- package/src/screens/WaterQualityGuide/index.js +1 -0
- package/src/utils/Apis/axios.js +17 -5
- package/src/utils/I18n/translations/en.json +19 -4
- package/src/utils/I18n/translations/vi.json +22 -7
- package/src/utils/Route/index.js +4 -1
- package/src/utils/Utils.js +22 -2
- package/assets/images/AddLocationMaps/PinLocation.svg +0 -3
- package/assets/images/AddLocationMaps/Point.svg +0 -3
- package/src/commons/ThreeButtonHistory/CalendarHeader.js +0 -35
- package/src/commons/ThreeButtonHistory/CalendarHeaderStyles.js +0 -17
- package/src/commons/ThreeButtonHistory/SelectMonth.js +0 -53
- package/src/commons/ThreeButtonHistory/SelectMonthStyles.js +0 -29
- package/src/commons/ThreeButtonHistory/__test__/SelectMonth.test.js +0 -37
- package/src/commons/ThreeButtonHistory/__test__/ThreeButtonHistory.test.js +0 -231
- package/src/commons/ThreeButtonHistory/index.js +0 -281
- package/src/commons/ThreeButtonHistory/styles.js +0 -65
- package/src/screens/Unit/ManageUnit/index.js +0 -286
- package/src/screens/Unit/SelectLocation.js +0 -161
- 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, {
|
|
2
|
-
|
|
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 =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
64
|
+
const onFullScreen = useCallback(() => {
|
|
65
|
+
handleFullScreen && handleFullScreen({ uri, cameraName, thumbnail });
|
|
66
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
67
|
+
}, []);
|
|
52
68
|
|
|
53
|
-
|
|
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
|
-
<
|
|
56
|
-
|
|
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.
|
|
59
|
-
|
|
203
|
+
styles.cameraName,
|
|
204
|
+
amount && amount !== 1 && styles.cameraName2,
|
|
60
205
|
]}
|
|
61
206
|
>
|
|
62
|
-
|
|
63
|
-
</
|
|
207
|
+
{cameraName}
|
|
208
|
+
</Text>
|
|
209
|
+
)}
|
|
210
|
+
{isShowFullScreenIcon && (
|
|
64
211
|
<TouchableOpacity
|
|
65
|
-
|
|
66
|
-
style={
|
|
67
|
-
|
|
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
|
-
{
|
|
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
|
-
|
|
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);
|
|
@@ -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}>
|
|
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
|
-
{
|
|
31
|
+
{
|
|
32
|
+
width: standardizeWidth,
|
|
33
|
+
height: standardizeHeight,
|
|
34
|
+
},
|
|
31
35
|
]}
|
|
32
36
|
testID={TESTID.SUB_UNIT_CAMERA_VIEW}
|
|
33
37
|
>
|
|
34
|
-
<
|
|
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
|
|
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.
|
|
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 ?
|
|
166
|
+
fontSize={valueText.toString().length >= 6 ? 35 : 56}
|
|
167
167
|
y={svgHeight / 2 + 30}
|
|
168
168
|
fill={filledArcColor}
|
|
169
169
|
textAnchor="middle"
|