@eohjsc/react-native-smart-city 0.3.8 → 0.3.9
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/README.md +36 -15
- package/package.json +10 -6
- package/react-native-smart-city.podspec +1 -0
- package/src/commons/Action/ItemQuickAction.js +16 -4
- package/src/commons/Action/__test__/ItemQuickAction.test.js +11 -6
- package/src/commons/ActionGroup/ColorPickerTemplate.js +37 -24
- package/src/commons/ActionGroup/CurtainButtonTemplate.js +10 -5
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/__test__/index.test.js +4 -0
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscode.js +1 -1
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/ItemPasscode.test.js +24 -0
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +14 -0
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/index.js +1 -0
- package/src/commons/ActionGroup/OnOffTemplate/OnOffButtonTemplate.js +8 -2
- package/src/commons/ActionGroup/SliderRangeTemplate.js +6 -2
- package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +7 -3
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +22 -8
- package/src/commons/ActionGroup/TimerActionTemplate.js +11 -3
- package/src/commons/ActionGroup/TwoButtonTemplate/index.js +1 -5
- package/src/commons/ActionGroup/__test__/CurtainButtonTemplate.test.js +53 -4
- package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +14 -14
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +53 -78
- package/src/commons/ActionGroup/__test__/OneBigButtonTemplate.test.js +36 -20
- package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +77 -0
- package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +58 -6
- package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +49 -1
- package/src/commons/ActionGroup/__test__/index.test.js +135 -0
- package/src/commons/Auth/AccountList.js +1 -1
- package/src/commons/Automate/ItemAutomate.js +1 -3
- package/src/commons/Calendar/__test__/Calendar.test.js +33 -0
- package/src/commons/Connecting/__test__/Connecting.test.js +19 -2
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItem.js +7 -3
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItemStyles.js +8 -11
- package/src/commons/ConnectingProcess/__test__/Connecting.test.js +136 -3
- package/src/commons/ConnectingProcess/__test__/DeviceItem.test.js +3 -2
- package/src/commons/ConnectingProcess/index.js +76 -26
- package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +16 -13
- package/src/commons/Dashboard/MyPinnedSharedUnit/index.js +1 -1
- package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +0 -5
- package/src/commons/Device/ConnectedViewHeader.js +1 -1
- package/src/commons/Device/Hanet/ItemHanetDevice.test.js +58 -0
- package/src/commons/Device/HistoryChart.js +7 -3
- package/src/commons/Device/ItemDevice.js +34 -13
- package/src/commons/Device/LinearChart.js +15 -0
- package/src/commons/Device/PMSensor/PMSensorIndicatior.js +16 -12
- package/src/commons/Device/PMSensor/PMSensorIndicatorStyles.js +3 -0
- package/src/commons/Device/SonosSpeaker/index.js +1 -1
- package/src/commons/Device/WaterQualitySensor/ListQualityIndicator.js +1 -0
- package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +7 -2
- package/src/commons/Explore/__test__/CityItem.test.js +33 -54
- package/src/commons/FieldTemplate/ChooseUserField/ChooseFieldStyles.js +25 -0
- package/src/commons/FieldTemplate/ChooseUserField/ChoosePopup.js +96 -0
- package/src/commons/FieldTemplate/ChooseUserField/ChoosePopupStyles.js +39 -0
- package/src/commons/FieldTemplate/ChooseUserField/__test__/index.test.js +118 -0
- package/src/commons/FieldTemplate/ChooseUserField/index.js +62 -0
- package/src/commons/FieldTemplate/PasscodeField/PasscodeFieldStyles.js +30 -0
- package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +90 -0
- package/src/commons/FieldTemplate/PasscodeField/index.js +43 -0
- package/src/commons/FieldTemplate/ScheduleField/ScheduleFieldStyles.js +13 -0
- package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +179 -0
- package/src/commons/FieldTemplate/ScheduleField/index.js +176 -0
- package/src/commons/Form/CurrencyInput.js +15 -1
- package/src/commons/Form/TextInputPassword.js +1 -1
- package/src/commons/FullLoading/index.js +2 -1
- package/src/commons/Header/HeaderCustom.js +2 -1
- package/src/commons/HeaderAni/index.js +6 -1
- package/src/commons/HorizontalPicker/index.js +2 -2
- package/src/commons/MediaPlayerDetail/Styles/MediaPlayerDetailStyles.js +0 -6
- package/src/commons/MediaPlayerDetail/index.js +26 -47
- package/src/commons/MenuActionAddnew/index.js +1 -0
- package/src/commons/MenuActionList/index.js +1 -0
- package/src/commons/MenuActionMore/index.js +1 -1
- package/src/commons/PreventAccess/__test__/PreventAccess.test.js +62 -0
- package/src/commons/PreventAccess/index.js +9 -1
- package/src/commons/Sharing/MemberList.js +10 -2
- package/src/commons/Sharing/WrapHeaderScrollable.js +2 -0
- package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +0 -1
- package/src/commons/SubUnit/Favorites/index.js +2 -3
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +8 -35
- package/src/commons/SubUnit/OneTap/index.js +1 -2
- package/src/commons/SubUnit/ShortDetail.js +25 -9
- package/src/commons/SubUnit/__test__/Item.test.js +0 -1
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +9 -2
- package/src/commons/Unit/SharedUnit.js +1 -0
- package/src/commons/Unit/__test__/SharedUnit.test.js +38 -183
- package/src/commons/UnitSummary/ConfigHistoryChart/index.js +2 -13
- package/src/commons/UnitSummary/ConfigHistoryChart.js +22 -13
- package/src/commons/WheelDateTimePicker/index.js +4 -3
- package/src/configs/API.js +87 -143
- package/src/configs/Constants.js +61 -1
- package/src/configs/SCConfig.js +4 -0
- package/src/context/actionType.ts +10 -0
- package/src/context/mockStore.ts +11 -0
- package/src/context/reducer.ts +51 -2
- package/src/hooks/Common/index.js +2 -0
- package/src/hooks/Common/useGGHomeDeviceConnected.js +16 -0
- package/src/hooks/Common/useGetIdUser.js +1 -5
- package/src/hooks/Common/useSensorsStatus.js +4 -4
- package/src/hooks/IoT/__test__/useGGHomeConnection.test.js +199 -0
- package/src/hooks/IoT/__test__/useRemoteControl.test.js +198 -0
- package/src/hooks/IoT/index.js +4 -0
- package/src/hooks/IoT/useGGHomeConnection.js +93 -0
- package/src/hooks/IoT/useRemoteControl.js +79 -0
- package/src/hooks/index.js +4 -0
- package/src/hooks/useReceiveNotifications.js +9 -5
- package/src/iot/Monitor.js +3 -2
- package/src/iot/RemoteControl/Bluetooth.js +1 -1
- package/src/iot/RemoteControl/GoogleHome.js +75 -49
- package/src/iot/RemoteControl/Internet.js +1 -1
- package/src/iot/RemoteControl/__test__/GoogleHome.test.js +95 -48
- package/src/iot/RemoteControl/__test__/Internet.test.js +18 -7
- package/src/iot/RemoteControl/__test__/LgThinq.test.js +36 -177
- package/src/iot/RemoteControl/index.js +52 -52
- package/src/navigations/UnitStack.js +11 -20
- package/src/navigations/UnitStackStyles.js +21 -0
- package/src/screens/AQIGuide/index.js +1 -1
- package/src/screens/ActivityLog/FilterPopup.js +2 -0
- package/src/screens/ActivityLog/__test__/index.test.js +38 -23
- package/src/screens/ActivityLog/hooks/__test__/index.test.js +51 -90
- package/src/screens/ActivityLog/hooks/index.js +1 -1
- package/src/screens/ActivityLog/index.js +2 -2
- package/src/screens/AddCommon/SelectSubUnit.js +1 -0
- package/src/screens/AddCommon/SelectUnit.js +1 -0
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +13 -24
- package/src/screens/AddCommon/__test__/SelectUnit.test.js +9 -33
- package/src/screens/AddLocationMaps/index.js +9 -5
- package/src/screens/AddNewAction/SelectAction.js +8 -8
- package/src/screens/AddNewAction/SelectSensorDevices.js +8 -2
- package/src/screens/AddNewAction/SetupSensor.js +7 -7
- package/src/screens/AddNewAction/__test__/SelectAction.test.js +10 -91
- package/src/screens/AddNewAction/__test__/SelectSensorDevices.test.js +40 -26
- package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +3 -1
- package/src/screens/AddNewAutoSmart/index.js +5 -2
- package/src/screens/AddNewDevice/ConnectingDevices.js +3 -3
- package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +42 -34
- package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +0 -4
- package/src/screens/AddNewDevice/__test__/ConnectingDevices.test.js +22 -22
- package/src/screens/AddNewDevice/hooks/ConnectDevices.js +1 -1
- package/src/screens/AddNewDevice/index.js +1 -0
- package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +23 -17
- package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +46 -40
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/GatewayWifiList.test.js +64 -10
- package/src/screens/AddNewGateway/SelectGateway.js +1 -0
- package/src/screens/AddNewGateway/SetupGatewayWifi.js +2 -0
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +4 -6
- package/src/screens/AddNewGateway/__test__/ConnectedGateway.test.js +0 -4
- package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +5 -29
- package/src/screens/AddNewGateway/__test__/SelectGateway.test.js +0 -4
- package/src/screens/AddNewGateway/__test__/SetupGateway.test.js +0 -4
- package/src/screens/AddNewGateway/index.js +1 -0
- package/src/screens/AddNewOneTap/__test__/AddNewOneTap.test.js +10 -24
- package/src/screens/AddNewOneTap/index.js +3 -2
- package/src/screens/AllCamera/index.js +4 -4
- package/src/screens/Automate/MultiUnits.js +8 -8
- package/src/screens/Automate/__test__/MultiUnits.test.js +6 -9
- package/src/screens/Automate/__test__/index.test.js +7 -12
- package/src/screens/Automate/index.js +5 -3
- package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +36 -8
- package/src/screens/ConfirmUnitDeletion/index.js +7 -1
- package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +71 -22
- package/src/screens/Device/EditDevice/index.js +17 -15
- package/src/screens/Device/__test__/detail.test.js +33 -86
- package/src/screens/Device/components/DetailHistoryChart.js +1 -1
- package/src/screens/Device/components/SensorConnectStatusViewHeader.js +44 -24
- package/src/screens/Device/components/SensorDisplayItem.js +5 -2
- package/src/screens/Device/detail.js +85 -26
- package/src/screens/Device/hooks/useDisconnectedDevice.js +4 -4
- package/src/screens/Device/hooks/useFavoriteDevice.js +5 -9
- package/src/screens/DeviceInfo/__test__/index.test.js +0 -2
- package/src/screens/EditActionsList/index.js +1 -1
- package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +6 -3
- package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +7 -19
- package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +20 -2
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +40 -23
- package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
- package/src/screens/EmergencySetting/index.js +4 -1
- package/src/screens/EnterPassword/__test__/EnterPassword.test.js +41 -25
- package/src/screens/Explore/index.js +2 -0
- package/src/screens/GuestInfo/__test__/index.test.js +14 -41
- package/src/screens/GuestInfo/components/RecurringDetail.js +1 -0
- package/src/screens/GuestInfo/components/TemporaryDetail.js +2 -2
- package/src/screens/HanetCamera/Detail.js +1 -1
- package/src/screens/HanetCamera/__test__/CaptureFaceID.test.js +8 -12
- package/src/screens/HanetCamera/__test__/Detail.test.js +27 -42
- package/src/screens/HanetCamera/__test__/ManageAccess.test.js +8 -5
- package/src/screens/HanetCamera/__test__/MemberInfo.test.js +10 -32
- package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +3 -2
- package/src/screens/HanetCamera/hooks/__test__/useHanetCheckinData.test.js +43 -35
- package/src/screens/HanetCamera/hooks/__test__/useHanetPlaceMembers.test.js +10 -21
- package/src/screens/HanetCamera/hooks/useHanetCheckinData.js +11 -11
- package/src/screens/HanetCamera/hooks/useHanetPlaceMembers.js +11 -11
- package/src/screens/ManageAccess/__test__/ManageAccess.test.js +33 -22
- package/src/screens/ManageAccess/hooks/__test__/useManageAccess.test.js +44 -45
- package/src/screens/ManageAccess/hooks/index.js +7 -4
- package/src/screens/ManageAccess/index.js +2 -1
- package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +35 -12
- package/src/screens/MoveToAnotherSubUnit/index.js +6 -6
- package/src/screens/Notification/__test__/Notification.test.js +14 -25
- package/src/screens/Notification/__test__/NotificationItem.test.js +8 -7
- package/src/screens/Notification/components/NotificationItem.js +17 -20
- package/src/screens/Notification/index.js +9 -2
- package/src/screens/PlayBackCamera/Timer.js +2 -2
- package/src/screens/PlayBackCamera/__test__/index.test.js +87 -2
- package/src/screens/PlayBackCamera/index.js +54 -35
- package/src/screens/ScanChipQR/__test__/ScanChipQR.test.js +7 -20
- package/src/screens/ScanChipQR/components/QRScan/index.js +1 -0
- package/src/screens/ScanChipQR/hooks/index.js +15 -16
- package/src/screens/ScanSensorQR/__test__/ScanSensorQR.test.js +8 -24
- package/src/screens/ScriptDetail/__test__/index.test.js +17 -86
- package/src/screens/ScriptDetail/index.js +19 -14
- package/src/screens/SelectUnit/__test__/index.test.js +12 -55
- package/src/screens/SelectUnit/index.js +9 -4
- package/src/screens/SetSchedule/index.js +15 -11
- package/src/screens/SharedUnit/__test__/TabHeader.test.js +0 -2
- package/src/screens/SharedUnit/index.js +2 -0
- package/src/screens/Sharing/Components/SensorItem.js +10 -12
- package/src/screens/Sharing/InfoMemberUnit.js +1 -1
- package/src/screens/Sharing/MemberList.js +12 -11
- package/src/screens/Sharing/SelectPermission.js +121 -76
- package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +47 -29
- package/src/screens/Sharing/__test__/MemberList.test.js +13 -127
- package/src/screens/Sharing/__test__/MemberList2.test.js +80 -0
- package/src/screens/Sharing/__test__/SelectPermission.test.js +28 -38
- package/src/screens/Sharing/__test__/SelectUser.test.js +17 -38
- package/src/screens/Sharing/hooks/index.js +3 -0
- package/src/screens/SideMenuDetail/SideMenuDetailStyles.js +28 -0
- package/src/screens/SideMenuDetail/__test__/index.test.js +154 -0
- package/src/screens/SideMenuDetail/index.js +148 -0
- package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +3 -2
- package/src/screens/SmartIr/components/SelectBrand.js +1 -1
- package/src/screens/SubUnit/AddSubUnit.js +23 -17
- package/src/screens/SubUnit/Detail.js +1 -2
- package/src/screens/SubUnit/EditSubUnit.js +15 -13
- package/src/screens/SubUnit/ManageSubUnit.js +13 -7
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +29 -89
- package/src/screens/SubUnit/__test__/Detail.test.js +31 -8
- package/src/screens/SubUnit/__test__/EditSubUnit.test.js +21 -89
- package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +27 -1
- package/src/screens/SubUnit/hooks/__test__/useManageSubUnit.test.js +48 -45
- package/src/screens/SubUnit/hooks/useManageSubUnit.js +7 -7
- package/src/screens/SyncLGDevice/AddLGDevice.js +1 -0
- package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +22 -91
- package/src/screens/TDSGuide/index.js +4 -1
- package/src/screens/UVIndexGuide/index.js +1 -1
- package/src/screens/Unit/ChooseLocation.js +7 -14
- package/src/screens/Unit/Detail.js +31 -75
- package/src/screens/Unit/ManageUnit.js +1 -0
- package/src/screens/Unit/SelectAddress.js +45 -23
- package/src/screens/Unit/SmartAccount.js +4 -4
- package/src/screens/Unit/Station/index.js +4 -0
- package/src/screens/Unit/Summaries.js +18 -2
- package/src/screens/Unit/__test__/CheckSendEmail.test.js +24 -29
- package/src/screens/Unit/__test__/ChooseLocation.test.js +27 -14
- package/src/screens/Unit/__test__/Detail.test.js +98 -199
- package/src/screens/Unit/__test__/ManageUnit.test.js +18 -42
- package/src/screens/Unit/__test__/SelectAddress.test.js +159 -49
- package/src/screens/Unit/__test__/SmartAccount.test.js +17 -9
- package/src/screens/Unit/__test__/SmartAccountItem.test.js +0 -1
- package/src/screens/Unit/__test__/Summaries.test.js +100 -0
- package/src/screens/Unit/components/MyAllUnit/__test__/MyAllUnit.test.js +36 -0
- package/src/screens/Unit/components/MyAllUnit/__test__/index.test.js +54 -0
- package/src/screens/Unit/components/MyUnitDevice/index.js +4 -4
- package/src/screens/Unit/components/SharedUnit/index.js +1 -0
- package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +2 -2
- package/src/screens/Unit/components/__test__/SharedUnit.test.js +31 -34
- package/src/screens/Unit/hook/useUnitConnectRemoteDevices.js +50 -0
- package/src/screens/Unit/styles.js +4 -0
- package/src/screens/UnitSummary/__test__/index.test.js +91 -30
- package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +31 -2
- package/src/screens/UnitSummary/components/PowerConsumeHistoryChart/__test__/index.test.js +7 -4
- package/src/screens/UnitSummary/components/PowerConsumeHistoryChart/index.js +2 -13
- package/src/screens/UnitSummary/components/PowerConsumption/__test__/ItemPower.test.js +0 -1
- package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +14 -16
- package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +11 -2
- package/src/screens/UnitSummary/components/RunningDevices/index.js +7 -10
- package/src/screens/UnitSummary/components/Temperature/index.js +4 -4
- package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +10 -2
- package/src/screens/UnitSummary/index.js +15 -1
- package/src/screens/WaterQualityGuide/index.js +1 -1
- package/src/utils/Apis/axios.js +54 -31
- package/src/utils/Converter/time.js +0 -18
- package/src/utils/I18n/translations/en.json +7 -1
- package/src/utils/I18n/translations/vi.json +8 -1
- package/src/utils/Permission/common.js +67 -0
- package/src/utils/Route/index.js +1 -0
- package/src/utils/Setting/Location.js +30 -0
- package/src/utils/Utils.js +11 -7
- package/src/utils/__test__/Utils.test.js +12 -0
package/README.md
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
## react-native-smart-city
|
|
2
2
|
|
|
3
3
|
## Getting started
|
|
4
|
+
|
|
4
5
|
1. Install package dependencies:
|
|
5
|
-
|
|
6
|
+
|
|
7
|
+
- Using [Yarn](https://yarnpkg.com/): `yarn add react-native-reanimated@^1.10.1`
|
|
6
8
|
|
|
7
9
|
2. Install:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
- Using [npm](https://www.npmjs.com/#getting-started): `npm install @eohjsc/react-native-smart-city --save`
|
|
12
|
+
- Using [Yarn](https://yarnpkg.com/): `yarn add @eohjsc/react-native-smart-city`
|
|
10
13
|
|
|
11
14
|
3. Compile application using react-native run-android
|
|
15
|
+
|
|
12
16
|
### Mostly automatic installation
|
|
17
|
+
|
|
13
18
|
`$ react-native link @eohjsc/react-native-smart-city`
|
|
14
19
|
|
|
15
20
|
## Usage
|
|
21
|
+
|
|
16
22
|
1. StackNavigator
|
|
23
|
+
|
|
17
24
|
```javascript
|
|
18
25
|
import {
|
|
19
26
|
UnitStack,
|
|
@@ -30,7 +37,7 @@ import {
|
|
|
30
37
|
} from '@eohjsc/react-native-smart-city';
|
|
31
38
|
import { createStackNavigator } from '@react-navigation/stack';
|
|
32
39
|
|
|
33
|
-
// TODO: What to do with the module?
|
|
40
|
+
// TODO: What to do with the module?
|
|
34
41
|
const Stack = createStackNavigator();
|
|
35
42
|
|
|
36
43
|
const YourStack = () => {
|
|
@@ -84,7 +91,9 @@ const MainTab = () => {
|
|
|
84
91
|
);
|
|
85
92
|
};
|
|
86
93
|
```
|
|
94
|
+
|
|
87
95
|
2. Use components
|
|
96
|
+
|
|
88
97
|
```javascript
|
|
89
98
|
import React from 'react';
|
|
90
99
|
import { View } from 'react-native';
|
|
@@ -93,13 +102,15 @@ import { MyPinnedSharedUnit, MyUnit } from '@eohjsc/react-native-smart-city';
|
|
|
93
102
|
const MyScreen = () => {
|
|
94
103
|
return (
|
|
95
104
|
<View>
|
|
96
|
-
|
|
97
|
-
|
|
105
|
+
<MyUnit />
|
|
106
|
+
<MyPinnedSharedUnit />
|
|
98
107
|
</View>
|
|
99
108
|
);
|
|
100
109
|
};
|
|
101
110
|
```
|
|
111
|
+
|
|
102
112
|
3. Trigger quick action
|
|
113
|
+
|
|
103
114
|
```javascript
|
|
104
115
|
import React from 'react';
|
|
105
116
|
import { View, Button } from 'react-native';
|
|
@@ -126,23 +137,33 @@ export const MyFunctionalComponent = () => {
|
|
|
126
137
|
lg_actions: [],
|
|
127
138
|
name: 'Garage Up',
|
|
128
139
|
};
|
|
129
|
-
const handleQuickAction = async() => {
|
|
140
|
+
const handleQuickAction = async () => {
|
|
130
141
|
const result = await sendRemoteCommand(sensor, action); // Action Garage Up
|
|
131
|
-
if (result){
|
|
132
|
-
console.log('Successful control')
|
|
133
|
-
}else {
|
|
134
|
-
console.log('Control failed')
|
|
142
|
+
if (result) {
|
|
143
|
+
console.log('Successful control');
|
|
144
|
+
} else {
|
|
145
|
+
console.log('Control failed');
|
|
135
146
|
}
|
|
136
147
|
};
|
|
137
148
|
return (
|
|
138
149
|
<View>
|
|
139
|
-
<Button
|
|
150
|
+
<Button
|
|
151
|
+
onPress={handleQuickAction}
|
|
152
|
+
title="Example trigger quick action control Garage Up"
|
|
153
|
+
/>
|
|
140
154
|
</View>
|
|
141
155
|
);
|
|
142
156
|
};
|
|
143
157
|
```
|
|
144
|
-
|
|
145
|
-
- `
|
|
158
|
+
|
|
159
|
+
- sendRemoteCommand user needs to `have permission to control the device`, you pass in the `sensor and action` to it and it will run after calling render.
|
|
160
|
+
- `sensor` is a device in your Unit and action is the `action` key of the device..
|
|
146
161
|
- You can take out the sensor and action from your Unit when calling the `API.UNIT.UNIT_DETAIL(unitId)` it will return all devices in 1 unit.
|
|
147
|
-
- Or get sensor from `API.
|
|
162
|
+
- Or get sensor from `API.DEVICE.DISPLAY(sensor.id)` returns all actions of 1 device.
|
|
148
163
|
- Refer YourProjectPath /node_modules/@eohjsc/react-native-smart-city/src/screens/Unit/Detail.js
|
|
164
|
+
|
|
165
|
+
## Sync file to EoH source
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
yarn install && yarn watch
|
|
169
|
+
```
|
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.3.
|
|
4
|
+
"version": "0.3.09",
|
|
5
5
|
"description": "TODO",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"ios": "react-native run-ios",
|
|
19
19
|
"start": "react-native start",
|
|
20
20
|
"test": "yarn run lint && yarn run jest",
|
|
21
|
-
"lint": "eslint . --ext js --ext ts --ext tsx",
|
|
21
|
+
"lint": "eslint . --ext js --ext ts --ext tsx --max-warnings 5",
|
|
22
22
|
"lint-fix": "eslint . --fix",
|
|
23
23
|
"type-check": "npx tsc",
|
|
24
24
|
"pod": "cd ios && pod install",
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"@types/react": "^17.0.0",
|
|
75
75
|
"@types/react-native": "^0.63.43",
|
|
76
76
|
"@types/react-test-renderer": "^17.0.0",
|
|
77
|
+
"axios-mock-adapter": "^1.21.1",
|
|
77
78
|
"babel-jest": "^26.6.3",
|
|
78
79
|
"detox": "^18.3.1",
|
|
79
80
|
"eslint": "7.14.0",
|
|
@@ -99,7 +100,7 @@
|
|
|
99
100
|
"@ant-design/icons-react-native": "^2.2.1",
|
|
100
101
|
"@ant-design/react-native": "^4.0.5",
|
|
101
102
|
"@babel/helper-environment-visitor": "^7.16.7",
|
|
102
|
-
"@eohjsc/highcharts": "^1.0.
|
|
103
|
+
"@eohjsc/highcharts": "^1.0.9",
|
|
103
104
|
"@eohjsc/react-native-keyboard-aware-scroll-view": "^0.9.5",
|
|
104
105
|
"@formatjs/intl-getcanonicallocales": "^1.4.5",
|
|
105
106
|
"@formatjs/intl-numberformat": "^5.6.2",
|
|
@@ -124,6 +125,7 @@
|
|
|
124
125
|
"@react-navigation/stack": "^5.7.0",
|
|
125
126
|
"@sentry/react-native": "^1.7.1",
|
|
126
127
|
"@testing-library/react-hooks": "^6.0.0",
|
|
128
|
+
"apisauce": "^2.1.5",
|
|
127
129
|
"axios": "^0.19.2",
|
|
128
130
|
"dotenv": "^8.2.0",
|
|
129
131
|
"google-libphonenumber": "^3.2.10",
|
|
@@ -144,6 +146,8 @@
|
|
|
144
146
|
"react-hooks-global-state": "^1.0.1",
|
|
145
147
|
"react-i18next": "^11.8.12",
|
|
146
148
|
"react-native-alert-async": "^1.0.5",
|
|
149
|
+
"react-native-android-keyboard-adjust": "^1.2.0",
|
|
150
|
+
"react-native-android-location-enabler": "^1.2.2",
|
|
147
151
|
"react-native-android-wifi": "^0.0.41",
|
|
148
152
|
"react-native-appearance": "^0.3.4",
|
|
149
153
|
"react-native-base64": "^0.1.0",
|
|
@@ -174,7 +178,7 @@
|
|
|
174
178
|
"react-native-pager-view": "^5.4.1",
|
|
175
179
|
"react-native-parallax-scroll-view": "^0.21.3",
|
|
176
180
|
"react-native-parsed-text": "^0.0.22",
|
|
177
|
-
"react-native-permissions": "
|
|
181
|
+
"react-native-permissions": "3.0.3",
|
|
178
182
|
"react-native-popover-view": "^4.0.3",
|
|
179
183
|
"react-native-progress": "^5.0.0",
|
|
180
184
|
"react-native-reanimated": "1.10.1",
|
|
@@ -189,8 +193,8 @@
|
|
|
189
193
|
"react-native-udp": "^4.1.3",
|
|
190
194
|
"react-native-unimodules": "^0.11.0",
|
|
191
195
|
"react-native-version-check": "^3.4.2",
|
|
192
|
-
"react-native-vlc-media-player": "^1.0.
|
|
193
|
-
"react-native-webview": "
|
|
196
|
+
"react-native-vlc-media-player": "^1.0.41",
|
|
197
|
+
"react-native-webview": "11.17.2",
|
|
194
198
|
"react-native-wheel-color-picker": "^1.2.0",
|
|
195
199
|
"react-native-wheel-scrollview-picker": "^1.2.2",
|
|
196
200
|
"react-native-wifi-reborn": "^4.5.0",
|
|
@@ -3,7 +3,7 @@ import { TouchableOpacity, View } from 'react-native';
|
|
|
3
3
|
import { TESTID } from '../../configs/Constants';
|
|
4
4
|
import { useSCContextSelector } from '../../context';
|
|
5
5
|
import { watchMultiConfigs } from '../../iot/Monitor';
|
|
6
|
-
import {
|
|
6
|
+
import { useRemoteControl } from '../../hooks/IoT';
|
|
7
7
|
import { useConfigGlobalState } from '../../iot/states';
|
|
8
8
|
import IconComponent from '../IconComponent';
|
|
9
9
|
|
|
@@ -13,6 +13,8 @@ const ItemQuickAction = memo(({ sensor, wrapperStyle, setStatus, unit }) => {
|
|
|
13
13
|
// eslint-disable-next-line no-unused-vars
|
|
14
14
|
const [configValues, _] = useConfigGlobalState('configValues');
|
|
15
15
|
|
|
16
|
+
const sendRemoteCommand = useRemoteControl();
|
|
17
|
+
|
|
16
18
|
const revertActionUpdate = useCallback(
|
|
17
19
|
(value, on_action, on_status, off_action, off_status) => {
|
|
18
20
|
setIsSendingCommand(false);
|
|
@@ -43,8 +45,9 @@ const ItemQuickAction = memo(({ sensor, wrapperStyle, setStatus, unit }) => {
|
|
|
43
45
|
useEffect(() => {
|
|
44
46
|
sensor.quick_action &&
|
|
45
47
|
sensor.quick_action.config_id &&
|
|
48
|
+
sensor.device_type !== 'GOOGLE_HOME' &&
|
|
46
49
|
watchMultiConfigs([sensor.quick_action.config_id]);
|
|
47
|
-
}, [sensor.quick_action]);
|
|
50
|
+
}, [sensor.quick_action, sensor?.device_type]);
|
|
48
51
|
|
|
49
52
|
useEffect(() => {
|
|
50
53
|
if (!sensor.quick_action) {
|
|
@@ -59,7 +62,9 @@ const ItemQuickAction = memo(({ sensor, wrapperStyle, setStatus, unit }) => {
|
|
|
59
62
|
const userId = useSCContextSelector((state) => state?.auth.account.user.id);
|
|
60
63
|
const onActionPress = useCallback(() => {
|
|
61
64
|
sendRemoteCommand(sensor, action, null, userId);
|
|
62
|
-
sensor.quick_action &&
|
|
65
|
+
sensor.quick_action &&
|
|
66
|
+
sensor.device_type !== 'GOOGLE_HOME' &&
|
|
67
|
+
watchMultiConfigs([sensor.quick_action.config_id]);
|
|
63
68
|
setIsSendingCommand(true);
|
|
64
69
|
|
|
65
70
|
if (!sensor.quick_action) {
|
|
@@ -78,7 +83,14 @@ const ItemQuickAction = memo(({ sensor, wrapperStyle, setStatus, unit }) => {
|
|
|
78
83
|
statusCallback(action.id === sensor.quick_action.on_action.id);
|
|
79
84
|
}, sensor.quick_action.interval);
|
|
80
85
|
}
|
|
81
|
-
}, [
|
|
86
|
+
}, [
|
|
87
|
+
sensor,
|
|
88
|
+
action,
|
|
89
|
+
userId,
|
|
90
|
+
revertActionUpdate,
|
|
91
|
+
statusCallback,
|
|
92
|
+
sendRemoteCommand,
|
|
93
|
+
]);
|
|
82
94
|
|
|
83
95
|
if (!action) {
|
|
84
96
|
return <View />;
|
|
@@ -5,7 +5,6 @@ import ItemQuickAction from '../ItemQuickAction';
|
|
|
5
5
|
import { Colors } from '../../../configs';
|
|
6
6
|
import { TESTID } from '../../../configs/Constants';
|
|
7
7
|
import { factory } from 'factory-girl';
|
|
8
|
-
import { sendRemoteCommand } from '../../../iot/RemoteControl';
|
|
9
8
|
|
|
10
9
|
class Sensor {}
|
|
11
10
|
|
|
@@ -21,7 +20,13 @@ jest.mock('react', () => {
|
|
|
21
20
|
|
|
22
21
|
useState.mockImplementation((init) => [init, mockSetState]);
|
|
23
22
|
|
|
24
|
-
jest.
|
|
23
|
+
const mockSendRemoteControl = jest.fn();
|
|
24
|
+
jest.mock('../../../hooks/IoT', () => {
|
|
25
|
+
return {
|
|
26
|
+
...jest.requireActual('../../../hooks/IoT'),
|
|
27
|
+
useRemoteControl: () => mockSendRemoteControl,
|
|
28
|
+
};
|
|
29
|
+
});
|
|
25
30
|
|
|
26
31
|
jest.mock('../../../iot/states', () => ({
|
|
27
32
|
useConfigGlobalState: () => [{}, null],
|
|
@@ -83,9 +88,9 @@ describe('Test ItemQuickAction', () => {
|
|
|
83
88
|
};
|
|
84
89
|
|
|
85
90
|
test('render with no action', async () => {
|
|
86
|
-
const
|
|
91
|
+
const newSensor = await factory.build('Sensor');
|
|
87
92
|
act(() => {
|
|
88
|
-
tree = create(<ItemQuickAction sensor={
|
|
93
|
+
tree = create(<ItemQuickAction sensor={newSensor} />);
|
|
89
94
|
});
|
|
90
95
|
const instance = tree.root;
|
|
91
96
|
const buttonOnActionPress = instance.findAll(
|
|
@@ -121,7 +126,7 @@ describe('Test ItemQuickAction', () => {
|
|
|
121
126
|
act(() => {
|
|
122
127
|
buttonOnActionPress.props.onPress();
|
|
123
128
|
});
|
|
124
|
-
expect(
|
|
129
|
+
expect(mockSendRemoteControl).toBeCalled();
|
|
125
130
|
expect(mockSetState).toBeCalledTimes(1);
|
|
126
131
|
|
|
127
132
|
jest.runAllTimers();
|
|
@@ -154,7 +159,7 @@ describe('Test ItemQuickAction', () => {
|
|
|
154
159
|
act(() => {
|
|
155
160
|
buttonOnActionPress.props.onPress();
|
|
156
161
|
});
|
|
157
|
-
expect(
|
|
162
|
+
expect(mockSendRemoteControl).toBeCalled();
|
|
158
163
|
expect(mockSetState).toBeCalledTimes(1);
|
|
159
164
|
|
|
160
165
|
jest.runAllTimers();
|
|
@@ -1,54 +1,67 @@
|
|
|
1
|
-
import React, { memo,
|
|
1
|
+
import React, { memo, useState, useEffect } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import styles from './ColorPickerTemplateStyles';
|
|
4
4
|
import ColorPicker from 'react-native-wheel-color-picker';
|
|
5
5
|
import { watchMultiConfigs } from '../../iot/Monitor';
|
|
6
6
|
import { useConfigGlobalState } from '../../iot/states';
|
|
7
7
|
|
|
8
|
+
let isFirstTime = true;
|
|
9
|
+
|
|
10
|
+
const WheelColorPicker = ({ valueColor, onChangeColor }) => {
|
|
11
|
+
return (
|
|
12
|
+
<ColorPicker
|
|
13
|
+
style={styles.colorPicker}
|
|
14
|
+
sliderHidden={true}
|
|
15
|
+
swatches={false}
|
|
16
|
+
color={valueColor}
|
|
17
|
+
onColorChangeComplete={onChangeColor}
|
|
18
|
+
thumbSize={16}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
8
23
|
const ColorPickerTemplate = memo(({ actionGroup, doAction, sensor }) => {
|
|
9
24
|
const { configuration } = actionGroup;
|
|
10
25
|
const [valueColorComplete, setValueColorComplete] = useState('');
|
|
11
|
-
const [isFirstColor, setIsFirstColor] = useState(false);
|
|
12
26
|
const [configValues] = useConfigGlobalState('configValues');
|
|
13
27
|
|
|
14
|
-
const onChangeColor =
|
|
15
|
-
(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
28
|
+
const onChangeColor = (color) => {
|
|
29
|
+
const to = setTimeout(() => {
|
|
30
|
+
isFirstTime = false;
|
|
31
|
+
clearTimeout(to);
|
|
32
|
+
}, 1000);
|
|
33
|
+
|
|
34
|
+
!isFirstTime &&
|
|
20
35
|
doAction(
|
|
21
36
|
configuration?.action_color_data,
|
|
22
37
|
JSON.stringify({ value: color })
|
|
23
38
|
);
|
|
24
|
-
|
|
25
|
-
[configuration?.action_color_data, doAction, isFirstColor]
|
|
26
|
-
);
|
|
27
|
-
const valueColor = useMemo(() => {
|
|
28
|
-
return valueColorComplete || '';
|
|
29
|
-
}, [valueColorComplete]);
|
|
39
|
+
};
|
|
30
40
|
|
|
31
41
|
useEffect(() => {
|
|
32
42
|
const { config } = configuration;
|
|
33
43
|
const configValue = configValues[config];
|
|
34
|
-
|
|
35
|
-
|
|
44
|
+
if (configValue && isFirstTime) {
|
|
45
|
+
setValueColorComplete(`#${configValue?.toString(16)}`);
|
|
46
|
+
}
|
|
47
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
|
+
}, [configValues]);
|
|
36
49
|
|
|
37
50
|
useEffect(() => {
|
|
38
|
-
if (sensor?.is_managed_by_backend) {
|
|
51
|
+
if (sensor?.is_managed_by_backend && sensor.device_type !== 'GOOGLE_HOME') {
|
|
39
52
|
watchMultiConfigs([configuration.config]);
|
|
40
53
|
}
|
|
41
54
|
}, [sensor, configuration.config]);
|
|
42
55
|
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
return () => (isFirstTime = true);
|
|
58
|
+
}, []);
|
|
59
|
+
|
|
43
60
|
return (
|
|
44
61
|
<View style={styles.viewPickColor}>
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
swatches={false}
|
|
49
|
-
color={valueColor}
|
|
50
|
-
onColorChangeComplete={onChangeColor}
|
|
51
|
-
thumbSize={16}
|
|
62
|
+
<WheelColorPicker
|
|
63
|
+
valueColor={valueColorComplete}
|
|
64
|
+
onChangeColor={onChangeColor}
|
|
52
65
|
/>
|
|
53
66
|
</View>
|
|
54
67
|
);
|
|
@@ -17,6 +17,11 @@ const CurtainButtonTemplate = memo(({ actionGroup, doAction, sensor }) => {
|
|
|
17
17
|
close_action_data,
|
|
18
18
|
action_off_data,
|
|
19
19
|
action_on_data,
|
|
20
|
+
is_display_lock,
|
|
21
|
+
text1,
|
|
22
|
+
text2,
|
|
23
|
+
text3,
|
|
24
|
+
text_door_lock,
|
|
20
25
|
} = configuration || {};
|
|
21
26
|
const [lock, setLock] = useState(false);
|
|
22
27
|
|
|
@@ -52,21 +57,21 @@ const CurtainButtonTemplate = memo(({ actionGroup, doAction, sensor }) => {
|
|
|
52
57
|
{
|
|
53
58
|
style: styles.buttonActionCurtain,
|
|
54
59
|
icon: Images.buttonLeftCurtain,
|
|
55
|
-
text:
|
|
60
|
+
text: text1,
|
|
56
61
|
onPress: onButtonOpenPress,
|
|
57
62
|
testID: TESTID.BUTTON_TEMPLATE_1,
|
|
58
63
|
},
|
|
59
64
|
{
|
|
60
65
|
style: styles.buttonActionCurtainCenter,
|
|
61
66
|
icon: Images.buttonPauseCurtain,
|
|
62
|
-
text:
|
|
67
|
+
text: text2,
|
|
63
68
|
onPress: onButtonStopPress,
|
|
64
69
|
testID: TESTID.BUTTON_TEMPLATE_2,
|
|
65
70
|
},
|
|
66
71
|
{
|
|
67
72
|
style: styles.buttonActionCurtain,
|
|
68
73
|
icon: Images.buttonRightCurtain,
|
|
69
|
-
text:
|
|
74
|
+
text: text3,
|
|
70
75
|
onPress: onButtonClosePress,
|
|
71
76
|
testID: TESTID.BUTTON_TEMPLATE_3,
|
|
72
77
|
},
|
|
@@ -96,7 +101,7 @@ const CurtainButtonTemplate = memo(({ actionGroup, doAction, sensor }) => {
|
|
|
96
101
|
style={styles.textLockDoor}
|
|
97
102
|
testID={TESTID.TEXT_DOOR_LOOK_ON_OFF}
|
|
98
103
|
>
|
|
99
|
-
{
|
|
104
|
+
{text_door_lock}{' '}
|
|
100
105
|
</Text>
|
|
101
106
|
</View>
|
|
102
107
|
<Switch
|
|
@@ -115,7 +120,7 @@ const CurtainButtonTemplate = memo(({ actionGroup, doAction, sensor }) => {
|
|
|
115
120
|
<RenderThreeButtonActions />
|
|
116
121
|
</View>
|
|
117
122
|
<View style={styles.lockSwitch}>
|
|
118
|
-
{
|
|
123
|
+
{is_display_lock &&
|
|
119
124
|
itemLock(
|
|
120
125
|
lock ? 'lock' : 'unlock',
|
|
121
126
|
lock ? Colors.Primary : Colors.Gray6
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { act, create } from 'react-test-renderer';
|
|
3
|
+
import { Switch } from 'react-native';
|
|
3
4
|
|
|
4
5
|
import AutoLock from '../index';
|
|
5
6
|
import { mockSCStore } from '../../../../../context/mockStore';
|
|
@@ -38,6 +39,9 @@ describe('Test AutoLock', () => {
|
|
|
38
39
|
});
|
|
39
40
|
|
|
40
41
|
const instance = tree.root;
|
|
42
|
+
const switchs = instance.findByType(Switch);
|
|
43
|
+
await switchs.props.onValueChange();
|
|
44
|
+
|
|
41
45
|
const { buttonEnable, buttonInstant, buttonRelockTiming } =
|
|
42
46
|
getElement(instance);
|
|
43
47
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TouchableOpacity } from 'react-native';
|
|
3
|
+
import { act, create } from 'react-test-renderer';
|
|
4
|
+
import { SCProvider } from '../../../../../context';
|
|
5
|
+
import { mockSCStore } from '../../../../../context/mockStore';
|
|
6
|
+
import ItemPasscode from '../ItemPasscode';
|
|
7
|
+
|
|
8
|
+
const wrapComponent = (route = {}) => (
|
|
9
|
+
<SCProvider initState={mockSCStore({})}>
|
|
10
|
+
<ItemPasscode route={route} />
|
|
11
|
+
</SCProvider>
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
describe('Test ItemPasscode', () => {
|
|
15
|
+
let tree;
|
|
16
|
+
test('test render without params', async () => {
|
|
17
|
+
await act(async () => {
|
|
18
|
+
tree = await create(wrapComponent());
|
|
19
|
+
});
|
|
20
|
+
const instance = tree.root;
|
|
21
|
+
const TouchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
22
|
+
expect(TouchableOpacities).toHaveLength(2);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -40,6 +40,7 @@ describe('Test SetupGeneratePasscode', () => {
|
|
|
40
40
|
const changeDuration = instance.findAll(
|
|
41
41
|
(item) => item.props.testID === TESTID.GENERATE_PASSCODE_SET_DURATION
|
|
42
42
|
);
|
|
43
|
+
|
|
43
44
|
return {
|
|
44
45
|
changeName,
|
|
45
46
|
changeTime,
|
|
@@ -58,5 +59,18 @@ describe('Test SetupGeneratePasscode', () => {
|
|
|
58
59
|
expect(changeName[0]).toBeDefined();
|
|
59
60
|
expect(changeTime[0]).toBeDefined();
|
|
60
61
|
expect(changeDuration[0]).toBeDefined();
|
|
62
|
+
|
|
63
|
+
await changeDuration[0].props.onPressSetMinute();
|
|
64
|
+
await changeDuration[0].props.onPressSelectCircle();
|
|
65
|
+
await changeTime[0].props.onPressSetTime();
|
|
66
|
+
|
|
67
|
+
const wheelDateTimePicker = instance.findAll(
|
|
68
|
+
(item) =>
|
|
69
|
+
item.props.testID ===
|
|
70
|
+
`${TESTID.WHEEL_DATE_TIME_PICKER_BUTTON}${TESTID.VIEW_BUTTON_BOTTOM_RIGHT_BUTTON}`
|
|
71
|
+
);
|
|
72
|
+
await wheelDateTimePicker[5].props.onClick();
|
|
73
|
+
await wheelDateTimePicker[11].props.onClick();
|
|
74
|
+
await wheelDateTimePicker[17].props.onClick();
|
|
61
75
|
});
|
|
62
76
|
});
|
|
@@ -5,15 +5,20 @@ import React, { memo } from 'react';
|
|
|
5
5
|
import { TouchableOpacity, View } from 'react-native';
|
|
6
6
|
import { Colors } from '../../../configs';
|
|
7
7
|
import styles from './OnOffButtonTemplateStyle';
|
|
8
|
+
import { TESTID } from '../../../configs/Constants';
|
|
8
9
|
|
|
9
10
|
const OnOffButtonTemplate = memo(
|
|
10
11
|
({ isOn, triggerAction, actionGroup, isLight = false }) => {
|
|
11
|
-
const { configuration } = actionGroup;
|
|
12
|
+
const { configuration, id } = actionGroup;
|
|
12
13
|
|
|
13
14
|
return (
|
|
14
15
|
<>
|
|
15
16
|
<View style={styles.barrierControlContainer}>
|
|
16
|
-
<TouchableOpacity
|
|
17
|
+
<TouchableOpacity
|
|
18
|
+
style={styles.bigCircle}
|
|
19
|
+
onPress={triggerAction}
|
|
20
|
+
testID={`${TESTID.ON_OFF_BUTTON}-${id}`}
|
|
21
|
+
>
|
|
17
22
|
<View style={styles.smallCircle}>
|
|
18
23
|
<Icon
|
|
19
24
|
name={isOn ? configuration.icon_on : configuration.icon_off}
|
|
@@ -25,6 +30,7 @@ const OnOffButtonTemplate = memo(
|
|
|
25
30
|
styles.textBig,
|
|
26
31
|
{ color: isOn ? Colors.Gray8 : Colors.Gray6 },
|
|
27
32
|
]}
|
|
33
|
+
testID={`${TESTID.SENSOR_STATUS}-${id}`}
|
|
28
34
|
>
|
|
29
35
|
{isOn ? configuration.text_on : configuration.text_off}
|
|
30
36
|
</Text>
|
|
@@ -33,11 +33,15 @@ const SliderRangeTemplate = memo(({ actionGroup, doAction, sensor }) => {
|
|
|
33
33
|
useEffect(() => {
|
|
34
34
|
const { config } = configuration;
|
|
35
35
|
const configValue = configValues[config];
|
|
36
|
-
|
|
36
|
+
let valueTemp = configValue;
|
|
37
|
+
if (configValue > 0) {
|
|
38
|
+
valueTemp = Math.round((configValue / 254) * 100);
|
|
39
|
+
}
|
|
40
|
+
setValueBrightness(valueTemp);
|
|
37
41
|
}, [configuration.config, configValues, configuration]);
|
|
38
42
|
|
|
39
43
|
useEffect(() => {
|
|
40
|
-
if (sensor?.is_managed_by_backend) {
|
|
44
|
+
if (sensor?.is_managed_by_backend && sensor.device_type !== 'GOOGLE_HOME') {
|
|
41
45
|
watchMultiConfigs([configuration.config]);
|
|
42
46
|
}
|
|
43
47
|
}, [sensor, configuration.config]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { memo, useCallback } from 'react';
|
|
2
|
-
import { View, ScrollView
|
|
2
|
+
import { View, ScrollView } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import styles from './SmartTiviActionTemplateStyles';
|
|
5
5
|
import Text from '../../Text';
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
Youtube,
|
|
23
23
|
Netflix,
|
|
24
24
|
} from './component/Icon';
|
|
25
|
+
import { notImplemented } from '../../../utils/Utils';
|
|
25
26
|
|
|
26
27
|
const SmartTiviActionTemplate = memo(
|
|
27
28
|
({ actionGroup, doAction, scrollEnabled = true }) => {
|
|
@@ -68,7 +69,7 @@ const SmartTiviActionTemplate = memo(
|
|
|
68
69
|
case SMART_TIVI_BUTTON.HOME_BUTTON:
|
|
69
70
|
case SMART_TIVI_BUTTON.BACK_BUTTON:
|
|
70
71
|
case SMART_TIVI_BUTTON.CHANNEL_BUTTON:
|
|
71
|
-
return
|
|
72
|
+
return notImplemented(t);
|
|
72
73
|
default:
|
|
73
74
|
return <></>;
|
|
74
75
|
}
|
|
@@ -91,7 +92,10 @@ const SmartTiviActionTemplate = memo(
|
|
|
91
92
|
}, []);
|
|
92
93
|
return (
|
|
93
94
|
<>
|
|
94
|
-
<ScrollView
|
|
95
|
+
<ScrollView
|
|
96
|
+
scrollEnabled={scrollEnabled}
|
|
97
|
+
scrollIndicatorInsets={{ right: 1 }}
|
|
98
|
+
>
|
|
95
99
|
<View style={styles.wrap}>
|
|
96
100
|
<View style={styles.rowOnOff}>
|
|
97
101
|
<CircleButton
|