@eohjsc/react-native-smart-city 0.6.2 → 0.7.3-rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/android/build.gradle +7 -10
- package/assets/images/Automation-fill.svg +85 -0
- package/assets/images/Scenario-filled.svg +22 -0
- package/assets/images/schedule-fill.svg +48 -0
- package/package.json +53 -70
- package/src/commons/Action/ItemQuickAction.js +1 -1
- package/src/commons/Action/__test__/ItemQuickAction.test.js +2 -2
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +3 -3
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapper.js +3 -3
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/ItemPasscode.test.js +2 -2
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +3 -3
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +3 -3
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/ButtonWrapper.js +2 -2
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +0 -15
- package/src/commons/ActionGroup/OnOffTemplate/OnOffSimpleTemplate.js +2 -2
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +2 -2
- package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +2 -2
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButton.js +5 -5
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlay.js +5 -5
- package/src/commons/ActionGroup/TerminalBoxTemplate.js +2 -2
- package/src/commons/ActionGroup/TextBoxTemplate.js +2 -2
- package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonTemplate.test.js +4 -4
- package/src/commons/ActionGroup/TimerActionTemplate.js +4 -5
- package/src/commons/ActionGroup/TwoButtonTemplate/index.js +2 -2
- package/src/commons/ActionGroup/__test__/ColorPickerTemplate.test.js +4 -9
- package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +2 -9
- package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +4 -11
- package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +2 -9
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +4 -18
- package/src/commons/ActionGroup/__test__/OneBigButtonTemplate.test.js +2 -2
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +1 -8
- package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +0 -7
- package/src/commons/ActionGroup/__test__/SwitchButtonTemplate.test.js +4 -15
- package/src/commons/ActionGroup/__test__/TerminalBoxTemplate.test.js +0 -7
- package/src/commons/ActionGroup/__test__/TextBoxTemplate.test.js +1 -8
- package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +8 -15
- package/src/commons/ActionGroup/__test__/TimerActionTemplateWithutConfigValue.test.js +2 -10
- package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +3 -20
- package/src/commons/ActionGroup/__test__/index.test.js +15 -23
- package/src/commons/ActionTemplate/__test__/index.test.js +2 -0
- package/src/commons/ActionTemplate/__test__/utils.js +21 -0
- package/src/commons/ActionTemplate/index.js +1 -2
- package/src/commons/BackDefault/index.js +2 -2
- package/src/commons/ButtonPopup/index.js +2 -2
- package/src/commons/Calendar/__test__/Calendar.test.js +0 -7
- package/src/commons/CircleButton/__test__/CircleButton.test.js +2 -2
- package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +11 -25
- package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +27 -20
- package/src/commons/Dashboard/MyUnit/index.js +0 -1
- package/src/commons/DateTimeRangeChange/DateTimeButton.js +2 -2
- package/src/commons/DateTimeRangeChange/__test__/DateTimeButton.test.js +4 -4
- package/src/commons/DateTimeRangeChange/index.js +3 -3
- package/src/commons/Device/ConnectedViewHeader.js +2 -2
- package/src/commons/Device/DisconnectedView.js +2 -2
- package/src/commons/Device/Emergency/EmergencyDetail.js +3 -3
- package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +2 -2
- package/src/commons/Device/FlatListItems.js +3 -3
- package/src/commons/Device/Hanet/ItemHanetDevice.js +3 -3
- package/src/commons/Device/Hanet/ItemHanetDevice.test.js +3 -11
- package/src/commons/Device/ItemAddNew/index.js +2 -2
- package/src/commons/Device/ItemDevice.js +5 -21
- package/src/commons/Device/SonosSpeaker/index.js +3 -3
- package/src/commons/Device/WaterPurifierStatus/AlertStatusMachine.js +2 -2
- package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +2 -6
- package/src/commons/DisplayChecking/index.js +2 -2
- package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -2
- package/src/commons/EmergencyButton/AlertSent.js +6 -2
- package/src/commons/FieldTemplate/ChooseUserField/index.js +2 -2
- package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +5 -5
- package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +9 -9
- package/src/commons/Form/CurrencyInput.js +1 -15
- package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +1 -22
- package/src/commons/Header/HeaderCustom.js +8 -3
- package/src/commons/HeaderAni/index.js +2 -2
- package/src/commons/IconComponent/index.js +3 -3
- package/src/commons/MediaPlayerDetail/MediaPlayerFull.js +1 -1
- package/src/commons/MediaPlayerDetail/__test__/MediaPlayerFull.test.js +12 -48
- package/src/commons/MenuActionAddnew/__test__/MenuActionAddNew.test.js +1 -1
- package/src/commons/MenuActionList/__test__/MenuActionList.test.js +1 -0
- package/src/commons/MenuActionMore/MenuActionMoreStyles.js +2 -1
- package/src/commons/MenuActionMore/index.js +1 -1
- package/src/commons/NavBar/NavBarStyles.js +1 -1
- package/src/commons/NavBar/index.js +2 -2
- package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +3 -3
- package/src/commons/PreventAccess/__test__/PreventAccess.test.js +1 -13
- package/src/commons/Processing/__test__/Connecting.test.js +3 -14
- package/src/commons/SearchLocation/index.js +3 -3
- package/src/commons/SelectActionCard/index.js +2 -2
- package/src/commons/SelectSubUnit/__test__/SelectSubUnit.test.js +1 -18
- package/src/commons/SelectSubUnit/index.js +2 -2
- package/src/commons/SelectUnit/__test__/SelectUnit.test.js +1 -13
- package/src/commons/Sharing/BtnRemoveMember.js +2 -2
- package/src/commons/Sharing/StationDevicePermissions.js +2 -2
- package/src/commons/Sharing/WrapHeaderScrollable.js +1 -1
- package/src/commons/Sharing/__test__/ButtonRemoveMember.test.js +2 -2
- package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +1 -1
- package/src/commons/SubUnit/DeviceTemplate/ConfigAndEvaluation/ConfigAndEvaluation.js +2 -2
- package/src/commons/SubUnit/DeviceTemplate/ConfigValue/ConfigValue.js +2 -2
- package/src/commons/SubUnit/DeviceTemplate/EvaluationOverConfig/EvaluationOverConfig.js +2 -2
- package/src/commons/SubUnit/Item/index.js +3 -3
- package/src/commons/SubUnit/OneTap/ItemOneTap.js +5 -5
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +11 -8
- package/src/commons/SubUnit/__test__/Favorites.test.js +1 -13
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +5 -16
- package/src/commons/SummaryItem/index.js +22 -23
- package/src/commons/Tabbar/__test__/index.test.js +0 -11
- package/src/commons/Unit/HeaderUnit/index.js +93 -85
- package/src/commons/Unit/SharedUnit.js +7 -7
- package/src/commons/Unit/__test__/HeaderUnit.test.js +29 -52
- package/src/commons/Unit/__test__/SharedUnit.test.js +94 -105
- package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +11 -30
- package/src/commons/Widgets/IFrameWithConfig/IFrameWithConfig.js +44 -1
- package/src/commons/Widgets/IFrameWithConfig/__tests__/IFrameWithConfig.test.js +69 -0
- package/src/commons/WrapParallaxScrollView/index.js +20 -50
- package/src/configs/API.js +1 -2
- package/src/configs/Constants.js +3 -3
- package/src/hooks/Common/__test__/useAndroidTranslucentStatusBar.test.js +4 -15
- package/src/hooks/Common/useIsOwnerOfUnit.js +1 -1
- package/src/hooks/IoT/__test__/useRemoteControl.test.js +1 -1
- package/src/hooks/IoT/__test__/useWatchConfigs.test.js +6 -21
- package/src/iot/RemoteControl/HomeAssistant.js +1 -1
- package/src/iot/RemoteControl/__test__/Bluetooth.test.js +234 -232
- package/src/navigations/AddDeviceStack.js +2 -2
- package/src/navigations/AddGatewayStack.js +2 -2
- package/src/navigations/AddLGDeviceStack.js +2 -2
- package/src/navigations/AddMemberStack.js +2 -2
- package/src/navigations/AddSubUnitStack.js +2 -2
- package/src/navigations/AddUnitStack.js +2 -2
- package/src/navigations/AllGatewayStack.js +2 -2
- package/src/navigations/AutomateStack.js +4 -4
- package/src/navigations/EmergencyContactsStack.js +4 -4
- package/src/navigations/GatewayStack.js +2 -2
- package/src/navigations/HanetCameraStack.js +2 -2
- package/src/navigations/Main.js +2 -2
- package/src/navigations/NotificationStack.js +2 -2
- package/src/navigations/SharedStack.js +8 -6
- package/src/navigations/SmartAccountStack.js +2 -2
- package/src/navigations/SmartIrStack.js +2 -2
- package/src/navigations/SmartLockStack.js +2 -2
- package/src/navigations/SmartStack.js +2 -2
- package/src/navigations/TemplateStack.js +2 -2
- package/src/navigations/UnitStack.js +4 -12
- package/src/navigations/utils.js +1 -4
- package/src/screens/ActivityLog/hooks/index.js +7 -4
- package/src/screens/ActivityLog/index.js +2 -2
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +4 -21
- package/src/screens/AddCommon/__test__/SelectUnit.test.js +7 -19
- package/src/screens/AddLocationMaps/__test__/index.test.js +3 -13
- package/src/screens/AddLocationMaps/index.js +11 -6
- package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +3 -20
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +11 -18
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/ZigbeeDeviceConnectGuide.test.js +4 -21
- package/src/screens/AddNewGateway/RenameNewDevices.js +2 -2
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +3 -3
- package/src/screens/AddNewGateway/__test__/ConnectingModbusDevice.test.js +0 -17
- package/src/screens/AddNewGateway/__test__/ConnectingWifiDevice.test.js +4 -19
- package/src/screens/AddNewGateway/__test__/ConnectingWifiGuide.test.js +3 -15
- package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +31 -51
- package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +9 -22
- package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +12 -19
- package/src/screens/AddNewGateway/__test__/ScanModbusQR.test.js +6 -16
- package/src/screens/AddNewGateway/__test__/ScanWifiDeviceQR.test.js +4 -15
- package/src/screens/AddNewGateway/__test__/SelectDeviceSubUnit.test.js +3 -3
- package/src/screens/AddNewGateway/__test__/SelectDeviceType.test.js +18 -10
- package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +1 -1
- package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +12 -9
- package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +12 -9
- package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +7 -21
- package/src/screens/AllGateway/DetailConfigActionInternal/__test__/index.test.js +0 -20
- package/src/screens/AllGateway/DetailConfigActionModbus/__test__/index.test.js +7 -24
- package/src/screens/AllGateway/DeviceGatewayInfo/__test__/index.test.js +0 -17
- package/src/screens/AllGateway/DeviceInternalDetail/__test__/index.test.js +84 -100
- package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +64 -82
- package/src/screens/AllGateway/DeviceZigbeeDetail/__test__/index.test.js +36 -55
- package/src/screens/AllGateway/GatewayConnectionMethods/__test__/index.test.js +9 -18
- package/src/screens/AllGateway/GatewayDetail/__test__/index.test.js +10 -37
- package/src/screens/AllGateway/GatewayInfo/__test__/index.test.js +7 -32
- package/src/screens/AllGateway/__test__/index.test.js +1 -14
- package/src/screens/AllGateway/components/GatewayItem/__test__/index.test.js +0 -12
- package/src/screens/AllGateway/components/TabPaneCT/__test__/index.test.js +1 -13
- package/src/screens/AllGateway/components/TabPaneCT/index.js +1 -1
- package/src/screens/AllGateway/hooks/__test__/index.test.js +1 -8
- package/src/screens/AllGateway/test-utils.js +1 -1
- package/src/screens/Automate/AddNewAction/NewActionWrapper.js +2 -2
- package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +27 -28
- package/src/screens/Automate/AddNewAction/__test__/ChooseAction.test.js +3 -3
- package/src/screens/Automate/AddNewAction/__test__/ChooseConfig.test.js +8 -5
- package/src/screens/Automate/AddNewAction/__test__/SelectControlDevices.test.js +2 -2
- package/src/screens/Automate/AddNewAction/__test__/SelectMonitorDevices.test.js +1 -18
- package/src/screens/Automate/AddNewAction/__test__/SetupConfigCondition.test.js +17 -15
- package/src/screens/Automate/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +4 -4
- package/src/screens/Automate/EditActionsList/__tests__/UpdateActionScript.test.js +38 -55
- package/src/screens/Automate/EditActionsList/__tests__/UpdateDelayScript.test.js +0 -18
- package/src/screens/Automate/EditActionsList/__tests__/UpdateNotifyScript.test.js +1 -19
- package/src/screens/Automate/EditActionsList/__tests__/index.test.js +14 -11
- package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +3 -3
- package/src/screens/Automate/Scenario/__test__/AddNewOneTap.test.js +2 -2
- package/src/screens/Automate/ScriptDetail/Components/AddActionScript.js +2 -2
- package/src/screens/Automate/ScriptDetail/__test__/index.test.js +33 -25
- package/src/screens/Automate/ScriptDetail/index.js +6 -6
- package/src/screens/Automate/SetSchedule/__test__/index.test.js +4 -4
- package/src/screens/Automate/SetSchedule/components/RowItem.js +3 -3
- package/src/screens/Automate/Styles/indexStyles.js +6 -0
- package/src/screens/Automate/__test__/MultiUnits.test.js +7 -7
- package/src/screens/Automate/__test__/index.test.js +9 -34
- package/src/screens/Automate/index.js +50 -33
- package/src/screens/ChangePosition/__test__/index.test.js +1 -14
- package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +1 -23
- package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +1 -11
- package/src/screens/Device/EditDevice/index.js +2 -2
- package/src/screens/Device/__test__/detail.test.js +11 -11
- package/src/screens/Device/__test__/sensorDisplayItem.test.js +0 -12
- package/src/screens/Device/detail.js +14 -12
- package/src/screens/Drawer/Drawer.test.js +3 -11
- package/src/screens/Drawer/index.js +3 -4
- package/src/screens/EmergencyContacts/EmergencyContactsList.js +4 -8
- package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +3 -3
- package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +4 -17
- package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +3 -14
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +0 -10
- package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
- package/src/screens/EnterPassword/__test__/EnterPassword.test.js +4 -17
- package/src/screens/GuestInfo/__test__/index.test.js +0 -11
- package/src/screens/GuestInfo/components/RowGuestInfo.js +2 -2
- package/src/screens/GuestInfo/index.js +2 -2
- package/src/screens/HanetCamera/Detail.js +6 -2
- package/src/screens/HanetCamera/ManageAccess.js +3 -4
- package/src/screens/HanetCamera/MemberInfo.js +4 -4
- package/src/screens/HanetCamera/__test__/CaptureFaceID.test.js +2 -16
- package/src/screens/HanetCamera/__test__/Detail.test.js +1 -12
- package/src/screens/HanetCamera/__test__/ManageAccess.test.js +5 -16
- package/src/screens/HanetCamera/__test__/MemberInfo.test.js +5 -18
- package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +2 -2
- package/src/screens/ManageAccess/__test__/ManageAccess.test.js +3 -19
- package/src/screens/ManageAccess/index.js +3 -3
- package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +7 -7
- package/src/screens/Notification/__test__/Notification.test.js +5 -15
- package/src/screens/Notification/__test__/NotificationItem.test.js +9 -19
- package/src/screens/Notification/index.js +5 -5
- package/src/screens/PlayBackCamera/__test__/index.test.js +13 -22
- package/src/screens/PlayBackCamera/index.js +2 -2
- package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +0 -11
- package/src/screens/ScanChipQR/components/QRScan/index.js +3 -3
- package/src/screens/SelectUnit/__test__/index.test.js +9 -29
- package/src/screens/SelectUnit/index.js +2 -2
- package/src/screens/SharedUnit/TabHeader.js +2 -2
- package/src/screens/SharedUnit/index.js +5 -0
- package/src/screens/Sharing/Components/EndDevice.js +3 -3
- package/src/screens/Sharing/SelectUser.js +5 -4
- package/src/screens/Sharing/UnitMemberList.js +7 -6
- package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +9 -4
- package/src/screens/Sharing/__test__/SelectShareDevice.test.js +2 -15
- package/src/screens/Sharing/__test__/SelectUser.test.js +2 -22
- package/src/screens/Sharing/__test__/UnitMemberList.test.js +2 -2
- package/src/screens/Sharing/__test__/UpdateShareDevice.test.js +4 -17
- package/src/screens/Sharing/hooks/__test__/index.test.js +2 -13
- package/src/screens/SmartAccount/Connecting/index.js +0 -2
- package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +3 -18
- package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +11 -21
- package/src/screens/SmartAccount/SuccessfullyConnected/index.js +3 -4
- package/src/screens/SmartAccount/__test__/Connecting.test.js +30 -36
- package/src/screens/SmartAccount/__test__/SmartAccount.test.js +12 -21
- package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +8 -17
- package/src/screens/SmartIr/__test__/SelectBrand.test.js +1 -11
- package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +1 -12
- package/src/screens/SmartIr/__test__/SmartIr.test.js +3 -11
- package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +6 -5
- package/src/screens/SmartIr/components/SelectBrand.js +2 -2
- package/src/screens/SubUnit/AddSubUnit.js +1 -0
- package/src/screens/SubUnit/EditSubUnit.js +3 -2
- package/src/screens/SubUnit/ManageSubUnit.js +5 -5
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +9 -31
- package/src/screens/SubUnit/__test__/EditSubUnit.test.js +12 -30
- package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +2 -2
- package/src/screens/SubUnit/hooks/__test__/useManageSubUnit.test.js +0 -12
- package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +7 -20
- package/src/screens/Template/__test__/EditTemplate.test.js +4 -15
- package/src/screens/Template/__test__/GatewayList.test.js +0 -9
- package/src/screens/Template/__test__/detail.test.js +8 -8
- package/src/screens/Template/__test__/index.test.js +3 -14
- package/src/screens/Template/detail.js +2 -2
- package/src/screens/Unit/Detail.js +10 -55
- package/src/screens/Unit/MoreMenu.js +6 -5
- package/src/screens/Unit/SelectAddToFavorites.js +2 -2
- package/src/screens/Unit/SelectAddress.js +9 -4
- package/src/screens/Unit/SmartAccountItem.js +2 -2
- package/src/screens/Unit/Station/__test__/index.test.js +2 -2
- package/src/screens/Unit/Summaries.js +24 -29
- package/src/screens/Unit/__test__/AddMenu.test.js +5 -2
- package/src/screens/Unit/__test__/CheckSendEmail.test.js +0 -12
- package/src/screens/Unit/__test__/ChooseLocation.test.js +1 -4
- package/src/screens/Unit/__test__/Detail.test.js +14 -12
- package/src/screens/Unit/__test__/ManageUnit.test.js +2 -17
- package/src/screens/Unit/__test__/MoreMenu.test.js +6 -12
- package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +3 -14
- package/src/screens/Unit/__test__/SelectAddress.test.js +4 -17
- package/src/screens/Unit/__test__/SmartAccount.test.js +14 -11
- package/src/screens/Unit/__test__/SmartAccountItem.test.js +0 -11
- package/src/screens/Unit/__test__/Summaries.test.js +2 -14
- package/src/screens/Unit/components/AutomateScript/index.js +5 -5
- package/src/screens/Unit/components/ButtonWrapper/index.js +3 -4
- package/src/screens/Unit/components/Header/index.js +5 -4
- package/src/screens/Unit/components/SharedUnit/index.js +5 -5
- package/src/screens/Unit/components/__test__/Header.test.js +1 -14
- package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +1 -11
- package/src/screens/Unit/components/__test__/SharedUnit.test.js +1 -11
- package/src/screens/UnitSummary/__test__/index.test.js +51 -17
- package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +8 -25
- package/src/screens/UnitSummary/components/AirQuality/__test__/index.test.js +1 -7
- package/src/screens/UnitSummary/components/AirQuality/index.js +8 -3
- package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +0 -11
- package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +1 -16
- package/src/screens/UnitSummary/components/Temperature/index.js +5 -1
- package/src/screens/UnitSummary/components/UvIndex/__test__/index.test.js +0 -8
- package/src/screens/UnitSummary/components/UvIndex/index.js +6 -2
- package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +3 -3
- package/src/screens/UnitSummary/components/WaterQuality/__test__/index.test.js +14 -18
- package/src/screens/UnitSummary/components/__test__/UnitSummary.test.js +8 -8
- package/src/screens/UnitSummary/index.js +6 -6
- package/src/utils/Apis/axios.js +4 -2
- package/src/utils/Converter/__test__/timer.test.js +8 -0
- package/src/utils/Functions/preloadImages.js +13 -14
- package/src/utils/Monitor.js +2 -3
- package/src/utils/Route/index.js +0 -1
- package/src/utils/Storage.js +1 -1
- package/assets/images/OneTap.svg +0 -14
- package/assets/images/Schedule.svg +0 -39
- package/assets/images/ValueChange.svg +0 -49
- package/src/commons/Device/WindSpeed/LinearChart/__test__/LinearChart.test.js +0 -48
- package/src/commons/Device/WindSpeed/LinearChart/index.js +0 -155
- package/src/screens/AddNewGateway/hooks/__Tests__/index.test.js +0 -27
- package/src/screens/AddNewGateway/hooks/index.js +0 -31
- package/src/screens/SubUnit/Detail.js +0 -150
- package/src/screens/SubUnit/__test__/Detail.test.js +0 -125
- package/src/screens/UnitSummary/components/Temperature/ChartAverage/index.js +0 -62
- package/src/screens/UnitSummary/components/Temperature/__test__/ChartAverage.test.js +0 -17
- package/src/utils/dateHelper/getTickValues.js +0 -22
|
@@ -4,20 +4,8 @@ import useManageSubUnit from '../useManageSubUnit';
|
|
|
4
4
|
import API from '../../../../configs/API';
|
|
5
5
|
import api from '../../../../utils/Apis/axios';
|
|
6
6
|
|
|
7
|
-
const mockRoute = jest.fn();
|
|
8
7
|
const mock = new MockAdapter(api.axiosInstance);
|
|
9
8
|
|
|
10
|
-
jest.mock('@react-navigation/native', () => {
|
|
11
|
-
return {
|
|
12
|
-
...jest.requireActual('@react-navigation/native'),
|
|
13
|
-
useRoute: () => mockRoute,
|
|
14
|
-
useNavigation: () => ({
|
|
15
|
-
goBack: jest.fn(),
|
|
16
|
-
}),
|
|
17
|
-
useIsFocused: jest.fn(),
|
|
18
|
-
};
|
|
19
|
-
});
|
|
20
|
-
|
|
21
9
|
describe('Test Manage Access', () => {
|
|
22
10
|
const unit = { id: 1, name: 'unit name' };
|
|
23
11
|
|
|
@@ -17,19 +17,6 @@ import { SCConfig } from '../../../configs';
|
|
|
17
17
|
|
|
18
18
|
const mock = new MockAdapter(api.axiosInstance);
|
|
19
19
|
|
|
20
|
-
const mockedNavigate = jest.fn();
|
|
21
|
-
const mockedGoBack = jest.fn();
|
|
22
|
-
jest.mock('@react-navigation/native', () => {
|
|
23
|
-
return {
|
|
24
|
-
...jest.requireActual('@react-navigation/native'),
|
|
25
|
-
useNavigation: () => ({
|
|
26
|
-
navigate: mockedNavigate,
|
|
27
|
-
goBack: mockedGoBack,
|
|
28
|
-
}),
|
|
29
|
-
useIsFocused: jest.fn(),
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
|
|
33
20
|
const wrapComponent = (route) => (
|
|
34
21
|
<SCProvider initState={mockSCStore({})}>
|
|
35
22
|
<AddLGDevice route={route} />
|
|
@@ -137,7 +124,7 @@ describe('Test Add LG Device', () => {
|
|
|
137
124
|
await act(async () => {
|
|
138
125
|
viewButtonBottom.props.onLeftClick();
|
|
139
126
|
});
|
|
140
|
-
expect(mockedGoBack).toHaveBeenCalled();
|
|
127
|
+
expect(global.mockedGoBack).toHaveBeenCalled();
|
|
141
128
|
});
|
|
142
129
|
|
|
143
130
|
it('ViewButtonBottom onRightClick without select stationId', async () => {
|
|
@@ -149,7 +136,7 @@ describe('Test Add LG Device', () => {
|
|
|
149
136
|
await act(async () => {
|
|
150
137
|
viewButtonBottom.props.onRightClick();
|
|
151
138
|
});
|
|
152
|
-
expect(mockedNavigate).toHaveBeenCalled();
|
|
139
|
+
expect(global.mockedNavigate).toHaveBeenCalled();
|
|
153
140
|
});
|
|
154
141
|
|
|
155
142
|
it('ViewButtonBottom onRightClick with stationId', async () => {
|
|
@@ -201,7 +188,7 @@ describe('Test Add LG Device', () => {
|
|
|
201
188
|
text1: getTranslate('en', 'lg_sync_success'),
|
|
202
189
|
visibilityTime: 1000,
|
|
203
190
|
});
|
|
204
|
-
expect(mockedNavigate).toHaveBeenCalledWith(Routes.Dashboard);
|
|
191
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.Dashboard);
|
|
205
192
|
});
|
|
206
193
|
|
|
207
194
|
it('ViewButtonBottom onRightClick with case sync device fail', async () => {
|
|
@@ -253,7 +240,7 @@ describe('Test Add LG Device', () => {
|
|
|
253
240
|
text1: getTranslate('en', 'lg_sync_failed'),
|
|
254
241
|
visibilityTime: 1000,
|
|
255
242
|
});
|
|
256
|
-
expect(mockedNavigate).toHaveBeenCalledWith(Routes.Dashboard);
|
|
243
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.Dashboard);
|
|
257
244
|
});
|
|
258
245
|
|
|
259
246
|
it('ViewButtonBottom onRightClick with stationId but sync failed', async () => {
|
|
@@ -299,7 +286,7 @@ describe('Test Add LG Device', () => {
|
|
|
299
286
|
text1: getTranslate('en', 'lg_sync_failed'),
|
|
300
287
|
visibilityTime: 1000,
|
|
301
288
|
});
|
|
302
|
-
expect(mockedNavigate).toHaveBeenCalledWith(Routes.Dashboard);
|
|
289
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.Dashboard);
|
|
303
290
|
});
|
|
304
291
|
|
|
305
292
|
it('ViewButtonBottom onRightClick with stationId but get token failed, wrong data', async () => {
|
|
@@ -342,7 +329,7 @@ describe('Test Add LG Device', () => {
|
|
|
342
329
|
|
|
343
330
|
expect(spyToastSuccess).not.toBeCalled();
|
|
344
331
|
expect(spyToastError).toBeCalled();
|
|
345
|
-
expect(mockedNavigate).toHaveBeenCalledWith(Routes.Dashboard);
|
|
332
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.Dashboard);
|
|
346
333
|
|
|
347
334
|
spyToastSuccess.mockReset();
|
|
348
335
|
spyToastSuccess.mockRestore();
|
|
@@ -378,7 +365,7 @@ describe('Test Add LG Device', () => {
|
|
|
378
365
|
|
|
379
366
|
expect(spyToastSuccess).not.toBeCalled();
|
|
380
367
|
expect(spyToastError).toBeCalled();
|
|
381
|
-
expect(mockedNavigate).toHaveBeenCalledWith(Routes.Dashboard);
|
|
368
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(Routes.Dashboard);
|
|
382
369
|
|
|
383
370
|
spyToastSuccess.mockReset();
|
|
384
371
|
spyToastSuccess.mockRestore();
|
|
@@ -16,17 +16,7 @@ const wrapComponent = () => (
|
|
|
16
16
|
</SCProvider>
|
|
17
17
|
);
|
|
18
18
|
|
|
19
|
-
const mockGoBack = jest.fn();
|
|
20
19
|
const mockSetData = jest.fn();
|
|
21
|
-
jest.mock('@react-navigation/native', () => {
|
|
22
|
-
return {
|
|
23
|
-
...jest.requireActual('@react-navigation/native'),
|
|
24
|
-
useNavigation: () => ({
|
|
25
|
-
goBack: mockGoBack,
|
|
26
|
-
}),
|
|
27
|
-
useRoute: jest.fn(),
|
|
28
|
-
};
|
|
29
|
-
});
|
|
30
20
|
|
|
31
21
|
describe('Test EditTemplate', () => {
|
|
32
22
|
let tree;
|
|
@@ -67,19 +57,18 @@ describe('Test EditTemplate', () => {
|
|
|
67
57
|
const DraggableFlatLists = instance.findAllByType(DraggableFlatList);
|
|
68
58
|
expect(DraggableFlatLists).toHaveLength(1);
|
|
69
59
|
|
|
70
|
-
const
|
|
60
|
+
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
71
61
|
|
|
72
62
|
await act(async () => {
|
|
73
|
-
await
|
|
63
|
+
await touchableOpacities[0].props.onPress();
|
|
74
64
|
});
|
|
75
65
|
await act(async () => {
|
|
76
66
|
const firstItem = instance.findByProps({ accessibilityLabel: 'item-0' });
|
|
77
67
|
await firstItem.props.onLongPress();
|
|
78
68
|
});
|
|
79
69
|
|
|
80
|
-
expect(
|
|
70
|
+
expect(global.mockedGoBack).toBeCalled();
|
|
81
71
|
|
|
82
|
-
mockGoBack.mockReset();
|
|
83
72
|
await act(async () => {
|
|
84
73
|
await DraggableFlatLists[0].props.onDragEnd({
|
|
85
74
|
data,
|
|
@@ -90,6 +79,6 @@ describe('Test EditTemplate', () => {
|
|
|
90
79
|
.findByProps({ accessibilityLabel: 'Save' })
|
|
91
80
|
.props.onPress();
|
|
92
81
|
});
|
|
93
|
-
expect(
|
|
82
|
+
expect(global.mockedGoBack).toBeCalled();
|
|
94
83
|
});
|
|
95
84
|
});
|
|
@@ -3,15 +3,6 @@ import { View } from 'react-native';
|
|
|
3
3
|
import { act, create } from 'react-test-renderer';
|
|
4
4
|
import GatewayList from '../GatewayList';
|
|
5
5
|
|
|
6
|
-
jest.mock('@react-navigation/native', () => {
|
|
7
|
-
return {
|
|
8
|
-
...jest.requireActual('@react-navigation/native'),
|
|
9
|
-
useNavigation: () => ({
|
|
10
|
-
goBack: jest.fn(),
|
|
11
|
-
}),
|
|
12
|
-
};
|
|
13
|
-
});
|
|
14
|
-
|
|
15
6
|
describe('Test GatewayList', () => {
|
|
16
7
|
let tree;
|
|
17
8
|
|
|
@@ -22,12 +22,12 @@ const wrapComponent = () => (
|
|
|
22
22
|
|
|
23
23
|
describe('Test Detail', () => {
|
|
24
24
|
const mockGoBack = useNavigation().goBack;
|
|
25
|
-
const
|
|
25
|
+
const mockedNavigate = useNavigation().navigate;
|
|
26
26
|
let tree;
|
|
27
27
|
|
|
28
28
|
beforeEach(() => {
|
|
29
29
|
mockGoBack.mockReset();
|
|
30
|
-
|
|
30
|
+
mockedNavigate.mockReset();
|
|
31
31
|
useRoute.mockReturnValue({
|
|
32
32
|
params: {
|
|
33
33
|
item: {
|
|
@@ -57,9 +57,9 @@ describe('Test Detail', () => {
|
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
const instance = tree.root;
|
|
60
|
-
const
|
|
61
|
-
await
|
|
62
|
-
expect(
|
|
60
|
+
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
61
|
+
await touchableOpacities[0].props.onPress();
|
|
62
|
+
expect(global.mockedGoBack).toBeCalled();
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
it('Test render onClick more header onPress delete', async () => {
|
|
@@ -82,9 +82,9 @@ describe('Test Detail', () => {
|
|
|
82
82
|
});
|
|
83
83
|
|
|
84
84
|
const instance = tree.root;
|
|
85
|
-
const
|
|
85
|
+
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
86
86
|
await act(async () => {
|
|
87
|
-
await
|
|
87
|
+
await touchableOpacities[1].props.onPress();
|
|
88
88
|
});
|
|
89
89
|
const menuActionMore = instance.findByType(MenuActionMore);
|
|
90
90
|
const mockDoAction = jest.fn();
|
|
@@ -101,7 +101,7 @@ describe('Test Detail', () => {
|
|
|
101
101
|
await act(async () => {
|
|
102
102
|
await menuActionMore.props.listMenuItem[0].doAction();
|
|
103
103
|
});
|
|
104
|
-
expect(
|
|
104
|
+
expect(global.mockedNavigate).toHaveBeenCalled();
|
|
105
105
|
await act(async () => {
|
|
106
106
|
await menuActionMore.props.listMenuItem[3].doAction();
|
|
107
107
|
});
|
|
@@ -9,17 +9,6 @@ import api from '../../../utils/Apis/axios';
|
|
|
9
9
|
|
|
10
10
|
const mock = new MockAdapter(api.axiosInstance);
|
|
11
11
|
|
|
12
|
-
const mockNavigate = jest.fn();
|
|
13
|
-
jest.mock('@react-navigation/native', () => {
|
|
14
|
-
return {
|
|
15
|
-
...jest.requireActual('@react-navigation/native'),
|
|
16
|
-
useNavigation: () => ({
|
|
17
|
-
navigate: mockNavigate,
|
|
18
|
-
}),
|
|
19
|
-
useIsFocused: () => true,
|
|
20
|
-
};
|
|
21
|
-
});
|
|
22
|
-
|
|
23
12
|
describe('Test Template screen', () => {
|
|
24
13
|
let tree;
|
|
25
14
|
it('Test render', async () => {
|
|
@@ -36,9 +25,9 @@ describe('Test Template screen', () => {
|
|
|
36
25
|
const instance = tree.root;
|
|
37
26
|
const FlatLists = instance.findAllByType(FlatList);
|
|
38
27
|
expect(FlatLists).toHaveLength(1);
|
|
39
|
-
const
|
|
40
|
-
await
|
|
41
|
-
expect(
|
|
28
|
+
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
29
|
+
await touchableOpacities[0].props.onPress();
|
|
30
|
+
expect(global.mockedNavigate).toBeCalled();
|
|
42
31
|
});
|
|
43
32
|
|
|
44
33
|
it('Test onSearch', async () => {
|
|
@@ -6,7 +6,7 @@ import React, {
|
|
|
6
6
|
useState,
|
|
7
7
|
} from 'react';
|
|
8
8
|
import { View, TouchableOpacity } from 'react-native';
|
|
9
|
-
import
|
|
9
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
10
10
|
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
11
11
|
|
|
12
12
|
import WrapHeaderScrollable from '../../commons/Sharing/WrapHeaderScrollable';
|
|
@@ -163,7 +163,7 @@ const TemplateDetail = () => {
|
|
|
163
163
|
ref={refMenuAction}
|
|
164
164
|
style={styles.headerButton}
|
|
165
165
|
>
|
|
166
|
-
<
|
|
166
|
+
<MaterialIcons name={'more-vert'} size={27} color={Colors.Black} />
|
|
167
167
|
</TouchableOpacity>
|
|
168
168
|
</View>
|
|
169
169
|
);
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import React, {
|
|
2
2
|
useCallback,
|
|
3
|
-
useEffect,
|
|
4
|
-
useState,
|
|
5
3
|
useContext,
|
|
4
|
+
useEffect,
|
|
6
5
|
useMemo,
|
|
6
|
+
useState,
|
|
7
7
|
} from 'react';
|
|
8
|
-
import {
|
|
9
|
-
import { useIsFocused } from '@react-navigation/native';
|
|
8
|
+
import { Platform, View } from 'react-native';
|
|
9
|
+
import { useIsFocused, useNavigation } from '@react-navigation/native';
|
|
10
10
|
|
|
11
11
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
12
12
|
import styles from './styles';
|
|
13
|
-
import AddMenu from './AddMenu';
|
|
14
|
-
import MoreMenu from './MoreMenu';
|
|
15
13
|
import Summaries from './Summaries';
|
|
16
14
|
|
|
17
15
|
import Text from '../../commons/Text';
|
|
@@ -20,7 +18,6 @@ import {
|
|
|
20
18
|
useBlockBackAndroid,
|
|
21
19
|
useBoolean,
|
|
22
20
|
useIsOwnerOfUnit,
|
|
23
|
-
usePopover,
|
|
24
21
|
} from '../../hooks/Common';
|
|
25
22
|
import { useFavorites } from './hook/useFavorites';
|
|
26
23
|
import { useUnitConnectRemoteDevices } from './hook/useUnitConnectRemoteDevices';
|
|
@@ -32,20 +29,19 @@ import WrapParallaxScrollView from '../../commons/WrapParallaxScrollView';
|
|
|
32
29
|
import { SCContext, useSCContextSelector } from '../../context';
|
|
33
30
|
import { Action } from '../../context/actionType';
|
|
34
31
|
import CameraDevice from '../../commons/CameraDevice';
|
|
35
|
-
import { useNavigation } from '@react-navigation/native';
|
|
36
32
|
import Routes from '../../utils/Route';
|
|
37
33
|
import SubUnitAutomate from '../../commons/SubUnit/OneTap';
|
|
38
34
|
import SubUnitFavorites from '../../commons/SubUnit/Favorites';
|
|
39
35
|
import {
|
|
36
|
+
AccessibilityLabel,
|
|
37
|
+
AUTOMATE_TABS,
|
|
40
38
|
AUTOMATE_TYPE,
|
|
41
39
|
Constants,
|
|
42
40
|
NOTIFICATION_TYPES,
|
|
43
|
-
AccessibilityLabel,
|
|
44
|
-
AUTOMATE_TABS,
|
|
45
41
|
} from '../../configs/Constants';
|
|
46
42
|
import {
|
|
47
|
-
watchNotificationData,
|
|
48
43
|
unwatchNotificationData,
|
|
44
|
+
watchNotificationData,
|
|
49
45
|
} from '../../utils/Monitor';
|
|
50
46
|
import PreventAccess from '../../commons/PreventAccess';
|
|
51
47
|
import MediaPlayerDetail from '../../commons/MediaPlayerDetail';
|
|
@@ -197,7 +193,6 @@ const UnitDetail = ({ route }) => {
|
|
|
197
193
|
const {
|
|
198
194
|
unitId,
|
|
199
195
|
unitData,
|
|
200
|
-
routeName,
|
|
201
196
|
isOneTap,
|
|
202
197
|
stationId,
|
|
203
198
|
isAddSubUnit,
|
|
@@ -218,19 +213,16 @@ const UnitDetail = ({ route }) => {
|
|
|
218
213
|
isSuccessfullyConnected ? RouterHardware(Routes.Dashboard) : goBack
|
|
219
214
|
);
|
|
220
215
|
const user = useSCContextSelector((state) => state?.auth?.account?.user);
|
|
221
|
-
const {
|
|
216
|
+
const { isFirstOpenCamera, appState } = useSCContextSelector(
|
|
222
217
|
(state) => state.app
|
|
223
218
|
);
|
|
224
219
|
|
|
225
220
|
const [unit, setUnit] = useState(unitData || { id: unitId });
|
|
226
221
|
const [listAutomate, setListAutomate] = useState([]);
|
|
227
|
-
|
|
222
|
+
|
|
228
223
|
const [showPreventAccess, setShowPreventAccess, setHidePreventAccess] =
|
|
229
224
|
useBoolean(false);
|
|
230
225
|
|
|
231
|
-
const { childRef, showingPopover, showPopoverWithRef, hidePopover } =
|
|
232
|
-
usePopover();
|
|
233
|
-
|
|
234
226
|
const { isOwner } = useIsOwnerOfUnit(unit.user_id);
|
|
235
227
|
|
|
236
228
|
const prepareData = useCallback(
|
|
@@ -317,14 +309,6 @@ const UnitDetail = ({ route }) => {
|
|
|
317
309
|
}
|
|
318
310
|
}, [fetchDetails, isFocused]);
|
|
319
311
|
|
|
320
|
-
const onBack = useCallback(() => {
|
|
321
|
-
navigate(isLavidaSource ? Routes.SmartHomeDashboard : routeName);
|
|
322
|
-
}, [navigate, routeName, isLavidaSource]);
|
|
323
|
-
|
|
324
|
-
const Dashboard = useCallback(() => {
|
|
325
|
-
navigate(isLavidaSource ? Routes.SmartHomeDashboard : Routes.Dashboard);
|
|
326
|
-
}, [isLavidaSource, navigate]);
|
|
327
|
-
|
|
328
312
|
useEffect(() => {
|
|
329
313
|
watchNotificationData(user, onRefresh);
|
|
330
314
|
return () => unwatchNotificationData(user);
|
|
@@ -341,21 +325,7 @@ const UnitDetail = ({ route }) => {
|
|
|
341
325
|
}, [isFirstOpenCamera, isIOS]);
|
|
342
326
|
|
|
343
327
|
return (
|
|
344
|
-
<WrapParallaxScrollView
|
|
345
|
-
uriImg={unit.background}
|
|
346
|
-
title={t('Welcome {name}', {
|
|
347
|
-
name: unit.name ? unit.name : '',
|
|
348
|
-
})}
|
|
349
|
-
refreshControl={
|
|
350
|
-
<RefreshControl refreshing={false} onRefresh={onRefresh} />
|
|
351
|
-
}
|
|
352
|
-
onAdd={setShowAdd}
|
|
353
|
-
onMore={showPopoverWithRef}
|
|
354
|
-
hideRightPlus={!isOwner}
|
|
355
|
-
onBack={(isSuccessfullyConnected && Dashboard) || (routeName && onBack)}
|
|
356
|
-
accessibilityLabel={AccessibilityLabel.UNIT_DETAIL_PARALLAX_SCROLLVIEW}
|
|
357
|
-
idButtonMore={AccessibilityLabel.UNIT_DETAIL_PARALLAX_BUTTON_MORE}
|
|
358
|
-
>
|
|
328
|
+
<WrapParallaxScrollView unit={unit} onRefresh={onRefresh}>
|
|
359
329
|
{isFirstOpenCamera && isIOS && (
|
|
360
330
|
<MediaPlayerDetail
|
|
361
331
|
uri={Constants.URL_STREAM_CAMERA_DEMO}
|
|
@@ -375,21 +345,6 @@ const UnitDetail = ({ route }) => {
|
|
|
375
345
|
isAddSubUnit={isAddSubUnit}
|
|
376
346
|
isEditSubUnit={isEditSubUnit}
|
|
377
347
|
/>
|
|
378
|
-
<AddMenu
|
|
379
|
-
unit={unit}
|
|
380
|
-
afterItemClick={hidePopover}
|
|
381
|
-
showAdd={showAdd}
|
|
382
|
-
setHideAdd={setHideAdd}
|
|
383
|
-
/>
|
|
384
|
-
<MoreMenu
|
|
385
|
-
unit={unit}
|
|
386
|
-
hidePopover={hidePopover}
|
|
387
|
-
isOwner={isOwner}
|
|
388
|
-
childRef={childRef}
|
|
389
|
-
showingPopover={showingPopover}
|
|
390
|
-
idLabelPopover={AccessibilityLabel.UNIT_DETAIL_POPUP_MORE}
|
|
391
|
-
idLabelItem={AccessibilityLabel.UNIT_DETAIL_POPUP_MORE_ITEM}
|
|
392
|
-
/>
|
|
393
348
|
<PreventAccess
|
|
394
349
|
visible={showPreventAccess}
|
|
395
350
|
hidePreventAccess={setHidePreventAccess}
|
|
@@ -14,6 +14,7 @@ const MoreMenu = ({
|
|
|
14
14
|
idLabelScrollView,
|
|
15
15
|
idLabelItem,
|
|
16
16
|
}) => {
|
|
17
|
+
const { id } = unit;
|
|
17
18
|
const t = useTranslations();
|
|
18
19
|
const navigation = useNavigation();
|
|
19
20
|
|
|
@@ -30,25 +31,25 @@ const MoreMenu = ({
|
|
|
30
31
|
id: 'mange-unit',
|
|
31
32
|
route: Routes.ManageUnit,
|
|
32
33
|
text: t('manage_unit'),
|
|
33
|
-
data: { unitId:
|
|
34
|
+
data: { unitId: id, unit },
|
|
34
35
|
};
|
|
35
36
|
const RouteUnitMemberList = {
|
|
36
37
|
id: 'unit-member',
|
|
37
38
|
route: Routes.UnitMemberList,
|
|
38
39
|
text: t('members'),
|
|
39
|
-
data: { unitId:
|
|
40
|
+
data: { unitId: id, unit },
|
|
40
41
|
};
|
|
41
42
|
const ListSmartAccount = {
|
|
42
43
|
id: 'smart-account',
|
|
43
44
|
route: Routes.ListSmartAccount,
|
|
44
45
|
text: t('smart_account'),
|
|
45
|
-
data: { unitId:
|
|
46
|
+
data: { unitId: id, unit },
|
|
46
47
|
};
|
|
47
48
|
const RouteAllGateway = {
|
|
48
49
|
id: 'all-gateway',
|
|
49
50
|
route: Routes.AllGateway,
|
|
50
51
|
text: t('all_gateway'),
|
|
51
|
-
data: { unitId:
|
|
52
|
+
data: { unitId: id, unit },
|
|
52
53
|
};
|
|
53
54
|
return isOwner
|
|
54
55
|
? [
|
|
@@ -58,7 +59,7 @@ const MoreMenu = ({
|
|
|
58
59
|
RouteAllGateway,
|
|
59
60
|
]
|
|
60
61
|
: [RouteUnitMemberList];
|
|
61
|
-
}, [t, unit, isOwner]);
|
|
62
|
+
}, [t, id, unit, isOwner]);
|
|
62
63
|
|
|
63
64
|
return (
|
|
64
65
|
<MenuActionMore
|
|
@@ -8,7 +8,7 @@ import React, {
|
|
|
8
8
|
} from 'react';
|
|
9
9
|
import { View, ScrollView, TouchableOpacity } from 'react-native';
|
|
10
10
|
import { useNavigation } from '@react-navigation/native';
|
|
11
|
-
import
|
|
11
|
+
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
12
12
|
import { HeaderCustom } from '../../commons/Header';
|
|
13
13
|
import Text from '../../commons/Text';
|
|
14
14
|
import NavBar from '../../commons/NavBar';
|
|
@@ -142,7 +142,7 @@ const SelectAddToFavorites = memo(({ route }) => {
|
|
|
142
142
|
style={styles.buttonClose}
|
|
143
143
|
onPress={goBack}
|
|
144
144
|
>
|
|
145
|
-
<
|
|
145
|
+
<AntDesign name={'close'} size={24} color={Colors.Black} />
|
|
146
146
|
</TouchableOpacity>
|
|
147
147
|
),
|
|
148
148
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -2,7 +2,8 @@ import React, { memo, useCallback, useEffect, useRef, useState } from 'react';
|
|
|
2
2
|
import { TouchableOpacity, View, ScrollView } from 'react-native';
|
|
3
3
|
import MapView, { Marker, Circle, PROVIDER_GOOGLE } from 'react-native-maps';
|
|
4
4
|
import { useNavigation } from '@react-navigation/native';
|
|
5
|
-
import
|
|
5
|
+
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
6
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
6
7
|
import { check, RESULTS } from 'react-native-permissions';
|
|
7
8
|
import { openPromptEnableLocation } from '../../utils/Setting/Location';
|
|
8
9
|
|
|
@@ -194,7 +195,11 @@ const SelectAddress = memo(({ route }) => {
|
|
|
194
195
|
style={styles.button}
|
|
195
196
|
accessibilityLabel={AccessibilityLabel.BUTTON_YOUR_LOCATION}
|
|
196
197
|
>
|
|
197
|
-
<
|
|
198
|
+
<MaterialIcons
|
|
199
|
+
name="my-location"
|
|
200
|
+
size={27}
|
|
201
|
+
color={Colors.Primary}
|
|
202
|
+
/>
|
|
198
203
|
<Text type="Body" color={Colors.Gray9} style={styles.text} bold>
|
|
199
204
|
{t('your_location')}
|
|
200
205
|
</Text>
|
|
@@ -205,7 +210,7 @@ const SelectAddress = memo(({ route }) => {
|
|
|
205
210
|
style={styles.button}
|
|
206
211
|
accessibilityLabel={AccessibilityLabel.BUTTON_CHOOSE_ON_MAP}
|
|
207
212
|
>
|
|
208
|
-
<
|
|
213
|
+
<AntDesign name="enviroment" size={27} color={Colors.Primary} />
|
|
209
214
|
<Text type="Body" color={Colors.Gray9} style={styles.text} bold>
|
|
210
215
|
{t('choose_on_map')}
|
|
211
216
|
</Text>
|
|
@@ -243,7 +248,7 @@ const SelectAddress = memo(({ route }) => {
|
|
|
243
248
|
}}
|
|
244
249
|
tracksViewChanges={false}
|
|
245
250
|
>
|
|
246
|
-
<
|
|
251
|
+
<AntDesign name="enviroment" size={27} color={Colors.Blue10} />
|
|
247
252
|
</Marker>
|
|
248
253
|
</>
|
|
249
254
|
)}
|
|
@@ -4,7 +4,7 @@ import React, { memo, useRef } from 'react';
|
|
|
4
4
|
import styles from './SmartAccountStyles';
|
|
5
5
|
import { Colors } from '../../configs';
|
|
6
6
|
import Text from '../../commons/Text';
|
|
7
|
-
import
|
|
7
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
8
8
|
import { AccessibilityLabel } from '../../configs/Constants';
|
|
9
9
|
|
|
10
10
|
export const SmartAccountItem = memo(
|
|
@@ -44,7 +44,7 @@ export const SmartAccountItem = memo(
|
|
|
44
44
|
onPress={onPressMore}
|
|
45
45
|
ref={buttonMoreRef}
|
|
46
46
|
>
|
|
47
|
-
<
|
|
47
|
+
<MaterialIcons name={'more-vert'} size={27} color={Colors.Black} />
|
|
48
48
|
</TouchableOpacity>
|
|
49
49
|
</View>
|
|
50
50
|
);
|
|
@@ -50,8 +50,8 @@ describe('Test Station', () => {
|
|
|
50
50
|
zoomScale: 1,
|
|
51
51
|
},
|
|
52
52
|
});
|
|
53
|
-
const
|
|
54
|
-
await
|
|
53
|
+
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
54
|
+
await touchableOpacities[0].props.onPress();
|
|
55
55
|
expect(mockOnSnapToItem).toBeCalled();
|
|
56
56
|
});
|
|
57
57
|
});
|
|
@@ -10,6 +10,7 @@ import { AccessibilityLabel } from '../../configs/Constants';
|
|
|
10
10
|
import { useSCContextSelector } from '../../context';
|
|
11
11
|
|
|
12
12
|
const Summaries = memo(({ unit }) => {
|
|
13
|
+
const { id } = unit;
|
|
13
14
|
const [unitSummaries, setUnitSummaries] = useState([]);
|
|
14
15
|
const isFocused = useIsFocused();
|
|
15
16
|
const navigation = useNavigation();
|
|
@@ -17,31 +18,32 @@ const Summaries = memo(({ unit }) => {
|
|
|
17
18
|
const timeoutId = useRef(null);
|
|
18
19
|
|
|
19
20
|
const fetchUnitSummary = useCallback(async () => {
|
|
20
|
-
if (!
|
|
21
|
+
if (!id) {
|
|
21
22
|
return false;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
const { success, data } = await axiosGet(
|
|
25
|
-
API.UNIT.UNIT_SUMMARY(
|
|
26
|
+
API.UNIT.UNIT_SUMMARY(id),
|
|
26
27
|
{},
|
|
27
28
|
true
|
|
28
29
|
);
|
|
29
|
-
if (success && data
|
|
30
|
+
if (success && data?.length) {
|
|
30
31
|
setUnitSummaries(data);
|
|
32
|
+
return true;
|
|
31
33
|
}
|
|
32
|
-
return
|
|
33
|
-
}, [
|
|
34
|
+
return false;
|
|
35
|
+
}, [id]);
|
|
34
36
|
|
|
35
37
|
const goToSummary = useCallback(
|
|
36
38
|
(summary) => {
|
|
37
39
|
navigation.navigate(Routes.UnitSummary, {
|
|
38
40
|
summaryId: summary.id,
|
|
39
|
-
unitId:
|
|
41
|
+
unitId: id,
|
|
40
42
|
summaryData: summary,
|
|
41
43
|
unitData: unit,
|
|
42
44
|
});
|
|
43
45
|
},
|
|
44
|
-
[navigation, unit]
|
|
46
|
+
[navigation, unit, id]
|
|
45
47
|
);
|
|
46
48
|
|
|
47
49
|
const continuousFetchSummary = useCallback(async () => {
|
|
@@ -79,32 +81,25 @@ const Summaries = memo(({ unit }) => {
|
|
|
79
81
|
const { dataNotification } = useReceiveNotifications();
|
|
80
82
|
|
|
81
83
|
useEffect(() => {
|
|
82
|
-
if (dataNotification) {
|
|
83
|
-
|
|
84
|
-
if (summary_id) {
|
|
85
|
-
fetchUnitSummary();
|
|
86
|
-
}
|
|
84
|
+
if (dataNotification?.params?.summary_id) {
|
|
85
|
+
fetchUnitSummary();
|
|
87
86
|
}
|
|
88
87
|
}, [dataNotification, fetchUnitSummary]);
|
|
89
88
|
|
|
89
|
+
if (unitSummaries.length === 0) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
|
|
90
93
|
return (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
key={(item?.id || index).toString()}
|
|
101
|
-
item={item}
|
|
102
|
-
goToSummary={goToSummary}
|
|
103
|
-
/>
|
|
104
|
-
))}
|
|
105
|
-
</ScrollView>
|
|
106
|
-
)}
|
|
107
|
-
</>
|
|
94
|
+
<ScrollView
|
|
95
|
+
horizontal
|
|
96
|
+
scrollIndicatorInsets={{ right: 1 }}
|
|
97
|
+
accessibilityLabel={AccessibilityLabel.UNIT_DETAIL_UNIT_SUMMARY_VIEW}
|
|
98
|
+
>
|
|
99
|
+
{unitSummaries.map((item) => (
|
|
100
|
+
<SummaryItem key={item.id} item={item} goToSummary={goToSummary} />
|
|
101
|
+
))}
|
|
102
|
+
</ScrollView>
|
|
108
103
|
);
|
|
109
104
|
});
|
|
110
105
|
|
|
@@ -77,7 +77,10 @@ describe('Test AddMenu Unit', () => {
|
|
|
77
77
|
|
|
78
78
|
expect(menuActionAddnew.props.visible).toBe(true);
|
|
79
79
|
expect(mockedAfterItemClick).toHaveBeenCalled();
|
|
80
|
-
expect(mockedNavigate).toHaveBeenCalledWith(
|
|
80
|
+
expect(global.mockedNavigate).toHaveBeenCalledWith(
|
|
81
|
+
'route test',
|
|
82
|
+
'data test'
|
|
83
|
+
);
|
|
81
84
|
});
|
|
82
85
|
|
|
83
86
|
it('add new device but have no permission', async () => {
|
|
@@ -201,7 +204,7 @@ describe('Test AddMenu Unit', () => {
|
|
|
201
204
|
await act(async () => {
|
|
202
205
|
menuActionAddnew.props.onItemClick(menuActionAddnew.props.dataActions[3]);
|
|
203
206
|
});
|
|
204
|
-
expect(mockedNavigate).toBeCalledWith(Routes.SmartAccountStack, {
|
|
207
|
+
expect(global.mockedNavigate).toBeCalledWith(Routes.SmartAccountStack, {
|
|
205
208
|
params: { unitId: 1, unitName: 'Unit 1' },
|
|
206
209
|
screen: 'SmartAccount',
|
|
207
210
|
});
|