@eohjsc/react-native-smart-city 0.2.82 → 0.2.85
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/Event.svg +9 -0
- package/assets/images/brightness.svg +12 -0
- package/package.json +4 -2
- package/src/Images/Common/SuccessfullyConnected.svg +4 -0
- package/src/Images/Common/eye-closed.png +0 -0
- package/src/Images/Common/eye-closed@2x.png +0 -0
- package/src/Images/Common/eye-closed@3x.png +0 -0
- package/src/Images/Common/eye.png +0 -0
- package/src/Images/Common/eye@2x.png +0 -0
- package/src/Images/Common/eye@3x.png +0 -0
- package/src/commons/ActionGroup/CurtainButtonTemplate.js +32 -21
- package/src/commons/ActionGroup/LightActionTemplate.js +103 -0
- package/src/commons/ActionGroup/LightActionTemplateStyles.js +57 -0
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +8 -6
- package/src/commons/ActionGroup/OnOffTemplate/OnOffButtonTemplate.js +33 -31
- package/src/commons/ActionGroup/OnOffTemplate/index.js +11 -3
- package/src/commons/ActionGroup/OneBigButtonTemplate.js +10 -7
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +5 -2
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +7 -3
- package/src/commons/ActionGroup/ThreeButtonTemplate.js +33 -24
- package/src/commons/ActionGroup/__test__/LightActionTemplate.test.js +59 -0
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +18 -6
- package/src/commons/ActionGroup/__test__/OneBigButtonTemplate.test.js +9 -1
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +25 -13
- package/src/commons/ActionGroup/__test__/index.test.js +48 -14
- package/src/commons/ActionGroup/index.js +3 -0
- package/src/commons/Automate/ItemAutomate.js +1 -1
- package/src/commons/Automate/ItemAutomateStyles.js +5 -1
- package/src/commons/CardShadow/index.js +5 -2
- package/src/commons/CardShadow/styles.js +2 -3
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItem.js +16 -0
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItemStyles.js +42 -0
- package/src/commons/ConnectingProcess/__test__/Connecting.test.js +27 -0
- package/src/commons/ConnectingProcess/__test__/DeviceItem.test.js +18 -0
- package/src/commons/ConnectingProcess/index.js +202 -0
- package/src/commons/ConnectingProcess/styles.js +69 -0
- package/src/commons/Device/HorizontalBarChart.js +7 -1
- package/src/commons/Device/ItemDevice.js +8 -5
- package/src/commons/Device/LinearChart.js +1 -0
- package/src/commons/Device/WaterQualitySensor/ListQualityIndicator.js +1 -1
- package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +1 -1
- package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -2
- package/src/commons/EmergencyButton/AlertSent.js +2 -2
- package/src/commons/Form/TextInputPassword.js +1 -1
- package/src/commons/FullLoading/index.js +35 -0
- package/src/commons/SubUnit/Favorites/index.js +2 -0
- package/src/commons/SubUnit/OneTap/ItemOneTap.js +3 -0
- package/src/commons/SubUnit/ShortDetail.js +7 -1
- package/src/commons/index.js +2 -0
- package/src/configs/API.js +6 -4
- package/src/configs/Constants.js +25 -0
- package/src/configs/Images.js +2 -0
- package/src/context/actionType.ts +2 -0
- package/src/context/reducer.ts +10 -0
- package/src/hooks/Common/useBlockBackAndroid.js +3 -1
- package/src/iot/RemoteControl/Internet.js +8 -1
- package/src/iot/RemoteControl/index.js +4 -2
- package/src/navigations/AddDeviceStack.js +10 -0
- package/src/screens/AddCommon/SelectSubUnit.js +29 -6
- package/src/screens/AddCommon/SelectUnit.js +24 -2
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +120 -1
- package/src/screens/AddCommon/__test__/SelectUnit.test.js +16 -1
- package/src/screens/AddNewAction/SelectAction.js +46 -28
- package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +3 -3
- package/src/screens/AddNewAutoSmart/index.js +18 -1
- package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +55 -16
- package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +52 -23
- package/src/screens/AddNewGateway/SelectGateway.js +132 -0
- package/src/screens/AddNewGateway/SelectGatewayStyles.js +55 -0
- package/src/screens/AddNewGateway/__test__/SetupGateway.test.js +0 -52
- package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +2 -2
- package/src/screens/Device/EditDevice/index.js +2 -2
- package/src/screens/Device/__test__/detail.test.js +18 -11
- package/src/screens/Device/components/SensorConnectStatusViewHeader.js +2 -2
- package/src/screens/Device/components/SensorDisplayItem.js +2 -2
- package/src/screens/Device/detail.js +64 -26
- package/src/screens/Device/styles.js +2 -0
- package/src/screens/Notification/__test__/NotificationItem.test.js +197 -15
- package/src/screens/Notification/components/NotificationItem.js +188 -14
- package/src/screens/Notification/styles/NotificationItemStyles.js +3 -3
- package/src/screens/ScanChipQR/__test__/ScanChipQR.test.js +10 -7
- package/src/screens/ScanChipQR/hooks/index.js +48 -40
- package/src/screens/SubUnit/AddSubUnit.js +4 -1
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +148 -0
- package/src/screens/Unit/Detail.js +33 -1
- package/src/screens/Unit/ManageUnit.js +1 -1
- package/src/screens/Unit/ManageUnitStyles.js +0 -6
- package/src/screens/Unit/SmartAccount.js +5 -1
- package/src/screens/Unit/Summaries.js +2 -2
- package/src/screens/Unit/__test__/CheckSendEmail.test.js +10 -0
- package/src/screens/Unit/__test__/Detail.test.js +10 -0
- package/src/screens/Unit/components/__test__/SharedUnit.test.js +21 -2
- package/src/screens/UnitSummary/__test__/index.test.js +3 -3
- package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +2 -2
- package/src/screens/UnitSummary/index.js +52 -9
- package/src/utils/Apis/axios.js +1 -1
- package/src/utils/I18n/translations/en.json +16 -0
- package/src/utils/I18n/translations/vi.json +16 -1
- package/src/utils/Route/index.js +2 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<svg width="22" height="40" viewBox="0 0 22 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M21.4995 0H6.49908L0.500977 21.5962H6.51129L1.4009 40H3.20118L20.5983 18.4029H11.785L21.4995 0Z" fill="url(#paint0_linear_8208_3875)"/>
|
|
3
|
+
<defs>
|
|
4
|
+
<linearGradient id="paint0_linear_8208_3875" x1="0.500977" y1="0" x2="33.409" y2="17.2947" gradientUnits="userSpaceOnUse">
|
|
5
|
+
<stop stop-color="#2B6B9F"/>
|
|
6
|
+
<stop offset="1" stop-color="#D5FFCB"/>
|
|
7
|
+
</linearGradient>
|
|
8
|
+
</defs>
|
|
9
|
+
</svg>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M10.0001 3.90845C8.79471 3.90824 7.61636 4.26551 6.61406 4.93507C5.61177 5.60463 4.83056 6.55639 4.36924 7.66998C3.90791 8.78357 3.78721 10.009 4.02239 11.1912C4.25757 12.3734 4.83807 13.4593 5.69046 14.3115C6.54286 15.1638 7.62885 15.7441 8.81109 15.979C9.99333 16.214 11.2187 16.0931 12.3322 15.6316C13.4457 15.1701 14.3974 14.3887 15.0667 13.3863C15.7361 12.3839 16.0932 11.2055 16.0928 10.0001C16.0922 8.38449 15.4501 6.83522 14.3076 5.6929C13.1651 4.55058 11.6157 3.90872 10.0001 3.90845ZM10.0001 14.6376C9.08332 14.6378 8.18709 14.3662 7.4247 13.8571C6.66232 13.3479 6.06802 12.6242 5.71696 11.7773C5.36589 10.9304 5.27383 9.99847 5.4524 9.09928C5.63097 8.20008 6.07216 7.37403 6.72019 6.72557C7.36821 6.07711 8.19397 5.63536 9.09304 5.45618C9.99212 5.277 10.9241 5.36844 11.7712 5.71893C12.6184 6.06943 13.3425 6.66324 13.8522 7.42528C14.3618 8.18731 14.634 9.08336 14.6344 10.0001C14.6336 11.2293 14.1452 12.4079 13.2763 13.2773C12.4075 14.1467 11.2292 14.636 10.0001 14.6376Z" fill="#BFBFBF"/>
|
|
3
|
+
<path d="M9.37419 0.866699H10.6242C10.6936 0.866699 10.7284 0.901421 10.7284 0.970866V2.96774C10.7284 3.03719 10.6936 3.07191 10.6242 3.07191H9.37419C9.30474 3.07191 9.27002 3.03719 9.27002 2.96774V0.970866C9.27002 0.901421 9.30474 0.866699 9.37419 0.866699Z" fill="#BFBFBF"/>
|
|
4
|
+
<path d="M3.09933 3.98419L3.98321 3.10031C4.03232 3.0512 4.08142 3.0512 4.13053 3.10031L5.54253 4.51231C5.59164 4.56141 5.59164 4.61052 5.54253 4.65962L4.65865 5.54351C4.60954 5.59261 4.56044 5.59261 4.51133 5.54351L3.09933 4.1315C3.05022 4.0824 3.05022 4.03329 3.09933 3.98419Z" fill="#BFBFBF"/>
|
|
5
|
+
<path d="M0.970866 9.27197H2.96774C3.03719 9.27197 3.07191 9.3067 3.07191 9.37614V10.6261C3.07191 10.6956 3.03719 10.7303 2.96774 10.7303H0.970866C0.901421 10.7303 0.866699 10.6956 0.866699 10.6261V9.37614C0.866699 9.3067 0.901421 9.27197 0.970866 9.27197Z" fill="#BFBFBF"/>
|
|
6
|
+
<path d="M3.10079 15.8697L4.5128 14.4577C4.5619 14.4086 4.61101 14.4086 4.66011 14.4577L5.54399 15.3416C5.5931 15.3907 5.5931 15.4398 5.54399 15.4889L4.13199 16.9009C4.08289 16.95 4.03378 16.95 3.98468 16.9009L3.10079 16.017C3.05169 15.9679 3.05169 15.9188 3.10079 15.8697Z" fill="#BFBFBF"/>
|
|
7
|
+
<path d="M9.37614 16.9282H10.6261C10.6956 16.9282 10.7303 16.9629 10.7303 17.0324V19.0293C10.7303 19.0987 10.6956 19.1334 10.6261 19.1334H9.37614C9.3067 19.1334 9.27197 19.0987 9.27197 19.0293V17.0324C9.27197 16.9629 9.3067 16.9282 9.37614 16.9282Z" fill="#BFBFBF"/>
|
|
8
|
+
<path d="M14.4572 15.3404L15.3411 14.4565C15.3902 14.4074 15.4393 14.4074 15.4884 14.4565L16.9004 15.8685C16.9496 15.9176 16.9496 15.9667 16.9004 16.0158L16.0166 16.8997C15.9675 16.9488 15.9184 16.9488 15.8692 16.8997L14.4572 15.4877C14.4081 15.4386 14.4081 15.3895 14.4572 15.3404Z" fill="#BFBFBF"/>
|
|
9
|
+
<path d="M17.0324 9.26978H19.0293C19.0987 9.26978 19.1334 9.3045 19.1334 9.37394V10.6239C19.1334 10.6934 19.0987 10.7281 19.0293 10.7281H17.0324C16.9629 10.7281 16.9282 10.6934 16.9282 10.6239V9.37394C16.9282 9.3045 16.9629 9.26978 17.0324 9.26978Z" fill="#BFBFBF"/>
|
|
10
|
+
<path d="M14.4558 4.51109L15.8678 3.09908C15.9169 3.04998 15.966 3.04998 16.0151 3.09908L16.899 3.98297C16.9481 4.03207 16.9481 4.08118 16.899 4.13028L15.487 5.54229C15.4379 5.59139 15.3888 5.59139 15.3397 5.54229L14.4558 4.6584C14.4067 4.6093 14.4067 4.56019 14.4558 4.51109Z" fill="#BFBFBF"/>
|
|
11
|
+
<path d="M9.89605 6.07715C8.87128 6.10077 7.89643 6.52444 7.18002 7.25756C6.4636 7.99068 6.0625 8.97503 6.0625 10.0001C6.0625 11.0251 6.4636 12.0095 7.18002 12.7426C7.89643 13.4757 8.87128 13.8994 9.89605 13.923C9.92367 13.923 9.95017 13.912 9.9697 13.8925C9.98924 13.8729 10.0002 13.8464 10.0002 13.8188V6.18132C10.0002 6.15369 9.98924 6.12719 9.9697 6.10766C9.95017 6.08812 9.92367 6.07715 9.89605 6.07715Z" fill="#BFBFBF"/>
|
|
12
|
+
</svg>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eohjsc/react-native-smart-city",
|
|
3
3
|
"title": "React Native Smart Home",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.85",
|
|
5
5
|
"description": "TODO",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
"react-native-image-resizer": "^1.4.5",
|
|
162
162
|
"react-native-input-credit-card": "^0.5.5",
|
|
163
163
|
"react-native-iphone-x-helper": "^1.2.1",
|
|
164
|
-
"react-native-keyboard-aware-scroll-view": "
|
|
164
|
+
"react-native-keyboard-aware-scroll-view": "https://github.com/hinh-eoh/react-native-keyboard-aware-scroll-view.git",
|
|
165
165
|
"react-native-linear-gradient": "^2.5.6",
|
|
166
166
|
"react-native-localize": "^1.4.1",
|
|
167
167
|
"react-native-maps": "0.27.1",
|
|
@@ -174,6 +174,7 @@
|
|
|
174
174
|
"react-native-parsed-text": "^0.0.22",
|
|
175
175
|
"react-native-permissions": "^2.1.5",
|
|
176
176
|
"react-native-popover-view": "^4.0.3",
|
|
177
|
+
"react-native-progress": "^5.0.0",
|
|
177
178
|
"react-native-reanimated": "1.10.1",
|
|
178
179
|
"react-native-responsive-fontsize": "^0.5.1",
|
|
179
180
|
"react-native-safe-area-context": "^3.1.1",
|
|
@@ -188,6 +189,7 @@
|
|
|
188
189
|
"react-native-version-check": "^3.4.2",
|
|
189
190
|
"react-native-vlc-media-player": "^1.0.39",
|
|
190
191
|
"react-native-webview": "^10.9.3",
|
|
192
|
+
"react-native-wheel-color-picker": "^1.2.0",
|
|
191
193
|
"react-native-wheel-scrollview-picker": "^1.2.2",
|
|
192
194
|
"react-native-wifi-reborn": "^4.5.0",
|
|
193
195
|
"react-navigation": "^2.2.0",
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M21.8437 11.0312H20.3781C20.0593 11.0312 19.7562 11.1844 19.5687 11.4469L14.6562 18.2594L12.4312 15.1719C12.2437 14.9125 11.9437 14.7563 11.6218 14.7563H10.1562C9.95303 14.7563 9.83428 14.9875 9.95303 15.1531L13.8468 20.5531C13.9388 20.6815 14.06 20.7861 14.2005 20.8583C14.341 20.9305 14.4967 20.9681 14.6546 20.9681C14.8125 20.9681 14.9682 20.9305 15.1087 20.8583C15.2492 20.7861 15.3704 20.6815 15.4624 20.5531L22.0437 11.4281C22.1656 11.2625 22.0468 11.0312 21.8437 11.0312V11.0312Z" fill="#52C41A"/>
|
|
3
|
+
<path d="M16 2C8.26875 2 2 8.26875 2 16C2 23.7312 8.26875 30 16 30C23.7312 30 30 23.7312 30 16C30 8.26875 23.7312 2 16 2ZM16 27.625C9.58125 27.625 4.375 22.4187 4.375 16C4.375 9.58125 9.58125 4.375 16 4.375C22.4187 4.375 27.625 9.58125 27.625 16C27.625 22.4187 22.4187 27.625 16 27.625Z" fill="#52C41A"/>
|
|
4
|
+
</svg>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -6,35 +6,46 @@ import Text from '../Text';
|
|
|
6
6
|
import { TESTID } from '../../configs/Constants';
|
|
7
7
|
import { Colors, Images } from '../../configs';
|
|
8
8
|
|
|
9
|
-
const CurtainButtonTemplate = memo(({ actionGroup, doAction }) => {
|
|
9
|
+
const CurtainButtonTemplate = memo(({ actionGroup, doAction, sensor }) => {
|
|
10
10
|
const { configuration } = actionGroup;
|
|
11
|
+
const {
|
|
12
|
+
text_open,
|
|
13
|
+
open_action_data,
|
|
14
|
+
text_stop,
|
|
15
|
+
stop_action_data,
|
|
16
|
+
text_close,
|
|
17
|
+
close_action_data,
|
|
18
|
+
action_off_data,
|
|
19
|
+
action_on_data,
|
|
20
|
+
} = configuration || {};
|
|
11
21
|
const [lock, setLock] = useState(false);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
)
|
|
22
|
+
|
|
23
|
+
const onButtonOpenPress = useCallback(() => {
|
|
24
|
+
const actionName = `${sensor?.name} ${text_open?.toLowerCase()}`;
|
|
25
|
+
doAction(open_action_data, null, actionName);
|
|
26
|
+
}, [open_action_data, text_open, doAction, sensor?.name]);
|
|
27
|
+
|
|
28
|
+
const onButtonStopPress = useCallback(() => {
|
|
29
|
+
const actionName = `${sensor?.name} ${text_stop?.toLowerCase()}`;
|
|
30
|
+
doAction(stop_action_data, null, actionName);
|
|
31
|
+
}, [stop_action_data, text_stop, doAction, sensor?.name]);
|
|
32
|
+
|
|
33
|
+
const onButtonClosePress = useCallback(() => {
|
|
34
|
+
const actionName = `${sensor?.name} ${text_close?.toLowerCase()}`;
|
|
35
|
+
doAction(close_action_data, null, actionName);
|
|
36
|
+
}, [close_action_data, text_close, doAction, sensor?.name]);
|
|
37
|
+
|
|
24
38
|
const onChangeSwitch = useCallback(() => {
|
|
25
39
|
if (lock) {
|
|
40
|
+
const actionName = `${sensor?.name} unlock`;
|
|
26
41
|
setLock(false);
|
|
27
|
-
doAction(
|
|
42
|
+
doAction(action_off_data, null, actionName);
|
|
28
43
|
return;
|
|
29
44
|
}
|
|
30
|
-
|
|
45
|
+
const actionName = `${sensor?.name} lock`;
|
|
46
|
+
doAction(action_on_data, null, actionName);
|
|
31
47
|
setLock(true);
|
|
32
|
-
}, [
|
|
33
|
-
configuration.action_off_data,
|
|
34
|
-
configuration.action_on_data,
|
|
35
|
-
doAction,
|
|
36
|
-
lock,
|
|
37
|
-
]);
|
|
48
|
+
}, [action_off_data, action_on_data, doAction, lock, sensor?.name]);
|
|
38
49
|
|
|
39
50
|
const RenderThreeButtonActions = () => {
|
|
40
51
|
const buttons = [
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React, { memo, useCallback, useState, useMemo } from 'react';
|
|
2
|
+
import { Alert, View } from 'react-native';
|
|
3
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
4
|
+
import styles from './LightActionTemplateStyles';
|
|
5
|
+
import Text from '../Text';
|
|
6
|
+
import { Colors } from '../../configs';
|
|
7
|
+
import { Card } from '../CardShadow';
|
|
8
|
+
import ColorPicker from 'react-native-wheel-color-picker';
|
|
9
|
+
import SvgBrightness from '../../../assets/images/brightness.svg';
|
|
10
|
+
import Slider from 'react-native-slider';
|
|
11
|
+
import OnOffButtonTemplate from './OnOffTemplate/OnOffButtonTemplate';
|
|
12
|
+
|
|
13
|
+
const LightActionTemplate = memo(({ actionGroup, doAction, sensor }) => {
|
|
14
|
+
const t = useTranslations();
|
|
15
|
+
const { configuration, title } = actionGroup;
|
|
16
|
+
const dataColor = useMemo(() => {
|
|
17
|
+
return configuration?.config_color;
|
|
18
|
+
}, [configuration]);
|
|
19
|
+
|
|
20
|
+
const dataBrightness = useMemo(() => {
|
|
21
|
+
return configuration?.config_brightness;
|
|
22
|
+
}, [configuration]);
|
|
23
|
+
|
|
24
|
+
const [valueComplete, setValueComplete] = useState(dataBrightness || 0);
|
|
25
|
+
const [value, setValue] = useState(dataBrightness || 0);
|
|
26
|
+
const [color, setColor] = useState(dataColor || '');
|
|
27
|
+
const [isOn] = useState(true);
|
|
28
|
+
|
|
29
|
+
const onChangeColor = useCallback(
|
|
30
|
+
(color) => {
|
|
31
|
+
setColor(color);
|
|
32
|
+
Alert.alert(t('feature_under_development'));
|
|
33
|
+
},
|
|
34
|
+
[t]
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const onChangeBrightness = useCallback(
|
|
38
|
+
(value) => {
|
|
39
|
+
setValueComplete(value);
|
|
40
|
+
Alert.alert(t('feature_under_development'));
|
|
41
|
+
},
|
|
42
|
+
[t]
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const triggerAction = useCallback(() => {
|
|
46
|
+
Alert.alert(t('feature_under_development'));
|
|
47
|
+
}, [t]);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<View>
|
|
51
|
+
<OnOffButtonTemplate
|
|
52
|
+
isOn={isOn}
|
|
53
|
+
triggerAction={triggerAction}
|
|
54
|
+
actionGroup={actionGroup}
|
|
55
|
+
isLight={true}
|
|
56
|
+
/>
|
|
57
|
+
<Card title={!!title && t(title)}>
|
|
58
|
+
<View style={styles.viewPickColor}>
|
|
59
|
+
<ColorPicker
|
|
60
|
+
style={styles.colorPicker}
|
|
61
|
+
sliderHidden={true}
|
|
62
|
+
swatches={false}
|
|
63
|
+
color={color}
|
|
64
|
+
onColorChangeComplete={(color) => onChangeColor(color)}
|
|
65
|
+
thumbSize={16}
|
|
66
|
+
/>
|
|
67
|
+
</View>
|
|
68
|
+
<View style={styles.viewBrightness}>
|
|
69
|
+
<View style={styles.LeftBrightness}>
|
|
70
|
+
<SvgBrightness />
|
|
71
|
+
<Text type="H4" style={styles.LeftTextBrightness}>
|
|
72
|
+
{t('brightness')}
|
|
73
|
+
</Text>
|
|
74
|
+
</View>
|
|
75
|
+
<View style={styles.RightBrightness}>
|
|
76
|
+
<View style={styles.slider}>
|
|
77
|
+
<Slider
|
|
78
|
+
value={valueComplete}
|
|
79
|
+
onSlidingComplete={(value) => onChangeBrightness(value)}
|
|
80
|
+
onValueChange={(value) => setValue(value)}
|
|
81
|
+
step={1}
|
|
82
|
+
minimumValue={0}
|
|
83
|
+
maximumValue={100}
|
|
84
|
+
thumbTintColor={Colors.Gray3}
|
|
85
|
+
minimumTrackTintColor={Colors.Primary}
|
|
86
|
+
maximumTrackTintColor={Colors.Gray4}
|
|
87
|
+
trackStyle={styles.trackSlider}
|
|
88
|
+
thumbStyle={styles.thumbSlider}
|
|
89
|
+
/>
|
|
90
|
+
</View>
|
|
91
|
+
<View style={styles.valuePercent}>
|
|
92
|
+
<Text type="Label" style={styles.textValuePercent}>
|
|
93
|
+
{`${value || 0}%`}
|
|
94
|
+
</Text>
|
|
95
|
+
</View>
|
|
96
|
+
</View>
|
|
97
|
+
</View>
|
|
98
|
+
</Card>
|
|
99
|
+
</View>
|
|
100
|
+
);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
export default LightActionTemplate;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { Colors } from '../../configs';
|
|
3
|
+
|
|
4
|
+
export default StyleSheet.create({
|
|
5
|
+
wrap: {
|
|
6
|
+
flexDirection: 'row',
|
|
7
|
+
justifyContent: 'space-around',
|
|
8
|
+
paddingVertical: 30,
|
|
9
|
+
},
|
|
10
|
+
viewPickColor: {
|
|
11
|
+
justifyContent: 'center',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
},
|
|
14
|
+
viewBrightness: {
|
|
15
|
+
paddingTop: 16,
|
|
16
|
+
flexDirection: 'row',
|
|
17
|
+
justifyContent: 'space-between',
|
|
18
|
+
},
|
|
19
|
+
slider: {
|
|
20
|
+
width: 131,
|
|
21
|
+
},
|
|
22
|
+
trackSlider: {
|
|
23
|
+
height: 8,
|
|
24
|
+
borderRadius: 30,
|
|
25
|
+
},
|
|
26
|
+
thumbSlider: {
|
|
27
|
+
backgroundColor: Colors.Primary,
|
|
28
|
+
width: 20,
|
|
29
|
+
height: 20,
|
|
30
|
+
},
|
|
31
|
+
colorPicker: {
|
|
32
|
+
width: '100%',
|
|
33
|
+
height: 'auto',
|
|
34
|
+
},
|
|
35
|
+
valuePercent: {
|
|
36
|
+
width: 40,
|
|
37
|
+
flexDirection: 'row',
|
|
38
|
+
paddingLeft: 16,
|
|
39
|
+
},
|
|
40
|
+
textValuePercent: {
|
|
41
|
+
width: 50,
|
|
42
|
+
},
|
|
43
|
+
LeftBrightness: {
|
|
44
|
+
flex: 1,
|
|
45
|
+
flexDirection: 'row',
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
},
|
|
48
|
+
LeftTextBrightness: {
|
|
49
|
+
paddingTop: 4,
|
|
50
|
+
paddingLeft: 8,
|
|
51
|
+
},
|
|
52
|
+
RightBrightness: {
|
|
53
|
+
flex: 1.2,
|
|
54
|
+
flexDirection: 'row',
|
|
55
|
+
alignItems: 'center',
|
|
56
|
+
},
|
|
57
|
+
});
|
|
@@ -38,8 +38,8 @@ const NumberUpDownActionTemplate = ({ actionGroup, doAction, sensor }) => {
|
|
|
38
38
|
}, [configValues, config, keep_track_config]);
|
|
39
39
|
|
|
40
40
|
const doActionAndWatchConfig = useCallback(
|
|
41
|
-
(actionData, actionValue) => {
|
|
42
|
-
doAction(actionData, actionValue);
|
|
41
|
+
(actionData, actionValue, actionName) => {
|
|
42
|
+
doAction(actionData, actionValue, actionName);
|
|
43
43
|
if (!sensor?.is_managed_by_backend) {
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
@@ -56,16 +56,18 @@ const NumberUpDownActionTemplate = ({ actionGroup, doAction, sensor }) => {
|
|
|
56
56
|
);
|
|
57
57
|
|
|
58
58
|
const doActionUp = useCallback(async () => {
|
|
59
|
+
const actionName = `${sensor?.name} temp up`;
|
|
59
60
|
const newValue = checkMinMax(value + 1);
|
|
60
|
-
doActionAndWatchConfig(action_data, newValue);
|
|
61
|
+
doActionAndWatchConfig(action_data, newValue, actionName);
|
|
61
62
|
setValue(newValue);
|
|
62
|
-
}, [checkMinMax, value, doActionAndWatchConfig, action_data]);
|
|
63
|
+
}, [sensor?.name, checkMinMax, value, doActionAndWatchConfig, action_data]);
|
|
63
64
|
|
|
64
65
|
const doActionDown = useCallback(async () => {
|
|
66
|
+
const actionName = `${sensor?.name} temp down`;
|
|
65
67
|
const newValue = checkMinMax(value - 1);
|
|
66
|
-
doActionAndWatchConfig(action_data, newValue);
|
|
68
|
+
doActionAndWatchConfig(action_data, newValue, actionName);
|
|
67
69
|
setValue(newValue);
|
|
68
|
-
}, [checkMinMax, value, doActionAndWatchConfig, action_data]);
|
|
70
|
+
}, [sensor?.name, checkMinMax, value, doActionAndWatchConfig, action_data]);
|
|
69
71
|
|
|
70
72
|
const checkMinMax = useCallback(
|
|
71
73
|
(tempValue) => {
|
|
@@ -6,37 +6,39 @@ import { TouchableOpacity, View } from 'react-native';
|
|
|
6
6
|
import { Colors } from '../../../configs';
|
|
7
7
|
import styles from './OnOffButtonTemplateStyle';
|
|
8
8
|
|
|
9
|
-
const OnOffButtonTemplate = memo(
|
|
10
|
-
|
|
9
|
+
const OnOffButtonTemplate = memo(
|
|
10
|
+
({ isOn, triggerAction, actionGroup, isLight = false }) => {
|
|
11
|
+
const { configuration } = actionGroup;
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<View style={styles.barrierControlContainer}>
|
|
16
|
+
<TouchableOpacity style={styles.bigCircle} onPress={triggerAction}>
|
|
17
|
+
<View style={styles.smallCircle}>
|
|
18
|
+
<Icon
|
|
19
|
+
name={isOn ? configuration.icon_on : configuration.icon_off}
|
|
20
|
+
size={44}
|
|
21
|
+
color={isOn ? Colors.Green7 : Colors.Gray6}
|
|
22
|
+
/>
|
|
23
|
+
<Text
|
|
24
|
+
style={[
|
|
25
|
+
styles.textBig,
|
|
26
|
+
{ color: isOn ? Colors.Gray8 : Colors.Gray6 },
|
|
27
|
+
]}
|
|
28
|
+
>
|
|
29
|
+
{isOn ? configuration.text_on : configuration.text_off}
|
|
30
|
+
</Text>
|
|
31
|
+
</View>
|
|
32
|
+
</TouchableOpacity>
|
|
33
|
+
</View>
|
|
34
|
+
{!!actionGroup.title && !isLight && (
|
|
35
|
+
<Text size={20} semibold center>
|
|
36
|
+
{actionGroup.title}
|
|
37
|
+
</Text>
|
|
38
|
+
)}
|
|
39
|
+
</>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
);
|
|
41
43
|
|
|
42
44
|
export default OnOffButtonTemplate;
|
|
@@ -34,22 +34,30 @@ const OnOffTemplate = memo(({ actionGroup, doAction, sensor }) => {
|
|
|
34
34
|
}
|
|
35
35
|
if (action_on_data && action_off_data) {
|
|
36
36
|
if (isOn) {
|
|
37
|
-
|
|
37
|
+
const actionName = `${
|
|
38
|
+
sensor?.name
|
|
39
|
+
} ${actionGroup?.title?.toLowerCase()} off`;
|
|
40
|
+
doAction(action_off_data, null, actionName);
|
|
38
41
|
} else {
|
|
39
|
-
|
|
42
|
+
const actionName = `${
|
|
43
|
+
sensor?.name
|
|
44
|
+
} ${actionGroup?.title?.toLowerCase()} on`;
|
|
45
|
+
doAction(action_on_data, null, actionName);
|
|
40
46
|
}
|
|
41
47
|
}
|
|
42
48
|
if (sensor?.is_managed_by_backend) {
|
|
43
49
|
configuration.config && watchMultiConfigs([configuration.config]);
|
|
44
50
|
}
|
|
45
51
|
}, [
|
|
52
|
+
actionGroup?.title,
|
|
46
53
|
action_data,
|
|
47
54
|
action_off_data,
|
|
48
55
|
action_on_data,
|
|
49
56
|
configuration.config,
|
|
50
57
|
doAction,
|
|
51
58
|
isOn,
|
|
52
|
-
sensor,
|
|
59
|
+
sensor?.is_managed_by_backend,
|
|
60
|
+
sensor?.name,
|
|
53
61
|
]);
|
|
54
62
|
|
|
55
63
|
useEffect(() => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { memo } from 'react';
|
|
1
|
+
import React, { memo, useCallback } from 'react';
|
|
2
2
|
import { TouchableOpacity, View } from 'react-native';
|
|
3
3
|
import { Icon } from '@ant-design/react-native';
|
|
4
4
|
import Text from '../Text';
|
|
@@ -6,19 +6,22 @@ import Text from '../Text';
|
|
|
6
6
|
import { Colors } from '../../configs';
|
|
7
7
|
import styles from './OneBigButtonTemplateStyle';
|
|
8
8
|
|
|
9
|
-
const OneBigButtonTemplate = memo(({ actionGroup, doAction }) => {
|
|
9
|
+
const OneBigButtonTemplate = memo(({ actionGroup, doAction, sensor }) => {
|
|
10
10
|
const { configuration } = actionGroup;
|
|
11
|
+
const { text, action_data } = configuration || {};
|
|
12
|
+
|
|
13
|
+
const onPressDoAction = useCallback(() => {
|
|
14
|
+
const actionName = `${sensor?.name} ${text?.toLowerCase()}`;
|
|
15
|
+
doAction(action_data, null, actionName);
|
|
16
|
+
}, [action_data, text, doAction, sensor?.name]);
|
|
11
17
|
|
|
12
18
|
return (
|
|
13
19
|
<>
|
|
14
20
|
<View style={styles.barrierControlContainer}>
|
|
15
|
-
<TouchableOpacity
|
|
16
|
-
style={styles.bigCircle}
|
|
17
|
-
onPress={() => doAction(configuration.action_data)}
|
|
18
|
-
>
|
|
21
|
+
<TouchableOpacity style={styles.bigCircle} onPress={onPressDoAction}>
|
|
19
22
|
<View style={styles.smallCircle}>
|
|
20
23
|
<Icon name={configuration.icon} size={44} color={Colors.Green7} />
|
|
21
|
-
<Text style={styles.textBig}>{
|
|
24
|
+
<Text style={styles.textBig}>{text}</Text>
|
|
22
25
|
</View>
|
|
23
26
|
</TouchableOpacity>
|
|
24
27
|
</View>
|
|
@@ -56,7 +56,8 @@ const OptionsDropdownActionTemplate = ({ actionGroup, doAction, sensor }) => {
|
|
|
56
56
|
const onDone = useCallback(() => {
|
|
57
57
|
const newOption = options[selectedIndex];
|
|
58
58
|
const value = getOptionValue(newOption);
|
|
59
|
-
|
|
59
|
+
const actionName = `${sensor?.name} ${title?.toLowerCase()} ${value}`;
|
|
60
|
+
doAction(action_data, value, actionName);
|
|
60
61
|
if (sensor?.is_managed_by_backend) {
|
|
61
62
|
configuration.config && watchMultiConfigs([configuration.config]);
|
|
62
63
|
}
|
|
@@ -68,7 +69,9 @@ const OptionsDropdownActionTemplate = ({ actionGroup, doAction, sensor }) => {
|
|
|
68
69
|
hideAlertAction,
|
|
69
70
|
options,
|
|
70
71
|
selectedIndex,
|
|
71
|
-
sensor
|
|
72
|
+
sensor?.is_managed_by_backend,
|
|
73
|
+
sensor?.name,
|
|
74
|
+
title,
|
|
72
75
|
]);
|
|
73
76
|
|
|
74
77
|
const iconKit = !!icon_kit_data && icon_kit_data.icon;
|
|
@@ -20,7 +20,7 @@ const buttonStyle = {
|
|
|
20
20
|
},
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
const GridItem = ({ item, index, length, doAction, sensor }) => {
|
|
23
|
+
const GridItem = ({ item, index, length, doAction, sensor, title }) => {
|
|
24
24
|
const isFirst = index === 0;
|
|
25
25
|
const isLast = index === length - 1;
|
|
26
26
|
const isNextLine = index % 4 === 0;
|
|
@@ -49,12 +49,15 @@ const GridItem = ({ item, index, length, doAction, sensor }) => {
|
|
|
49
49
|
|
|
50
50
|
const doActionAndWatchConfig = useCallback(
|
|
51
51
|
(actionData) => {
|
|
52
|
-
|
|
52
|
+
const actionName = `${
|
|
53
|
+
sensor?.name
|
|
54
|
+
} ${title?.toLowerCase()} ${text?.toLowerCase()}`;
|
|
55
|
+
doAction(actionData, null, actionName);
|
|
53
56
|
if (sensor?.is_managed_by_backend) {
|
|
54
57
|
config && watchMultiConfigs([config]);
|
|
55
58
|
}
|
|
56
59
|
},
|
|
57
|
-
[config, doAction, sensor
|
|
60
|
+
[config, doAction, sensor?.is_managed_by_backend, sensor?.name, text, title]
|
|
58
61
|
);
|
|
59
62
|
|
|
60
63
|
const iconKit = !!icon_kit_data && icon_kit_data.icon;
|
|
@@ -121,6 +124,7 @@ const StatesGridActionTemplate = ({ actionGroup, doAction, sensor }) => {
|
|
|
121
124
|
length={options.length}
|
|
122
125
|
doAction={doAction}
|
|
123
126
|
sensor={sensor}
|
|
127
|
+
title={title}
|
|
124
128
|
/>
|
|
125
129
|
))}
|
|
126
130
|
</View>
|
|
@@ -8,9 +8,19 @@ import { TESTID } from '../../configs/Constants';
|
|
|
8
8
|
import { Colors } from '../../configs';
|
|
9
9
|
import { Card } from '../../commons/CardShadow';
|
|
10
10
|
|
|
11
|
-
const ThreeButtonTemplate = memo(({ actionGroup, doAction }) => {
|
|
11
|
+
const ThreeButtonTemplate = memo(({ actionGroup, doAction, sensor }) => {
|
|
12
12
|
const t = useTranslations();
|
|
13
13
|
const { configuration } = actionGroup;
|
|
14
|
+
const {
|
|
15
|
+
text1,
|
|
16
|
+
action1_data,
|
|
17
|
+
text2,
|
|
18
|
+
action2_data,
|
|
19
|
+
text3,
|
|
20
|
+
action3_data,
|
|
21
|
+
action_off_data,
|
|
22
|
+
action_on_data,
|
|
23
|
+
} = configuration;
|
|
14
24
|
const [lock, setLock] = useState(false);
|
|
15
25
|
const iconCustom = (icon) => {
|
|
16
26
|
return icon === 'stop' ? (
|
|
@@ -19,32 +29,31 @@ const ThreeButtonTemplate = memo(({ actionGroup, doAction }) => {
|
|
|
19
29
|
<Icon name={icon} size={30} color={Colors.Primary} />
|
|
20
30
|
);
|
|
21
31
|
};
|
|
22
|
-
const onButton1Press = useCallback(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
const onButton1Press = useCallback(() => {
|
|
33
|
+
const actionName = `${sensor?.name} ${text1?.toLowerCase()}`;
|
|
34
|
+
doAction(action1_data, null, actionName);
|
|
35
|
+
}, [action1_data, text1, doAction, sensor?.name]);
|
|
36
|
+
|
|
37
|
+
const onButton2Press = useCallback(() => {
|
|
38
|
+
const actionName = `${sensor?.name} ${text2?.toLowerCase()}`;
|
|
39
|
+
doAction(action2_data, null, actionName);
|
|
40
|
+
}, [action2_data, text2, doAction, sensor?.name]);
|
|
41
|
+
|
|
42
|
+
const onButton3Press = useCallback(() => {
|
|
43
|
+
const actionName = `${sensor?.name} ${text3?.toLowerCase()}`;
|
|
44
|
+
doAction(action3_data, null, actionName);
|
|
45
|
+
}, [action3_data, text3, doAction, sensor?.name]);
|
|
46
|
+
|
|
34
47
|
const onChangeSwitch = useCallback(() => {
|
|
35
48
|
if (lock) {
|
|
36
49
|
setLock(false);
|
|
37
|
-
doAction(
|
|
50
|
+
doAction(action_off_data);
|
|
38
51
|
return;
|
|
39
52
|
}
|
|
40
|
-
doAction(
|
|
53
|
+
doAction(action_on_data);
|
|
41
54
|
setLock(true);
|
|
42
|
-
}, [
|
|
43
|
-
|
|
44
|
-
configuration.action_on_data,
|
|
45
|
-
doAction,
|
|
46
|
-
lock,
|
|
47
|
-
]);
|
|
55
|
+
}, [action_off_data, action_on_data, doAction, lock]);
|
|
56
|
+
|
|
48
57
|
const itemLock = (icon, color) => {
|
|
49
58
|
return (
|
|
50
59
|
<>
|
|
@@ -84,7 +93,7 @@ const ThreeButtonTemplate = memo(({ actionGroup, doAction }) => {
|
|
|
84
93
|
color={Colors.Primary}
|
|
85
94
|
/>
|
|
86
95
|
</View>
|
|
87
|
-
<Text style={styles.text}>{
|
|
96
|
+
<Text style={styles.text}>{text1}</Text>
|
|
88
97
|
</TouchableOpacity>
|
|
89
98
|
|
|
90
99
|
<TouchableOpacity
|
|
@@ -96,7 +105,7 @@ const ThreeButtonTemplate = memo(({ actionGroup, doAction }) => {
|
|
|
96
105
|
<View style={styles.imageButton}>
|
|
97
106
|
{iconCustom(configuration.icon2)}
|
|
98
107
|
</View>
|
|
99
|
-
<Text style={styles.text}>{
|
|
108
|
+
<Text style={styles.text}>{text2}</Text>
|
|
100
109
|
</TouchableOpacity>
|
|
101
110
|
|
|
102
111
|
<TouchableOpacity
|
|
@@ -112,7 +121,7 @@ const ThreeButtonTemplate = memo(({ actionGroup, doAction }) => {
|
|
|
112
121
|
color={Colors.Primary}
|
|
113
122
|
/>
|
|
114
123
|
</View>
|
|
115
|
-
<Text style={styles.text}>{
|
|
124
|
+
<Text style={styles.text}>{text3}</Text>
|
|
116
125
|
</TouchableOpacity>
|
|
117
126
|
</View>
|
|
118
127
|
<View style={styles.lockSwitch}>
|