@eohjsc/react-native-smart-city 0.2.86 → 0.2.89
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/Common/Calendar.svg +3 -0
- package/assets/images/Common/SmartPhone.svg +3 -0
- package/assets/images/Hanet/CaptureFaceID.svg +25 -0
- package/assets/images/Hanet/FaceFrame.svg +6 -0
- package/assets/images/brightnessBlack.svg +12 -0
- package/index.js +4 -0
- package/package.json +3 -3
- package/src/Images/SmartIr/AC.svg +14 -0
- package/src/Images/SmartIr/DIY.svg +3 -0
- package/src/Images/SmartIr/Fan.svg +10 -0
- package/src/Images/SmartIr/Fridge.svg +5 -0
- package/src/Images/SmartIr/Remote.svg +15 -0
- package/src/Images/SmartIr/SmartIr.svg +4 -0
- package/src/Images/SmartIr/TV.svg +10 -0
- package/src/Images/SmartIr/Union.svg +9 -0
- package/src/Images/SmartIr/WM.svg +11 -0
- package/src/Images/SmartIr/index.js +10 -0
- package/src/commons/ActionGroup/ColorPickerTemplate.js +51 -0
- package/src/commons/ActionGroup/ColorPickerTemplateStyles.js +17 -0
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/AutoLockStyles.js +40 -0
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapper.js +65 -0
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapperStyles.js +43 -0
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/__test__/index.test.js +48 -0
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/index.js +57 -0
- package/src/commons/ActionGroup/{OnOffSmartLock.js → OnOffSmartLock/OnOffSmartLock.js} +5 -5
- package/src/commons/ActionGroup/{OnOffSmartLockStyle.js → OnOffSmartLock/OnOffSmartLockStyle.js} +1 -1
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscode.js +48 -0
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscodeStyles.js +42 -0
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/PasscodeListStyles.js +49 -0
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +66 -0
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/ButtonWrapper.js +96 -0
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/SetupGeneratePasscodeStyles.js +98 -0
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +62 -0
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/index.js +249 -0
- package/src/commons/ActionGroup/OnOffTemplate/index.js +4 -2
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +2 -1
- package/src/commons/ActionGroup/SliderRangeTemplate.js +64 -0
- package/src/commons/ActionGroup/{LightActionTemplateStyles.js → SliderRangeTemplateStyles.js} +0 -8
- package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +167 -186
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +2 -1
- package/src/commons/ActionGroup/index.js +7 -4
- package/src/commons/BottomSheet/index.js +2 -1
- package/src/commons/Device/DisconnectedView.js +7 -1
- package/src/commons/Device/Hanet/ItemHanetDevice.js +109 -0
- package/src/commons/Device/HistoryChart.js +2 -2
- package/src/commons/Device/HorizontalBarChart.js +7 -0
- package/src/commons/Device/ItemDevice.js +18 -15
- package/src/commons/Device/LinearChart.js +14 -41
- package/src/commons/Device/__test__/DisconnectedView.test.js +13 -2
- package/src/commons/RowItem/index.js +12 -7
- package/src/commons/SubUnit/Favorites/index.js +2 -2
- package/src/commons/SubUnit/ShortDetail.js +39 -20
- package/src/commons/WheelDateTimePicker/index.js +18 -4
- package/src/configs/API.js +23 -1
- package/src/configs/Colors.js +1 -0
- package/src/configs/Constants.js +48 -0
- package/src/configs/SCConfig.js +1 -1
- package/src/context/actionType.ts +4 -0
- package/src/context/mockStore.ts +3 -0
- package/src/context/reducer.ts +20 -0
- package/src/iot/RemoteControl/Bluetooth.js +3 -22
- package/src/iot/RemoteControl/index.js +0 -1
- package/src/navigations/HanetCameraStack.js +41 -0
- package/src/navigations/SmartIrStack.js +31 -0
- package/src/navigations/SmartLockStack.js +51 -0
- package/src/navigations/UnitStack.js +46 -4
- package/src/screens/ActivityLog/hooks/index.js +1 -1
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +1 -1
- package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +79 -72
- package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +155 -27
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectWifiWarning.test.js +65 -0
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/GatewayWifiList.test.js +26 -2
- package/src/screens/Device/__test__/detail.test.js +0 -10
- package/src/screens/Device/components/SensorConnectStatusViewHeader.js +13 -2
- package/src/screens/Device/detail.js +118 -38
- package/src/screens/Device/hooks/useDisconnectedDevice.js +28 -16
- package/src/screens/GuestInfo/components/AccessScheduleItem.js +9 -2
- package/src/screens/GuestInfo/components/RecurringDetail.js +3 -2
- package/src/screens/GuestInfo/components/TemporaryDetail.js +3 -2
- package/src/screens/GuestInfo/styles/AccessScheduleItemStyles.js +3 -0
- package/src/screens/HanetCamera/CaptureFaceID.js +210 -0
- package/src/screens/HanetCamera/Detail.js +252 -0
- package/src/screens/HanetCamera/ManageAccess.js +173 -0
- package/src/screens/HanetCamera/MemberInfo.js +208 -0
- package/src/screens/HanetCamera/__test__/CaptureFaceID.test.js +133 -0
- package/src/screens/HanetCamera/__test__/Detail.test.js +185 -0
- package/src/screens/HanetCamera/__test__/ManageAccess.test.js +152 -0
- package/src/screens/HanetCamera/__test__/MemberInfo.test.js +178 -0
- package/src/screens/HanetCamera/components/CheckinHeader.js +37 -0
- package/src/screens/HanetCamera/hooks/__test__/useHanetCheckinData.test.js +151 -0
- package/src/screens/HanetCamera/hooks/__test__/useHanetPlaceMembers.test.js +71 -0
- package/src/screens/HanetCamera/hooks/index.js +5 -0
- package/src/screens/HanetCamera/hooks/useHanetCheckinData.js +116 -0
- package/src/screens/HanetCamera/hooks/useHanetPlaceMembers.js +86 -0
- package/src/screens/HanetCamera/hooks/useStateAlertAction.js +62 -0
- package/src/screens/HanetCamera/styles/captureFaceIDStyles.js +50 -0
- package/src/screens/HanetCamera/styles/checkinHeaderStyles.js +24 -0
- package/src/screens/HanetCamera/styles/detailStyles.js +107 -0
- package/src/screens/HanetCamera/styles/manageAccessStyles.js +49 -0
- package/src/screens/HanetCamera/styles/memberInfoStyles.js +73 -0
- package/src/screens/HanetCamera/utils/Monitor.js +52 -0
- package/src/screens/Notification/__test__/NotificationItem.test.js +1 -0
- package/src/screens/Notification/components/NotificationItem.js +16 -0
- package/src/screens/SmartIr/__test__/ButtonsBottom.test.js +31 -0
- package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +80 -0
- package/src/screens/SmartIr/__test__/SelectBrand.test.js +65 -0
- package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +57 -0
- package/src/screens/SmartIr/__test__/SmartIr.test.js +1 -0
- package/src/screens/SmartIr/components/GroupButtonByType/ButtonsBottom.js +45 -0
- package/src/screens/SmartIr/components/GroupButtonByType/ButtonsBottomStyles.js +31 -0
- package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +208 -0
- package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByTypeStyles.js +113 -0
- package/src/screens/SmartIr/components/SelectBrand.js +61 -0
- package/src/screens/SmartIr/components/SelectBrandStyles.js +14 -0
- package/src/screens/SmartIr/components/SelectDeviceType.js +96 -0
- package/src/screens/SmartIr/components/SelectDeviceTypeStyles.js +30 -0
- package/src/screens/SmartIr/index.js +8 -3
- package/src/screens/Unit/Detail.js +7 -11
- package/src/screens/Unit/__test__/Detail.test.js +0 -10
- package/src/screens/Unit/components/MyUnitDevice/index.js +2 -4
- package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +38 -9
- package/src/utils/I18n/translations/en.json +51 -1
- package/src/utils/I18n/translations/vi.json +51 -1
- package/src/utils/Route/index.js +14 -1
- package/src/commons/ActionGroup/LightActionTemplate.js +0 -103
- package/src/commons/ActionGroup/__test__/LightActionTemplate.test.js +0 -59
|
@@ -4,6 +4,7 @@ import { View, ScrollView, Alert } from 'react-native';
|
|
|
4
4
|
import styles from './SmartTiviActionTemplateStyles';
|
|
5
5
|
import Text from '../../Text';
|
|
6
6
|
import { Colors } from '../../../configs';
|
|
7
|
+
import { SMART_TIVI_BUTTON } from '../../../configs/Constants';
|
|
7
8
|
import { IconOutline } from '@ant-design/icons-react-native';
|
|
8
9
|
import CircleButton from './component/CircleButton';
|
|
9
10
|
import RectangleButton from './component/RectangleButton';
|
|
@@ -22,193 +23,173 @@ import {
|
|
|
22
23
|
Netflix,
|
|
23
24
|
} from './component/Icon';
|
|
24
25
|
|
|
25
|
-
const SmartTiviActionTemplate = memo(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
switch (item.icon) {
|
|
105
|
-
case 'disney':
|
|
106
|
-
return <Disney style={styles.iconChannel} />;
|
|
107
|
-
case 'youtube':
|
|
108
|
-
return <Youtube style={styles.iconChannel} />;
|
|
109
|
-
case 'netflix':
|
|
110
|
-
return <Netflix style={styles.iconChannel} />;
|
|
111
|
-
case 'spotify':
|
|
112
|
-
return <Spotify style={styles.iconChannel} />;
|
|
113
|
-
default:
|
|
114
|
-
return <></>;
|
|
115
|
-
}
|
|
116
|
-
}, []);
|
|
117
|
-
return (
|
|
118
|
-
<>
|
|
119
|
-
<ScrollView>
|
|
120
|
-
<View style={styles.wrap}>
|
|
121
|
-
<View style={styles.rowOnOff}>
|
|
122
|
-
<CircleButton
|
|
123
|
-
type="small"
|
|
124
|
-
icon={
|
|
125
|
-
<IconOutline
|
|
126
|
-
name="poweroff"
|
|
127
|
-
size={20}
|
|
128
|
-
color={Colors.Gray6}
|
|
129
|
-
style={styles.iconButton}
|
|
130
|
-
/>
|
|
131
|
-
}
|
|
132
|
-
onPress={onPressOnOff}
|
|
133
|
-
testID={TESTID.SMART_TIVI_TEMPLATE.ONOFF_BUTTON}
|
|
134
|
-
/>
|
|
135
|
-
<CircleButton
|
|
136
|
-
type="small"
|
|
137
|
-
icon={<SvgInput size={20} style={styles.iconButtonExit} />}
|
|
138
|
-
onPress={onPressExit}
|
|
139
|
-
testID={TESTID.SMART_TIVI_TEMPLATE.EXIT_BUTTON}
|
|
140
|
-
/>
|
|
141
|
-
</View>
|
|
142
|
-
<View style={styles.controlDevice}>
|
|
143
|
-
<RectangleButton
|
|
144
|
-
type="column"
|
|
145
|
-
icon={<VolumeUp width={20} height={20} />}
|
|
146
|
-
onPressUp={onPressVolumeUp}
|
|
147
|
-
onPressDown={onPressVolumeDown}
|
|
148
|
-
testID={TESTID.SMART_TIVI_TEMPLATE.VOLUME_BUTTON}
|
|
149
|
-
/>
|
|
150
|
-
<CircleButton
|
|
151
|
-
type="big"
|
|
152
|
-
wrapStyle={styles.circleBigButton}
|
|
153
|
-
onPressUp={onPressUp}
|
|
154
|
-
onPressDown={onPressDown}
|
|
155
|
-
onPressLeft={onPressLeft}
|
|
156
|
-
onPressRight={onPressRight}
|
|
157
|
-
onPressOk={onPressOk}
|
|
158
|
-
testID={TESTID.SMART_TIVI_TEMPLATE.BIG_BUTTON}
|
|
159
|
-
/>
|
|
160
|
-
<RectangleButton
|
|
161
|
-
type="column"
|
|
162
|
-
icon={
|
|
163
|
-
<Text type="H4" color={Colors.Gray9} bold>
|
|
164
|
-
CH
|
|
165
|
-
</Text>
|
|
166
|
-
}
|
|
167
|
-
onPressUp={onPressChUp}
|
|
168
|
-
onPressDown={onPressChDown}
|
|
169
|
-
testID={TESTID.SMART_TIVI_TEMPLATE.CH_BUTTON}
|
|
170
|
-
/>
|
|
171
|
-
</View>
|
|
172
|
-
<View style={styles.controlPlay}>
|
|
173
|
-
<ControlPlay
|
|
174
|
-
onPressPrev={onPressPrev}
|
|
175
|
-
onPressStop={onPressStop}
|
|
176
|
-
onPressNext={onPressNext}
|
|
177
|
-
testID={TESTID.SMART_TIVI_TEMPLATE.CONTROL_BUTTON}
|
|
178
|
-
/>
|
|
179
|
-
</View>
|
|
180
|
-
<View style={styles.controlHome}>
|
|
181
|
-
<RectangleButton
|
|
182
|
-
type="row"
|
|
183
|
-
onPress={onPressHome}
|
|
184
|
-
icon={<Home />}
|
|
185
|
-
testID={TESTID.SMART_TIVI_TEMPLATE.HOME_BUTTON}
|
|
186
|
-
/>
|
|
187
|
-
<RectangleButton
|
|
188
|
-
type="row"
|
|
189
|
-
onPress={onPressBack}
|
|
190
|
-
icon={<KeyboardReturn />}
|
|
191
|
-
testID={TESTID.SMART_TIVI_TEMPLATE.BACK_BUTTON}
|
|
192
|
-
/>
|
|
193
|
-
</View>
|
|
194
|
-
<View style={styles.channelTV}>
|
|
195
|
-
{!!FakeDataChannel &&
|
|
196
|
-
FakeDataChannel.map((item, index) => {
|
|
197
|
-
return (
|
|
198
|
-
<RectangleButton
|
|
199
|
-
type="row"
|
|
200
|
-
onPress={() => onPressChannel(item)}
|
|
201
|
-
icon={iconChannels(item)}
|
|
202
|
-
wrapStyle={styles.buttonChannel}
|
|
203
|
-
index={index}
|
|
26
|
+
const SmartTiviActionTemplate = memo(
|
|
27
|
+
({ actionGroup, doAction, scrollEnabled = true }) => {
|
|
28
|
+
const t = useTranslations();
|
|
29
|
+
const FakeDataChannel = [
|
|
30
|
+
{
|
|
31
|
+
id: 1,
|
|
32
|
+
icon: 'disney',
|
|
33
|
+
link: '...',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: 2,
|
|
37
|
+
icon: 'youtube',
|
|
38
|
+
link: '...',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 3,
|
|
42
|
+
icon: 'netflix',
|
|
43
|
+
link: '...',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: 4,
|
|
47
|
+
icon: 'spotify',
|
|
48
|
+
link: '...',
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
const onPressButton = useCallback(
|
|
52
|
+
(button, item) => () => {
|
|
53
|
+
switch (button) {
|
|
54
|
+
case SMART_TIVI_BUTTON.ONOFF_BUTTON:
|
|
55
|
+
case SMART_TIVI_BUTTON.EXIT_BUTTON:
|
|
56
|
+
case SMART_TIVI_BUTTON.VOLUME_UP_BUTTON:
|
|
57
|
+
case SMART_TIVI_BUTTON.VOLUME_DOWN_BUTTON:
|
|
58
|
+
case SMART_TIVI_BUTTON.CH_UP:
|
|
59
|
+
case SMART_TIVI_BUTTON.CH_DOWN:
|
|
60
|
+
case SMART_TIVI_BUTTON.UP_BUTTON:
|
|
61
|
+
case SMART_TIVI_BUTTON.DOWN_BUTTON:
|
|
62
|
+
case SMART_TIVI_BUTTON.LEFT_BUTTON:
|
|
63
|
+
case SMART_TIVI_BUTTON.RIGHT_BUTTON:
|
|
64
|
+
case SMART_TIVI_BUTTON.OK_BUTTON:
|
|
65
|
+
case SMART_TIVI_BUTTON.PREV_BUTTON:
|
|
66
|
+
case SMART_TIVI_BUTTON.STOP_BUTTON:
|
|
67
|
+
case SMART_TIVI_BUTTON.NEXT_BUTTON:
|
|
68
|
+
case SMART_TIVI_BUTTON.HOME_BUTTON:
|
|
69
|
+
case SMART_TIVI_BUTTON.BACK_BUTTON:
|
|
70
|
+
case SMART_TIVI_BUTTON.CHANNEL_BUTTON:
|
|
71
|
+
return Alert.alert(t('feature_under_development'));
|
|
72
|
+
default:
|
|
73
|
+
return <></>;
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
[t]
|
|
77
|
+
);
|
|
78
|
+
const iconChannels = useCallback((item) => {
|
|
79
|
+
switch (item.icon) {
|
|
80
|
+
case 'disney':
|
|
81
|
+
return <Disney style={styles.iconChannel} />;
|
|
82
|
+
case 'youtube':
|
|
83
|
+
return <Youtube style={styles.iconChannel} />;
|
|
84
|
+
case 'netflix':
|
|
85
|
+
return <Netflix style={styles.iconChannel} />;
|
|
86
|
+
case 'spotify':
|
|
87
|
+
return <Spotify style={styles.iconChannel} />;
|
|
88
|
+
default:
|
|
89
|
+
return <></>;
|
|
90
|
+
}
|
|
91
|
+
}, []);
|
|
92
|
+
return (
|
|
93
|
+
<>
|
|
94
|
+
<ScrollView scrollEnabled={scrollEnabled}>
|
|
95
|
+
<View style={styles.wrap}>
|
|
96
|
+
<View style={styles.rowOnOff}>
|
|
97
|
+
<CircleButton
|
|
98
|
+
type="small"
|
|
99
|
+
icon={
|
|
100
|
+
<IconOutline
|
|
101
|
+
name="poweroff"
|
|
102
|
+
size={20}
|
|
103
|
+
color={Colors.Gray6}
|
|
104
|
+
style={styles.iconButton}
|
|
204
105
|
/>
|
|
205
|
-
|
|
206
|
-
|
|
106
|
+
}
|
|
107
|
+
onPress={onPressButton(SMART_TIVI_BUTTON.ONOFF_BUTTON)}
|
|
108
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.ONOFF_BUTTON}
|
|
109
|
+
/>
|
|
110
|
+
<CircleButton
|
|
111
|
+
type="small"
|
|
112
|
+
icon={<SvgInput size={20} style={styles.iconButtonExit} />}
|
|
113
|
+
onPress={onPressButton(SMART_TIVI_BUTTON.EXIT_BUTTON)}
|
|
114
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.EXIT_BUTTON}
|
|
115
|
+
/>
|
|
116
|
+
</View>
|
|
117
|
+
<View style={styles.controlDevice}>
|
|
118
|
+
<RectangleButton
|
|
119
|
+
type="column"
|
|
120
|
+
icon={<VolumeUp width={20} height={20} />}
|
|
121
|
+
onPressUp={onPressButton(SMART_TIVI_BUTTON.VOLUME_UP_BUTTON)}
|
|
122
|
+
onPressDown={onPressButton(
|
|
123
|
+
SMART_TIVI_BUTTON.VOLUME_DOWN_BUTTON
|
|
124
|
+
)}
|
|
125
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.VOLUME_BUTTON}
|
|
126
|
+
/>
|
|
127
|
+
<CircleButton
|
|
128
|
+
type="big"
|
|
129
|
+
wrapStyle={styles.circleBigButton}
|
|
130
|
+
onPressUp={onPressButton(SMART_TIVI_BUTTON.UP_BUTTON)}
|
|
131
|
+
onPressDown={onPressButton(SMART_TIVI_BUTTON.DOWN_BUTTON)}
|
|
132
|
+
onPressLeft={onPressButton(SMART_TIVI_BUTTON.LEFT_BUTTON)}
|
|
133
|
+
onPressRight={onPressButton(SMART_TIVI_BUTTON.RIGHT_BUTTON)}
|
|
134
|
+
onPressOk={onPressButton(SMART_TIVI_BUTTON.OK_BUTTON)}
|
|
135
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.BIG_BUTTON}
|
|
136
|
+
/>
|
|
137
|
+
<RectangleButton
|
|
138
|
+
type="column"
|
|
139
|
+
icon={
|
|
140
|
+
<Text type="H4" color={Colors.Gray9} bold>
|
|
141
|
+
CH
|
|
142
|
+
</Text>
|
|
143
|
+
}
|
|
144
|
+
onPressUp={onPressButton(SMART_TIVI_BUTTON.CH_UP)}
|
|
145
|
+
onPressDown={onPressButton(SMART_TIVI_BUTTON.CH_DOWN)}
|
|
146
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.CH_BUTTON}
|
|
147
|
+
/>
|
|
148
|
+
</View>
|
|
149
|
+
<View style={styles.controlPlay}>
|
|
150
|
+
<ControlPlay
|
|
151
|
+
onPressPrev={onPressButton(SMART_TIVI_BUTTON.PREV_BUTTON)}
|
|
152
|
+
onPressStop={onPressButton(SMART_TIVI_BUTTON.STOP_BUTTON)}
|
|
153
|
+
onPressNext={onPressButton(SMART_TIVI_BUTTON.NEXT_BUTTON)}
|
|
154
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.CONTROL_BUTTON}
|
|
155
|
+
/>
|
|
156
|
+
</View>
|
|
157
|
+
<View style={styles.controlHome}>
|
|
158
|
+
<RectangleButton
|
|
159
|
+
type="row"
|
|
160
|
+
onPress={onPressButton(SMART_TIVI_BUTTON.HOME_BUTTON)}
|
|
161
|
+
icon={<Home />}
|
|
162
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.HOME_BUTTON}
|
|
163
|
+
/>
|
|
164
|
+
<RectangleButton
|
|
165
|
+
type="row"
|
|
166
|
+
onPress={onPressButton(SMART_TIVI_BUTTON.BACK_BUTTON)}
|
|
167
|
+
icon={<KeyboardReturn />}
|
|
168
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.BACK_BUTTON}
|
|
169
|
+
/>
|
|
170
|
+
</View>
|
|
171
|
+
<View style={styles.channelTV}>
|
|
172
|
+
{!!FakeDataChannel &&
|
|
173
|
+
FakeDataChannel.map((item, index) => {
|
|
174
|
+
return (
|
|
175
|
+
<RectangleButton
|
|
176
|
+
type="row"
|
|
177
|
+
onPress={onPressButton(
|
|
178
|
+
SMART_TIVI_BUTTON.CHANNEL_BUTTON,
|
|
179
|
+
item
|
|
180
|
+
)}
|
|
181
|
+
icon={iconChannels(item)}
|
|
182
|
+
wrapStyle={styles.buttonChannel}
|
|
183
|
+
index={index}
|
|
184
|
+
/>
|
|
185
|
+
);
|
|
186
|
+
})}
|
|
187
|
+
</View>
|
|
207
188
|
</View>
|
|
208
|
-
</
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
189
|
+
</ScrollView>
|
|
190
|
+
</>
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
);
|
|
213
194
|
|
|
214
195
|
export default SmartTiviActionTemplate;
|
|
@@ -49,9 +49,10 @@ const GridItem = ({ item, index, length, doAction, sensor, title }) => {
|
|
|
49
49
|
|
|
50
50
|
const doActionAndWatchConfig = useCallback(
|
|
51
51
|
(actionData) => {
|
|
52
|
-
|
|
52
|
+
let actionName = `${
|
|
53
53
|
sensor?.name
|
|
54
54
|
} ${title?.toLowerCase()} ${text?.toLowerCase()}`;
|
|
55
|
+
actionName = actionName.replace(/\s+/g, ' ').trim();
|
|
55
56
|
doAction(actionData, null, actionName);
|
|
56
57
|
if (sensor?.is_managed_by_backend) {
|
|
57
58
|
config && watchMultiConfigs([config]);
|
|
@@ -10,8 +10,9 @@ import OnOffTemplate from './OnOffTemplate';
|
|
|
10
10
|
import TimerActionTemplate from './TimerActionTemplate';
|
|
11
11
|
import CurtainButtonTemplate from './CurtainButtonTemplate';
|
|
12
12
|
import SmartTiviActionTemplate from './SmartTiviActionTemplate/SmartTiviActionTemplate';
|
|
13
|
-
import
|
|
14
|
-
import
|
|
13
|
+
import ColorPickerTemplate from './ColorPickerTemplate';
|
|
14
|
+
import SliderRangeTemplate from './SliderRangeTemplate';
|
|
15
|
+
import OnOffSmartLock from './OnOffSmartLock/OnOffSmartLock';
|
|
15
16
|
|
|
16
17
|
export const getActionComponent = (template) => {
|
|
17
18
|
switch (template) {
|
|
@@ -39,8 +40,10 @@ export const getActionComponent = (template) => {
|
|
|
39
40
|
return CurtainButtonTemplate;
|
|
40
41
|
case 'SmartTiviActionTemplate':
|
|
41
42
|
return SmartTiviActionTemplate;
|
|
42
|
-
case '
|
|
43
|
-
return
|
|
43
|
+
case 'color_picker_template':
|
|
44
|
+
return ColorPickerTemplate;
|
|
45
|
+
case 'slider_range_template':
|
|
46
|
+
return SliderRangeTemplate;
|
|
44
47
|
default:
|
|
45
48
|
return null;
|
|
46
49
|
}
|
|
@@ -10,6 +10,7 @@ const BottomSheet = ({
|
|
|
10
10
|
onHide,
|
|
11
11
|
title,
|
|
12
12
|
children,
|
|
13
|
+
style,
|
|
13
14
|
}) => {
|
|
14
15
|
return (
|
|
15
16
|
<ModalCustom
|
|
@@ -22,7 +23,7 @@ const BottomSheet = ({
|
|
|
22
23
|
useNativeDriverForBackdrop={true}
|
|
23
24
|
>
|
|
24
25
|
<View style={styles.popoverStyle}>
|
|
25
|
-
<View style={styles.modalWrapper}>
|
|
26
|
+
<View style={[styles.modalWrapper, style]}>
|
|
26
27
|
{!!title && (
|
|
27
28
|
<View style={styles.modalHeader}>
|
|
28
29
|
<Text semibold style={styles.modalHeaderText}>
|
|
@@ -42,7 +42,7 @@ const DisplayTextDisconnected = memo(({ type }) => {
|
|
|
42
42
|
return <Text style={styles.redStatus}>{text}</Text>;
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
const DisconnectedView = memo(({ sensor, type }) => {
|
|
45
|
+
const DisconnectedView = memo(({ sensor, type, isDeviceHasBle }) => {
|
|
46
46
|
const t = useTranslations();
|
|
47
47
|
return (
|
|
48
48
|
<View style={styles.statusContainer}>
|
|
@@ -74,6 +74,12 @@ const DisconnectedView = memo(({ sensor, type }) => {
|
|
|
74
74
|
<CircleView size={6} backgroundColor={Colors.Gray8} />
|
|
75
75
|
<Text style={styles.noticeText}>{t('check_the_wifi')}</Text>
|
|
76
76
|
</View>
|
|
77
|
+
{isDeviceHasBle && (
|
|
78
|
+
<View style={styles.infoRow}>
|
|
79
|
+
<CircleView size={6} backgroundColor={Colors.Gray8} />
|
|
80
|
+
<Text style={styles.noticeText}>{t('check_the_ble')}</Text>
|
|
81
|
+
</View>
|
|
82
|
+
)}
|
|
77
83
|
</View>
|
|
78
84
|
</View>
|
|
79
85
|
);
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
StyleSheet,
|
|
4
|
+
TouchableOpacity,
|
|
5
|
+
TouchableWithoutFeedback,
|
|
6
|
+
View,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
import { IconFill, IconOutline } from '@ant-design/icons-react-native';
|
|
9
|
+
import { useNavigation } from '@react-navigation/native';
|
|
10
|
+
|
|
11
|
+
import Text from '../../Text';
|
|
12
|
+
import FImage from '../../FImage';
|
|
13
|
+
import { Colors } from '../../../configs';
|
|
14
|
+
import { DEVICE_SIZE } from '../../../configs/Constants';
|
|
15
|
+
import Routes from '../../../utils/Route';
|
|
16
|
+
|
|
17
|
+
const ItemHanetDevice = memo(
|
|
18
|
+
({ svgMain, title, sensor, unit, station, wrapStyle }) => {
|
|
19
|
+
const { navigate } = useNavigation();
|
|
20
|
+
|
|
21
|
+
const goToDetail = () => {
|
|
22
|
+
navigate(Routes.HanetCameraStack, {
|
|
23
|
+
screen: Routes.HanetCameraDetail,
|
|
24
|
+
params: {
|
|
25
|
+
unit,
|
|
26
|
+
station,
|
|
27
|
+
sensor,
|
|
28
|
+
title,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const displayIconSensor = () => {
|
|
34
|
+
const iconKit = sensor.icon_kit;
|
|
35
|
+
return iconKit ? (
|
|
36
|
+
<FImage source={{ uri: iconKit }} style={styles.iconSensor} />
|
|
37
|
+
) : (
|
|
38
|
+
<IconFill name={svgMain} size={32} color={Colors.Red6} />
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<TouchableWithoutFeedback onPress={goToDetail}>
|
|
44
|
+
<View style={[styles.container, wrapStyle]}>
|
|
45
|
+
<View style={styles.boxIcon}>
|
|
46
|
+
<TouchableOpacity onPress={goToDetail}>
|
|
47
|
+
{displayIconSensor()}
|
|
48
|
+
</TouchableOpacity>
|
|
49
|
+
</View>
|
|
50
|
+
<TouchableOpacity onPress={goToDetail}>
|
|
51
|
+
<Text
|
|
52
|
+
numberOfLines={1}
|
|
53
|
+
semibold
|
|
54
|
+
size={14}
|
|
55
|
+
color={Colors.Gray9}
|
|
56
|
+
style={styles.lineHeight22}
|
|
57
|
+
>
|
|
58
|
+
{title}
|
|
59
|
+
</Text>
|
|
60
|
+
<View style={styles.row}>
|
|
61
|
+
<IconOutline name="right" size={12} />
|
|
62
|
+
</View>
|
|
63
|
+
</TouchableOpacity>
|
|
64
|
+
</View>
|
|
65
|
+
</TouchableWithoutFeedback>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
export default ItemHanetDevice;
|
|
71
|
+
|
|
72
|
+
const styles = StyleSheet.create({
|
|
73
|
+
container: {
|
|
74
|
+
padding: 12,
|
|
75
|
+
borderRadius: 10,
|
|
76
|
+
shadowColor: Colors.Shadow,
|
|
77
|
+
shadowOffset: {
|
|
78
|
+
width: 0,
|
|
79
|
+
height: 2,
|
|
80
|
+
},
|
|
81
|
+
shadowOpacity: 0.1,
|
|
82
|
+
shadowRadius: 3,
|
|
83
|
+
elevation: 4,
|
|
84
|
+
width: DEVICE_SIZE.width,
|
|
85
|
+
height: DEVICE_SIZE.height,
|
|
86
|
+
backgroundColor: Colors.White,
|
|
87
|
+
borderColor: Colors.Gray4,
|
|
88
|
+
justifyContent: 'space-between',
|
|
89
|
+
marginBottom: 8,
|
|
90
|
+
borderWidth: 1,
|
|
91
|
+
},
|
|
92
|
+
boxIcon: {
|
|
93
|
+
flexDirection: 'row',
|
|
94
|
+
justifyContent: 'space-between',
|
|
95
|
+
},
|
|
96
|
+
row: {
|
|
97
|
+
flexDirection: 'row',
|
|
98
|
+
justifyContent: 'flex-end',
|
|
99
|
+
alignItems: 'center',
|
|
100
|
+
},
|
|
101
|
+
lineHeight22: {
|
|
102
|
+
lineHeight: 22,
|
|
103
|
+
},
|
|
104
|
+
iconSensor: {
|
|
105
|
+
width: 40,
|
|
106
|
+
height: 40,
|
|
107
|
+
resizeMode: 'contain',
|
|
108
|
+
},
|
|
109
|
+
});
|
|
@@ -234,7 +234,7 @@ const HistoryChart = memo(
|
|
|
234
234
|
)}
|
|
235
235
|
<DateTimePickerModal
|
|
236
236
|
isVisible={eventPicker.showModalStart}
|
|
237
|
-
date={eventPicker.startTime.toDate()}
|
|
237
|
+
date={eventPicker.startTime.utc().toDate()}
|
|
238
238
|
mode={formatType || 'datetime'}
|
|
239
239
|
onConfirm={onConfirmStart}
|
|
240
240
|
onCancel={onCancel}
|
|
@@ -242,7 +242,7 @@ const HistoryChart = memo(
|
|
|
242
242
|
/>
|
|
243
243
|
<DateTimePickerModal
|
|
244
244
|
isVisible={eventPicker.showModalEnd}
|
|
245
|
-
date={eventPicker.
|
|
245
|
+
date={eventPicker.endTime.utc().toDate()}
|
|
246
246
|
mode={formatType || 'datetime'}
|
|
247
247
|
onConfirm={onConfirmEnd}
|
|
248
248
|
onCancel={onCancel}
|
|
@@ -149,6 +149,7 @@ const HorizontalBarChart = memo(({ datas, config }) => {
|
|
|
149
149
|
<HighchartsReactNative
|
|
150
150
|
styles={styles.chartStyle}
|
|
151
151
|
options={chartOptions}
|
|
152
|
+
webviewStyles={styles.webviewStyle}
|
|
152
153
|
/>
|
|
153
154
|
</View>
|
|
154
155
|
);
|
|
@@ -168,4 +169,10 @@ const styles = StyleSheet.create({
|
|
|
168
169
|
backgroundColor: Colors.White,
|
|
169
170
|
flex: 1,
|
|
170
171
|
},
|
|
172
|
+
webviewStyle: {
|
|
173
|
+
flex: 1,
|
|
174
|
+
minHeight: 200,
|
|
175
|
+
height: 300,
|
|
176
|
+
opacity: 0.99,
|
|
177
|
+
},
|
|
171
178
|
});
|
|
@@ -12,16 +12,12 @@ import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
|
12
12
|
import ItemQuickAction from '../../commons/Action/ItemQuickAction';
|
|
13
13
|
import Text from '../../commons/Text';
|
|
14
14
|
import { isDeviceConnected } from '../../iot/RemoteControl/Bluetooth';
|
|
15
|
+
import { useSCContextSelector } from '../../context';
|
|
15
16
|
|
|
16
|
-
import { Colors
|
|
17
|
-
import { TESTID, DEVICE_TYPE } from '../../configs/Constants';
|
|
17
|
+
import { Colors } from '../../configs';
|
|
18
|
+
import { TESTID, DEVICE_TYPE, DEVICE_SIZE } from '../../configs/Constants';
|
|
18
19
|
import FImage from '../../commons/FImage';
|
|
19
20
|
|
|
20
|
-
const marginItem = 12;
|
|
21
|
-
const marginHorizontal = 16;
|
|
22
|
-
const widthItem = (Constants.width - marginHorizontal * 2 - marginItem) / 2;
|
|
23
|
-
const heightItem = (widthItem / 166) * 106;
|
|
24
|
-
|
|
25
21
|
const ItemDevice = memo(
|
|
26
22
|
({
|
|
27
23
|
svgMain,
|
|
@@ -30,14 +26,21 @@ const ItemDevice = memo(
|
|
|
30
26
|
sensor,
|
|
31
27
|
unit,
|
|
32
28
|
station,
|
|
33
|
-
isNetworkConnected,
|
|
34
29
|
isGGHomeConnected,
|
|
30
|
+
serverDown,
|
|
35
31
|
status,
|
|
36
32
|
wrapStyle,
|
|
37
33
|
}) => {
|
|
38
34
|
const t = useTranslations();
|
|
39
35
|
const navigation = useNavigation();
|
|
40
36
|
|
|
37
|
+
const isBluetoothEnabled = useSCContextSelector(
|
|
38
|
+
(state) => state.app.isBluetoothEnabled
|
|
39
|
+
);
|
|
40
|
+
const isNetworkConnected = useSCContextSelector(
|
|
41
|
+
(state) => state.app.isNetworkConnected
|
|
42
|
+
);
|
|
43
|
+
|
|
41
44
|
const goToSensorDisplay = useCallback(() => {
|
|
42
45
|
navigation.navigate(Routes.DeviceDetail, {
|
|
43
46
|
unitData: unit,
|
|
@@ -59,11 +62,11 @@ const ItemDevice = memo(
|
|
|
59
62
|
|
|
60
63
|
const isConnectedViaInternet =
|
|
61
64
|
status === undefined
|
|
62
|
-
? isNetworkConnected && sensor.is_connected
|
|
63
|
-
: isNetworkConnected && status.is_connected;
|
|
64
|
-
const isConnectedViaBLE =
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
? !serverDown && isNetworkConnected && sensor.is_connected
|
|
66
|
+
: !serverDown && isNetworkConnected && status.is_connected;
|
|
67
|
+
const isConnectedViaBLE =
|
|
68
|
+
isBluetoothEnabled &&
|
|
69
|
+
isDeviceConnected(sensor?.remote_control_options?.bluetooth?.address);
|
|
67
70
|
const isConnectedViaGGHome =
|
|
68
71
|
!!sensor &&
|
|
69
72
|
sensor?.is_other_device &&
|
|
@@ -129,8 +132,8 @@ const styles = StyleSheet.create({
|
|
|
129
132
|
shadowOpacity: 0.1,
|
|
130
133
|
shadowRadius: 3,
|
|
131
134
|
elevation: 4,
|
|
132
|
-
width:
|
|
133
|
-
height:
|
|
135
|
+
width: DEVICE_SIZE.width,
|
|
136
|
+
height: DEVICE_SIZE.height,
|
|
134
137
|
backgroundColor: Colors.White,
|
|
135
138
|
justifyContent: 'space-between',
|
|
136
139
|
marginBottom: 8,
|