@eohjsc/react-native-smart-city 0.2.86 → 0.2.87
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/brightnessBlack.svg +12 -0
- package/index.js +4 -0
- package/package.json +1 -1
- 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/TV.svg +10 -0
- package/src/Images/SmartIr/WM.svg +11 -0
- package/src/Images/SmartIr/index.js +7 -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/SmartTiviActionTemplate/SmartTiviActionTemplate.js +188 -186
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +2 -1
- package/src/commons/ActionGroup/index.js +1 -1
- package/src/commons/Device/DisconnectedView.js +7 -1
- package/src/commons/Device/LinearChart.js +3 -40
- package/src/commons/Device/__test__/DisconnectedView.test.js +13 -2
- package/src/commons/RowItem/index.js +12 -7
- package/src/commons/WheelDateTimePicker/index.js +18 -4
- package/src/configs/API.js +1 -1
- package/src/configs/Colors.js +1 -0
- package/src/configs/Constants.js +11 -0
- package/src/context/mockStore.ts +1 -0
- package/src/iot/RemoteControl/Bluetooth.js +3 -3
- package/src/navigations/SmartIrStack.js +31 -0
- package/src/navigations/SmartLockStack.js +51 -0
- package/src/navigations/UnitStack.js +12 -3
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +1 -1
- package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +77 -55
- package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +141 -27
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectWifiWarning.test.js +58 -0
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/GatewayWifiList.test.js +26 -2
- package/src/screens/Device/components/SensorConnectStatusViewHeader.js +13 -2
- package/src/screens/Device/detail.js +49 -10
- package/src/screens/Device/hooks/useDisconnectedDevice.js +21 -5
- 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/Notification/__test__/NotificationItem.test.js +1 -0
- package/src/screens/Notification/components/NotificationItem.js +16 -0
- package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +54 -0
- package/src/screens/SmartIr/__test__/SelectBrand.test.js +74 -0
- package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +64 -0
- package/src/screens/SmartIr/__test__/SmartIr.test.js +1 -0
- package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +86 -0
- package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByTypeStyles.js +76 -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 -3
- 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 +24 -1
- package/src/utils/I18n/translations/vi.json +24 -1
- package/src/utils/Route/index.js +9 -1
|
@@ -22,193 +22,195 @@ import {
|
|
|
22
22
|
Netflix,
|
|
23
23
|
} from './component/Icon';
|
|
24
24
|
|
|
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
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
<
|
|
121
|
-
<View style={styles.
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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}
|
|
25
|
+
const SmartTiviActionTemplate = memo(
|
|
26
|
+
({ actionGroup, doAction, scrollEnabled = true }) => {
|
|
27
|
+
const t = useTranslations();
|
|
28
|
+
const FakeDataChannel = [
|
|
29
|
+
{
|
|
30
|
+
id: 1,
|
|
31
|
+
icon: 'disney',
|
|
32
|
+
link: '...',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 2,
|
|
36
|
+
icon: 'youtube',
|
|
37
|
+
link: '...',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: 3,
|
|
41
|
+
icon: 'netflix',
|
|
42
|
+
link: '...',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: 4,
|
|
46
|
+
icon: 'spotify',
|
|
47
|
+
link: '...',
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
const onPressOnOff = useCallback(() => {
|
|
51
|
+
return Alert.alert(t('feature_under_development'));
|
|
52
|
+
}, [t]);
|
|
53
|
+
const onPressExit = useCallback(() => {
|
|
54
|
+
return Alert.alert(t('feature_under_development'));
|
|
55
|
+
}, [t]);
|
|
56
|
+
const onPressVolumeUp = useCallback(() => {
|
|
57
|
+
return Alert.alert(t('feature_under_development'));
|
|
58
|
+
}, [t]);
|
|
59
|
+
const onPressVolumeDown = useCallback(() => {
|
|
60
|
+
return Alert.alert(t('feature_under_development'));
|
|
61
|
+
}, [t]);
|
|
62
|
+
const onPressChUp = useCallback(() => {
|
|
63
|
+
return Alert.alert(t('feature_under_development'));
|
|
64
|
+
}, [t]);
|
|
65
|
+
const onPressChDown = useCallback(() => {
|
|
66
|
+
return Alert.alert(t('feature_under_development'));
|
|
67
|
+
}, [t]);
|
|
68
|
+
const onPressUp = useCallback(() => {
|
|
69
|
+
return Alert.alert(t('feature_under_development'));
|
|
70
|
+
}, [t]);
|
|
71
|
+
const onPressDown = useCallback(() => {
|
|
72
|
+
return Alert.alert(t('feature_under_development'));
|
|
73
|
+
}, [t]);
|
|
74
|
+
const onPressLeft = useCallback(() => {
|
|
75
|
+
return Alert.alert(t('feature_under_development'));
|
|
76
|
+
}, [t]);
|
|
77
|
+
const onPressRight = useCallback(() => {
|
|
78
|
+
return Alert.alert(t('feature_under_development'));
|
|
79
|
+
}, [t]);
|
|
80
|
+
const onPressOk = useCallback(() => {
|
|
81
|
+
return Alert.alert(t('feature_under_development'));
|
|
82
|
+
}, [t]);
|
|
83
|
+
const onPressPrev = useCallback(() => {
|
|
84
|
+
return Alert.alert(t('feature_under_development'));
|
|
85
|
+
}, [t]);
|
|
86
|
+
const onPressStop = useCallback(() => {
|
|
87
|
+
return Alert.alert(t('feature_under_development'));
|
|
88
|
+
}, [t]);
|
|
89
|
+
const onPressNext = useCallback(() => {
|
|
90
|
+
return Alert.alert(t('feature_under_development'));
|
|
91
|
+
}, [t]);
|
|
92
|
+
const onPressHome = useCallback(() => {
|
|
93
|
+
return Alert.alert(t('feature_under_development'));
|
|
94
|
+
}, [t]);
|
|
95
|
+
const onPressBack = useCallback(() => {
|
|
96
|
+
return Alert.alert(t('feature_under_development'));
|
|
97
|
+
}, [t]);
|
|
98
|
+
const onPressChannel = useCallback(
|
|
99
|
+
(item) => {
|
|
100
|
+
return Alert.alert(t('feature_under_development'));
|
|
101
|
+
},
|
|
102
|
+
[t]
|
|
103
|
+
);
|
|
104
|
+
const iconChannels = useCallback((item) => {
|
|
105
|
+
switch (item.icon) {
|
|
106
|
+
case 'disney':
|
|
107
|
+
return <Disney style={styles.iconChannel} />;
|
|
108
|
+
case 'youtube':
|
|
109
|
+
return <Youtube style={styles.iconChannel} />;
|
|
110
|
+
case 'netflix':
|
|
111
|
+
return <Netflix style={styles.iconChannel} />;
|
|
112
|
+
case 'spotify':
|
|
113
|
+
return <Spotify style={styles.iconChannel} />;
|
|
114
|
+
default:
|
|
115
|
+
return <></>;
|
|
116
|
+
}
|
|
117
|
+
}, []);
|
|
118
|
+
return (
|
|
119
|
+
<>
|
|
120
|
+
<ScrollView scrollEnabled={scrollEnabled}>
|
|
121
|
+
<View style={styles.wrap}>
|
|
122
|
+
<View style={styles.rowOnOff}>
|
|
123
|
+
<CircleButton
|
|
124
|
+
type="small"
|
|
125
|
+
icon={
|
|
126
|
+
<IconOutline
|
|
127
|
+
name="poweroff"
|
|
128
|
+
size={20}
|
|
129
|
+
color={Colors.Gray6}
|
|
130
|
+
style={styles.iconButton}
|
|
204
131
|
/>
|
|
205
|
-
|
|
206
|
-
|
|
132
|
+
}
|
|
133
|
+
onPress={onPressOnOff}
|
|
134
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.ONOFF_BUTTON}
|
|
135
|
+
/>
|
|
136
|
+
<CircleButton
|
|
137
|
+
type="small"
|
|
138
|
+
icon={<SvgInput size={20} style={styles.iconButtonExit} />}
|
|
139
|
+
onPress={onPressExit}
|
|
140
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.EXIT_BUTTON}
|
|
141
|
+
/>
|
|
142
|
+
</View>
|
|
143
|
+
<View style={styles.controlDevice}>
|
|
144
|
+
<RectangleButton
|
|
145
|
+
type="column"
|
|
146
|
+
icon={<VolumeUp width={20} height={20} />}
|
|
147
|
+
onPressUp={onPressVolumeUp}
|
|
148
|
+
onPressDown={onPressVolumeDown}
|
|
149
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.VOLUME_BUTTON}
|
|
150
|
+
/>
|
|
151
|
+
<CircleButton
|
|
152
|
+
type="big"
|
|
153
|
+
wrapStyle={styles.circleBigButton}
|
|
154
|
+
onPressUp={onPressUp}
|
|
155
|
+
onPressDown={onPressDown}
|
|
156
|
+
onPressLeft={onPressLeft}
|
|
157
|
+
onPressRight={onPressRight}
|
|
158
|
+
onPressOk={onPressOk}
|
|
159
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.BIG_BUTTON}
|
|
160
|
+
/>
|
|
161
|
+
<RectangleButton
|
|
162
|
+
type="column"
|
|
163
|
+
icon={
|
|
164
|
+
<Text type="H4" color={Colors.Gray9} bold>
|
|
165
|
+
CH
|
|
166
|
+
</Text>
|
|
167
|
+
}
|
|
168
|
+
onPressUp={onPressChUp}
|
|
169
|
+
onPressDown={onPressChDown}
|
|
170
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.CH_BUTTON}
|
|
171
|
+
/>
|
|
172
|
+
</View>
|
|
173
|
+
<View style={styles.controlPlay}>
|
|
174
|
+
<ControlPlay
|
|
175
|
+
onPressPrev={onPressPrev}
|
|
176
|
+
onPressStop={onPressStop}
|
|
177
|
+
onPressNext={onPressNext}
|
|
178
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.CONTROL_BUTTON}
|
|
179
|
+
/>
|
|
180
|
+
</View>
|
|
181
|
+
<View style={styles.controlHome}>
|
|
182
|
+
<RectangleButton
|
|
183
|
+
type="row"
|
|
184
|
+
onPress={onPressHome}
|
|
185
|
+
icon={<Home />}
|
|
186
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.HOME_BUTTON}
|
|
187
|
+
/>
|
|
188
|
+
<RectangleButton
|
|
189
|
+
type="row"
|
|
190
|
+
onPress={onPressBack}
|
|
191
|
+
icon={<KeyboardReturn />}
|
|
192
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.BACK_BUTTON}
|
|
193
|
+
/>
|
|
194
|
+
</View>
|
|
195
|
+
<View style={styles.channelTV}>
|
|
196
|
+
{!!FakeDataChannel &&
|
|
197
|
+
FakeDataChannel.map((item, index) => {
|
|
198
|
+
return (
|
|
199
|
+
<RectangleButton
|
|
200
|
+
type="row"
|
|
201
|
+
onPress={() => onPressChannel(item)}
|
|
202
|
+
icon={iconChannels(item)}
|
|
203
|
+
wrapStyle={styles.buttonChannel}
|
|
204
|
+
index={index}
|
|
205
|
+
/>
|
|
206
|
+
);
|
|
207
|
+
})}
|
|
208
|
+
</View>
|
|
207
209
|
</View>
|
|
208
|
-
</
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
</ScrollView>
|
|
211
|
+
</>
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
);
|
|
213
215
|
|
|
214
216
|
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]);
|
|
@@ -11,7 +11,7 @@ import TimerActionTemplate from './TimerActionTemplate';
|
|
|
11
11
|
import CurtainButtonTemplate from './CurtainButtonTemplate';
|
|
12
12
|
import SmartTiviActionTemplate from './SmartTiviActionTemplate/SmartTiviActionTemplate';
|
|
13
13
|
import LightActionTemplate from './LightActionTemplate';
|
|
14
|
-
import OnOffSmartLock from './OnOffSmartLock';
|
|
14
|
+
import OnOffSmartLock from './OnOffSmartLock/OnOffSmartLock';
|
|
15
15
|
|
|
16
16
|
export const getActionComponent = (template) => {
|
|
17
17
|
switch (template) {
|
|
@@ -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
|
);
|
|
@@ -47,46 +47,9 @@ const chartOptions = {
|
|
|
47
47
|
text: '',
|
|
48
48
|
},
|
|
49
49
|
labels: {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
let month = ('0' + (time.getMonth() + 1)).slice(-2);
|
|
54
|
-
return `${date}.${month}`;
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
minRange: 3600 * 24 * 1000,
|
|
58
|
-
tickInterval: 24 * 3600 * 1000,
|
|
59
|
-
},
|
|
60
|
-
plotOptions: {
|
|
61
|
-
series: {
|
|
62
|
-
events: {
|
|
63
|
-
legendItemClick: function () {
|
|
64
|
-
const { index, visible, chart } = this;
|
|
65
|
-
const { series } = chart;
|
|
66
|
-
series.forEach((serie, i) => {
|
|
67
|
-
if (i !== index) {
|
|
68
|
-
serie.visible ? serie.show() : serie.hide();
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
const isHiding = (serie, i) => {
|
|
72
|
-
if (i === index) {
|
|
73
|
-
return visible;
|
|
74
|
-
}
|
|
75
|
-
return !serie.visible;
|
|
76
|
-
};
|
|
77
|
-
if (this.chart.series.every(isHiding)) {
|
|
78
|
-
this.chart.yAxis[0].update({
|
|
79
|
-
min: 0,
|
|
80
|
-
max: 100,
|
|
81
|
-
});
|
|
82
|
-
} else {
|
|
83
|
-
this.chart.yAxis[0].update({
|
|
84
|
-
min: undefined,
|
|
85
|
-
max: undefined,
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
},
|
|
50
|
+
align: 'center',
|
|
51
|
+
padding: 70,
|
|
52
|
+
format: '{value:%d.%m %H:%M}',
|
|
90
53
|
},
|
|
91
54
|
},
|
|
92
55
|
};
|
|
@@ -5,9 +5,9 @@ import renderer, { act } from 'react-test-renderer';
|
|
|
5
5
|
import { SCProvider } from '../../../context';
|
|
6
6
|
import { mockSCStore } from '../../../context/mockStore';
|
|
7
7
|
|
|
8
|
-
const wrapComponent = (sensor) => (
|
|
8
|
+
const wrapComponent = (sensor, isDeviceHasBle) => (
|
|
9
9
|
<SCProvider initState={mockSCStore({})}>
|
|
10
|
-
<DisconnectedView sensor={sensor} />
|
|
10
|
+
<DisconnectedView sensor={sensor} isDeviceHasBle={isDeviceHasBle} />
|
|
11
11
|
</SCProvider>
|
|
12
12
|
);
|
|
13
13
|
|
|
@@ -63,4 +63,15 @@ describe('Test DisconnectedView', () => {
|
|
|
63
63
|
const Views = instance.findAllByType(View);
|
|
64
64
|
expect(Views).toHaveLength(15);
|
|
65
65
|
});
|
|
66
|
+
|
|
67
|
+
test('render DisconnectedView text check bluetooth', () => {
|
|
68
|
+
const isDeviceHasBle = true;
|
|
69
|
+
const sensor = { icon: 'test' };
|
|
70
|
+
act(() => {
|
|
71
|
+
tree = renderer.create(wrapComponent(sensor, isDeviceHasBle));
|
|
72
|
+
});
|
|
73
|
+
const instance = tree.root;
|
|
74
|
+
const Views = instance.findAllByType(View);
|
|
75
|
+
expect(Views).toHaveLength(17);
|
|
76
|
+
});
|
|
66
77
|
});
|
|
@@ -21,7 +21,8 @@ export const RowItem = memo(
|
|
|
21
21
|
type, //primary | disable | undefined
|
|
22
22
|
leftIcon,
|
|
23
23
|
text,
|
|
24
|
-
|
|
24
|
+
isShowSubText = true,
|
|
25
|
+
subtext = '',
|
|
25
26
|
subtextColor = Colors.Gray6,
|
|
26
27
|
rightComponent,
|
|
27
28
|
onPress,
|
|
@@ -40,14 +41,18 @@ export const RowItem = memo(
|
|
|
40
41
|
<View style={styles.wrapItem}>
|
|
41
42
|
<TouchableOpacity onPress={onPress} disabled={type === 'disable'}>
|
|
42
43
|
<View style={styles.Border}>
|
|
43
|
-
|
|
44
|
-
<
|
|
45
|
-
{
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
{!!leftIcon && (
|
|
45
|
+
<View style={styles.paddingLeft16}>
|
|
46
|
+
<CircleView size={40} backgroundColor={circleColor} center>
|
|
47
|
+
{leftIcon}
|
|
48
|
+
</CircleView>
|
|
49
|
+
</View>
|
|
50
|
+
)}
|
|
48
51
|
<View style={styles.columeFlex}>
|
|
49
52
|
<Text style={styles.titleName}> {text}</Text>
|
|
50
|
-
|
|
53
|
+
{!!isShowSubText && (
|
|
54
|
+
<Text style={styles.status}> {subtext}</Text>
|
|
55
|
+
)}
|
|
51
56
|
</View>
|
|
52
57
|
{!!rightComponent && (
|
|
53
58
|
<View style={styles.endFlex}>{rightComponent}</View>
|
|
@@ -92,10 +92,14 @@ const WheelDateTimePicker = ({
|
|
|
92
92
|
}, [dateSelected, hourSelected, minuteSelected, onCancel, onPicked]);
|
|
93
93
|
|
|
94
94
|
const title = useMemo(() => {
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
switch (mode) {
|
|
96
|
+
case 'time':
|
|
97
|
+
return t('set_time');
|
|
98
|
+
case 'datetime':
|
|
99
|
+
return t('set_date_time');
|
|
100
|
+
default:
|
|
101
|
+
return t('minutes');
|
|
97
102
|
}
|
|
98
|
-
return t('set_date_time');
|
|
99
103
|
}, [t, mode]);
|
|
100
104
|
|
|
101
105
|
return (
|
|
@@ -125,7 +129,7 @@ const WheelDateTimePicker = ({
|
|
|
125
129
|
style={styles.picker}
|
|
126
130
|
/>
|
|
127
131
|
</View>
|
|
128
|
-
) : (
|
|
132
|
+
) : mode === 'datetime' ? (
|
|
129
133
|
<View style={styles.container}>
|
|
130
134
|
<Picker
|
|
131
135
|
dataSource={dateData}
|
|
@@ -153,6 +157,16 @@ const WheelDateTimePicker = ({
|
|
|
153
157
|
style={styles.picker}
|
|
154
158
|
/>
|
|
155
159
|
</View>
|
|
160
|
+
) : (
|
|
161
|
+
<View style={styles.container}>
|
|
162
|
+
<Picker
|
|
163
|
+
dataSource={minuteData}
|
|
164
|
+
selectedIndex={indexInitialMinute}
|
|
165
|
+
onValueChange={onValueMinuteChange}
|
|
166
|
+
keyPrefix="minute"
|
|
167
|
+
style={styles.picker}
|
|
168
|
+
/>
|
|
169
|
+
</View>
|
|
156
170
|
)}
|
|
157
171
|
<ViewButtonBottom
|
|
158
172
|
leftTitle={t('cancel')}
|
package/src/configs/API.js
CHANGED
|
@@ -184,7 +184,7 @@ const API = {
|
|
|
184
184
|
VCONNEX: {
|
|
185
185
|
AUTHORIZE: (client_id, redirect_uri, user_id, unit_id, station_id) =>
|
|
186
186
|
// eslint-disable-next-line max-len
|
|
187
|
-
`https://partner-api
|
|
187
|
+
`https://partner-api.vconnex.vn/oauth/authorize?client_id=${client_id}&redirect_uri=${redirect_uri}&response_type=code&scope=SYNCH&scope=CONTROL&scope=QUERY&state=${user_id}@${unit_id}@${station_id}`,
|
|
188
188
|
},
|
|
189
189
|
},
|
|
190
190
|
NOTIFICATION: {
|
package/src/configs/Colors.js
CHANGED
package/src/configs/Constants.js
CHANGED
|
@@ -636,6 +636,16 @@ export const TESTID = {
|
|
|
636
636
|
|
|
637
637
|
// MoveToAnotherSubUnit
|
|
638
638
|
ROW_SUB_UNIT: 'ROW_SUB_UNIT',
|
|
639
|
+
|
|
640
|
+
//SetupGeneratePasscode
|
|
641
|
+
GENERATE_PASSCODE_CHOOSE_USER: 'GENERATE_PASSCODE_CHOOSE_USER',
|
|
642
|
+
GENERATE_PASSCODE_SET_TIME: 'GENERATE_PASSCODE_SET_TIME',
|
|
643
|
+
GENERATE_PASSCODE_SET_DURATION: 'GENERATE_PASSCODE_SET_DURATION',
|
|
644
|
+
|
|
645
|
+
//AutoLock
|
|
646
|
+
AUTO_LOCK_BUTTON_ENABLE: 'AUTO_LOCK_BUTTON_ENABLE',
|
|
647
|
+
AUTO_LOCK_BUTTON_INSTANT: 'AUTO_LOCK_BUTTON_INSTANT',
|
|
648
|
+
AUTO_LOCK_BUTTON_RELOCK_TIMING: 'AUTO_LOCK_BUTTON_RELOCK_TIMING',
|
|
639
649
|
};
|
|
640
650
|
|
|
641
651
|
export const NOTIFICATION_TYPES = {
|
|
@@ -682,4 +692,5 @@ export const SENSOR_TYPE = {
|
|
|
682
692
|
SMOKE: 'smoke',
|
|
683
693
|
FIRE: 'fire',
|
|
684
694
|
SOS: 'sos',
|
|
695
|
+
FILTER_WATER: 'filter_water',
|
|
685
696
|
};
|
package/src/context/mockStore.ts
CHANGED
|
@@ -185,9 +185,9 @@ export const sendDataOverBluetooth = async (
|
|
|
185
185
|
return result;
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
188
|
+
const timeout = setTimeout(() => {
|
|
189
|
+
device.cancelConnection();
|
|
190
|
+
clearTimeout(timeout);
|
|
191
191
|
}, responseTime);
|
|
192
192
|
return result;
|
|
193
193
|
};
|