@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,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TouchableOpacity, View } from 'react-native';
|
|
2
|
+
import { Platform, TouchableOpacity, View } from 'react-native';
|
|
3
3
|
import MockAdapter from 'axios-mock-adapter';
|
|
4
4
|
import renderer, { act } from 'react-test-renderer';
|
|
5
5
|
import ParallaxScrollView from '../../../libs/react-native-parallax-scroll-view';
|
|
@@ -8,13 +8,14 @@ import { useIsFocused } from '@react-navigation/native';
|
|
|
8
8
|
import AsyncStorage from '@react-native-community/async-storage';
|
|
9
9
|
import UnitDetail from '../Detail';
|
|
10
10
|
import { API } from '../../../configs';
|
|
11
|
-
import {
|
|
11
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
12
12
|
import { SCProvider } from '../../../context';
|
|
13
13
|
import { mockSCStore } from '../../../context/mockStore';
|
|
14
14
|
import CameraDevice from '../../../commons/CameraDevice';
|
|
15
15
|
import SubUnitFavorites from '../../../commons/SubUnit/Favorites';
|
|
16
16
|
import api from '../../../utils/Apis/axios';
|
|
17
17
|
import PreventAccess from '../../../commons/PreventAccess';
|
|
18
|
+
import Routes from '../../../utils/Route';
|
|
18
19
|
|
|
19
20
|
const mockDispatch = jest.fn();
|
|
20
21
|
jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');
|
|
@@ -54,12 +55,12 @@ jest.mock('@react-navigation/native', () => {
|
|
|
54
55
|
};
|
|
55
56
|
});
|
|
56
57
|
|
|
57
|
-
const
|
|
58
|
+
const mockConnectHomeAssistant = jest.fn();
|
|
58
59
|
jest.mock('../../../hooks/IoT', () => {
|
|
59
60
|
return {
|
|
60
61
|
...jest.requireActual('../../../hooks/IoT'),
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
useHomeAssistantConnection: () => ({
|
|
63
|
+
connectHomeAssistant: mockConnectHomeAssistant,
|
|
63
64
|
}),
|
|
64
65
|
};
|
|
65
66
|
});
|
|
@@ -83,6 +84,7 @@ describe('Test UnitDetail', () => {
|
|
|
83
84
|
const detailUnitApiUrl = API.UNIT.UNIT_DETAIL(1);
|
|
84
85
|
const summaryUnitApiUrl = API.UNIT.UNIT_SUMMARY(1);
|
|
85
86
|
const sensorStatusApiUrl = API.UNIT.SENSORS_STATUS(1);
|
|
87
|
+
const getAutomates = API.UNIT.AUTOMATE(1);
|
|
86
88
|
|
|
87
89
|
let tree;
|
|
88
90
|
|
|
@@ -90,6 +92,46 @@ describe('Test UnitDetail', () => {
|
|
|
90
92
|
jest.clearAllTimers();
|
|
91
93
|
useIsFocused.mockImplementation(() => true);
|
|
92
94
|
AsyncStorage.clear();
|
|
95
|
+
mock.resetHistory();
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test('render subunit camera devices', async () => {
|
|
99
|
+
const unitData = {
|
|
100
|
+
stations: [
|
|
101
|
+
{
|
|
102
|
+
camera_devices: [
|
|
103
|
+
{
|
|
104
|
+
configuration: {
|
|
105
|
+
id: 4,
|
|
106
|
+
name: 'Camera cửa nhà xe',
|
|
107
|
+
uri: 'rtsp://admin:hd543211@/ISAPI/Streaming/Channels/101/',
|
|
108
|
+
preview_uri:
|
|
109
|
+
'rtsp://admin:hd543211@/ISAPI/Streaming/Channels/101/',
|
|
110
|
+
playback: 'rtsp://admin:hd543211@/Streaming/tracks/101/',
|
|
111
|
+
},
|
|
112
|
+
id: 41,
|
|
113
|
+
order: 1,
|
|
114
|
+
template: 'camera',
|
|
115
|
+
type: 'camera',
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
await act(async () => {
|
|
123
|
+
tree = await renderer.create(
|
|
124
|
+
wrapComponent({ params: { ...route.params, unitData } }, account)
|
|
125
|
+
);
|
|
126
|
+
});
|
|
127
|
+
const instance = tree.root;
|
|
128
|
+
const CameraDeviceViews = instance.findAllByType(CameraDevice);
|
|
129
|
+
expect(CameraDeviceViews).toHaveLength(1);
|
|
130
|
+
await CameraDeviceViews[0].props.goToPlayBack()();
|
|
131
|
+
expect(mockedNavigate).toBeCalledWith(Routes.PlaybackCamera, {
|
|
132
|
+
item: undefined,
|
|
133
|
+
thumbnail: undefined,
|
|
134
|
+
});
|
|
93
135
|
});
|
|
94
136
|
|
|
95
137
|
test('fetch unit detail success', async () => {
|
|
@@ -144,7 +186,8 @@ describe('Test UnitDetail', () => {
|
|
|
144
186
|
});
|
|
145
187
|
const instance = tree.root;
|
|
146
188
|
const button1 = instance.find(
|
|
147
|
-
(el) =>
|
|
189
|
+
(el) =>
|
|
190
|
+
el.props.accessibilityLabel === AccessibilityLabel.BUTTON_PREVENT_ACCESS
|
|
148
191
|
);
|
|
149
192
|
expect(button1.props.isVisible).toBeTruthy();
|
|
150
193
|
});
|
|
@@ -192,7 +235,7 @@ describe('Test UnitDetail', () => {
|
|
|
192
235
|
expect(refreshControl).toBeDefined();
|
|
193
236
|
});
|
|
194
237
|
|
|
195
|
-
test('when unit has
|
|
238
|
+
test('when unit has home assistant action then connect to home assistant', async () => {
|
|
196
239
|
const unitData = {
|
|
197
240
|
remote_control_options: {
|
|
198
241
|
googlehome: [
|
|
@@ -209,7 +252,7 @@ describe('Test UnitDetail', () => {
|
|
|
209
252
|
wrapComponent({ params: { ...route.params, unitData } }, account)
|
|
210
253
|
);
|
|
211
254
|
});
|
|
212
|
-
expect(
|
|
255
|
+
expect(mockConnectHomeAssistant).toBeCalled();
|
|
213
256
|
});
|
|
214
257
|
|
|
215
258
|
test('when unit has bluetooth action then scan for devices', async () => {
|
|
@@ -297,7 +340,7 @@ describe('Test UnitDetail', () => {
|
|
|
297
340
|
const instance = tree.root;
|
|
298
341
|
const icon = await instance.findAll(
|
|
299
342
|
(el) =>
|
|
300
|
-
el.props.
|
|
343
|
+
el.props.accessibilityLabel === AccessibilityLabel.NAVBAR_ICON_BARS &&
|
|
301
344
|
el.type === TouchableOpacity
|
|
302
345
|
);
|
|
303
346
|
expect(icon.length).toEqual(1);
|
|
@@ -307,53 +350,14 @@ describe('Test UnitDetail', () => {
|
|
|
307
350
|
});
|
|
308
351
|
|
|
309
352
|
const menu = instance.findAll(
|
|
310
|
-
(el) =>
|
|
353
|
+
(el) =>
|
|
354
|
+
el.props.accessibilityLabel ===
|
|
355
|
+
AccessibilityLabel.NAVBAR_MENU_ACTION_MORE
|
|
311
356
|
);
|
|
312
357
|
expect(menu).toHaveLength(1);
|
|
313
358
|
expect(menu[0].props.isVisible).toEqual(true);
|
|
314
359
|
});
|
|
315
360
|
|
|
316
|
-
test('render subunit camera devices', async () => {
|
|
317
|
-
const unitData = {
|
|
318
|
-
stations: [
|
|
319
|
-
{
|
|
320
|
-
camera_devices: [
|
|
321
|
-
{
|
|
322
|
-
configuration: {
|
|
323
|
-
id: 4,
|
|
324
|
-
name: 'Camera cửa nhà xe',
|
|
325
|
-
uri: 'rtsp://admin:hd543211@/ISAPI/Streaming/Channels/101/',
|
|
326
|
-
preview_uri:
|
|
327
|
-
'rtsp://admin:hd543211@/ISAPI/Streaming/Channels/101/',
|
|
328
|
-
playback: 'rtsp://admin:hd543211@/Streaming/tracks/101/',
|
|
329
|
-
},
|
|
330
|
-
id: 41,
|
|
331
|
-
order: 1,
|
|
332
|
-
template: 'camera',
|
|
333
|
-
type: 'camera',
|
|
334
|
-
},
|
|
335
|
-
],
|
|
336
|
-
},
|
|
337
|
-
],
|
|
338
|
-
};
|
|
339
|
-
|
|
340
|
-
await act(async () => {
|
|
341
|
-
tree = await renderer.create(
|
|
342
|
-
wrapComponent({ params: { ...route.params, unitData } }, account)
|
|
343
|
-
);
|
|
344
|
-
});
|
|
345
|
-
const instance = tree.root;
|
|
346
|
-
const CameraDeviceViews = instance.findAllByType(CameraDevice);
|
|
347
|
-
expect(CameraDeviceViews).toHaveLength(0);
|
|
348
|
-
|
|
349
|
-
const fullCamera = tree.root.findAll(
|
|
350
|
-
(el) =>
|
|
351
|
-
el.props.testID === TESTID.SUB_UNIT_FULL_CAMERA &&
|
|
352
|
-
el.type === TouchableOpacity
|
|
353
|
-
);
|
|
354
|
-
expect(fullCamera).toHaveLength(0);
|
|
355
|
-
});
|
|
356
|
-
|
|
357
361
|
test('onPress subunit camera devices', async () => {
|
|
358
362
|
const unitData = {
|
|
359
363
|
stations: [
|
|
@@ -388,7 +392,7 @@ describe('Test UnitDetail', () => {
|
|
|
388
392
|
expect(CameraDeviceViews).toHaveLength(0);
|
|
389
393
|
const goDetailButton = tree.root.findAll(
|
|
390
394
|
(el) =>
|
|
391
|
-
el.props.
|
|
395
|
+
el.props.accessibilityLabel === AccessibilityLabel.SUB_UNIT_GO_DETAIL &&
|
|
392
396
|
el.type === TouchableOpacity
|
|
393
397
|
);
|
|
394
398
|
|
|
@@ -396,7 +400,7 @@ describe('Test UnitDetail', () => {
|
|
|
396
400
|
await act(async () => {
|
|
397
401
|
await goDetailButton[0].props.onPress();
|
|
398
402
|
});
|
|
399
|
-
expect(mockedNavigate).
|
|
403
|
+
expect(mockedNavigate).toHaveBeenCalled();
|
|
400
404
|
});
|
|
401
405
|
|
|
402
406
|
test('render subunit favorites', async () => {
|
|
@@ -439,7 +443,8 @@ describe('Test UnitDetail', () => {
|
|
|
439
443
|
});
|
|
440
444
|
const instance = tree.root;
|
|
441
445
|
const navBar = instance.find(
|
|
442
|
-
(el) =>
|
|
446
|
+
(el) =>
|
|
447
|
+
el.props.accessibilityLabel === AccessibilityLabel.NAVBAR_ON_SNAP_ITEM
|
|
443
448
|
);
|
|
444
449
|
|
|
445
450
|
await act(() => {
|
|
@@ -449,8 +454,38 @@ describe('Test UnitDetail', () => {
|
|
|
449
454
|
expect(navBar).toBeDefined();
|
|
450
455
|
const viewAutomate = instance.findAll(
|
|
451
456
|
(el) =>
|
|
452
|
-
el.props.
|
|
457
|
+
el.props.accessibilityLabel ===
|
|
458
|
+
AccessibilityLabel.VIEW_SUB_UNIT_AUTOMATE && el.type === View
|
|
453
459
|
);
|
|
454
460
|
expect(viewAutomate).toHaveLength(1);
|
|
455
461
|
});
|
|
462
|
+
|
|
463
|
+
test('test get automate onPress goBack', async () => {
|
|
464
|
+
Platform.OS = 'ios';
|
|
465
|
+
route.params.isSuccessfullyConnected = true;
|
|
466
|
+
jest.useFakeTimers();
|
|
467
|
+
mock.onGet(getAutomates).reply(200, [{}]);
|
|
468
|
+
await act(async () => {
|
|
469
|
+
tree = await renderer.create(wrapComponent(route, account));
|
|
470
|
+
});
|
|
471
|
+
jest.runAllTimers();
|
|
472
|
+
const instance = tree.root;
|
|
473
|
+
const PreventAccesss = instance.findByType(PreventAccess);
|
|
474
|
+
expect(PreventAccesss).toBeDefined();
|
|
475
|
+
const TouchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
476
|
+
await TouchableOpacities[0].props.onPress();
|
|
477
|
+
expect(mockedNavigate).toBeCalled();
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
test('test onPress goBack with routeName', async () => {
|
|
481
|
+
route.params.routeName = 'test';
|
|
482
|
+
route.params.isSuccessfullyConnected = false;
|
|
483
|
+
await act(async () => {
|
|
484
|
+
tree = await renderer.create(wrapComponent(route, account));
|
|
485
|
+
});
|
|
486
|
+
const instance = tree.root;
|
|
487
|
+
const TouchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
488
|
+
await TouchableOpacities[0].props.onPress();
|
|
489
|
+
expect(mockedNavigate).toBeCalled();
|
|
490
|
+
});
|
|
456
491
|
});
|
|
@@ -4,7 +4,7 @@ import MockAdapter from 'axios-mock-adapter';
|
|
|
4
4
|
import Toast from 'react-native-toast-message';
|
|
5
5
|
|
|
6
6
|
import { ToastBottomHelper } from '../../../utils/Utils';
|
|
7
|
-
import {
|
|
7
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
8
8
|
|
|
9
9
|
import ManageUnit from '../ManageUnit';
|
|
10
10
|
import { SCProvider } from '../../../context';
|
|
@@ -63,25 +63,39 @@ describe('Test Manage Unit', () => {
|
|
|
63
63
|
|
|
64
64
|
const getElement = (instance) => {
|
|
65
65
|
const changeName = instance.findAll(
|
|
66
|
-
(item) =>
|
|
66
|
+
(item) =>
|
|
67
|
+
item.props.accessibilityLabel ===
|
|
68
|
+
AccessibilityLabel.MANAGE_UNIT_CHANGE_NAME
|
|
67
69
|
);
|
|
68
70
|
const changeLocation = instance.findAll(
|
|
69
|
-
(item) =>
|
|
71
|
+
(item) =>
|
|
72
|
+
item.props.accessibilityLabel ===
|
|
73
|
+
AccessibilityLabel.MANAGE_UNIT_CHANGE_LOCATION
|
|
70
74
|
);
|
|
71
75
|
const changePhoto = instance.findAll(
|
|
72
|
-
(item) =>
|
|
76
|
+
(item) =>
|
|
77
|
+
item.props.accessibilityLabel ===
|
|
78
|
+
AccessibilityLabel.MANAGE_UNIT_CHANGE_PHOTO
|
|
73
79
|
);
|
|
74
80
|
const imagePicker = instance.findAll(
|
|
75
|
-
(item) =>
|
|
81
|
+
(item) =>
|
|
82
|
+
item.props.accessibilityLabel ===
|
|
83
|
+
AccessibilityLabel.MANAGE_UNIT_IMAGE_PICKER
|
|
76
84
|
);
|
|
77
85
|
const modalRename = instance.findAll(
|
|
78
|
-
(item) =>
|
|
86
|
+
(item) =>
|
|
87
|
+
item.props.accessibilityLabel ===
|
|
88
|
+
AccessibilityLabel.MANAGE_UNIT_MODAL_RENAME
|
|
79
89
|
);
|
|
80
90
|
const inputRename = instance.findAll(
|
|
81
|
-
(item) =>
|
|
91
|
+
(item) =>
|
|
92
|
+
item.props.accessibilityLabel ===
|
|
93
|
+
AccessibilityLabel.MANAGE_UNIT_MODAL_RENAME_INPUT_NAME
|
|
82
94
|
);
|
|
83
95
|
const showRemove = instance.findAll(
|
|
84
|
-
(item) =>
|
|
96
|
+
(item) =>
|
|
97
|
+
item.props.accessibilityLabel ===
|
|
98
|
+
AccessibilityLabel.MANAGE_UNIT_SHOW_REMOVE
|
|
85
99
|
);
|
|
86
100
|
return {
|
|
87
101
|
changeName,
|
|
@@ -126,8 +140,8 @@ describe('Test Manage Unit', () => {
|
|
|
126
140
|
});
|
|
127
141
|
const bottomButton = instance.find(
|
|
128
142
|
(item) =>
|
|
129
|
-
item.props.
|
|
130
|
-
`${
|
|
143
|
+
item.props.accessibilityLabel ===
|
|
144
|
+
`${AccessibilityLabel.PREFIX.MANAGE_UNIT}${AccessibilityLabel.VIEW_BUTTON_BOTTOM_RIGHT_BUTTON}`
|
|
131
145
|
);
|
|
132
146
|
mock.onPatch(API.UNIT.MANAGE_UNIT(1)).reply(200, {});
|
|
133
147
|
await act(async () => {
|
|
@@ -157,8 +171,8 @@ describe('Test Manage Unit', () => {
|
|
|
157
171
|
|
|
158
172
|
const bottomButton = instance.find(
|
|
159
173
|
(item) =>
|
|
160
|
-
item.props.
|
|
161
|
-
`${
|
|
174
|
+
item.props.accessibilityLabel ===
|
|
175
|
+
`${AccessibilityLabel.PREFIX.MANAGE_UNIT_ALERT}${AccessibilityLabel.VIEW_BUTTON_BOTTOM_RIGHT_BUTTON}`
|
|
162
176
|
);
|
|
163
177
|
expect(bottomButton).toBeDefined();
|
|
164
178
|
await act(async () => {
|
|
@@ -182,8 +196,8 @@ describe('Test Manage Unit', () => {
|
|
|
182
196
|
|
|
183
197
|
const bottomButton = instance.find(
|
|
184
198
|
(item) =>
|
|
185
|
-
item.props.
|
|
186
|
-
`${
|
|
199
|
+
item.props.accessibilityLabel ===
|
|
200
|
+
`${AccessibilityLabel.PREFIX.MANAGE_UNIT}${AccessibilityLabel.VIEW_BUTTON_BOTTOM_RIGHT_BUTTON}`
|
|
187
201
|
);
|
|
188
202
|
mock.onPatch(API.UNIT.MANAGE_UNIT(1)).reply(200);
|
|
189
203
|
|
|
@@ -205,11 +219,15 @@ describe('Test Manage Unit', () => {
|
|
|
205
219
|
const instance = tree.root;
|
|
206
220
|
|
|
207
221
|
const imagePicker = instance.find(
|
|
208
|
-
(item) =>
|
|
222
|
+
(item) =>
|
|
223
|
+
item.props.accessibilityLabel ===
|
|
224
|
+
AccessibilityLabel.MANAGE_UNIT_IMAGE_PICKER
|
|
209
225
|
);
|
|
210
226
|
|
|
211
227
|
const handleChoosePhoto = instance.findAll(
|
|
212
|
-
(item) =>
|
|
228
|
+
(item) =>
|
|
229
|
+
item.props.accessibilityLabel ===
|
|
230
|
+
AccessibilityLabel.MANAGE_UNIT_CHANGE_PHOTO
|
|
213
231
|
);
|
|
214
232
|
|
|
215
233
|
act(() => {
|
|
@@ -228,7 +246,9 @@ describe('Test Manage Unit', () => {
|
|
|
228
246
|
const instance = tree.root;
|
|
229
247
|
|
|
230
248
|
const buttonWrapper = instance.find(
|
|
231
|
-
(item) =>
|
|
249
|
+
(item) =>
|
|
250
|
+
item.props.accessibilityLabel ===
|
|
251
|
+
AccessibilityLabel.MANAGE_UNIT_CHANGE_LOCATION
|
|
232
252
|
);
|
|
233
253
|
|
|
234
254
|
act(() => {
|
|
@@ -244,7 +264,9 @@ describe('Test Manage Unit', () => {
|
|
|
244
264
|
const instance = tree.root;
|
|
245
265
|
|
|
246
266
|
const buttonWrapper = instance.find(
|
|
247
|
-
(item) =>
|
|
267
|
+
(item) =>
|
|
268
|
+
item.props.accessibilityLabel ===
|
|
269
|
+
AccessibilityLabel.MANAGE_UNIT_GO_TO_SUBUNIT
|
|
248
270
|
);
|
|
249
271
|
|
|
250
272
|
act(() => {
|
|
@@ -12,7 +12,7 @@ import SearchBarLocation from '../../../commons/SearchLocation';
|
|
|
12
12
|
import RowLocation from '../../../commons/SearchLocation/RowLocation';
|
|
13
13
|
import BottomButtonView from '../../../commons/BottomButtonView';
|
|
14
14
|
import { API } from '../../../configs';
|
|
15
|
-
import {
|
|
15
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
16
16
|
import api from '../../../utils/Apis/axios';
|
|
17
17
|
import {
|
|
18
18
|
GEOLOCATION_ERROR,
|
|
@@ -230,7 +230,8 @@ describe('Test SelectAddress', () => {
|
|
|
230
230
|
});
|
|
231
231
|
const instance = tree.root;
|
|
232
232
|
const button = instance.find(
|
|
233
|
-
(el) =>
|
|
233
|
+
(el) =>
|
|
234
|
+
el.props.accessibilityLabel === AccessibilityLabel.BUTTON_YOUR_LOCATION
|
|
234
235
|
);
|
|
235
236
|
|
|
236
237
|
const response = {
|
|
@@ -263,7 +264,8 @@ describe('Test SelectAddress', () => {
|
|
|
263
264
|
});
|
|
264
265
|
const instance = tree.root;
|
|
265
266
|
const button = instance.find(
|
|
266
|
-
(el) =>
|
|
267
|
+
(el) =>
|
|
268
|
+
el.props.accessibilityLabel === AccessibilityLabel.BUTTON_YOUR_LOCATION
|
|
267
269
|
);
|
|
268
270
|
|
|
269
271
|
const response = {
|
|
@@ -291,7 +293,8 @@ describe('Test SelectAddress', () => {
|
|
|
291
293
|
});
|
|
292
294
|
const instance = tree.root;
|
|
293
295
|
const button = instance.find(
|
|
294
|
-
(el) =>
|
|
296
|
+
(el) =>
|
|
297
|
+
el.props.accessibilityLabel === AccessibilityLabel.BUTTON_YOUR_LOCATION
|
|
295
298
|
);
|
|
296
299
|
|
|
297
300
|
global.navigator.geolocation = {
|
|
@@ -315,7 +318,8 @@ describe('Test SelectAddress', () => {
|
|
|
315
318
|
});
|
|
316
319
|
const instance = tree.root;
|
|
317
320
|
const button = instance.find(
|
|
318
|
-
(el) =>
|
|
321
|
+
(el) =>
|
|
322
|
+
el.props.accessibilityLabel === AccessibilityLabel.BUTTON_YOUR_LOCATION
|
|
319
323
|
);
|
|
320
324
|
|
|
321
325
|
global.navigator.geolocation = {
|
|
@@ -360,7 +364,8 @@ describe('Test SelectAddress', () => {
|
|
|
360
364
|
});
|
|
361
365
|
const instance = tree.root;
|
|
362
366
|
const button = instance.find(
|
|
363
|
-
(el) =>
|
|
367
|
+
(el) =>
|
|
368
|
+
el.props.accessibilityLabel === AccessibilityLabel.BUTTON_YOUR_LOCATION
|
|
364
369
|
);
|
|
365
370
|
|
|
366
371
|
global.navigator.geolocation = {
|
|
@@ -381,7 +386,8 @@ describe('Test SelectAddress', () => {
|
|
|
381
386
|
});
|
|
382
387
|
const instance = tree.root;
|
|
383
388
|
const button = instance.find(
|
|
384
|
-
(el) =>
|
|
389
|
+
(el) =>
|
|
390
|
+
el.props.accessibilityLabel === AccessibilityLabel.BUTTON_YOUR_LOCATION
|
|
385
391
|
);
|
|
386
392
|
|
|
387
393
|
global.navigator.geolocation = {
|
|
@@ -405,7 +411,8 @@ describe('Test SelectAddress', () => {
|
|
|
405
411
|
});
|
|
406
412
|
const instance = tree.root;
|
|
407
413
|
const button = instance.find(
|
|
408
|
-
(el) =>
|
|
414
|
+
(el) =>
|
|
415
|
+
el.props.accessibilityLabel === AccessibilityLabel.BUTTON_CHOOSE_ON_MAP
|
|
409
416
|
);
|
|
410
417
|
await act(async () => {
|
|
411
418
|
await button.props.onPress();
|
|
@@ -44,30 +44,35 @@ describe('Test SmartAccount', () => {
|
|
|
44
44
|
unitId: 1,
|
|
45
45
|
},
|
|
46
46
|
};
|
|
47
|
+
const response = {
|
|
48
|
+
status: 200,
|
|
49
|
+
data: [
|
|
50
|
+
{
|
|
51
|
+
brand: 'google_home',
|
|
52
|
+
id: 9,
|
|
53
|
+
logo: null,
|
|
54
|
+
username: 'dienquangsmart08@gmail.com',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
brand: 'google home',
|
|
58
|
+
id: 7,
|
|
59
|
+
logo: 'https://eoh-gateway-backend.eoh.io/logolgggggg.png',
|
|
60
|
+
username: 'do.loi@eoh.io',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
brand: 'google home',
|
|
64
|
+
id: 5,
|
|
65
|
+
logo: 'https://eoh-gateway-backend.eoh.io/reminderpopup2.png',
|
|
66
|
+
username: 'loitest3',
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
afterEach(() => {
|
|
72
|
+
mock.resetHistory();
|
|
73
|
+
});
|
|
74
|
+
|
|
47
75
|
test('test render SmartAccount', async () => {
|
|
48
|
-
const response = {
|
|
49
|
-
status: 200,
|
|
50
|
-
data: [
|
|
51
|
-
{
|
|
52
|
-
brand: 'google_home',
|
|
53
|
-
id: 9,
|
|
54
|
-
logo: null,
|
|
55
|
-
username: 'dienquangsmart08@gmail.com',
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
brand: 'google home',
|
|
59
|
-
id: 7,
|
|
60
|
-
logo: 'https://eoh-gateway-backend.eoh.io/logolgggggg.png',
|
|
61
|
-
username: 'do.loi@eoh.io',
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
brand: 'google home',
|
|
65
|
-
id: 5,
|
|
66
|
-
logo: 'https://eoh-gateway-backend.eoh.io/reminderpopup2.png',
|
|
67
|
-
username: 'loitest3',
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
};
|
|
71
76
|
mock
|
|
72
77
|
.onGet(API.SMART_ACCOUNT.LIST_SMART_ACCOUNT(1))
|
|
73
78
|
.reply(response.status, response.data);
|
|
@@ -80,10 +85,12 @@ describe('Test SmartAccount', () => {
|
|
|
80
85
|
expect(smartAccountItem.length).toEqual(3);
|
|
81
86
|
act(() => {
|
|
82
87
|
smartAccountItem[0].props.gotoSmartAccountDetail(response.data[0]);
|
|
83
|
-
smartAccountItem[0].props.onShowMenuMore(response.data[0]);
|
|
88
|
+
smartAccountItem[0].props.onShowMenuMore('ref', response.data[0]);
|
|
84
89
|
});
|
|
85
90
|
const alertAction = instance.findAllByType(AlertAction);
|
|
86
|
-
mock
|
|
91
|
+
mock
|
|
92
|
+
.onDelete(API.SMART_ACCOUNT.REMOVE_SMART_ACCOUNT(response.data[0].id))
|
|
93
|
+
.reply(200);
|
|
87
94
|
await alertAction[0].props.leftButtonClick();
|
|
88
95
|
expect(mockNavigate).toBeCalledWith(Routes.ListDeviceSmartAccount, {
|
|
89
96
|
username: response.data[0].username,
|
|
@@ -91,6 +98,16 @@ describe('Test SmartAccount', () => {
|
|
|
91
98
|
smart_account_id: response.data[0].id,
|
|
92
99
|
unit_id: route.params.unitId,
|
|
93
100
|
});
|
|
101
|
+
const menuActionMore = instance.findByType(MenuActionMore);
|
|
102
|
+
await act(async () => {
|
|
103
|
+
menuActionMore.props.onItemClick({ action: 'remove' });
|
|
104
|
+
});
|
|
105
|
+
expect(menuActionMore.props.isVisible).toEqual(true);
|
|
106
|
+
|
|
107
|
+
await act(async () => {
|
|
108
|
+
menuActionMore.props.onItemClick({ action: 'action' });
|
|
109
|
+
});
|
|
110
|
+
expect(menuActionMore.props.isVisible).toEqual(true);
|
|
94
111
|
});
|
|
95
112
|
|
|
96
113
|
test('test render SmartAccountItem', async () => {
|
|
@@ -5,7 +5,7 @@ import { SCProvider } from '../../../context';
|
|
|
5
5
|
import { mockSCStore } from '../../../context/mockStore';
|
|
6
6
|
import { SmartAccountItem } from '../SmartAccountItem';
|
|
7
7
|
import { TouchableOpacity } from 'react-native';
|
|
8
|
-
import {
|
|
8
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
9
9
|
|
|
10
10
|
const mockedOnShowMenuMore = jest.fn();
|
|
11
11
|
const mockedGotoSmartAccountDetail = jest.fn();
|
|
@@ -47,7 +47,7 @@ describe('Test SmartAccountItem', () => {
|
|
|
47
47
|
|
|
48
48
|
const onPressGotoSmartAccountDetail = instance.find(
|
|
49
49
|
(el) =>
|
|
50
|
-
el.props.
|
|
50
|
+
el.props.accessibilityLabel === AccessibilityLabel.SMART_ACCOUNT_ITEM &&
|
|
51
51
|
el.type === TouchableOpacity
|
|
52
52
|
);
|
|
53
53
|
|
|
@@ -59,7 +59,8 @@ describe('Test SmartAccountItem', () => {
|
|
|
59
59
|
|
|
60
60
|
const onPressMore = instance.find(
|
|
61
61
|
(el) =>
|
|
62
|
-
el.props.
|
|
62
|
+
el.props.accessibilityLabel ===
|
|
63
|
+
AccessibilityLabel.SMART_ACCOUNT_ITEM_PRESSMORE &&
|
|
63
64
|
el.type === TouchableOpacity
|
|
64
65
|
);
|
|
65
66
|
|
|
@@ -9,7 +9,10 @@ import ValueChange from '../../../../../assets/images/ValueChange.svg';
|
|
|
9
9
|
import Schedule from '../../../../../assets/images/Schedule.svg';
|
|
10
10
|
import Event from '../../../../../assets/images/Event.svg';
|
|
11
11
|
import styles from './styles';
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
AUTOMATE_TYPE,
|
|
14
|
+
AccessibilityLabel,
|
|
15
|
+
} from '../../../../configs/Constants';
|
|
13
16
|
import { Colors } from '../../../../configs';
|
|
14
17
|
|
|
15
18
|
const AutomateScript = ({ automate, onPress, isSelected }) => {
|
|
@@ -38,7 +41,7 @@ const AutomateScript = ({ automate, onPress, isSelected }) => {
|
|
|
38
41
|
return (
|
|
39
42
|
<TouchableWithoutFeedback
|
|
40
43
|
onPress={_onPress}
|
|
41
|
-
accessibilityLabel={`${
|
|
44
|
+
accessibilityLabel={`${AccessibilityLabel.TOUCHABLE_ACTION_ADD_ITEM_AUTOMATE_FAVORITE}-${automate.id}`}
|
|
42
45
|
>
|
|
43
46
|
<View style={[styles.container, isSelected && styles.active]}>
|
|
44
47
|
<View style={styles.boxIcon}>{displayIcon()}</View>
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { TouchableOpacity } from 'react-native';
|
|
3
3
|
import { act, create } from 'react-test-renderer';
|
|
4
4
|
import { Colors } from '../../../../../configs';
|
|
5
|
-
import {
|
|
5
|
+
import { AccessibilityLabel } from '../../../../../configs/Constants';
|
|
6
6
|
import HeaderUnit from '../../../../../commons/Unit/HeaderUnit';
|
|
7
7
|
const mockGoBack = jest.fn();
|
|
8
8
|
|
|
@@ -43,7 +43,8 @@ describe('Test HeaderUnit', () => {
|
|
|
43
43
|
const instance = tree.root;
|
|
44
44
|
const button = instance.find(
|
|
45
45
|
(el) =>
|
|
46
|
-
el.props.
|
|
46
|
+
el.props.accessibilityLabel ===
|
|
47
|
+
AccessibilityLabel.HEADER_UNIT_BUTTON_BACK &&
|
|
47
48
|
el.type === TouchableOpacity
|
|
48
49
|
);
|
|
49
50
|
act(() => {
|
|
@@ -60,7 +61,8 @@ describe('Test HeaderUnit', () => {
|
|
|
60
61
|
const instance = tree.root;
|
|
61
62
|
const button = instance.find(
|
|
62
63
|
(el) =>
|
|
63
|
-
el.props.
|
|
64
|
+
el.props.accessibilityLabel ===
|
|
65
|
+
AccessibilityLabel.HEADER_UNIT_BUTTON_BACK &&
|
|
64
66
|
el.type === TouchableOpacity
|
|
65
67
|
);
|
|
66
68
|
act(() => {
|
|
@@ -76,7 +78,8 @@ describe('Test HeaderUnit', () => {
|
|
|
76
78
|
const instance = tree.root;
|
|
77
79
|
const button = instance.find(
|
|
78
80
|
(el) =>
|
|
79
|
-
el.props.
|
|
81
|
+
el.props.accessibilityLabel ===
|
|
82
|
+
AccessibilityLabel.HEADER_UNIT_BUTTON_ADD &&
|
|
80
83
|
el.type === TouchableOpacity
|
|
81
84
|
);
|
|
82
85
|
act(() => {
|
|
@@ -92,7 +95,8 @@ describe('Test HeaderUnit', () => {
|
|
|
92
95
|
const instance = tree.root;
|
|
93
96
|
const button = instance.find(
|
|
94
97
|
(el) =>
|
|
95
|
-
el.props.
|
|
98
|
+
el.props.accessibilityLabel ===
|
|
99
|
+
AccessibilityLabel.HEADER_UNIT_BUTTON_MORE &&
|
|
96
100
|
el.type === TouchableOpacity
|
|
97
101
|
);
|
|
98
102
|
act(() => {
|
|
@@ -9,7 +9,7 @@ const AnimatedScrollView = Animated.createAnimatedComponent(ScrollView);
|
|
|
9
9
|
|
|
10
10
|
const MyAllUnit = ({ route, navigation }) => {
|
|
11
11
|
const animatedScrollYValue = useRef(new Animated.Value(0)).current;
|
|
12
|
-
const unitItems = route
|
|
12
|
+
const unitItems = route?.params?.myUnits;
|
|
13
13
|
|
|
14
14
|
return (
|
|
15
15
|
<SafeAreaView style={[styles.wrap, styles.backgroundWhite]}>
|