@eohjsc/react-native-smart-city 0.3.31 → 0.3.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/images/AddNewDevice/add-gateway-icon.svg +13 -0
- package/assets/images/AddNewDevice/add-modbus-device-icon.svg +8 -0
- package/assets/images/AddNewDevice/add-wifi-device-icon.svg +4 -0
- package/assets/images/AddNewDevice/add-zigbee-device-icon.svg +4 -0
- package/assets/images/AddNewDevice/interact-smartphone-icon.svg +14 -0
- package/index.js +2 -0
- package/package.json +8 -5
- package/src/Images/SmartAccount/DienQuang.png +0 -0
- package/src/Images/SmartAccount/DienQuang@2x.png +0 -0
- package/src/Images/SmartAccount/DienQuang@3x.png +0 -0
- package/src/Images/SmartAccount/LG.png +0 -0
- package/src/Images/SmartAccount/LG@2x.png +0 -0
- package/src/Images/SmartAccount/LG@3x.png +0 -0
- package/src/Images/SmartAccount/Samsung.png +0 -0
- package/src/Images/SmartAccount/Samsung@2x.png +0 -0
- package/src/Images/SmartAccount/Samsung@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/CurtainButtonTemplate.js +6 -6
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +9 -6
- 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 +2 -2
- 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 +4 -6
- package/src/commons/ActionGroup/OnOffTemplate/index.js +28 -10
- package/src/commons/ActionGroup/OneBigButtonTemplate.js +1 -1
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +25 -12
- 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 +5 -5
- package/src/commons/ActionGroup/TwoButtonTemplate/index.js +4 -4
- 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 +5 -3
- 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/Device/ConnectedViewHeader.js +2 -2
- package/src/commons/Device/DeviceAlertStatus.js +2 -2
- package/src/commons/Device/DisconnectedView.js +2 -2
- package/src/commons/Device/Emergency/EmergencyButton.js +2 -2
- 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/SensorConnectedStatus.js +5 -2
- package/src/commons/Device/WindDirection/Compass/index.js +5 -2
- 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/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 +2 -3
- 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 +52 -0
- package/src/commons/SelectUnit/__test__/SelectUnit.test.js +120 -0
- package/src/commons/SelectUnit/index.js +105 -0
- package/src/commons/SelectUnit/styles.js +53 -0
- package/src/commons/Sharing/WrapHeaderScrollable.js +2 -2
- 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 +16 -14
- package/src/configs/AccessibilityLabel.js +629 -0
- package/src/configs/Constants.js +1 -604
- package/src/configs/Images.js +2 -0
- package/src/context/actionType.ts +10 -3
- package/src/context/mockStore.ts +6 -3
- package/src/context/reducer.ts +45 -8
- 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 +56 -21
- package/src/navigations/Main.js +2 -2
- package/src/navigations/SmartAccountStack.js +52 -0
- 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 +49 -192
- package/src/screens/AddCommon/SelectUnit.js +58 -204
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +25 -61
- package/src/screens/AddCommon/__test__/SelectUnit.test.js +41 -32
- 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/ConnectingWifiGuide.js +167 -0
- package/src/screens/AddNewGateway/ConnectingWifiGuideStyles.js +58 -0
- package/src/screens/AddNewGateway/ConnectingZigbeeDevice.js +60 -0
- package/src/screens/AddNewGateway/PlugAndPlay/FirstWarning.js +16 -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 +80 -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 +147 -0
- package/src/screens/AddNewGateway/SelectDeviceTypeStyles.js +51 -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 +198 -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__/ConnectingWifiGuide.test.js +224 -0
- 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 +72 -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 +124 -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 +155 -0
- package/src/screens/AddNewGateway/hooks/__Tests__/index.test.js +1 -1
- 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/SensorConnectStatusViewHeader.js +6 -6
- package/src/screens/Device/components/SensorDisplayItem.js +2 -2
- package/src/screens/Device/detail.js +28 -22
- 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 +21 -9
- package/src/screens/EditActionsList/__tests__/index.test.js +120 -0
- package/src/screens/EditActionsList/index.js +15 -5
- 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/SharedUnit/__test__/ShareUnit.test.js +25 -0
- package/src/screens/SharedUnit/index.js +2 -0
- package/src/screens/Sharing/Components/{SensorItem.js → DeviceItem.js} +40 -30
- 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 +139 -123
- 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 +67 -14
- 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/SmartAccount/Connecting/index.js +171 -0
- package/src/{commons/ConnectingProcess/styles.js → screens/SmartAccount/Connecting/style.js} +3 -22
- package/src/screens/SmartAccount/ListDevice/DeviceItem.js +45 -0
- package/src/screens/SmartAccount/ListDevice/__test__/DeviceItem.test.js +34 -0
- package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +139 -0
- package/src/screens/SmartAccount/ListDevice/index.js +186 -0
- package/src/screens/SmartAccount/ListDevice/styles/DeviceItemStyles.js +70 -0
- package/src/screens/SmartAccount/ListDevice/styles/index.js +85 -0
- package/src/screens/SmartAccount/SuccessfullyConnected/DeviceItem.js +37 -0
- package/src/{commons/ConnectingProcess/DeviceItem → screens/SmartAccount/SuccessfullyConnected}/DeviceItemStyles.js +13 -5
- package/src/screens/SmartAccount/SuccessfullyConnected/__test__/DeviceItem.test.js +65 -0
- package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +88 -0
- package/src/screens/SmartAccount/SuccessfullyConnected/index.js +101 -0
- package/src/screens/SmartAccount/SuccessfullyConnected/styles.js +42 -0
- package/src/screens/SmartAccount/__test__/Connecting.test.js +86 -0
- package/src/screens/SmartAccount/__test__/SmartAccount.test.js +249 -0
- package/src/screens/SmartAccount/index.js +172 -0
- package/src/screens/SmartAccount/style.js +70 -0
- 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 +44 -14
- package/src/screens/TDSGuide/__test__/TDSGuide.test.js +4 -2
- package/src/screens/TDSGuide/index.js +2 -2
- package/src/screens/Template/EditTemplate.js +2 -1
- package/src/screens/Template/__test__/detail.test.js +9 -1
- package/src/screens/Template/index.js +0 -1
- package/src/screens/UVIndexGuide/__test__/UVIndexGuide.test.js +3 -2
- package/src/screens/UVIndexGuide/index.js +2 -2
- package/src/screens/Unit/AddMenu.js +10 -25
- 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 +8 -5
- package/src/screens/Unit/SmartAccountItem.js +3 -3
- package/src/screens/Unit/Station/__test__/index.test.js +1 -1
- 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 +17 -12
- 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 +8 -5
- 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 +36 -11
- package/src/utils/I18n/translations/vi.json +36 -10
- package/src/utils/Route/index.js +19 -10
- package/src/utils/Utils.js +6 -7
- package/src/utils/Validation.js +4 -0
- package/src/commons/Connecting/index.js +0 -67
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItem.js +0 -28
- 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/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
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderer, { act } from 'react-test-renderer';
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
5
|
+
|
|
6
|
+
import SelectUnit from '../index';
|
|
7
|
+
import Text from '../../../commons/Text';
|
|
8
|
+
import AccessibilityLabel from '../../../configs/AccessibilityLabel';
|
|
9
|
+
import { SCProvider } from '../../../context';
|
|
10
|
+
import { mockSCStore } from '../../../context/mockStore';
|
|
11
|
+
import api from '../../../utils/Apis/axios';
|
|
12
|
+
import { API } from '../../../configs';
|
|
13
|
+
|
|
14
|
+
const mock = new MockAdapter(api.axiosInstance);
|
|
15
|
+
|
|
16
|
+
const mockedGoBack = jest.fn();
|
|
17
|
+
const mockedNavigate = jest.fn();
|
|
18
|
+
jest.mock('@react-navigation/native', () => {
|
|
19
|
+
return {
|
|
20
|
+
...jest.requireActual('@react-navigation/native'),
|
|
21
|
+
useNavigation: () => ({
|
|
22
|
+
navigate: mockedNavigate,
|
|
23
|
+
goBack: mockedGoBack,
|
|
24
|
+
}),
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const wrapComponent = (title, subTitle, onPressNext) => (
|
|
29
|
+
<SCProvider initState={mockSCStore({})}>
|
|
30
|
+
<SelectUnit {...{ title, subTitle, onPressNext }} />
|
|
31
|
+
</SCProvider>
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
describe('test single SelectUnit', () => {
|
|
35
|
+
let tree;
|
|
36
|
+
|
|
37
|
+
test('fetch Unit success', async () => {
|
|
38
|
+
Platform.OS = 'android';
|
|
39
|
+
const response = {
|
|
40
|
+
status: 200,
|
|
41
|
+
success: true,
|
|
42
|
+
data: [
|
|
43
|
+
{ id: 1, name: 'Unit 1' },
|
|
44
|
+
{ id: 2, name: 'Unit 2' },
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
mock.onGet(API.SHARE.UNITS()).reply(200, response.data);
|
|
48
|
+
await act(async () => {
|
|
49
|
+
tree = renderer.create(wrapComponent());
|
|
50
|
+
});
|
|
51
|
+
const instance = tree.root;
|
|
52
|
+
const unitName = instance.findAll(
|
|
53
|
+
(item) =>
|
|
54
|
+
item.props.accessibilityLabel?.indexOf(
|
|
55
|
+
AccessibilityLabel.SELECT_UNIT_NAME
|
|
56
|
+
) === 0 && item.type === Text
|
|
57
|
+
);
|
|
58
|
+
const radioButton = instance.findAll(
|
|
59
|
+
(item) =>
|
|
60
|
+
item.props.accessibilityLabel?.indexOf(
|
|
61
|
+
AccessibilityLabel.SELECT_UNIT_RADIO_BUTTON
|
|
62
|
+
) === 0
|
|
63
|
+
);
|
|
64
|
+
expect(unitName[0].props.children).toBe('Unit 1');
|
|
65
|
+
expect(unitName[1].props.children).toBe('Unit 2');
|
|
66
|
+
expect(radioButton[0].props.active).toBeFalsy();
|
|
67
|
+
expect(radioButton[1].props.active).toBeFalsy();
|
|
68
|
+
const selectUnit = instance.findAll(
|
|
69
|
+
(item) =>
|
|
70
|
+
item.props.accessibilityLabel ===
|
|
71
|
+
`${AccessibilityLabel.SELECT_UNIT_SELECT}-1`
|
|
72
|
+
);
|
|
73
|
+
await act(async () => {
|
|
74
|
+
selectUnit[0].props.onPress();
|
|
75
|
+
});
|
|
76
|
+
expect(radioButton[0].props.active).toBeTruthy();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('fetch Unit not success', async () => {
|
|
80
|
+
Platform.OS = 'ios';
|
|
81
|
+
mock.onGet(500);
|
|
82
|
+
await act(async () => {
|
|
83
|
+
tree = renderer.create(wrapComponent());
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const instance = tree.root;
|
|
87
|
+
const unitName = instance.findAll(
|
|
88
|
+
(item) =>
|
|
89
|
+
item.props.accessibilityLabel?.indexOf(
|
|
90
|
+
AccessibilityLabel.SELECT_UNIT_NAME
|
|
91
|
+
) === 0 && item.type === Text
|
|
92
|
+
);
|
|
93
|
+
const radioButton = instance.findAll(
|
|
94
|
+
(item) =>
|
|
95
|
+
item.props.accessibilityLabel?.indexOf(
|
|
96
|
+
AccessibilityLabel.SELECT_UNIT_RADIO_BUTTON
|
|
97
|
+
) === 0
|
|
98
|
+
);
|
|
99
|
+
expect(unitName).toHaveLength(2);
|
|
100
|
+
expect(radioButton).toHaveLength(2);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test('click goBack', async () => {
|
|
104
|
+
await act(async () => {
|
|
105
|
+
tree = renderer.create(wrapComponent());
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
const instance = tree.root;
|
|
109
|
+
const goBack = instance.find(
|
|
110
|
+
(item) =>
|
|
111
|
+
item.props.accessibilityLabel ===
|
|
112
|
+
`${AccessibilityLabel.PREFIX.SELECT_UNIT}${AccessibilityLabel.VIEW_BUTTON_BOTTOM_LEFT_BUTTON}`
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
await act(async () => {
|
|
116
|
+
goBack.props.onPress();
|
|
117
|
+
});
|
|
118
|
+
expect(mockedGoBack).toBeCalled();
|
|
119
|
+
});
|
|
120
|
+
});
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { useNavigation } from '@react-navigation/native';
|
|
2
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
3
|
+
import React, { memo, useCallback, useEffect, useState } from 'react';
|
|
4
|
+
import { SafeAreaView, ScrollView, TouchableOpacity, View } from 'react-native';
|
|
5
|
+
|
|
6
|
+
import { API } from '../../configs';
|
|
7
|
+
import { RadioCircle, Section, ViewButtonBottom } from '../../commons';
|
|
8
|
+
import { axiosGet } from '../../utils/Apis/axios';
|
|
9
|
+
import Text from '../../commons/Text';
|
|
10
|
+
import AccessibilityLabel from '../../configs/AccessibilityLabel';
|
|
11
|
+
import styles from './styles';
|
|
12
|
+
import { HeaderCustom } from '../Header';
|
|
13
|
+
|
|
14
|
+
const UnitItem = memo(({ index, item, setSelectedIndex, selectedIndex }) => {
|
|
15
|
+
const handleSelectIndex = useCallback(() => {
|
|
16
|
+
setSelectedIndex((currentIndex) => {
|
|
17
|
+
if (currentIndex !== index) {
|
|
18
|
+
return index;
|
|
19
|
+
}
|
|
20
|
+
return -1;
|
|
21
|
+
});
|
|
22
|
+
}, [index, setSelectedIndex]);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<TouchableOpacity
|
|
26
|
+
key={index}
|
|
27
|
+
style={styles.rowContainer}
|
|
28
|
+
onPress={handleSelectIndex}
|
|
29
|
+
accessibilityLabel={`${AccessibilityLabel.SELECT_UNIT_SELECT}-${item.id}`}
|
|
30
|
+
>
|
|
31
|
+
<RadioCircle
|
|
32
|
+
active={selectedIndex === index}
|
|
33
|
+
accessibilityLabel={`${AccessibilityLabel.SELECT_UNIT_RADIO_BUTTON}-${item.id}`}
|
|
34
|
+
/>
|
|
35
|
+
<View style={styles.row}>
|
|
36
|
+
<Text
|
|
37
|
+
style={styles.text}
|
|
38
|
+
accessibilityLabel={`${AccessibilityLabel.SELECT_UNIT_NAME}-${item.id}`}
|
|
39
|
+
>
|
|
40
|
+
{item.name}
|
|
41
|
+
</Text>
|
|
42
|
+
</View>
|
|
43
|
+
</TouchableOpacity>
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const SelectUnit = ({ title, subTitle, onPressNext }) => {
|
|
48
|
+
const t = useTranslations();
|
|
49
|
+
const { goBack } = useNavigation();
|
|
50
|
+
const [selectedIndex, setSelectedIndex] = useState(-1);
|
|
51
|
+
const [units, setUnits] = useState([]);
|
|
52
|
+
|
|
53
|
+
const onRightClick = useCallback(() => {
|
|
54
|
+
onPressNext(units[selectedIndex]);
|
|
55
|
+
}, [onPressNext, selectedIndex, units]);
|
|
56
|
+
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
(async () => {
|
|
59
|
+
const { data, success } = await axiosGet(API.SHARE.UNITS());
|
|
60
|
+
if (success) {
|
|
61
|
+
const normalizeData = data.map((unit) => ({
|
|
62
|
+
name: unit.name,
|
|
63
|
+
id: unit.id,
|
|
64
|
+
}));
|
|
65
|
+
setUnits(normalizeData);
|
|
66
|
+
}
|
|
67
|
+
})();
|
|
68
|
+
}, []);
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<SafeAreaView style={styles.container}>
|
|
72
|
+
<HeaderCustom title={title} isShowSeparator />
|
|
73
|
+
<Text style={styles.subtitle}>{subTitle}</Text>
|
|
74
|
+
<View style={styles.contentContainer}>
|
|
75
|
+
<ScrollView
|
|
76
|
+
style={styles.scrollContainer}
|
|
77
|
+
showsVerticalScrollIndicator={false}
|
|
78
|
+
scrollIndicatorInsets={{ right: 1 }}
|
|
79
|
+
>
|
|
80
|
+
<Section type={'border'}>
|
|
81
|
+
{units.map((item, index) => (
|
|
82
|
+
<UnitItem
|
|
83
|
+
key={item?.id?.toString()}
|
|
84
|
+
item={item}
|
|
85
|
+
index={index}
|
|
86
|
+
setSelectedIndex={setSelectedIndex}
|
|
87
|
+
selectedIndex={selectedIndex}
|
|
88
|
+
/>
|
|
89
|
+
))}
|
|
90
|
+
</Section>
|
|
91
|
+
</ScrollView>
|
|
92
|
+
<ViewButtonBottom
|
|
93
|
+
leftTitle={t('cancel')}
|
|
94
|
+
onLeftClick={goBack}
|
|
95
|
+
rightTitle={t('next')}
|
|
96
|
+
rightDisabled={selectedIndex === -1}
|
|
97
|
+
onRightClick={onRightClick}
|
|
98
|
+
accessibilityLabelPrefix={AccessibilityLabel.PREFIX.SELECT_UNIT}
|
|
99
|
+
/>
|
|
100
|
+
</View>
|
|
101
|
+
</SafeAreaView>
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export default SelectUnit;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { Colors } from '../../configs';
|
|
3
|
+
|
|
4
|
+
const styles = StyleSheet.create({
|
|
5
|
+
container: {
|
|
6
|
+
flex: 1,
|
|
7
|
+
backgroundColor: Colors.Gray2,
|
|
8
|
+
},
|
|
9
|
+
contentContainer: {
|
|
10
|
+
flex: 1,
|
|
11
|
+
justifyContent: 'space-between',
|
|
12
|
+
},
|
|
13
|
+
scrollContainer: {
|
|
14
|
+
width: '100%',
|
|
15
|
+
flex: 1,
|
|
16
|
+
},
|
|
17
|
+
title: {
|
|
18
|
+
color: Colors.Gray9,
|
|
19
|
+
fontSize: 20,
|
|
20
|
+
lineHeight: 28,
|
|
21
|
+
marginTop: 8,
|
|
22
|
+
marginBottom: 4,
|
|
23
|
+
marginLeft: 16,
|
|
24
|
+
},
|
|
25
|
+
subtitle: {
|
|
26
|
+
color: Colors.Gray8,
|
|
27
|
+
fontSize: 14,
|
|
28
|
+
lineHeight: 22,
|
|
29
|
+
marginTop: 16,
|
|
30
|
+
marginLeft: 16,
|
|
31
|
+
marginBottom: 16,
|
|
32
|
+
},
|
|
33
|
+
row: {
|
|
34
|
+
flex: 1,
|
|
35
|
+
paddingVertical: 16,
|
|
36
|
+
borderBottomColor: Colors.Gray4,
|
|
37
|
+
borderBottomWidth: 1,
|
|
38
|
+
marginRight: 24,
|
|
39
|
+
marginLeft: 16,
|
|
40
|
+
},
|
|
41
|
+
rowContainer: {
|
|
42
|
+
flexDirection: 'row',
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
paddingLeft: 16,
|
|
45
|
+
},
|
|
46
|
+
text: {
|
|
47
|
+
fontSize: 16,
|
|
48
|
+
lineHeight: 24,
|
|
49
|
+
color: Colors.Gray9,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export default styles;
|
|
@@ -13,7 +13,7 @@ import { isIphoneX } from 'react-native-iphone-x-helper';
|
|
|
13
13
|
import { Colors, Theme } from '../../configs';
|
|
14
14
|
import HeaderAni, { heightHeader } from '../../commons/HeaderAni';
|
|
15
15
|
import Text from '../../commons/Text';
|
|
16
|
-
import {
|
|
16
|
+
import { AccessibilityLabel } from '../../configs/Constants';
|
|
17
17
|
|
|
18
18
|
const WrapHeaderScrollable = ({
|
|
19
19
|
children,
|
|
@@ -61,7 +61,7 @@ const WrapHeaderScrollable = ({
|
|
|
61
61
|
onLeft={onGoBack}
|
|
62
62
|
/>
|
|
63
63
|
<Animated.ScrollView
|
|
64
|
-
|
|
64
|
+
accessibilityLabel={AccessibilityLabel.ANIMATED_SCROLL}
|
|
65
65
|
scrollEnabled={scrollEnabled}
|
|
66
66
|
scrollEventThrottle={16}
|
|
67
67
|
onScroll={Animated.event(
|
|
@@ -18,7 +18,7 @@ import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
|
18
18
|
import { useNavigation } from '@react-navigation/native';
|
|
19
19
|
import Routes from '../../../utils/Route';
|
|
20
20
|
import { useGetIdUser } from '../../../hooks/Common';
|
|
21
|
-
import { AUTOMATE_TYPE,
|
|
21
|
+
import { AUTOMATE_TYPE, AccessibilityLabel } from '../../../configs/Constants';
|
|
22
22
|
|
|
23
23
|
const ItemOneTap = memo(
|
|
24
24
|
({ isOwner, automate = {}, unit, wrapSyles, onPressItem }) => {
|
|
@@ -105,14 +105,14 @@ const ItemOneTap = memo(
|
|
|
105
105
|
return (
|
|
106
106
|
<TouchableWithoutFeedback
|
|
107
107
|
onPress={onPressItem || goToDetail}
|
|
108
|
-
accessibilityLabel={`${
|
|
108
|
+
accessibilityLabel={`${AccessibilityLabel.AUTOMATE_SCRIPT_NAME}-${id}`}
|
|
109
109
|
>
|
|
110
110
|
<View style={[styles.container, wrapSyles]}>
|
|
111
111
|
<View style={styles.boxIcon}>
|
|
112
112
|
{displayIcon()}
|
|
113
113
|
{type === AUTOMATE_TYPE.ONE_TAP && (
|
|
114
114
|
<TouchableOpacity
|
|
115
|
-
|
|
115
|
+
accessibilityLabel={AccessibilityLabel.AUTOMATE_SCRIPT_ACTION}
|
|
116
116
|
onPress={handleScriptAction}
|
|
117
117
|
>
|
|
118
118
|
<CheckCircle />
|
|
@@ -120,7 +120,7 @@ const ItemOneTap = memo(
|
|
|
120
120
|
)}
|
|
121
121
|
</View>
|
|
122
122
|
<TouchableOpacity
|
|
123
|
-
|
|
123
|
+
accessibilityLabel={AccessibilityLabel.GO_DETAIL}
|
|
124
124
|
onPress={onPressItem || goToDetail}
|
|
125
125
|
>
|
|
126
126
|
<Text
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TouchableOpacity } from 'react-native';
|
|
2
|
+
import { TouchableWithoutFeedback, TouchableOpacity } from 'react-native';
|
|
3
3
|
import Toast from 'react-native-toast-message';
|
|
4
4
|
import { act, create } from 'react-test-renderer';
|
|
5
5
|
import MockAdapter from 'axios-mock-adapter';
|
|
6
6
|
|
|
7
7
|
import SubUnitAutomate from '..';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
AUTOMATE_TYPE,
|
|
10
|
+
AccessibilityLabel,
|
|
11
|
+
} from '../../../../configs/Constants';
|
|
9
12
|
import { SCProvider } from '../../../../context';
|
|
10
13
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
11
14
|
import Routes from '../../../../utils/Route';
|
|
@@ -72,7 +75,10 @@ describe('test Item', () => {
|
|
|
72
75
|
|
|
73
76
|
const instance = tree.root;
|
|
74
77
|
const item = instance.findAll(
|
|
75
|
-
(el) =>
|
|
78
|
+
(el) =>
|
|
79
|
+
el.props.accessibilityLabel ===
|
|
80
|
+
AccessibilityLabel.SUB_UNIT_ADD_DEVICE &&
|
|
81
|
+
el.type === TouchableWithoutFeedback
|
|
76
82
|
);
|
|
77
83
|
|
|
78
84
|
expect(item).toHaveLength(1);
|
|
@@ -86,7 +92,8 @@ describe('test Item', () => {
|
|
|
86
92
|
|
|
87
93
|
const goDetail = instance.findAll(
|
|
88
94
|
(el) =>
|
|
89
|
-
el.props.
|
|
95
|
+
el.props.accessibilityLabel === AccessibilityLabel.GO_DETAIL &&
|
|
96
|
+
el.type === TouchableOpacity
|
|
90
97
|
);
|
|
91
98
|
expect(goDetail).toHaveLength(1);
|
|
92
99
|
await act(async () => {
|
|
@@ -104,7 +111,8 @@ describe('test Item', () => {
|
|
|
104
111
|
|
|
105
112
|
const handleScriptAction = instance.findAll(
|
|
106
113
|
(el) =>
|
|
107
|
-
el.props.
|
|
114
|
+
el.props.accessibilityLabel ===
|
|
115
|
+
AccessibilityLabel.AUTOMATE_SCRIPT_ACTION &&
|
|
108
116
|
el.type === TouchableOpacity
|
|
109
117
|
);
|
|
110
118
|
expect(handleScriptAction).toHaveLength(1);
|
|
@@ -128,7 +136,8 @@ describe('test Item', () => {
|
|
|
128
136
|
|
|
129
137
|
const handleScriptAction = tree.root.findAll(
|
|
130
138
|
(el) =>
|
|
131
|
-
el.props.
|
|
139
|
+
el.props.accessibilityLabel ===
|
|
140
|
+
AccessibilityLabel.AUTOMATE_SCRIPT_ACTION &&
|
|
132
141
|
el.type === TouchableOpacity
|
|
133
142
|
);
|
|
134
143
|
expect(handleScriptAction).toHaveLength(1);
|
|
@@ -175,7 +184,8 @@ describe('test Item', () => {
|
|
|
175
184
|
|
|
176
185
|
const goDetail = tree.root.findAll(
|
|
177
186
|
(el) =>
|
|
178
|
-
el.props.
|
|
187
|
+
el.props.accessibilityLabel === AccessibilityLabel.GO_DETAIL &&
|
|
188
|
+
el.type === TouchableOpacity
|
|
179
189
|
);
|
|
180
190
|
expect(goDetail).toHaveLength(1);
|
|
181
191
|
await act(async () => {
|
|
@@ -220,7 +230,10 @@ describe('test Item', () => {
|
|
|
220
230
|
|
|
221
231
|
const instance = tree.root;
|
|
222
232
|
const item = instance.findAll(
|
|
223
|
-
(el) =>
|
|
233
|
+
(el) =>
|
|
234
|
+
el.props.accessibilityLabel ===
|
|
235
|
+
AccessibilityLabel.SUB_UNIT_ADD_DEVICE &&
|
|
236
|
+
el.type === TouchableWithoutFeedback
|
|
224
237
|
);
|
|
225
238
|
|
|
226
239
|
expect(item).toHaveLength(1);
|
|
@@ -235,7 +248,8 @@ describe('test Item', () => {
|
|
|
235
248
|
|
|
236
249
|
const goDetail = tree.root.findAll(
|
|
237
250
|
(el) =>
|
|
238
|
-
el.props.
|
|
251
|
+
el.props.accessibilityLabel === AccessibilityLabel.GO_DETAIL &&
|
|
252
|
+
el.type === TouchableOpacity
|
|
239
253
|
);
|
|
240
254
|
expect(goDetail).toHaveLength(1);
|
|
241
255
|
});
|
|
@@ -247,7 +261,8 @@ describe('test Item', () => {
|
|
|
247
261
|
const instance = tree.root;
|
|
248
262
|
const touchableOpacity = instance.findAll(
|
|
249
263
|
(el) =>
|
|
250
|
-
el.props.
|
|
264
|
+
el.props.accessibilityLabel ===
|
|
265
|
+
AccessibilityLabel.SUB_UNIT_SELECT_AUTOMATE_TYPE &&
|
|
251
266
|
el.type === TouchableOpacity
|
|
252
267
|
);
|
|
253
268
|
act(() => {
|
|
@@ -7,7 +7,7 @@ import ItemOneTap from './ItemOneTap';
|
|
|
7
7
|
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
8
8
|
import { useNavigation } from '@react-navigation/native';
|
|
9
9
|
import Routes from '../../../utils/Route/index.js';
|
|
10
|
-
import { AUTOMATE_TYPE,
|
|
10
|
+
import { AUTOMATE_TYPE, AccessibilityLabel } from '../../../configs/Constants';
|
|
11
11
|
import Text from '../../Text/index.js';
|
|
12
12
|
|
|
13
13
|
import styles from './OneTapStyles.js';
|
|
@@ -43,7 +43,10 @@ const SubUnitAutomate = ({ isOwner, listAutomate, unit, wrapItemStyle }) => {
|
|
|
43
43
|
}, [listAutomate]);
|
|
44
44
|
return (
|
|
45
45
|
<Section style={styles.noShadow}>
|
|
46
|
-
<View
|
|
46
|
+
<View
|
|
47
|
+
style={styles.boxScenario}
|
|
48
|
+
accessibilityLabel={AccessibilityLabel.VIEW_SUB_UNIT_AUTOMATE}
|
|
49
|
+
>
|
|
47
50
|
{listAutomate.map((item, index) => (
|
|
48
51
|
<TouchableOpacity
|
|
49
52
|
style={
|
|
@@ -53,11 +56,13 @@ const SubUnitAutomate = ({ isOwner, listAutomate, unit, wrapItemStyle }) => {
|
|
|
53
56
|
}
|
|
54
57
|
onPress={() => onItemClick(item, index)}
|
|
55
58
|
ref={refMenuAction}
|
|
56
|
-
|
|
59
|
+
accessibilityLabel={
|
|
60
|
+
AccessibilityLabel.SUB_UNIT_SELECT_AUTOMATE_TYPE
|
|
61
|
+
}
|
|
57
62
|
>
|
|
58
63
|
<View style={styles.boxTextScenarito}>
|
|
59
64
|
<Text
|
|
60
|
-
|
|
65
|
+
accessibilityLabel={AccessibilityLabel.SUB_UNIT_TEXT_DROPDOWN}
|
|
61
66
|
style={styles.textSelection}
|
|
62
67
|
semibold
|
|
63
68
|
>
|
|
@@ -5,8 +5,8 @@ import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
|
5
5
|
import { useDevicesStatus } from '../../hooks/Common';
|
|
6
6
|
import { useWatchConfigs } from '../../hooks/IoT';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { Device, Images } from '../../configs';
|
|
9
|
+
import { AccessibilityLabel, DEVICE_TYPE } from '../../configs/Constants';
|
|
10
10
|
import { Section } from '../Section';
|
|
11
11
|
import Text from '../Text';
|
|
12
12
|
import ItemDevice from '../Device/ItemDevice';
|
|
@@ -16,12 +16,6 @@ import { standardizeCameraScreenSize } from '../../utils/Utils';
|
|
|
16
16
|
import Routes from '../../utils/Route';
|
|
17
17
|
import FastImage from 'react-native-fast-image';
|
|
18
18
|
import MediaPlayerDetail from '../MediaPlayerDetail';
|
|
19
|
-
import {
|
|
20
|
-
keyPermission,
|
|
21
|
-
OpenSetting,
|
|
22
|
-
permitPermissionFunction,
|
|
23
|
-
} from '../../utils/Permission/common';
|
|
24
|
-
import { RESULTS } from 'react-native-permissions';
|
|
25
19
|
|
|
26
20
|
const { standardizeWidth, standardizeHeight } = standardizeCameraScreenSize(
|
|
27
21
|
Device.screenWidth - 32
|
|
@@ -70,8 +64,7 @@ const ShortDetailSubUnit = ({ unit, station }) => {
|
|
|
70
64
|
height: standardizeHeight,
|
|
71
65
|
},
|
|
72
66
|
]}
|
|
73
|
-
|
|
74
|
-
accessibilityLabel={`${TESTID.SUB_UNIT_CAMERA_VIEW}-${station?.id}`}
|
|
67
|
+
accessibilityLabel={`${AccessibilityLabel.SUB_UNIT_CAMERA_VIEW}-${station?.id}`}
|
|
75
68
|
>
|
|
76
69
|
<MediaPlayerDetail
|
|
77
70
|
uri={station.camera.uri}
|
|
@@ -97,7 +90,7 @@ const ShortDetailSubUnit = ({ unit, station }) => {
|
|
|
97
90
|
style={styles.image}
|
|
98
91
|
defaultSource={Images.BgDevice}
|
|
99
92
|
resizeMode="cover"
|
|
100
|
-
|
|
93
|
+
accessibilityLabel={AccessibilityLabel.SUB_UNIT_BACKGROUND}
|
|
101
94
|
/>
|
|
102
95
|
</View>
|
|
103
96
|
);
|
|
@@ -106,24 +99,13 @@ const ShortDetailSubUnit = ({ unit, station }) => {
|
|
|
106
99
|
};
|
|
107
100
|
|
|
108
101
|
const handleOnAddNew = () => {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
unit_name: unit.name,
|
|
117
|
-
},
|
|
118
|
-
});
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
if (res === RESULTS.BLOCKED) {
|
|
122
|
-
OpenSetting(
|
|
123
|
-
t('camera_request_permission'),
|
|
124
|
-
t('camera_request_permission_des')
|
|
125
|
-
);
|
|
126
|
-
}
|
|
102
|
+
navigate(Routes.AddGatewayStack, {
|
|
103
|
+
screen: Routes.FirstWarning,
|
|
104
|
+
params: {
|
|
105
|
+
stationId: station?.id,
|
|
106
|
+
unitId: unit.id,
|
|
107
|
+
unitName: unit.name,
|
|
108
|
+
},
|
|
127
109
|
});
|
|
128
110
|
};
|
|
129
111
|
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Image, View } from 'react-native';
|
|
3
3
|
import { act, create } from 'react-test-renderer';
|
|
4
4
|
import mock from 'react-native-permissions/mock';
|
|
5
|
-
import {
|
|
5
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
6
6
|
import { SCProvider } from '../../../context';
|
|
7
7
|
import { mockSCStore } from '../../../context/mockStore';
|
|
8
8
|
import ShortDetailSubUnit from '../ShortDetail';
|
|
@@ -84,7 +84,8 @@ describe('test ShortDetail Subunit', () => {
|
|
|
84
84
|
const instance = tree.root;
|
|
85
85
|
const image = instance.findAllByType(Image);
|
|
86
86
|
const imageBackground = image.find(
|
|
87
|
-
(item) =>
|
|
87
|
+
(item) =>
|
|
88
|
+
item.props.accessibilityLabel === AccessibilityLabel.SUB_UNIT_BACKGROUND
|
|
88
89
|
);
|
|
89
90
|
expect(imageBackground).not.toBeDefined();
|
|
90
91
|
});
|
|
@@ -97,7 +98,8 @@ describe('test ShortDetail Subunit', () => {
|
|
|
97
98
|
const instance = tree.root;
|
|
98
99
|
const image = instance.findAllByType(Image);
|
|
99
100
|
const imageBackground = image.find(
|
|
100
|
-
(item) =>
|
|
101
|
+
(item) =>
|
|
102
|
+
item.props.accessibilityLabel === AccessibilityLabel.SUB_UNIT_BACKGROUND
|
|
101
103
|
);
|
|
102
104
|
expect(imageBackground).not.toBeDefined();
|
|
103
105
|
});
|
|
@@ -116,7 +118,9 @@ describe('test ShortDetail Subunit', () => {
|
|
|
116
118
|
const instance = tree.root;
|
|
117
119
|
const view = instance.findAllByType(View);
|
|
118
120
|
const viewCamera = view.find(
|
|
119
|
-
(item) =>
|
|
121
|
+
(item) =>
|
|
122
|
+
item.props.accessibilityLabel ===
|
|
123
|
+
`${AccessibilityLabel.SUB_UNIT_CAMERA_VIEW}-${props.station.id}`
|
|
120
124
|
);
|
|
121
125
|
expect(viewCamera).toBeDefined();
|
|
122
126
|
});
|
|
@@ -150,7 +154,8 @@ describe('test ShortDetail Subunit', () => {
|
|
|
150
154
|
const instance = tree.root;
|
|
151
155
|
const itemDevice = instance.findAll(
|
|
152
156
|
(item) =>
|
|
153
|
-
item.props.
|
|
157
|
+
item.props.accessibilityLabel === AccessibilityLabel.SUB_UNIT_DEVICES &&
|
|
158
|
+
item.type === View
|
|
154
159
|
);
|
|
155
160
|
expect(itemDevice.length).toBe(0);
|
|
156
161
|
});
|
|
@@ -165,12 +170,12 @@ describe('test ShortDetail Subunit', () => {
|
|
|
165
170
|
buttonAddNew.props.onAddNew();
|
|
166
171
|
});
|
|
167
172
|
await mock.request(keyPermission.CAMERA);
|
|
168
|
-
expect(mockedNavigate).toHaveBeenCalledWith(Routes.
|
|
169
|
-
screen: Routes.
|
|
173
|
+
expect(mockedNavigate).toHaveBeenCalledWith(Routes.AddGatewayStack, {
|
|
174
|
+
screen: Routes.FirstWarning,
|
|
170
175
|
params: {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
176
|
+
stationId: props.station.id,
|
|
177
|
+
unitId: props.unit.id,
|
|
178
|
+
unitName: props.unit.name,
|
|
174
179
|
},
|
|
175
180
|
});
|
|
176
181
|
});
|
|
@@ -9,7 +9,7 @@ import Temperature from '../../../assets/images/Temperature.svg';
|
|
|
9
9
|
import UVIndex from '../../../assets/images/UVIndex.svg';
|
|
10
10
|
import WaterQuality from '../../../assets/images/WaterQuality.svg';
|
|
11
11
|
import Device from '../../../assets/images/Device.svg';
|
|
12
|
-
import {
|
|
12
|
+
import { AccessibilityLabel } from '../../configs/Constants';
|
|
13
13
|
|
|
14
14
|
const SummaryItem = memo(({ item, goToSummary }) => {
|
|
15
15
|
const Icon = (() => {
|
|
@@ -34,7 +34,7 @@ const SummaryItem = memo(({ item, goToSummary }) => {
|
|
|
34
34
|
<TouchableOpacity
|
|
35
35
|
onPress={() => goToSummary(item)}
|
|
36
36
|
style={styles.wrapSummaryItem}
|
|
37
|
-
accessibilityLabel={`${
|
|
37
|
+
accessibilityLabel={`${AccessibilityLabel.UNIT_DETAIL_UNIT_SUMMARY_ITEM}-${item?.id}`}
|
|
38
38
|
>
|
|
39
39
|
<View style={styles.summaryItem}>
|
|
40
40
|
<Icon />
|