@eohjsc/react-native-smart-city 0.3.30 → 0.3.33
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/package.json +7 -5
- package/src/Images/DevMode/close.png +0 -0
- package/src/Images/DevMode/close@2x.png +0 -0
- package/src/Images/DevMode/close@3x.png +0 -0
- package/src/Images/DevMode/plus.png +0 -0
- package/src/Images/DevMode/plus@2x.png +0 -0
- package/src/Images/DevMode/plus@3x.png +0 -0
- package/src/Images/DevMode/remove_circle.png +0 -0
- package/src/Images/DevMode/remove_circle@2x.png +0 -0
- package/src/Images/DevMode/remove_circle@3x.png +0 -0
- package/src/commons/Action/ItemQuickAction.js +20 -4
- package/src/commons/Action/__test__/ItemQuickAction.test.js +35 -11
- package/src/commons/ActionGroup/ColorPickerTemplate.js +36 -17
- package/src/commons/ActionGroup/CurtainButtonTemplate.js +6 -6
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +23 -15
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapper.js +5 -2
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/__test__/index.test.js +10 -4
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/index.js +4 -4
- package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLock.js +38 -45
- package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLockStyle.js +1 -0
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscode.js +1 -1
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +2 -2
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +2 -2
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/ButtonWrapper.js +2 -2
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +12 -6
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/index.js +8 -4
- package/src/commons/ActionGroup/OnOffTemplate/OnOffButtonTemplate.js +9 -10
- package/src/commons/ActionGroup/OnOffTemplate/index.js +30 -12
- package/src/commons/ActionGroup/OneBigButtonTemplate.js +5 -5
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +51 -28
- package/src/commons/ActionGroup/SliderRangeTemplate.js +2 -2
- package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +25 -9
- package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/ControlPlay.test.js +13 -7
- package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/RectangleButton.test.js +9 -5
- package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/SmartTiviActionTemplate.test.js +25 -9
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButton.js +16 -6
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlay.js +10 -4
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/RectangleButton.js +7 -3
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +21 -7
- package/src/commons/ActionGroup/ThreeButtonTemplate.js +50 -60
- package/src/commons/ActionGroup/TwoButtonTemplate/index.js +135 -133
- package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +7 -7
- package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +3 -3
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +3 -3
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +9 -5
- package/src/commons/ActionGroup/__test__/index.test.js +7 -5
- package/src/commons/ActionGroup/index.js +35 -10
- package/src/commons/ActionTemplate/OnOffButtonAction.js +14 -5
- package/src/commons/ActionTemplate/__test__/OnOffButtonAction.test.js +23 -2
- package/src/commons/ActionTemplate/__test__/index.test.js +2 -0
- package/src/commons/ActionTemplate/index.js +1 -0
- package/src/commons/AlertAction/index.js +2 -2
- package/src/commons/Auth/AccountItem.js +9 -3
- package/src/commons/Auth/__test__/AccountItem.test.js +6 -3
- package/src/commons/Automate/ItemAutomate.js +22 -3
- package/src/commons/BackDefault/index.js +2 -2
- package/src/commons/BottomButtonView/index.js +4 -5
- package/src/commons/Button/index.js +0 -2
- package/src/commons/ButtonPopup/index.js +3 -3
- package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +3 -2
- package/src/commons/Dashboard/MyPinnedSharedUnit/index.js +4 -2
- package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +6 -3
- package/src/commons/Dashboard/MyUnit/index.js +5 -3
- package/src/commons/DevMode/CardDevMode.js +42 -0
- package/src/commons/DevMode/EmptyComponent.js +18 -0
- package/src/commons/DevMode/Item.js +21 -0
- package/src/commons/DevMode/Styles/CardStyles.js +40 -0
- package/src/commons/DevMode/Styles/EmptyComponentStyles.js +15 -0
- package/src/commons/DevMode/Styles/ItemStyles.js +27 -0
- package/src/commons/DevMode/Styles/TextWithLabelStyles.js +36 -0
- package/src/commons/DevMode/TextWithLabel.js +30 -0
- package/src/commons/DevMode/index.js +5 -1
- package/src/commons/Device/ConnectedViewHeader.js +2 -2
- package/src/commons/Device/DeviceAlertStatus.js +3 -3
- package/src/commons/Device/DisconnectedView.js +2 -2
- package/src/commons/Device/Emergency/EmergencyButton.js +2 -2
- package/src/commons/Device/Emergency/EmergencyDetail.js +1 -1
- package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +3 -2
- package/src/commons/Device/FlatListItems.js +2 -2
- package/src/commons/Device/ItemAddNew/index.js +7 -12
- package/src/commons/Device/ItemDevice.js +16 -11
- package/src/commons/Device/PMSensor/PMSensorIndicatior.js +1 -1
- package/src/commons/Device/RainningSensor/CurrentRainSensor.js +1 -1
- package/src/commons/Device/SensorConnectedStatus.js +5 -2
- package/src/commons/Device/WindDirection/Compass/index.js +6 -3
- package/src/commons/Device/WindSpeed/Anemometer/index.js +1 -1
- package/src/commons/Device/__test__/DeviceAlertStatus.test.js +8 -4
- package/src/commons/Device/__test__/FlatListItems.test.js +3 -2
- package/src/commons/Device/__test__/SensorConnectedStatus.test.js +4 -2
- package/src/commons/Explore/ActivityIndicator/index.js +5 -2
- package/src/commons/Explore/SearchBox/__test__/SearchBox.test.js +3 -3
- package/src/commons/Explore/SearchBox/index.js +2 -2
- package/src/commons/FieldTemplate/ChooseUserField/ChoosePopup.js +4 -4
- package/src/commons/FieldTemplate/ChooseUserField/__test__/index.test.js +11 -8
- package/src/commons/FieldTemplate/ChooseUserField/index.js +2 -2
- package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +3 -2
- package/src/commons/FieldTemplate/PasscodeField/index.js +2 -2
- package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +12 -7
- package/src/commons/Form/TextInput.js +2 -2
- package/src/commons/Form/TextInputPassword.js +2 -2
- package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +5 -3
- package/src/commons/GroupCheckBox/index.js +2 -2
- package/src/commons/Header/HeaderCustom.js +8 -2
- package/src/commons/HeaderAni/index.js +2 -3
- package/src/commons/MediaPlayerDetail/index.js +2 -2
- package/src/commons/MenuActionList/index.js +2 -2
- package/src/commons/MenuActionMore/index.js +5 -4
- package/src/commons/NavBar/index.js +2 -3
- package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +12 -6
- package/src/commons/OneTapTemplate/OptionsDropdownActionTemplate.js +7 -3
- package/src/commons/OneTapTemplate/StatesGridActionTemplate.js +4 -2
- package/src/commons/OneTapTemplate/__test__/NumberUpDownActionTemplate.test.js +11 -8
- package/src/commons/OneTapTemplate/__test__/OptionsDropdownActionTemplate.test.js +9 -5
- package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +5 -3
- package/src/commons/Popover/index.js +2 -13
- package/src/commons/PreventAccess/__test__/PreventAccess.test.js +5 -3
- package/src/commons/PreventAccess/index.js +3 -3
- package/src/commons/{Connecting → Processing}/__test__/Connecting.test.js +5 -4
- package/src/commons/Processing/index.js +93 -0
- package/src/commons/{Connecting → Processing}/styles.js +9 -1
- package/src/commons/SelectGateway/index.js +105 -0
- package/src/commons/SelectGateway/styles.js +55 -0
- package/src/commons/SelectSubUnit/__test__/SelectSubUnit.test.js +106 -0
- package/src/commons/SelectSubUnit/index.js +124 -0
- package/src/commons/SelectSubUnit/styles.js +55 -0
- package/src/commons/SelectUnit/__test__/SelectUnit.test.js +120 -0
- package/src/commons/SelectUnit/index.js +106 -0
- package/src/commons/SelectUnit/styles.js +54 -0
- package/src/commons/Sharing/WrapHeaderScrollable.js +6 -4
- package/src/commons/SubUnit/OneTap/ItemOneTap.js +4 -4
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +25 -10
- package/src/commons/SubUnit/OneTap/index.js +9 -4
- package/src/commons/SubUnit/ShortDetail.js +11 -29
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +15 -10
- package/src/commons/SummaryItem/index.js +2 -2
- package/src/commons/Tabbar/__test__/index.test.js +97 -0
- package/src/commons/Unit/HeaderUnit/index.js +4 -5
- package/src/commons/Unit/SharedUnit.js +10 -8
- package/src/commons/Unit/__test__/HeaderUnit.test.js +13 -5
- package/src/commons/Unit/__test__/SharedUnit.test.js +30 -11
- package/src/commons/UnitSummary/AirQuality/__test__/index.test.js +13 -8
- package/src/commons/UnitSummary/AirQuality/index.js +7 -3
- package/src/commons/UnitSummary/TotalPowerBox.js +2 -2
- package/src/commons/UnitSummary/TotalPowerConsumption/index.js +2 -2
- package/src/commons/UnitSummary/__test__/TotalPowerBox.test.js +3 -2
- package/src/commons/UnitSummary/__test__/TotalPowerConsumption.test.js +4 -2
- package/src/commons/ViewButtonBottom/index.js +4 -4
- package/src/commons/WheelDateTimePicker/index.js +5 -3
- package/src/commons/WrapParallaxScrollView/index.js +2 -1
- package/src/configs/API.js +12 -14
- package/src/configs/AccessibilityLabel.js +611 -0
- package/src/configs/Colors.js +4 -0
- package/src/configs/Constants.js +1 -604
- package/src/configs/Images.js +3 -0
- package/src/context/actionType.ts +19 -3
- package/src/context/mockStore.ts +18 -3
- package/src/context/reducer.ts +66 -9
- package/src/hoc/__test__/withRemoteControl.test.js +24 -0
- package/src/hoc/withRemoteControl.js +1 -0
- package/src/hooks/Common/__test__/useAndroidTranslucentStatusBar.test.js +55 -0
- package/src/hooks/Common/index.js +2 -2
- package/src/hooks/Common/useDevicesStatus.js +19 -15
- package/src/hooks/Common/{useGGHomeDeviceConnected.js → useHomeAssistantDeviceConnected.js} +3 -3
- package/src/hooks/Common/usePopover.js +6 -1
- package/src/hooks/IoT/__test__/{useGGHomeConnection.test.js → useHomeAssistantConnection.test.js} +18 -18
- package/src/hooks/IoT/__test__/useRemoteControl.test.js +17 -12
- package/src/hooks/IoT/index.js +2 -2
- package/src/hooks/IoT/useHomeAssistantConnection.js +91 -0
- package/src/hooks/IoT/useRemoteControl.js +6 -6
- package/src/hooks/__test__/useInitDeepLink.test.js +28 -0
- package/src/hooks/useReceiveNotifications.js +2 -4
- package/src/iot/RemoteControl/{GoogleHome.js → HomeAssistant.js} +21 -17
- package/src/iot/RemoteControl/LG.js +2 -1
- package/src/iot/RemoteControl/__test__/{GoogleHome.test.js → HomeAssistant.test.js} +30 -30
- package/src/navigations/AddDeviceStack.js +0 -14
- package/src/navigations/AddGatewayStack.js +51 -21
- package/src/navigations/Main.js +28 -4
- package/src/navigations/SmartIrStack.js +3 -3
- package/src/navigations/UnitStack.js +1 -1
- package/src/screens/AQIGuide/__test__/AQIGuide.test.js +5 -3
- package/src/screens/AQIGuide/index.js +5 -3
- package/src/screens/ActivityLog/FilterPopup.js +2 -2
- package/src/screens/ActivityLog/__test__/FilterPopup.test.js +2 -2
- package/src/screens/ActivityLog/__test__/index.test.js +3 -2
- package/src/screens/ActivityLog/index.js +3 -3
- package/src/screens/AddCommon/SelectSubUnit.js +44 -191
- package/src/screens/AddCommon/SelectUnit.js +51 -204
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +7 -50
- package/src/screens/AddCommon/__test__/SelectUnit.test.js +28 -26
- package/src/screens/AddLocationMaps/__test__/index.test.js +13 -7
- package/src/screens/AddLocationMaps/index.js +3 -3
- package/src/screens/AddNewAction/Device/index.js +2 -2
- package/src/screens/AddNewAction/SelectAction.js +16 -7
- package/src/screens/AddNewAction/SelectSensorDevices.js +3 -3
- package/src/screens/AddNewAction/__test__/SelectAction.test.js +2 -2
- package/src/screens/AddNewAction/__test__/SelectSensorDevices.test.js +8 -3
- package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +11 -7
- package/src/screens/AddNewAutoSmart/index.js +9 -12
- package/src/screens/AddNewDevice/ConnectingDevices.js +1 -1
- package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +7 -4
- package/src/screens/AddNewDevice/index.js +4 -4
- package/src/screens/AddNewGateway/ConnectingDevice.js +40 -0
- package/src/screens/AddNewGateway/ConnectingModbusDevice.js +61 -0
- package/src/screens/AddNewGateway/ConnectingWifiDevice.js +70 -0
- package/src/screens/AddNewGateway/ConnectingZigbeeDevice.js +60 -0
- package/src/screens/AddNewGateway/PlugAndPlay/FirstWarning.js +21 -8
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +23 -4
- package/src/screens/AddNewGateway/RenameNewDevices.js +141 -0
- package/src/screens/AddNewGateway/RenameNewDevicesStyles.js +75 -0
- package/src/screens/AddNewGateway/ScanGatewayQR.js +57 -0
- package/src/screens/AddNewGateway/ScanModbusQR.js +53 -0
- package/src/screens/AddNewGateway/ScanWifiDeviceQR.js +55 -0
- package/src/screens/AddNewGateway/SelectDeviceSubUnit.js +31 -0
- package/src/screens/AddNewGateway/SelectDeviceType.js +52 -0
- package/src/screens/AddNewGateway/SelectDeviceUnit.js +29 -0
- package/src/screens/AddNewGateway/SelectModbusGateway.js +34 -0
- package/src/screens/AddNewGateway/SelectZigbeeGateway.js +34 -0
- package/src/screens/AddNewGateway/ShareWifiPassword.js +302 -0
- package/src/screens/AddNewGateway/ShareWifiPasswordStyles.js +44 -0
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +7 -4
- package/src/screens/AddNewGateway/__test__/ConnectingModbusDevice.test.js +63 -0
- package/src/screens/AddNewGateway/__test__/{SelectGateway.test.js → ConnectingWifiDevice.test.js} +15 -10
- package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +62 -0
- package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +191 -0
- package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +73 -0
- package/src/screens/AddNewGateway/__test__/ScanModbusQR.test.js +75 -0
- package/src/screens/AddNewGateway/__test__/ScanWifiDeviceQR.test.js +73 -0
- package/src/screens/AddNewGateway/__test__/SelectDeviceSubUnit.test.js +47 -0
- package/src/screens/AddNewGateway/__test__/SelectDeviceType.test.js +89 -0
- package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +48 -0
- package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +77 -0
- package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +77 -0
- package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +294 -0
- package/src/screens/AddNewGateway/hooks/__Tests__/index.test.js +27 -0
- package/src/screens/AddNewGateway/index.js +4 -4
- package/src/screens/AddNewOneTap/__test__/AddNewOneTap.test.js +5 -4
- package/src/screens/AddNewOneTap/index.js +4 -4
- package/src/screens/Automate/__test__/index.test.js +2 -2
- package/src/screens/Automate/index.js +6 -2
- package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +3 -2
- package/src/screens/ConfirmUnitDeletion/index.js +3 -3
- package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +5 -5
- package/src/screens/Device/EditDevice/index.js +3 -3
- package/src/screens/Device/__test__/detail.test.js +38 -22
- package/src/screens/Device/components/DetailHistoryChart.js +7 -5
- package/src/screens/Device/components/SensorConnectStatusViewHeader.js +6 -6
- package/src/screens/Device/components/SensorDisplayItem.js +51 -26
- package/src/screens/Device/detail.js +31 -23
- package/src/screens/Device/hooks/useEvaluateValue.js +0 -2
- package/src/screens/DeviceInfo/__test__/index.test.js +8 -4
- package/src/screens/DeviceInfo/index.js +10 -6
- package/src/screens/Drawer/index.js +30 -13
- package/src/screens/EmergencyContacts/EmergencyContactsAddNew.js +8 -4
- package/src/screens/EmergencyContacts/EmergencyContactsList.js +1 -1
- package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +5 -3
- package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +9 -5
- package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +7 -3
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +7 -3
- package/src/screens/EmergencySetting/__test__/DropDownItem.test.js +3 -2
- package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
- package/src/screens/EnterPassword/__test__/EnterPassword.test.js +6 -3
- package/src/screens/EnterPassword/index.js +5 -3
- package/src/screens/GuestInfo/__test__/index.test.js +18 -12
- package/src/screens/GuestInfo/components/AccessScheduleItem.js +2 -2
- package/src/screens/GuestInfo/components/AccessScheduleSheet.js +3 -3
- package/src/screens/GuestInfo/components/HeaderGuestInfo.js +2 -2
- package/src/screens/GuestInfo/components/RecurringDetail.js +4 -4
- package/src/screens/GuestInfo/components/TemporaryDetail.js +3 -3
- package/src/screens/GuestInfo/index.js +1 -1
- package/src/screens/HanetCamera/Detail.js +10 -4
- package/src/screens/HanetCamera/ManageAccess.js +4 -4
- package/src/screens/HanetCamera/MemberInfo.js +1 -1
- package/src/screens/HanetCamera/__test__/Detail.test.js +5 -3
- package/src/screens/HanetCamera/__test__/ManageAccess.test.js +10 -4
- package/src/screens/HanetCamera/__test__/MemberInfo.test.js +4 -2
- package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +2 -2
- package/src/screens/ManageAccess/index.js +1 -1
- package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +4 -4
- package/src/screens/MoveToAnotherSubUnit/index.js +2 -2
- package/src/screens/PlayBackCamera/__test__/index.test.js +9 -6
- package/src/screens/PlayBackCamera/index.js +6 -6
- package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +1 -1
- package/src/screens/ScanChipQR/components/QRScan/index.js +10 -3
- package/src/screens/ScriptDetail/__test__/index.test.js +43 -38
- package/src/screens/ScriptDetail/index.js +26 -16
- package/src/screens/SelectUnit/__test__/index.test.js +4 -3
- package/src/screens/SelectUnit/index.js +3 -3
- package/src/screens/SetSchedule/index.js +1 -1
- package/src/screens/Sharing/Components/{SensorItem.js → DeviceItem.js} +16 -22
- package/src/screens/Sharing/Components/Styles/{SensorItemStyles.js → DeviceItemStyles.js} +0 -0
- package/src/screens/Sharing/Components/__test__/{SensorItem.test.js → DeviceItem.test.js} +10 -8
- package/src/screens/Sharing/Components/index.js +2 -2
- package/src/screens/Sharing/InfoMemberUnit.js +7 -6
- package/src/screens/Sharing/MemberList.js +4 -4
- package/src/screens/Sharing/SelectPermission.js +72 -72
- package/src/screens/Sharing/SelectUser.js +9 -5
- package/src/screens/Sharing/Styles/SelectPermissionStyles.js +2 -2
- package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +3 -2
- package/src/screens/Sharing/__test__/SelectPermission.test.js +12 -12
- package/src/screens/Sharing/__test__/SelectUser.test.js +7 -4
- package/src/screens/SideMenuDetail/__test__/index.test.js +11 -7
- package/src/screens/SideMenuDetail/index.js +2 -2
- package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +4 -2
- package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +5 -5
- package/src/screens/SmartIr/__test__/SmartIr.test.js +14 -6
- package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +4 -2
- package/src/screens/SmartIr/components/{SelectDeviceType.js → SelectIrDeviceType.js} +2 -2
- package/src/screens/SmartIr/index.js +1 -1
- package/src/screens/SubUnit/AddSubUnit.js +7 -3
- package/src/screens/SubUnit/Detail.js +6 -6
- package/src/screens/SubUnit/EditSubUnit.js +10 -6
- package/src/screens/SubUnit/ManageSubUnit.js +2 -2
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +6 -3
- package/src/screens/SubUnit/__test__/Detail.test.js +5 -3
- package/src/screens/SubUnit/__test__/EditSubUnit.test.js +9 -5
- package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +3 -2
- package/src/screens/SyncLGDevice/AddLGDevice.js +4 -4
- package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +7 -4
- package/src/screens/TDSGuide/__test__/TDSGuide.test.js +4 -2
- package/src/screens/TDSGuide/index.js +2 -2
- package/src/screens/Template/EditTemplate.js +152 -0
- package/src/screens/Template/GatewayList.js +51 -0
- package/src/screens/Template/Information.js +41 -0
- package/src/screens/Template/Styles/EditTemplateStyle.js +109 -0
- package/src/screens/Template/Styles/GatewayStyles.js +46 -0
- package/src/screens/Template/Styles/InformationStyles.js +16 -0
- package/src/screens/Template/Styles/detailStyles.js +35 -0
- package/src/screens/Template/Styles/indexStyles.js +2 -33
- package/src/screens/Template/__test__/EditTemplate.test.js +89 -0
- package/src/screens/Template/__test__/GatewayList.test.js +26 -0
- package/src/screens/Template/__test__/Information.test.js +16 -0
- package/src/screens/Template/__test__/detail.test.js +68 -0
- package/src/screens/Template/__test__/index.test.js +26 -1
- package/src/screens/Template/detail.js +154 -0
- package/src/screens/Template/index.js +38 -32
- package/src/screens/UVIndexGuide/__test__/UVIndexGuide.test.js +3 -2
- package/src/screens/UVIndexGuide/index.js +2 -2
- package/src/screens/Unit/AddMenu.js +6 -20
- package/src/screens/Unit/ChooseLocation.js +1 -1
- package/src/screens/Unit/Detail.js +10 -10
- package/src/screens/Unit/ManageUnit.js +21 -15
- package/src/screens/Unit/MyAllUnit/index.js +1 -1
- package/src/screens/Unit/SelectAddToFavorites.js +7 -8
- package/src/screens/Unit/SelectAddress.js +4 -4
- package/src/screens/Unit/SmartAccount.js +1 -1
- package/src/screens/Unit/SmartAccountItem.js +3 -3
- package/src/screens/Unit/Station/__test__/index.test.js +19 -3
- package/src/screens/Unit/Station/index.js +2 -2
- package/src/screens/Unit/Summaries.js +2 -2
- package/src/screens/Unit/__test__/CheckSendEmail.test.js +6 -6
- package/src/screens/Unit/__test__/Detail.test.js +90 -55
- package/src/screens/Unit/__test__/ManageUnit.test.js +40 -18
- package/src/screens/Unit/__test__/SelectAddress.test.js +15 -8
- package/src/screens/Unit/__test__/SmartAccount.test.js +42 -25
- package/src/screens/Unit/__test__/SmartAccountItem.test.js +4 -3
- package/src/screens/Unit/components/AutomateScript/index.js +5 -2
- package/src/screens/Unit/components/ListMyAllUnit/index.js +1 -1
- package/src/screens/Unit/components/MyAllUnit/__test__/Header.test.js +9 -5
- package/src/screens/Unit/components/MyAllUnit/index.js +1 -1
- package/src/screens/Unit/components/MyUnitDevice/index.js +8 -5
- package/src/screens/Unit/components/SharedUnit/index.js +12 -6
- package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +2 -2
- package/src/screens/Unit/components/__test__/SharedUnit.test.js +24 -9
- package/src/screens/Unit/hook/useUnitConnectRemoteDevices.js +25 -11
- package/src/screens/UnitSummary/__test__/index.test.js +4 -2
- package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +4 -2
- package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +2 -2
- package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +4 -2
- package/src/screens/UnitSummary/components/PowerConsumption/index.js +2 -2
- package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +5 -4
- package/src/screens/UnitSummary/components/RunningDevices/index.js +6 -3
- package/src/screens/UnitSummary/components/TotalPowerBox/index.js +2 -2
- package/src/screens/UnitSummary/components/TotalPowerConsumption/index.js +2 -2
- package/src/screens/UnitSummary/components/__test__/TotalPowerBox.test.js +3 -2
- package/src/screens/UnitSummary/components/__test__/TotalPowerConsumption.test.js +4 -2
- package/src/screens/UnitSummary/index.js +10 -8
- package/src/screens/WaterQualityGuide/__test__/index.test.js +17 -12
- package/src/screens/WaterQualityGuide/index.js +26 -10
- package/src/utils/Apis/axios.js +1 -0
- package/src/utils/I18n/translations/en.json +20 -10
- package/src/utils/I18n/translations/vi.json +17 -9
- package/src/utils/Route/index.js +22 -10
- package/src/utils/Utils.js +6 -7
- package/src/commons/Connecting/index.js +0 -67
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItem.js +0 -28
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItemStyles.js +0 -41
- package/src/commons/ConnectingProcess/__test__/Connecting.test.js +0 -163
- package/src/commons/ConnectingProcess/__test__/DeviceItem.test.js +0 -19
- package/src/commons/ConnectingProcess/index.js +0 -213
- package/src/commons/ConnectingProcess/styles.js +0 -69
- package/src/hooks/IoT/useGGHomeConnection.js +0 -91
- package/src/iot/RemoteControl/index.js +0 -55
- package/src/screens/AddNewDevice/ConnectDevices.js +0 -184
- package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +0 -131
- package/src/screens/AddNewGateway/ConnectedGateway.js +0 -139
- package/src/screens/AddNewGateway/ConnectingGateway.js +0 -137
- package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +0 -214
- package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +0 -319
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectWifiWarning.test.js +0 -75
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/GatewayWifiList.test.js +0 -130
- package/src/screens/AddNewGateway/SelectGateway.js +0 -133
- package/src/screens/AddNewGateway/SetupGatewayWifi.js +0 -207
- package/src/screens/AddNewGateway/__test__/ConnectedGateway.test.js +0 -71
- package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +0 -96
- package/src/screens/AddNewGateway/__test__/SetupGateway.test.js +0 -120
- package/src/screens/ScanChipQR/__test__/ScanChipQR.test.js +0 -115
- package/src/screens/ScanChipQR/hooks/index.js +0 -120
- package/src/screens/ScanChipQR/index.js +0 -29
- package/src/screens/ScanSensorQR/__test__/ScanSensorQR.test.js +0 -111
- package/src/screens/ScanSensorQR/hooks/index.js +0 -40
- package/src/screens/ScanSensorQR/index.js +0 -39
|
@@ -3,156 +3,158 @@ import React, { memo, useState, useCallback, useEffect } from 'react';
|
|
|
3
3
|
import { TouchableOpacity, View } from 'react-native';
|
|
4
4
|
|
|
5
5
|
import { Colors } from '../../../configs';
|
|
6
|
-
import { DEVICE_TYPE,
|
|
6
|
+
import { DEVICE_TYPE, AccessibilityLabel } from '../../../configs/Constants';
|
|
7
7
|
import { watchMultiConfigs } from '../../../iot/Monitor';
|
|
8
8
|
import { useConfigGlobalState } from '../../../iot/states';
|
|
9
9
|
import { useUnwatchLGDeviceConfigControl } from '../../../hooks/IoT';
|
|
10
10
|
import Text from '../../Text';
|
|
11
11
|
import styles from './TwoButtonTemplateStyles';
|
|
12
12
|
|
|
13
|
-
const TwoButtonTemplate = memo(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
const TwoButtonTemplate = memo(
|
|
14
|
+
({ actionGroup = {}, doAction, sensor = {} }) => {
|
|
15
|
+
const { configuration = {} } = actionGroup;
|
|
16
|
+
const { button1, button2 } = configuration;
|
|
17
|
+
const [isOn, setIsOn] = useState(true);
|
|
18
|
+
const [isStart, setIsStart] = useState(true);
|
|
19
|
+
const [configValues] = useConfigGlobalState('configValues');
|
|
20
|
+
const isLight = false;
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
const triggerAction1 = useCallback(async () => {
|
|
23
|
+
if (button1?.action_on_data && button1?.action_off_data) {
|
|
24
|
+
if (isOn) {
|
|
25
|
+
await doAction(button1?.action_off_data, null);
|
|
26
|
+
} else {
|
|
27
|
+
await doAction(button1?.action_on_data, null);
|
|
28
|
+
}
|
|
27
29
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
]);
|
|
30
|
+
if (sensor?.is_managed_by_backend) {
|
|
31
|
+
configuration.config &&
|
|
32
|
+
sensor.device_type === DEVICE_TYPE.LG_THINQ &&
|
|
33
|
+
watchMultiConfigs([configuration.config]);
|
|
34
|
+
}
|
|
35
|
+
}, [
|
|
36
|
+
button1,
|
|
37
|
+
configuration.config,
|
|
38
|
+
doAction,
|
|
39
|
+
isOn,
|
|
40
|
+
sensor?.is_managed_by_backend,
|
|
41
|
+
sensor.device_type,
|
|
42
|
+
]);
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
const triggerAction2 = useCallback(async () => {
|
|
45
|
+
if (button2?.action_on_data && button2?.action_off_data) {
|
|
46
|
+
if (isStart) {
|
|
47
|
+
await doAction(button2?.action_off_data, null);
|
|
48
|
+
} else {
|
|
49
|
+
await doAction(button2?.action_on_data, null);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (
|
|
53
|
+
sensor?.is_managed_by_backend &&
|
|
54
|
+
sensor.device_type === DEVICE_TYPE.LG_THINQ
|
|
55
|
+
) {
|
|
56
|
+
configuration.config && watchMultiConfigs([configuration.config]);
|
|
49
57
|
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
configuration.config
|
|
61
|
-
doAction,
|
|
62
|
-
isStart,
|
|
63
|
-
sensor?.is_managed_by_backend,
|
|
64
|
-
sensor.device_type,
|
|
65
|
-
]);
|
|
58
|
+
}, [
|
|
59
|
+
button2?.action_off_data,
|
|
60
|
+
button2?.action_on_data,
|
|
61
|
+
configuration.config,
|
|
62
|
+
doAction,
|
|
63
|
+
isStart,
|
|
64
|
+
sensor?.is_managed_by_backend,
|
|
65
|
+
sensor.device_type,
|
|
66
|
+
]);
|
|
67
|
+
|
|
68
|
+
useUnwatchLGDeviceConfigControl(sensor, [configuration.config]);
|
|
66
69
|
|
|
67
|
-
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
const configValue1 = configValues[button1?.config];
|
|
72
|
+
const configValue2 = configValues[button2?.config];
|
|
73
|
+
if (button1?.is_on_value && button1?.is_on_value.length > 0) {
|
|
74
|
+
setIsOn(button1?.is_on_value.includes(configValue1?.value));
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (button2?.is_on_value && button2?.is_on_value.length > 0) {
|
|
78
|
+
setIsStart(button2?.is_on_value.includes(configValue2?.value));
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
68
81
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
82
|
+
setIsOn(configValue1?.value);
|
|
83
|
+
setIsStart(configValue2?.value);
|
|
84
|
+
}, [
|
|
85
|
+
configuration.config,
|
|
86
|
+
configValues,
|
|
87
|
+
configuration.is_on_value,
|
|
88
|
+
configuration,
|
|
89
|
+
button1?.config,
|
|
90
|
+
button1?.is_on_value,
|
|
91
|
+
button2?.config,
|
|
92
|
+
button2?.is_on_value,
|
|
93
|
+
]);
|
|
80
94
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
95
|
+
const RenderTwoButtonAction = () => {
|
|
96
|
+
const buttons = [
|
|
97
|
+
{
|
|
98
|
+
icon_on: button1?.icon_on,
|
|
99
|
+
icon_off: button1?.icon_off,
|
|
100
|
+
text_on: button1?.text_on,
|
|
101
|
+
text_off: button1?.text_off,
|
|
102
|
+
onPress: triggerAction1,
|
|
103
|
+
isCheckOnOff: isOn,
|
|
104
|
+
accessibilityLabel: AccessibilityLabel.BUTTON_TEMPLATE_1,
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
icon_on: button2?.icon_on,
|
|
108
|
+
icon_off: button2?.icon_off,
|
|
109
|
+
text_on: button2?.text_on,
|
|
110
|
+
text_off: button2?.text_off,
|
|
111
|
+
onPress: triggerAction2,
|
|
112
|
+
isCheckOnOff: isStart,
|
|
113
|
+
accessibilityLabel: AccessibilityLabel.BUTTON_TEMPLATE_1,
|
|
114
|
+
},
|
|
115
|
+
];
|
|
116
|
+
return (
|
|
117
|
+
<>
|
|
118
|
+
{buttons.map((item, index) => (
|
|
119
|
+
<TouchableOpacity
|
|
120
|
+
accessibilityLabel={item.accessibilityLabel}
|
|
121
|
+
style={styles.bigCircle}
|
|
122
|
+
onPress={item.onPress}
|
|
123
|
+
>
|
|
124
|
+
<View style={styles.smallCircle}>
|
|
125
|
+
<Icon
|
|
126
|
+
name={item?.isCheckOnOff ? item?.icon_on : item?.icon_off}
|
|
127
|
+
size={44}
|
|
128
|
+
color={item?.isCheckOnOff ? Colors.Green7 : Colors.Gray6}
|
|
129
|
+
/>
|
|
130
|
+
<Text
|
|
131
|
+
style={[
|
|
132
|
+
styles.textBig,
|
|
133
|
+
{ color: item?.isCheckOnOff ? Colors.Gray8 : Colors.Gray6 },
|
|
134
|
+
]}
|
|
135
|
+
>
|
|
136
|
+
{item?.isCheckOnOff ? item?.text_on : item?.text_off}
|
|
137
|
+
</Text>
|
|
138
|
+
</View>
|
|
139
|
+
</TouchableOpacity>
|
|
140
|
+
))}
|
|
141
|
+
</>
|
|
142
|
+
);
|
|
143
|
+
};
|
|
93
144
|
|
|
94
|
-
const RenderTwoButtonAction = () => {
|
|
95
|
-
const buttons = [
|
|
96
|
-
{
|
|
97
|
-
icon_on: button1?.icon_on,
|
|
98
|
-
icon_off: button1?.icon_off,
|
|
99
|
-
text_on: button1?.text_on,
|
|
100
|
-
text_off: button1?.text_off,
|
|
101
|
-
onPress: triggerAction1,
|
|
102
|
-
isCheckOnOff: isOn,
|
|
103
|
-
testID: TESTID.BUTTON_TEMPLATE_1,
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
icon_on: button2?.icon_on,
|
|
107
|
-
icon_off: button2?.icon_off,
|
|
108
|
-
text_on: button2?.text_on,
|
|
109
|
-
text_off: button2?.text_off,
|
|
110
|
-
onPress: triggerAction2,
|
|
111
|
-
isCheckOnOff: isStart,
|
|
112
|
-
testID: TESTID.BUTTON_TEMPLATE_1,
|
|
113
|
-
},
|
|
114
|
-
];
|
|
115
145
|
return (
|
|
116
146
|
<>
|
|
117
|
-
{
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
name={item?.isCheckOnOff ? item?.icon_on : item?.icon_off}
|
|
126
|
-
size={44}
|
|
127
|
-
color={item?.isCheckOnOff ? Colors.Green7 : Colors.Gray6}
|
|
128
|
-
/>
|
|
129
|
-
<Text
|
|
130
|
-
style={[
|
|
131
|
-
styles.textBig,
|
|
132
|
-
{ color: item?.isCheckOnOff ? Colors.Gray8 : Colors.Gray6 },
|
|
133
|
-
]}
|
|
134
|
-
>
|
|
135
|
-
{item?.isCheckOnOff ? item?.text_on : item?.text_off}
|
|
136
|
-
</Text>
|
|
137
|
-
</View>
|
|
138
|
-
</TouchableOpacity>
|
|
139
|
-
))}
|
|
147
|
+
<View style={styles.wrap}>
|
|
148
|
+
<RenderTwoButtonAction />
|
|
149
|
+
</View>
|
|
150
|
+
{!!actionGroup.title && !isLight && (
|
|
151
|
+
<Text size={20} semibold center>
|
|
152
|
+
{actionGroup.title}
|
|
153
|
+
</Text>
|
|
154
|
+
)}
|
|
140
155
|
</>
|
|
141
156
|
);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return (
|
|
145
|
-
<>
|
|
146
|
-
<View style={styles.wrap}>
|
|
147
|
-
<RenderTwoButtonAction />
|
|
148
|
-
</View>
|
|
149
|
-
{!!actionGroup.title && !isLight && (
|
|
150
|
-
<Text size={20} semibold center>
|
|
151
|
-
{actionGroup.title}
|
|
152
|
-
</Text>
|
|
153
|
-
)}
|
|
154
|
-
</>
|
|
155
|
-
);
|
|
156
|
-
});
|
|
157
|
+
}
|
|
158
|
+
);
|
|
157
159
|
|
|
158
160
|
export default TwoButtonTemplate;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { ActivityIndicator, TouchableOpacity } from 'react-native';
|
|
3
3
|
import { act, create } from 'react-test-renderer';
|
|
4
4
|
import Text from '../../../commons/Text';
|
|
5
|
-
import { DEVICE_TYPE,
|
|
5
|
+
import { DEVICE_TYPE, AccessibilityLabel } from '../../../configs/Constants';
|
|
6
6
|
import { watchMultiConfigs } from '../../../iot/Monitor';
|
|
7
7
|
import NumberUpDownActionTemplate from '../NumberUpDownActionTemplate';
|
|
8
8
|
|
|
@@ -188,7 +188,7 @@ describe('Test NumberUpDownActionTemplate', () => {
|
|
|
188
188
|
const instance = wrapper.root;
|
|
189
189
|
const touchs = instance.find(
|
|
190
190
|
(el) =>
|
|
191
|
-
el.props.
|
|
191
|
+
el.props.accessibilityLabel === AccessibilityLabel.NUMBER_ACTION_DOWN &&
|
|
192
192
|
el.type === TouchableOpacity
|
|
193
193
|
);
|
|
194
194
|
await act(async () => {
|
|
@@ -215,14 +215,14 @@ describe('Test NumberUpDownActionTemplate', () => {
|
|
|
215
215
|
const instance = wrapper.root;
|
|
216
216
|
const touchs = instance.find(
|
|
217
217
|
(el) =>
|
|
218
|
-
el.props.
|
|
218
|
+
el.props.accessibilityLabel === AccessibilityLabel.NUMBER_ACTION_UP &&
|
|
219
219
|
el.type === TouchableOpacity
|
|
220
220
|
);
|
|
221
221
|
await act(async () => {
|
|
222
222
|
await touchs.props.onPress();
|
|
223
223
|
});
|
|
224
224
|
const text = instance.find(
|
|
225
|
-
(el) => el.props.
|
|
225
|
+
(el) => el.props.accessibilityLabel === 'abcd' && el.type === Text
|
|
226
226
|
);
|
|
227
227
|
expect(text.props.children).toEqual('29 *C');
|
|
228
228
|
});
|
|
@@ -241,7 +241,7 @@ describe('Test NumberUpDownActionTemplate', () => {
|
|
|
241
241
|
const instance = wrapper.root;
|
|
242
242
|
const touchs = instance.find(
|
|
243
243
|
(el) =>
|
|
244
|
-
el.props.
|
|
244
|
+
el.props.accessibilityLabel === AccessibilityLabel.NUMBER_ACTION_DOWN &&
|
|
245
245
|
el.type === TouchableOpacity
|
|
246
246
|
);
|
|
247
247
|
|
|
@@ -267,7 +267,7 @@ describe('Test NumberUpDownActionTemplate', () => {
|
|
|
267
267
|
const instance = wrapper.root;
|
|
268
268
|
const touchs = instance.find(
|
|
269
269
|
(el) =>
|
|
270
|
-
el.props.
|
|
270
|
+
el.props.accessibilityLabel === AccessibilityLabel.NUMBER_ACTION_UP &&
|
|
271
271
|
el.type === TouchableOpacity
|
|
272
272
|
);
|
|
273
273
|
|
|
@@ -381,7 +381,7 @@ describe('Test NumberUpDownActionTemplate', () => {
|
|
|
381
381
|
const instance = wrapper.root;
|
|
382
382
|
const touchs = instance.find(
|
|
383
383
|
(el) =>
|
|
384
|
-
el.props.
|
|
384
|
+
el.props.accessibilityLabel === AccessibilityLabel.NUMBER_ACTION_UP &&
|
|
385
385
|
el.type === TouchableOpacity
|
|
386
386
|
);
|
|
387
387
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
2
2
|
import { watchMultiConfigs } from '../../../iot/Monitor';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { act, create } from 'react-test-renderer';
|
|
@@ -82,7 +82,7 @@ describe('Test OnOffTemplate', () => {
|
|
|
82
82
|
});
|
|
83
83
|
const instance = wrapper.root;
|
|
84
84
|
const button = instance.find(
|
|
85
|
-
(el) => el.props.
|
|
85
|
+
(el) => el.props.accessibilityLabel === AccessibilityLabel.BUTTON_ON_OFF
|
|
86
86
|
);
|
|
87
87
|
await act(async () => {
|
|
88
88
|
await button.props.onPress();
|
|
@@ -102,7 +102,7 @@ describe('Test OnOffTemplate', () => {
|
|
|
102
102
|
});
|
|
103
103
|
const instance = wrapper.root;
|
|
104
104
|
const button = instance.find(
|
|
105
|
-
(el) => el.props.
|
|
105
|
+
(el) => el.props.accessibilityLabel === AccessibilityLabel.BUTTON_ON_OFF
|
|
106
106
|
);
|
|
107
107
|
await act(async () => {
|
|
108
108
|
await button.props.onPress();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable promise/prefer-await-to-callbacks */
|
|
2
|
-
import { DEVICE_TYPE,
|
|
2
|
+
import { DEVICE_TYPE, AccessibilityLabel } from '../../../configs/Constants';
|
|
3
3
|
import { watchMultiConfigs } from '../../../iot/Monitor';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { View } from 'react-native';
|
|
@@ -131,8 +131,8 @@ describe('Test OnOffTemplate', () => {
|
|
|
131
131
|
|
|
132
132
|
const templateOnOffButton = instance.findAll(
|
|
133
133
|
(el) =>
|
|
134
|
-
el.props.
|
|
135
|
-
|
|
134
|
+
el.props.accessibilityLabel ===
|
|
135
|
+
AccessibilityLabel.ON_OFF_BUTTON_ACTION_TEMPLATE && el.type === View
|
|
136
136
|
);
|
|
137
137
|
const templateOnOffSimple = instance.findAllByType(OnOffSimpleTemplate);
|
|
138
138
|
|
|
@@ -5,7 +5,7 @@ import { act, create } from 'react-test-renderer';
|
|
|
5
5
|
import Text from '../../../commons/Text';
|
|
6
6
|
import { watchMultiConfigs } from '../../../iot/Monitor';
|
|
7
7
|
import { AlertAction, RadioCircle } from '../../../commons';
|
|
8
|
-
import { DEVICE_TYPE,
|
|
8
|
+
import { DEVICE_TYPE, AccessibilityLabel } from '../../../configs/Constants';
|
|
9
9
|
import { getTranslate } from '../../../utils/I18n';
|
|
10
10
|
import { SCProvider } from '../../../context';
|
|
11
11
|
import { mockSCStore } from '../../../context/mockStore';
|
|
@@ -129,7 +129,8 @@ describe('Test OptionsDropdownActionTemplate', () => {
|
|
|
129
129
|
|
|
130
130
|
const listChoosingOption = instance.findAll(
|
|
131
131
|
(el) =>
|
|
132
|
-
el.props.
|
|
132
|
+
el.props.accessibilityLabel ===
|
|
133
|
+
AccessibilityLabel.OPTIONS_DROPDOWN_ACTION_CHOOSING_ITEM &&
|
|
133
134
|
el.type === TouchableOpacity
|
|
134
135
|
);
|
|
135
136
|
expect(listChoosingOption).toHaveLength(2); // 2 option
|
|
@@ -197,7 +198,8 @@ describe('Test OptionsDropdownActionTemplate', () => {
|
|
|
197
198
|
|
|
198
199
|
const listChoosingOption = instance.findAll(
|
|
199
200
|
(el) =>
|
|
200
|
-
el.props.
|
|
201
|
+
el.props.accessibilityLabel ===
|
|
202
|
+
AccessibilityLabel.OPTIONS_DROPDOWN_ACTION_CHOOSING_ITEM &&
|
|
201
203
|
el.type === TouchableOpacity
|
|
202
204
|
);
|
|
203
205
|
expect(listChoosingOption).toHaveLength(2);
|
|
@@ -244,7 +246,8 @@ describe('Test OptionsDropdownActionTemplate', () => {
|
|
|
244
246
|
const instance = wrapper.root;
|
|
245
247
|
const textDisplaySelected = instance.find(
|
|
246
248
|
(el) =>
|
|
247
|
-
el.props.
|
|
249
|
+
el.props.accessibilityLabel ===
|
|
250
|
+
AccessibilityLabel.OPTIONS_DROPDOWN_ACTION_DISPLAY_SELECTED &&
|
|
248
251
|
el.type === Text
|
|
249
252
|
);
|
|
250
253
|
expect(textDisplaySelected.props.children).toEqual(
|
|
@@ -273,7 +276,8 @@ describe('Test OptionsDropdownActionTemplate', () => {
|
|
|
273
276
|
|
|
274
277
|
const listChoosingOption = instance.findAll(
|
|
275
278
|
(el) =>
|
|
276
|
-
el.props.
|
|
279
|
+
el.props.accessibilityLabel ===
|
|
280
|
+
AccessibilityLabel.OPTIONS_DROPDOWN_ACTION_CHOOSING_ITEM &&
|
|
277
281
|
el.type === TouchableOpacity
|
|
278
282
|
);
|
|
279
283
|
expect(listChoosingOption).toHaveLength(2);
|
|
@@ -7,7 +7,7 @@ import moment from 'moment';
|
|
|
7
7
|
import ActionGroup from '..';
|
|
8
8
|
import Text from '../../Text';
|
|
9
9
|
import { Colors } from '../../../configs';
|
|
10
|
-
import {
|
|
10
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
11
11
|
import { SCProvider } from '../../../context';
|
|
12
12
|
import { mockSCStore } from '../../../context/mockStore';
|
|
13
13
|
|
|
@@ -172,9 +172,10 @@ describe('Test ActionGroup', () => {
|
|
|
172
172
|
const buttons = instance.findAllByType(TouchableOpacity);
|
|
173
173
|
const switchOnOff = instance.findAllByType(Switch);
|
|
174
174
|
const TextDoorLock = instance.find(
|
|
175
|
-
(el) =>
|
|
175
|
+
(el) =>
|
|
176
|
+
el.props.accessibilityLabel === AccessibilityLabel.TEXT_DOOR_LOOK_ON_OFF
|
|
176
177
|
);
|
|
177
|
-
expect(TextDoorLock.props.children).toEqual(
|
|
178
|
+
expect(TextDoorLock.props.children).toEqual('Door lock ');
|
|
178
179
|
expect(switchOnOff.length).toEqual(1);
|
|
179
180
|
expect(buttons.length).toEqual(3);
|
|
180
181
|
act(() => {
|
|
@@ -243,9 +244,10 @@ describe('Test ActionGroup', () => {
|
|
|
243
244
|
const buttons = instance.findAllByType(TouchableOpacity);
|
|
244
245
|
const switchOnOff = instance.findAllByType(Switch);
|
|
245
246
|
const TextDoorLock = instance.find(
|
|
246
|
-
(el) =>
|
|
247
|
+
(el) =>
|
|
248
|
+
el.props.accessibilityLabel === AccessibilityLabel.TEXT_DOOR_LOOK_ON_OFF
|
|
247
249
|
);
|
|
248
|
-
expect(TextDoorLock.props.children).toEqual(
|
|
250
|
+
expect(TextDoorLock.props.children).toEqual('Door lock ');
|
|
249
251
|
expect(switchOnOff.length).toEqual(1);
|
|
250
252
|
expect(buttons.length).toEqual(3);
|
|
251
253
|
act(() => {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
+
import React, { memo, useCallback, useMemo } from 'react';
|
|
1
2
|
import Text from '../Text';
|
|
2
|
-
import React, { memo, useMemo } from 'react';
|
|
3
|
-
|
|
4
3
|
import OneBigButtonTemplate from './OneBigButtonTemplate';
|
|
5
4
|
import ThreeButtonTemplate from './ThreeButtonTemplate';
|
|
6
5
|
import StatesGridActionTemplate from './StatesGridActionTemplate';
|
|
@@ -14,6 +13,9 @@ import ColorPickerTemplate from './ColorPickerTemplate';
|
|
|
14
13
|
import SliderRangeTemplate from './SliderRangeTemplate';
|
|
15
14
|
import OnOffSmartLock from './OnOffSmartLock/OnOffSmartLock';
|
|
16
15
|
import TwoButtonTemplate from './TwoButtonTemplate';
|
|
16
|
+
import { CardDevMode } from '../DevMode';
|
|
17
|
+
import t from '../../hooks/Common/useTranslations';
|
|
18
|
+
import { useSCContextSelector } from '../../context';
|
|
17
19
|
|
|
18
20
|
export const getActionComponent = (template) => {
|
|
19
21
|
switch (template) {
|
|
@@ -52,23 +54,46 @@ export const getActionComponent = (template) => {
|
|
|
52
54
|
}
|
|
53
55
|
};
|
|
54
56
|
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
+
const isWrap = (template) => {
|
|
58
|
+
switch (template) {
|
|
59
|
+
case 'OnOffSmartLockActionTemplate':
|
|
60
|
+
return true;
|
|
61
|
+
default:
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const ActionGroup = (params = {}) => {
|
|
67
|
+
const { actionGroup = {}, id } = params;
|
|
68
|
+
const { template } = actionGroup;
|
|
69
|
+
const { isEditingTemplate } = useSCContextSelector((state) => state.devMode);
|
|
70
|
+
|
|
71
|
+
const getTitle = useCallback(() => {
|
|
72
|
+
switch (template) {
|
|
73
|
+
case 'OnOffSmartLockActionTemplate':
|
|
74
|
+
return isEditingTemplate ? 'label' : 'controller';
|
|
75
|
+
default:
|
|
76
|
+
return 'label';
|
|
77
|
+
}
|
|
78
|
+
}, [template, isEditingTemplate]);
|
|
79
|
+
|
|
57
80
|
const ButtonGroupComponent = useMemo(() => {
|
|
58
|
-
return getActionComponent(
|
|
59
|
-
}, [
|
|
81
|
+
return getActionComponent(template);
|
|
82
|
+
}, [template]);
|
|
60
83
|
|
|
61
84
|
return (
|
|
62
85
|
<>
|
|
63
86
|
{ButtonGroupComponent ? (
|
|
64
|
-
<
|
|
87
|
+
<CardDevMode title={t(getTitle())} id={id} isWrap={isWrap(template)}>
|
|
88
|
+
<ButtonGroupComponent {...params} />
|
|
89
|
+
</CardDevMode>
|
|
65
90
|
) : (
|
|
66
91
|
<Text
|
|
67
92
|
center
|
|
68
|
-
>{`Invalid action template '${actionGroup
|
|
93
|
+
>{`Invalid action template '${actionGroup?.template}'`}</Text>
|
|
69
94
|
)}
|
|
70
95
|
</>
|
|
71
96
|
);
|
|
72
|
-
}
|
|
97
|
+
};
|
|
73
98
|
|
|
74
|
-
export default ActionGroup;
|
|
99
|
+
export default memo(ActionGroup);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { memo, useCallback } from 'react';
|
|
2
2
|
import { TouchableOpacity } from 'react-native';
|
|
3
|
+
import AccessibilityLabel from '../../configs/AccessibilityLabel';
|
|
3
4
|
import Text from '../Text';
|
|
4
5
|
import styles from './OnOffButtonActionStyles';
|
|
5
6
|
|
|
6
|
-
const OnOffButtonAction = ({ configuration, onPress, template }) => {
|
|
7
|
+
const OnOffButtonAction = ({ title, configuration, onPress, template }) => {
|
|
7
8
|
const { text_on, text_off, action_on, action_off } = configuration;
|
|
8
9
|
const onPressActionOn = useCallback(() => {
|
|
9
10
|
onPress &&
|
|
@@ -26,13 +27,21 @@ const OnOffButtonAction = ({ configuration, onPress, template }) => {
|
|
|
26
27
|
return (
|
|
27
28
|
<>
|
|
28
29
|
<TouchableOpacity onPress={onPressActionOn}>
|
|
29
|
-
<Text
|
|
30
|
-
|
|
30
|
+
<Text
|
|
31
|
+
type="H4"
|
|
32
|
+
style={styles.textwithline}
|
|
33
|
+
accessibilityLabel={AccessibilityLabel.ON_OFF_BUTTON_ACTION_TITLE}
|
|
34
|
+
>
|
|
35
|
+
{title} {text_on}
|
|
31
36
|
</Text>
|
|
32
37
|
</TouchableOpacity>
|
|
33
38
|
<TouchableOpacity onPress={onPressActionOff}>
|
|
34
|
-
<Text
|
|
35
|
-
|
|
39
|
+
<Text
|
|
40
|
+
type="H4"
|
|
41
|
+
style={styles.textwithline}
|
|
42
|
+
accessibilityLabel={AccessibilityLabel.ON_OFF_BUTTON_ACTION_TITLE}
|
|
43
|
+
>
|
|
44
|
+
{title} {text_off}
|
|
36
45
|
</Text>
|
|
37
46
|
</TouchableOpacity>
|
|
38
47
|
</>
|
|
@@ -5,10 +5,17 @@ import { TouchableOpacity } from 'react-native';
|
|
|
5
5
|
import OnOffButtonAction from '../OnOffButtonAction';
|
|
6
6
|
import { SCProvider } from '../../../context';
|
|
7
7
|
import { mockSCStore } from '../../../context/mockStore';
|
|
8
|
+
import Text from '../../Text';
|
|
9
|
+
import AccessibilityLabel from '../../../configs/AccessibilityLabel';
|
|
8
10
|
|
|
9
11
|
const wrapComponent = (configuration, onPress) => (
|
|
10
12
|
<SCProvider initState={mockSCStore({})}>
|
|
11
|
-
<OnOffButtonAction
|
|
13
|
+
<OnOffButtonAction
|
|
14
|
+
configuration={configuration}
|
|
15
|
+
onPress={onPress}
|
|
16
|
+
title={'Cong tac 1'}
|
|
17
|
+
template={'on_off_button_action_template'}
|
|
18
|
+
/>
|
|
12
19
|
</SCProvider>
|
|
13
20
|
);
|
|
14
21
|
|
|
@@ -16,7 +23,12 @@ describe('Test OnOffButtonAction', () => {
|
|
|
16
23
|
let tree;
|
|
17
24
|
|
|
18
25
|
test('test onPress', () => {
|
|
19
|
-
const configuration = {
|
|
26
|
+
const configuration = {
|
|
27
|
+
text_on: 'On',
|
|
28
|
+
text_off: 'Off',
|
|
29
|
+
action_off: 'f49e1577-493d-4bae-a9ab-3b0f96a4ec52',
|
|
30
|
+
action_on: '94600cbe-2035-47d5-bd43-89ace5d59796',
|
|
31
|
+
};
|
|
20
32
|
const mockFuntion = jest.fn();
|
|
21
33
|
act(() => {
|
|
22
34
|
tree = renderer.create(wrapComponent(configuration, mockFuntion));
|
|
@@ -30,5 +42,14 @@ describe('Test OnOffButtonAction', () => {
|
|
|
30
42
|
touchOpacity[1].props.onPress();
|
|
31
43
|
});
|
|
32
44
|
expect(mockFuntion).toHaveBeenCalled();
|
|
45
|
+
|
|
46
|
+
const textTitle = instance.findAll(
|
|
47
|
+
(el) =>
|
|
48
|
+
el.props.accessibilityLabel ===
|
|
49
|
+
AccessibilityLabel.ON_OFF_BUTTON_ACTION_TITLE && el.type === Text
|
|
50
|
+
);
|
|
51
|
+
expect(textTitle).toHaveLength(2);
|
|
52
|
+
expect(textTitle[0].props.children).toEqual(['Cong tac 1', ' ', 'On']);
|
|
53
|
+
expect(textTitle[1].props.children).toEqual(['Cong tac 1', ' ', 'Off']);
|
|
33
54
|
});
|
|
34
55
|
});
|
|
@@ -93,12 +93,14 @@ describe('Test ActionTemplate', () => {
|
|
|
93
93
|
act(() => {
|
|
94
94
|
threeButtonAction.props.onPress({
|
|
95
95
|
name: 'OPEN',
|
|
96
|
+
action_name: 'OPEN',
|
|
96
97
|
action: '94ae262d-46e3-42ff-9d10-516831ecc830',
|
|
97
98
|
template: 'three_button_action_template',
|
|
98
99
|
});
|
|
99
100
|
});
|
|
100
101
|
expect(mockOnSelectAction).toBeCalledWith({
|
|
101
102
|
action: '94ae262d-46e3-42ff-9d10-516831ecc830',
|
|
103
|
+
action_name: 'OPEN',
|
|
102
104
|
data: null,
|
|
103
105
|
template: 'three_button_action_template',
|
|
104
106
|
});
|