@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
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { memo, useCallback, useEffect, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
3
3
|
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
4
|
-
import { Section } from '../../Section';
|
|
5
4
|
import Text from '../../Text';
|
|
6
5
|
import styles from './OnOffSmartLockStyle';
|
|
7
6
|
import ButtonLock from '../../../../assets/images/Device/button-lock.svg';
|
|
@@ -9,12 +8,14 @@ import ButtonUnLock from '../../../../assets/images/Device/button-unlock.svg';
|
|
|
9
8
|
import { useConfigGlobalState } from '../../../iot/states';
|
|
10
9
|
import { useUnwatchLGDeviceConfigControl } from '../../../hooks/IoT';
|
|
11
10
|
import { watchMultiConfigs } from '../../../iot/Monitor';
|
|
12
|
-
import { DEVICE_TYPE,
|
|
11
|
+
import { DEVICE_TYPE, AccessibilityLabel } from '../../../configs/Constants';
|
|
13
12
|
|
|
14
|
-
const OnOffSmartLock = memo(({ actionGroup, doAction, sensor }) => {
|
|
13
|
+
const OnOffSmartLock = memo(({ actionGroup = {}, doAction, sensor = {} }) => {
|
|
15
14
|
const t = useTranslations();
|
|
16
|
-
const { configuration } = actionGroup;
|
|
17
|
-
const { action_on_data, action_off_data } =
|
|
15
|
+
const { configuration = {} } = actionGroup;
|
|
16
|
+
const { action_on_data, action_off_data, config, is_on_value } =
|
|
17
|
+
configuration;
|
|
18
|
+
const { is_managed_by_backend, device_type } = sensor;
|
|
18
19
|
const [isUnlock, setisUnlock] = useState(true);
|
|
19
20
|
const [configValues] = useConfigGlobalState('configValues');
|
|
20
21
|
|
|
@@ -27,10 +28,10 @@ const OnOffSmartLock = memo(({ actionGroup, doAction, sensor }) => {
|
|
|
27
28
|
const dataUnlock = { door_lock: 1 };
|
|
28
29
|
await doAction(action_off_data, JSON.stringify(dataUnlock));
|
|
29
30
|
}
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
watchMultiConfigs([
|
|
31
|
+
if (is_managed_by_backend) {
|
|
32
|
+
config &&
|
|
33
|
+
device_type === DEVICE_TYPE.LG_THINQ &&
|
|
34
|
+
watchMultiConfigs([config]);
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
}, [
|
|
@@ -38,54 +39,46 @@ const OnOffSmartLock = memo(({ actionGroup, doAction, sensor }) => {
|
|
|
38
39
|
action_on_data,
|
|
39
40
|
doAction,
|
|
40
41
|
isUnlock,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
config,
|
|
43
|
+
is_managed_by_backend,
|
|
44
|
+
device_type,
|
|
44
45
|
]);
|
|
45
46
|
|
|
46
|
-
useUnwatchLGDeviceConfigControl(sensor, [
|
|
47
|
+
useUnwatchLGDeviceConfigControl(sensor, [config]);
|
|
47
48
|
|
|
48
49
|
useEffect(() => {
|
|
49
|
-
const { is_on_value, config } = configuration;
|
|
50
50
|
const configValue = configValues[config];
|
|
51
51
|
if (is_on_value && is_on_value.length) {
|
|
52
52
|
setisUnlock(is_on_value.includes(configValue?.value));
|
|
53
53
|
} else {
|
|
54
54
|
setisUnlock(configValue?.value);
|
|
55
55
|
}
|
|
56
|
-
}, [configValues, configuration]);
|
|
56
|
+
}, [config, configValues, configuration, is_on_value]);
|
|
57
57
|
|
|
58
58
|
return (
|
|
59
|
-
|
|
60
|
-
<View
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
)}
|
|
76
|
-
<Text style={styles.textSmartLock}>
|
|
77
|
-
{t(isUnlock ? 'lock' : 'unlock')}
|
|
78
|
-
</Text>
|
|
79
|
-
</TouchableOpacity>
|
|
80
|
-
</View>
|
|
81
|
-
<View style={styles.wrapStatus}>
|
|
82
|
-
<Text style={styles.textStatus}>
|
|
83
|
-
{t(isUnlock ? 'door_is_open' : 'door_is_close')}
|
|
84
|
-
</Text>
|
|
85
|
-
</View>
|
|
86
|
-
</Section>
|
|
59
|
+
<>
|
|
60
|
+
<View>
|
|
61
|
+
<TouchableOpacity
|
|
62
|
+
onPress={handleActionSmartLock}
|
|
63
|
+
accessibilityLabel={AccessibilityLabel.BUTTON_ON_OFF}
|
|
64
|
+
style={styles.wrapButtonSmartLock}
|
|
65
|
+
>
|
|
66
|
+
{isUnlock ? (
|
|
67
|
+
<ButtonLock style={styles.buttonSmartLock} />
|
|
68
|
+
) : (
|
|
69
|
+
<ButtonUnLock style={styles.buttonSmartLock} />
|
|
70
|
+
)}
|
|
71
|
+
<Text style={styles.textSmartLock}>
|
|
72
|
+
{t(isUnlock ? 'lock' : 'unlock')}
|
|
73
|
+
</Text>
|
|
74
|
+
</TouchableOpacity>
|
|
87
75
|
</View>
|
|
88
|
-
|
|
76
|
+
<View style={styles.wrapStatus}>
|
|
77
|
+
<Text style={styles.textStatus}>
|
|
78
|
+
{t(isUnlock ? 'door_is_open' : 'door_is_close')}
|
|
79
|
+
</Text>
|
|
80
|
+
</View>
|
|
81
|
+
</>
|
|
89
82
|
);
|
|
90
83
|
});
|
|
91
84
|
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { act, create } from 'react-test-renderer';
|
|
3
3
|
|
|
4
4
|
import { mockSCStore } from '../../../../../context/mockStore';
|
|
5
|
-
import {
|
|
5
|
+
import { AccessibilityLabel } from '../../../../../configs/Constants';
|
|
6
6
|
import { SCProvider } from '../../../../../context';
|
|
7
7
|
import PasscodeList from '../index';
|
|
8
8
|
import { TouchableOpacity } from 'react-native';
|
|
@@ -38,7 +38,7 @@ describe('Test SetupGeneratePasscode', () => {
|
|
|
38
38
|
const instance = tree.root;
|
|
39
39
|
const passcode_list = instance.findAll(
|
|
40
40
|
(item) =>
|
|
41
|
-
item.props.
|
|
41
|
+
item.props.accessibilityLabel === AccessibilityLabel.PASSCODE_LIST &&
|
|
42
42
|
item.type === TouchableOpacity
|
|
43
43
|
);
|
|
44
44
|
|
|
@@ -9,7 +9,7 @@ import t from '../../../../hooks/Common/useTranslations';
|
|
|
9
9
|
import { Colors } from '../../../../configs';
|
|
10
10
|
import Routes from '../../../../utils/Route';
|
|
11
11
|
import styles from './PasscodeListStyles';
|
|
12
|
-
import {
|
|
12
|
+
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
13
13
|
|
|
14
14
|
const PasscodeList = memo(() => {
|
|
15
15
|
const navigation = useNavigation();
|
|
@@ -51,7 +51,7 @@ const PasscodeList = memo(() => {
|
|
|
51
51
|
<TouchableOpacity
|
|
52
52
|
onPress={handleClickButton(item)}
|
|
53
53
|
style={styles.buttonWrapper}
|
|
54
|
-
|
|
54
|
+
accessibilityLabel={AccessibilityLabel.PASSCODE_LIST}
|
|
55
55
|
>
|
|
56
56
|
<View>
|
|
57
57
|
<Text style={styles.textCode}>{item.code}</Text>
|
|
@@ -8,7 +8,7 @@ import styles from './SetupGeneratePasscodeStyles';
|
|
|
8
8
|
|
|
9
9
|
const ButtonWrapper = memo(
|
|
10
10
|
({
|
|
11
|
-
|
|
11
|
+
accessibilityLabel,
|
|
12
12
|
textHeadline,
|
|
13
13
|
textMinutes,
|
|
14
14
|
value,
|
|
@@ -27,7 +27,7 @@ const ButtonWrapper = memo(
|
|
|
27
27
|
const boxNotSelect = { ...styles.boxSetTime, ...styles.boxSetTimeDuration };
|
|
28
28
|
return (
|
|
29
29
|
<View
|
|
30
|
-
|
|
30
|
+
accessibilityLabel={accessibilityLabel}
|
|
31
31
|
style={
|
|
32
32
|
!isButtonDuration
|
|
33
33
|
? styles.buttonWrapper
|
|
@@ -3,7 +3,7 @@ import { act, create } from 'react-test-renderer';
|
|
|
3
3
|
|
|
4
4
|
import SetupGeneratePasscode from '../index';
|
|
5
5
|
import { mockSCStore } from '../../../../../context/mockStore';
|
|
6
|
-
import {
|
|
6
|
+
import { AccessibilityLabel } from '../../../../../configs/Constants';
|
|
7
7
|
import { SCProvider } from '../../../../../context';
|
|
8
8
|
|
|
9
9
|
const mockNavigate = jest.fn();
|
|
@@ -32,13 +32,19 @@ describe('Test SetupGeneratePasscode', () => {
|
|
|
32
32
|
|
|
33
33
|
const getElement = (instance) => {
|
|
34
34
|
const changeName = instance.findAll(
|
|
35
|
-
(item) =>
|
|
35
|
+
(item) =>
|
|
36
|
+
item.props.accessibilityLabel ===
|
|
37
|
+
AccessibilityLabel.GENERATE_PASSCODE_CHOOSE_USER
|
|
36
38
|
);
|
|
37
39
|
const changeTime = instance.findAll(
|
|
38
|
-
(item) =>
|
|
40
|
+
(item) =>
|
|
41
|
+
item.props.accessibilityLabel ===
|
|
42
|
+
AccessibilityLabel.GENERATE_PASSCODE_SET_TIME
|
|
39
43
|
);
|
|
40
44
|
const changeDuration = instance.findAll(
|
|
41
|
-
(item) =>
|
|
45
|
+
(item) =>
|
|
46
|
+
item.props.accessibilityLabel ===
|
|
47
|
+
AccessibilityLabel.GENERATE_PASSCODE_SET_DURATION
|
|
42
48
|
);
|
|
43
49
|
|
|
44
50
|
return {
|
|
@@ -66,8 +72,8 @@ describe('Test SetupGeneratePasscode', () => {
|
|
|
66
72
|
|
|
67
73
|
const wheelDateTimePicker = instance.findAll(
|
|
68
74
|
(item) =>
|
|
69
|
-
item.props.
|
|
70
|
-
`${
|
|
75
|
+
item.props.accessibilityLabel ===
|
|
76
|
+
`${AccessibilityLabel.WHEEL_DATE_TIME_PICKER_BUTTON}${AccessibilityLabel.VIEW_BUTTON_BOTTOM_RIGHT_BUTTON}`
|
|
71
77
|
);
|
|
72
78
|
await wheelDateTimePicker[5].props.onClick();
|
|
73
79
|
await wheelDateTimePicker[11].props.onClick();
|
|
@@ -11,7 +11,7 @@ import TemporaryDetail from '../../../../screens/GuestInfo/components/TemporaryD
|
|
|
11
11
|
import AccessScheduleItem from '../../../../screens/GuestInfo/components/AccessScheduleItem';
|
|
12
12
|
import BottomButtonView from '../../../BottomButtonView';
|
|
13
13
|
import { ACCESS_SCHEDULE } from '../../../../screens/GuestInfo/constant';
|
|
14
|
-
import {
|
|
14
|
+
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
15
15
|
import ButtonWrapper from './ButtonWrapper';
|
|
16
16
|
import moment from 'moment';
|
|
17
17
|
import styles from './SetupGeneratePasscodeStyles';
|
|
@@ -187,14 +187,16 @@ const SetupGeneratePasscode = memo(() => {
|
|
|
187
187
|
textHeadline={t('choose_user')}
|
|
188
188
|
value={'Name'}
|
|
189
189
|
isButtonChooseUser
|
|
190
|
-
|
|
190
|
+
accessibilityLabel={
|
|
191
|
+
AccessibilityLabel.GENERATE_PASSCODE_CHOOSE_USER
|
|
192
|
+
}
|
|
191
193
|
/>
|
|
192
194
|
<ButtonWrapper
|
|
193
195
|
textHeadline={t('set_time')}
|
|
194
196
|
valueTime={time.format('HH:mm')}
|
|
195
197
|
onPressSetTime={handleSetTime}
|
|
196
198
|
isButtonSetTime
|
|
197
|
-
|
|
199
|
+
accessibilityLabel={AccessibilityLabel.GENERATE_PASSCODE_SET_TIME}
|
|
198
200
|
/>
|
|
199
201
|
<ButtonWrapper
|
|
200
202
|
textHeadline={t('duration')}
|
|
@@ -204,7 +206,9 @@ const SetupGeneratePasscode = memo(() => {
|
|
|
204
206
|
onPressSelectCircle={handleSelectCircle}
|
|
205
207
|
isButtonDuration
|
|
206
208
|
isSelectCircle={isSelectCircle}
|
|
207
|
-
|
|
209
|
+
accessibilityLabel={
|
|
210
|
+
AccessibilityLabel.GENERATE_PASSCODE_SET_DURATION
|
|
211
|
+
}
|
|
208
212
|
/>
|
|
209
213
|
<View>
|
|
210
214
|
<Text style={styles.textHeadLine}>{t('access_schedule')}</Text>
|
|
@@ -5,11 +5,12 @@ 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 {
|
|
8
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
9
9
|
|
|
10
10
|
const OnOffButtonTemplate = memo(
|
|
11
|
-
({ isOn, triggerAction, actionGroup, isLight = false }) => {
|
|
12
|
-
const { configuration, id } = actionGroup;
|
|
11
|
+
({ isOn, triggerAction, actionGroup = {}, isLight = false }) => {
|
|
12
|
+
const { configuration = {}, id } = actionGroup;
|
|
13
|
+
const { icon_on, icon_off, text_on, text_off } = configuration;
|
|
13
14
|
|
|
14
15
|
return (
|
|
15
16
|
<>
|
|
@@ -17,12 +18,11 @@ const OnOffButtonTemplate = memo(
|
|
|
17
18
|
<TouchableOpacity
|
|
18
19
|
style={styles.bigCircle}
|
|
19
20
|
onPress={triggerAction}
|
|
20
|
-
|
|
21
|
-
accessibilityLabel={`${TESTID.ON_OFF_BUTTON}-${id}`}
|
|
21
|
+
accessibilityLabel={`${AccessibilityLabel.ON_OFF_BUTTON}-${id}`}
|
|
22
22
|
>
|
|
23
23
|
<View style={styles.smallCircle}>
|
|
24
24
|
<Icon
|
|
25
|
-
name={isOn ?
|
|
25
|
+
name={isOn ? icon_on : icon_off}
|
|
26
26
|
size={44}
|
|
27
27
|
color={isOn ? Colors.Green7 : Colors.Gray6}
|
|
28
28
|
/>
|
|
@@ -31,16 +31,15 @@ const OnOffButtonTemplate = memo(
|
|
|
31
31
|
styles.textBig,
|
|
32
32
|
{ color: isOn ? Colors.Gray8 : Colors.Gray6 },
|
|
33
33
|
]}
|
|
34
|
-
|
|
35
|
-
accessibilityLabel={`${TESTID.SENSOR_STATUS}-${id}`}
|
|
34
|
+
accessibilityLabel={`${AccessibilityLabel.SENSOR_STATUS}-${id}`}
|
|
36
35
|
>
|
|
37
|
-
{isOn ?
|
|
36
|
+
{isOn ? text_on : text_off}
|
|
38
37
|
</Text>
|
|
39
38
|
</View>
|
|
40
39
|
</TouchableOpacity>
|
|
41
40
|
</View>
|
|
42
41
|
{!!actionGroup.title && !isLight && (
|
|
43
|
-
<Text
|
|
42
|
+
<Text type="H3" semibold center>
|
|
44
43
|
{actionGroup.title}
|
|
45
44
|
</Text>
|
|
46
45
|
)}
|
|
@@ -20,21 +20,27 @@ const getComponent = (template) => {
|
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
const OnOffTemplate = memo(({ actionGroup, doAction, sensor }) => {
|
|
24
|
-
const { configuration } = actionGroup;
|
|
25
|
-
const {
|
|
23
|
+
const OnOffTemplate = memo(({ actionGroup = {}, doAction, sensor }) => {
|
|
24
|
+
const { configuration = {} } = actionGroup;
|
|
25
|
+
const {
|
|
26
|
+
action_data,
|
|
27
|
+
action_on_data,
|
|
28
|
+
action_off_data,
|
|
29
|
+
is_on_value,
|
|
30
|
+
config,
|
|
31
|
+
allow_config_store_value,
|
|
32
|
+
} = configuration;
|
|
26
33
|
|
|
27
34
|
// eslint-disable-next-line no-unused-vars
|
|
28
35
|
const [configValues, _] = useConfigGlobalState('configValues');
|
|
29
36
|
|
|
30
37
|
const getIsOnValue = useCallback(() => {
|
|
31
|
-
const { is_on_value, config } = configuration;
|
|
32
38
|
const configValue = configValues[config];
|
|
33
39
|
if (is_on_value && is_on_value.length > 0) {
|
|
34
40
|
return is_on_value.includes(configValue?.value);
|
|
35
41
|
}
|
|
36
42
|
return !!configValue?.value;
|
|
37
|
-
}, [configValues,
|
|
43
|
+
}, [config, configValues, is_on_value]);
|
|
38
44
|
|
|
39
45
|
const [isOn, setIsOn] = useState(false);
|
|
40
46
|
const [tempIsOn, setTempIsOn] = useState(getIsOnValue());
|
|
@@ -49,10 +55,21 @@ const OnOffTemplate = memo(({ actionGroup, doAction, sensor }) => {
|
|
|
49
55
|
switch (sensor?.device_type) {
|
|
50
56
|
case DEVICE_TYPE.ZIGBEE:
|
|
51
57
|
if (action_on_data && action_off_data) {
|
|
58
|
+
let data;
|
|
52
59
|
if (isOn) {
|
|
53
|
-
|
|
60
|
+
data = { state: 0 };
|
|
61
|
+
if (allow_config_store_value && config) {
|
|
62
|
+
data.config_id = config;
|
|
63
|
+
data.config_value = 0;
|
|
64
|
+
}
|
|
65
|
+
await doAction(action_off_data, JSON.stringify(data));
|
|
54
66
|
} else {
|
|
55
|
-
|
|
67
|
+
data = { state: 1 };
|
|
68
|
+
if (allow_config_store_value && config) {
|
|
69
|
+
data.config_id = config;
|
|
70
|
+
data.config_value = 1;
|
|
71
|
+
}
|
|
72
|
+
await doAction(action_on_data, JSON.stringify(data));
|
|
56
73
|
}
|
|
57
74
|
}
|
|
58
75
|
break;
|
|
@@ -81,22 +98,23 @@ const OnOffTemplate = memo(({ actionGroup, doAction, sensor }) => {
|
|
|
81
98
|
}
|
|
82
99
|
updateStatusFromPusher();
|
|
83
100
|
if (sensor?.is_managed_by_backend) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
101
|
+
if (config && sensor.device_type === DEVICE_TYPE.LG_THINQ) {
|
|
102
|
+
watchMultiConfigs([config]);
|
|
103
|
+
}
|
|
87
104
|
}
|
|
88
105
|
}, [
|
|
106
|
+
allow_config_store_value,
|
|
107
|
+
config,
|
|
89
108
|
action_data,
|
|
90
109
|
action_off_data,
|
|
91
110
|
action_on_data,
|
|
92
|
-
configuration?.config,
|
|
93
111
|
doAction,
|
|
94
112
|
isOn,
|
|
95
113
|
sensor?.device_type,
|
|
96
114
|
sensor?.is_managed_by_backend,
|
|
97
115
|
]);
|
|
98
116
|
|
|
99
|
-
useUnwatchLGDeviceConfigControl(sensor, [
|
|
117
|
+
useUnwatchLGDeviceConfigControl(sensor, [config]);
|
|
100
118
|
|
|
101
119
|
useEffect(() => {
|
|
102
120
|
setIsOn(getIsOnValue());
|
|
@@ -6,9 +6,9 @@ import Text from '../Text';
|
|
|
6
6
|
import { Colors } from '../../configs';
|
|
7
7
|
import styles from './OneBigButtonTemplateStyle';
|
|
8
8
|
|
|
9
|
-
const OneBigButtonTemplate = memo(({ actionGroup, doAction, sensor }) => {
|
|
10
|
-
const { configuration } = actionGroup;
|
|
11
|
-
const { text, action_data } = configuration
|
|
9
|
+
const OneBigButtonTemplate = memo(({ actionGroup = {}, doAction, sensor }) => {
|
|
10
|
+
const { configuration = {} } = actionGroup;
|
|
11
|
+
const { text, action_data, icon } = configuration;
|
|
12
12
|
|
|
13
13
|
const onPressDoAction = useCallback(() => {
|
|
14
14
|
doAction(action_data, null);
|
|
@@ -19,13 +19,13 @@ const OneBigButtonTemplate = memo(({ actionGroup, doAction, sensor }) => {
|
|
|
19
19
|
<View style={styles.barrierControlContainer}>
|
|
20
20
|
<TouchableOpacity style={styles.bigCircle} onPress={onPressDoAction}>
|
|
21
21
|
<View style={styles.smallCircle}>
|
|
22
|
-
<Icon name={
|
|
22
|
+
<Icon name={icon} size={44} color={Colors.Green7} />
|
|
23
23
|
<Text style={styles.textBig}>{text}</Text>
|
|
24
24
|
</View>
|
|
25
25
|
</TouchableOpacity>
|
|
26
26
|
</View>
|
|
27
27
|
{!!actionGroup.title && (
|
|
28
|
-
<Text
|
|
28
|
+
<Text type="H3" semibold center>
|
|
29
29
|
{actionGroup.title}
|
|
30
30
|
</Text>
|
|
31
31
|
)}
|
|
@@ -10,72 +10,89 @@ import { useConfigGlobalState } from '../../iot/states';
|
|
|
10
10
|
import { useUnwatchLGDeviceConfigControl } from '../../hooks/IoT';
|
|
11
11
|
import styles from './OptionsDropdownActionTemplateStyle';
|
|
12
12
|
import { watchMultiConfigs } from '../../iot/Monitor';
|
|
13
|
-
import { DEVICE_TYPE,
|
|
13
|
+
import { DEVICE_TYPE, AccessibilityLabel } from '../../configs/Constants';
|
|
14
14
|
import IconComponent from '../../commons/IconComponent';
|
|
15
15
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
16
16
|
import SvgDoorState from '../../../assets/images/Device/door-state.svg';
|
|
17
17
|
import SvgCurrentState from '../../../assets/images/Device/current-state.svg';
|
|
18
18
|
import SvgWindStrength from '../../../assets/images/Device/wind-strength.svg';
|
|
19
19
|
|
|
20
|
-
function getOptionValue(option) {
|
|
21
|
-
if (option.value_text) {
|
|
20
|
+
function getOptionValue(option, allow_config_store_value) {
|
|
21
|
+
if (option.value_text && !allow_config_store_value) {
|
|
22
22
|
return option.value_text;
|
|
23
23
|
}
|
|
24
24
|
return option.value_int;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
const OptionsDropdownActionTemplate = ({
|
|
27
|
+
const OptionsDropdownActionTemplate = ({
|
|
28
|
+
actionGroup = {},
|
|
29
|
+
doAction,
|
|
30
|
+
sensor = {},
|
|
31
|
+
}) => {
|
|
28
32
|
const t = useTranslations();
|
|
29
|
-
const { configuration, title } = actionGroup;
|
|
30
|
-
const {
|
|
31
|
-
|
|
33
|
+
const { configuration = {}, title } = actionGroup;
|
|
34
|
+
const {
|
|
35
|
+
action_data,
|
|
36
|
+
options = [],
|
|
37
|
+
icon_kit_data,
|
|
38
|
+
icon,
|
|
39
|
+
icon_outlined,
|
|
40
|
+
config,
|
|
41
|
+
allow_config_store_value,
|
|
42
|
+
} = configuration;
|
|
32
43
|
// eslint-disable-next-line no-unused-vars
|
|
33
44
|
const [configValues, setConfigValues] = useConfigGlobalState('configValues');
|
|
34
45
|
const checkIcon = /\d/.test(icon); // to do check icon svg and icon antDesign
|
|
35
46
|
const selectedOption = useMemo(() => {
|
|
36
|
-
const currentValue = configValues[
|
|
47
|
+
const currentValue = configValues[config]?.value;
|
|
37
48
|
if (currentValue === null || currentValue === undefined) {
|
|
38
|
-
return
|
|
49
|
+
return options[0];
|
|
39
50
|
}
|
|
40
51
|
|
|
41
|
-
for (let i = 0; i <
|
|
42
|
-
const option =
|
|
43
|
-
const value = getOptionValue(option);
|
|
52
|
+
for (let i = 0; i < options.length; i++) {
|
|
53
|
+
const option = options[i];
|
|
54
|
+
const value = getOptionValue(option, allow_config_store_value);
|
|
44
55
|
if (value === currentValue) {
|
|
45
56
|
return option;
|
|
46
57
|
}
|
|
47
58
|
}
|
|
48
|
-
return
|
|
49
|
-
}, [configValues,
|
|
59
|
+
return options[0];
|
|
60
|
+
}, [configValues, config, options, allow_config_store_value]);
|
|
50
61
|
|
|
51
62
|
const { stateAlert, hideAlertAction, onShowAlert } = useDropdownAction();
|
|
52
63
|
const [selectedIndex, setSelectedIndex] = useState(
|
|
53
|
-
|
|
64
|
+
options.indexOf(selectedOption)
|
|
54
65
|
);
|
|
55
66
|
|
|
56
67
|
useEffect(() => {
|
|
57
|
-
setSelectedIndex(
|
|
58
|
-
}, [
|
|
68
|
+
setSelectedIndex(options.indexOf(selectedOption));
|
|
69
|
+
}, [options, selectedOption]);
|
|
59
70
|
|
|
60
71
|
const onDone = useCallback(() => {
|
|
61
72
|
const newOption = options[selectedIndex];
|
|
62
|
-
const value = getOptionValue(newOption);
|
|
73
|
+
const value = getOptionValue(newOption, allow_config_store_value);
|
|
74
|
+
|
|
75
|
+
let data = { level: value, key_code: newOption?.value_int };
|
|
76
|
+
if (allow_config_store_value && config) {
|
|
77
|
+
data.config_id = config;
|
|
78
|
+
data.config_value = newOption?.value_int;
|
|
79
|
+
}
|
|
80
|
+
data = JSON.stringify(data);
|
|
63
81
|
|
|
64
|
-
let data = JSON.stringify({ level: value, key_code: newOption?.value_int });
|
|
65
82
|
if (sensor.device_type === DEVICE_TYPE.GOOGLE_HOME) {
|
|
66
83
|
data = value;
|
|
67
84
|
}
|
|
68
|
-
|
|
69
85
|
doAction(action_data, data);
|
|
70
86
|
if (sensor?.is_managed_by_backend) {
|
|
71
|
-
|
|
87
|
+
config &&
|
|
72
88
|
sensor.device_type === DEVICE_TYPE.LG_THINQ &&
|
|
73
|
-
watchMultiConfigs([
|
|
89
|
+
watchMultiConfigs([config]);
|
|
74
90
|
}
|
|
75
91
|
hideAlertAction();
|
|
76
92
|
}, [
|
|
93
|
+
config,
|
|
94
|
+
allow_config_store_value,
|
|
77
95
|
action_data,
|
|
78
|
-
configuration.config,
|
|
79
96
|
doAction,
|
|
80
97
|
hideAlertAction,
|
|
81
98
|
options,
|
|
@@ -89,11 +106,11 @@ const OptionsDropdownActionTemplate = ({ actionGroup, doAction, sensor }) => {
|
|
|
89
106
|
const iconKit = !!icon_kit_data && icon_kit_data.icon;
|
|
90
107
|
|
|
91
108
|
const displaySelected = useMemo(() => {
|
|
92
|
-
if (!
|
|
109
|
+
if (!config) {
|
|
93
110
|
return t('not_available');
|
|
94
111
|
}
|
|
95
112
|
return selectedOption.text;
|
|
96
|
-
}, [
|
|
113
|
+
}, [config, selectedOption?.text, t]);
|
|
97
114
|
|
|
98
115
|
const iconSvg = useMemo(() => {
|
|
99
116
|
switch (icon) {
|
|
@@ -128,7 +145,9 @@ const OptionsDropdownActionTemplate = ({ actionGroup, doAction, sensor }) => {
|
|
|
128
145
|
</View>
|
|
129
146
|
<TouchableOpacity style={styles.iconAndTextOption} onPress={onShowAlert}>
|
|
130
147
|
<Text
|
|
131
|
-
|
|
148
|
+
accessibilityLabel={
|
|
149
|
+
AccessibilityLabel.OPTIONS_DROPDOWN_ACTION_DISPLAY_SELECTED
|
|
150
|
+
}
|
|
132
151
|
color={
|
|
133
152
|
displaySelected === t('not_available') ? Colors.Gray6 : Colors.Gray8
|
|
134
153
|
}
|
|
@@ -157,7 +176,9 @@ const OptionsDropdownActionTemplate = ({ actionGroup, doAction, sensor }) => {
|
|
|
157
176
|
<Text
|
|
158
177
|
color={Colors.Gray6}
|
|
159
178
|
style={styles.writeNotAvailable}
|
|
160
|
-
|
|
179
|
+
accessibilityLabel={
|
|
180
|
+
AccessibilityLabel.OPTIONS_DROPDOWN_ACTION_WRITE_NOT_AVAILABLE
|
|
181
|
+
}
|
|
161
182
|
>
|
|
162
183
|
{t('write_not_available')}
|
|
163
184
|
</Text>
|
|
@@ -166,7 +187,9 @@ const OptionsDropdownActionTemplate = ({ actionGroup, doAction, sensor }) => {
|
|
|
166
187
|
<View key={index} style={styles.rowContainer}>
|
|
167
188
|
<RadioCircle active={selectedIndex === index} />
|
|
168
189
|
<TouchableOpacity
|
|
169
|
-
|
|
190
|
+
accessibilityLabel={
|
|
191
|
+
AccessibilityLabel.OPTIONS_DROPDOWN_ACTION_CHOOSING_ITEM
|
|
192
|
+
}
|
|
170
193
|
style={styles.row}
|
|
171
194
|
onPress={() => {
|
|
172
195
|
setSelectedIndex(index);
|
|
@@ -8,9 +8,9 @@ import SvgBrightness from '../../../assets/images/brightness.svg';
|
|
|
8
8
|
import SliderRange from 'react-native-slider';
|
|
9
9
|
import { useConfigGlobalState } from '../../iot/states';
|
|
10
10
|
|
|
11
|
-
const SliderRangeTemplate = memo(({ actionGroup, doAction
|
|
11
|
+
const SliderRangeTemplate = memo(({ actionGroup = {}, doAction }) => {
|
|
12
12
|
const t = useTranslations();
|
|
13
|
-
const { configuration } = actionGroup;
|
|
13
|
+
const { configuration = {} } = actionGroup;
|
|
14
14
|
const [valueBrightness, setValueBrightness] = useState(0);
|
|
15
15
|
const [valueBrightnessTemp, setValueBrightnessTemp] = useState(0);
|
|
16
16
|
const [isFirstTime, setIsFirstTime] = useState(true);
|