@eohjsc/react-native-smart-city 0.3.29 → 0.3.32
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 +2 -2
- package/src/commons/Action/__test__/ItemQuickAction.test.js +17 -9
- package/src/commons/ActionGroup/ColorPickerTemplate.js +36 -17
- package/src/commons/ActionGroup/CurtainButtonTemplate.js +6 -6
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +18 -13
- 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 +2 -2
- package/src/commons/ActionGroup/OneBigButtonTemplate.js +5 -5
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +38 -22
- package/src/commons/ActionGroup/SliderRangeTemplate.js +24 -16
- 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 +2 -2
- 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/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 +13 -3
- package/src/commons/BackDefault/index.js +2 -2
- package/src/commons/BottomButtonView/index.js +4 -4
- package/src/commons/Button/index.js +2 -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 +10 -11
- package/src/commons/Device/ItemDevice.js +27 -20
- 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 +6 -5
- package/src/commons/NavBar/index.js +4 -4
- package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +11 -5
- 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 -12
- 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 +7 -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/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 +608 -0
- package/src/configs/Colors.js +4 -0
- package/src/configs/Constants.js +1 -593
- 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/withRemoteControl.js +1 -0
- package/src/hooks/Common/index.js +2 -2
- package/src/hooks/Common/useDevicesStatus.js +1 -1
- 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/IoT/useValueEvaluation.js +10 -19
- package/src/iot/RemoteControl/{GoogleHome.js → HomeAssistant.js} +27 -23
- 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 +5 -8
- 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 +5 -1
- package/src/screens/AddNewAction/SelectAction.js +36 -20
- package/src/screens/AddNewAction/SelectSensorDevices.js +3 -3
- package/src/screens/AddNewAction/__test__/SelectAction.test.js +3 -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 +11 -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 +16 -17
- package/src/screens/Device/components/SensorDisplayItem.js +51 -26
- package/src/screens/Device/detail.js +65 -38
- package/src/screens/Device/hooks/useEvaluateValue.js +0 -2
- package/src/screens/Device/hooks/useFavoriteDevice.js +4 -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 +11 -7
- package/src/screens/EmergencyContacts/EmergencyContactsList.js +1 -1
- package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +9 -10
- 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/Notification/__test__/NotificationItem.test.js +6 -30
- package/src/screens/Notification/components/NotificationItem.js +3 -19
- 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 +8 -4
- package/src/screens/ScriptDetail/index.js +7 -5
- 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 +6 -3
- package/src/screens/Sharing/Components/Styles/SensorItemStyles.js +4 -0
- package/src/screens/Sharing/Components/Styles/TitleCheckBoxStyles.js +4 -0
- package/src/screens/Sharing/Components/TitleCheckBox.js +17 -8
- package/src/screens/Sharing/Components/__test__/SensorItem.test.js +4 -2
- package/src/screens/Sharing/InfoMemberUnit.js +7 -6
- package/src/screens/Sharing/MemberList.js +4 -4
- package/src/screens/Sharing/SelectPermission.js +9 -4
- package/src/screens/Sharing/SelectUser.js +9 -5
- package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +3 -2
- 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 +14 -9
- package/src/screens/Unit/ManageUnit.js +21 -15
- package/src/screens/Unit/MyAllUnit/index.js +1 -1
- package/src/screens/Unit/SelectAddToFavorites.js +11 -2
- 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 +8 -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 +25 -10
- package/src/utils/I18n/translations/vi.json +22 -9
- package/src/utils/Route/index.js +22 -10
- 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 -307
- 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
|
@@ -4,8 +4,9 @@ import React, {
|
|
|
4
4
|
useMemo,
|
|
5
5
|
useState,
|
|
6
6
|
useRef,
|
|
7
|
+
useContext,
|
|
7
8
|
} from 'react';
|
|
8
|
-
import { View, TouchableOpacity } from 'react-native';
|
|
9
|
+
import { View, TouchableOpacity, Platform } from 'react-native';
|
|
9
10
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
10
11
|
import moment from 'moment';
|
|
11
12
|
import { get } from 'lodash';
|
|
@@ -33,7 +34,9 @@ import { useFavoriteDevice } from './hooks/useFavoriteDevice';
|
|
|
33
34
|
import BottomButtonView from '../../commons/BottomButtonView';
|
|
34
35
|
import Text from '../../commons/Text';
|
|
35
36
|
import { AlertAction, ButtonPopup, MenuActionMore } from '../../commons';
|
|
36
|
-
import { DEVICE_TYPE,
|
|
37
|
+
import { DEVICE_TYPE, AccessibilityLabel } from '../../configs/Constants';
|
|
38
|
+
import { SCContext } from '../../context';
|
|
39
|
+
import { Action } from '../../context/actionType';
|
|
37
40
|
|
|
38
41
|
import { usePopover } from '../../hooks/Common';
|
|
39
42
|
import { useConfigGlobalState } from '../../iot/states';
|
|
@@ -42,9 +45,12 @@ import styles from './styles';
|
|
|
42
45
|
import {
|
|
43
46
|
useIsOwnerOfUnit,
|
|
44
47
|
useBoolean,
|
|
45
|
-
|
|
48
|
+
useHomeAssistantDeviceConnected,
|
|
46
49
|
} from '../../hooks/Common';
|
|
47
|
-
import {
|
|
50
|
+
import {
|
|
51
|
+
useHomeAssistantConnection,
|
|
52
|
+
useValueEvaluations,
|
|
53
|
+
} from '../../hooks/IoT';
|
|
48
54
|
import { SensorDisplayItem } from './components/SensorDisplayItem';
|
|
49
55
|
import { useSCContextSelector } from '../../context';
|
|
50
56
|
import { EmergencyCountdown } from './components/EmergencyCountdown';
|
|
@@ -60,20 +66,24 @@ const DeviceDetail = ({ route }) => {
|
|
|
60
66
|
const t = useTranslations();
|
|
61
67
|
const navigation = useNavigation();
|
|
62
68
|
const token = useSCContextSelector((state) => state.auth.account.token);
|
|
69
|
+
const { isLockWhenPickColor } = useSCContextSelector((state) => state.app);
|
|
70
|
+
const { setAction } = useContext(SCContext);
|
|
63
71
|
const [offsetTitle, setOffsetTitle] = useState(1);
|
|
64
72
|
const [display, setDisplay] = useState({ items: [] });
|
|
65
|
-
const [
|
|
73
|
+
const [displayValuesData, setDisplayValuesData] = useState({
|
|
74
|
+
configs: [],
|
|
75
|
+
isConnected: false,
|
|
76
|
+
lastUpdated: null,
|
|
77
|
+
});
|
|
66
78
|
const [controlOptions, setControlOptions] = useState({
|
|
67
79
|
internet: {},
|
|
68
80
|
});
|
|
69
|
-
const [isConnected, setConnected] = useState(false);
|
|
70
|
-
const [lastUpdated, setLastUpdated] = useState(null);
|
|
71
81
|
const [lastEvent, setLastEvent] = useState({ id: 0, reportedAt: 0 });
|
|
72
82
|
const [maxValue, setMaxValue] = useState(60);
|
|
73
83
|
// eslint-disable-next-line no-unused-vars
|
|
74
84
|
const [configValues, setConfigValues] = useConfigGlobalState('configValues');
|
|
75
85
|
|
|
76
|
-
const { unitData, unitId, sensorData, sensorId } = route
|
|
86
|
+
const { unitData, unitId, sensorData, sensorId } = route?.params || {};
|
|
77
87
|
const [unit, setUnit] = useState(unitData || { id: unitId });
|
|
78
88
|
const [sensor, setSensor] = useState(sensorData || { id: sensorId });
|
|
79
89
|
const [station, setStation] = useState(sensor?.station);
|
|
@@ -95,8 +105,10 @@ const DeviceDetail = ({ route }) => {
|
|
|
95
105
|
const isBluetoothEnabled = useSCContextSelector((state) => {
|
|
96
106
|
return state.app.isBluetoothEnabled;
|
|
97
107
|
});
|
|
98
|
-
const {
|
|
99
|
-
|
|
108
|
+
const {
|
|
109
|
+
isConnected: isHomeAssistantConnected,
|
|
110
|
+
isConnecting: isHomeAssistantConnecting,
|
|
111
|
+
} = useHomeAssistantDeviceConnected(sensor);
|
|
100
112
|
|
|
101
113
|
const isDeviceConnectedViaBle = useMemo(
|
|
102
114
|
() =>
|
|
@@ -169,7 +181,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
169
181
|
}
|
|
170
182
|
}, [fetchUnitDetail, unitId, unitData]);
|
|
171
183
|
|
|
172
|
-
const {
|
|
184
|
+
const { connectHomeAssistant } = useHomeAssistantConnection();
|
|
173
185
|
|
|
174
186
|
useEffect(() => {
|
|
175
187
|
if (
|
|
@@ -178,7 +190,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
178
190
|
isNetworkConnected
|
|
179
191
|
) {
|
|
180
192
|
(async () => {
|
|
181
|
-
await
|
|
193
|
+
await connectHomeAssistant(unit.remote_control_options.googlehome);
|
|
182
194
|
})();
|
|
183
195
|
}
|
|
184
196
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -186,7 +198,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
186
198
|
|
|
187
199
|
const fetchSensorDetail = useCallback(async () => {
|
|
188
200
|
const { success, data, resp_status } = await axiosGet(
|
|
189
|
-
API.DEVICE.SENSOR_DETAIL(sensorId)
|
|
201
|
+
API.DEVICE.SENSOR_DETAIL(sensorId || sensor?.id)
|
|
190
202
|
);
|
|
191
203
|
if (success) {
|
|
192
204
|
setSensor(data);
|
|
@@ -195,7 +207,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
195
207
|
} else if (resp_status === 404) {
|
|
196
208
|
setShowPreventAccess();
|
|
197
209
|
}
|
|
198
|
-
}, [sensorId, setShowPreventAccess]);
|
|
210
|
+
}, [sensor, sensorId, setShowPreventAccess]);
|
|
199
211
|
|
|
200
212
|
useEffect(() => {
|
|
201
213
|
if (sensorId && !sensorData) {
|
|
@@ -424,6 +436,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
424
436
|
}, [sensor, fetchDataDeviceDetail]);
|
|
425
437
|
|
|
426
438
|
const onRefresh = useCallback(() => {
|
|
439
|
+
fetchSensorDetail();
|
|
427
440
|
fetchDataDeviceDetail();
|
|
428
441
|
if (
|
|
429
442
|
unit.remote_control_options &&
|
|
@@ -431,7 +444,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
431
444
|
isNetworkConnected
|
|
432
445
|
) {
|
|
433
446
|
(async () => {
|
|
434
|
-
await
|
|
447
|
+
await connectHomeAssistant(unit.remote_control_options.googlehome);
|
|
435
448
|
})();
|
|
436
449
|
}
|
|
437
450
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -447,7 +460,9 @@ const DeviceDetail = ({ route }) => {
|
|
|
447
460
|
|
|
448
461
|
const data = item.configuration.configs.map((config) => {
|
|
449
462
|
const configValue = configValues[config.id]?.value;
|
|
450
|
-
const displayValue =
|
|
463
|
+
const displayValue = (displayValuesData.configs || []).find(
|
|
464
|
+
(k) => k.id === config.id
|
|
465
|
+
);
|
|
451
466
|
if (
|
|
452
467
|
(configValue === null || configValue === undefined) &&
|
|
453
468
|
!displayValue
|
|
@@ -466,7 +481,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
466
481
|
});
|
|
467
482
|
return data.filter((value) => value);
|
|
468
483
|
},
|
|
469
|
-
[configValues,
|
|
484
|
+
[configValues, displayValuesData, evaluateValue]
|
|
470
485
|
);
|
|
471
486
|
|
|
472
487
|
useEffect(() => {
|
|
@@ -501,17 +516,23 @@ const DeviceDetail = ({ route }) => {
|
|
|
501
516
|
}
|
|
502
517
|
);
|
|
503
518
|
if (success) {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
data.last_updated = data.last_updated
|
|
519
|
+
data.isConnected = data.is_connected;
|
|
520
|
+
data.lastUpdated = data.last_updated
|
|
507
521
|
? moment(data.last_updated)
|
|
508
522
|
: data.last_updated;
|
|
509
|
-
|
|
510
|
-
|
|
523
|
+
setDisplayValuesData((prevState) => {
|
|
524
|
+
if (prevState.isConnected !== data.isConnected) {
|
|
525
|
+
setAction(Action.SET_DEVICES_STATUS, [
|
|
526
|
+
{ id: sensor?.id, is_connected: data.is_connected },
|
|
527
|
+
]);
|
|
528
|
+
}
|
|
529
|
+
return data;
|
|
530
|
+
});
|
|
511
531
|
} else if (resp_status >= 500) {
|
|
512
532
|
setServerDown(true);
|
|
513
533
|
}
|
|
514
|
-
|
|
534
|
+
loading.isConnected &&
|
|
535
|
+
setLoading((preState) => ({ ...preState, isConnected: false }));
|
|
515
536
|
};
|
|
516
537
|
if (
|
|
517
538
|
sensor?.is_managed_by_backend &&
|
|
@@ -524,7 +545,8 @@ const DeviceDetail = ({ route }) => {
|
|
|
524
545
|
Object.keys(sensor).length > 1 &&
|
|
525
546
|
setLoading((preState) => ({ ...preState, isConnected: false }));
|
|
526
547
|
}
|
|
527
|
-
|
|
548
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
549
|
+
}, [sensor, display, loading.isConnected]);
|
|
528
550
|
|
|
529
551
|
const isShowEmergencyResolve =
|
|
530
552
|
display.items.filter(
|
|
@@ -563,17 +585,19 @@ const DeviceDetail = ({ route }) => {
|
|
|
563
585
|
return (
|
|
564
586
|
<SensorConnectStatusViewHeader
|
|
565
587
|
sensor={sensor}
|
|
566
|
-
connectedViaNetwork={
|
|
588
|
+
connectedViaNetwork={
|
|
589
|
+
isNetworkConnected && displayValuesData.isConnected
|
|
590
|
+
}
|
|
567
591
|
connectedViaBle={
|
|
568
|
-
(!isNetworkConnected ||
|
|
592
|
+
(!isNetworkConnected ||
|
|
593
|
+
(isNetworkConnected && !displayValuesData.isConnected)) &&
|
|
569
594
|
isDeviceConnectedViaBle
|
|
570
595
|
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
lastUpdated={lastUpdated}
|
|
596
|
+
connectedViaHomeAssistant={isHomeAssistantConnected}
|
|
597
|
+
isHomeAssistantConnecting={isHomeAssistantConnecting}
|
|
598
|
+
lastUpdated={displayValuesData.lastUpdated}
|
|
574
599
|
isDisplayTime={isShowSetupEmergencyContact ? false : isDisplayTime}
|
|
575
600
|
showWindDirection={showWindDirection}
|
|
576
|
-
isGGHomeConnected={isGGHomeConnected}
|
|
577
601
|
isDeviceHasBle={isDeviceHasBle}
|
|
578
602
|
>
|
|
579
603
|
{display.items.map((item) => {
|
|
@@ -584,7 +608,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
584
608
|
default:
|
|
585
609
|
return (
|
|
586
610
|
<SensorDisplayItem
|
|
587
|
-
|
|
611
|
+
accessibilityLabel={AccessibilityLabel.SENSOR_DISPLAY_ITEM}
|
|
588
612
|
key={item.id.toString()}
|
|
589
613
|
item={item}
|
|
590
614
|
emergency={onEmergencyButtonPress}
|
|
@@ -607,7 +631,9 @@ const DeviceDetail = ({ route }) => {
|
|
|
607
631
|
case 'slider_range_template':
|
|
608
632
|
return (
|
|
609
633
|
<SensorDisplayItem
|
|
610
|
-
|
|
634
|
+
accessibilityLabel={
|
|
635
|
+
AccessibilityLabel.SENSOR_DISPLAY_ITEM
|
|
636
|
+
}
|
|
611
637
|
key={item.id.toString()}
|
|
612
638
|
item={item}
|
|
613
639
|
emergency={onEmergencyButtonPress}
|
|
@@ -675,7 +701,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
675
701
|
<TouchableOpacity
|
|
676
702
|
style={styles.buttonStar}
|
|
677
703
|
onPress={isFavorite ? removeFromFavorites : addToFavorites}
|
|
678
|
-
|
|
704
|
+
accessibilityLabel={AccessibilityLabel.HEADER_DEVICE_BUTTON_STAR}
|
|
679
705
|
>
|
|
680
706
|
{isFavorite ? (
|
|
681
707
|
<IconFill name="star" size={25} color={Colors.Yellow6} />
|
|
@@ -694,7 +720,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
694
720
|
style={styles.button}
|
|
695
721
|
onPress={handleShowMenuAction}
|
|
696
722
|
ref={refMenuAction}
|
|
697
|
-
|
|
723
|
+
accessibilityLabel={AccessibilityLabel.HEADER_DEVICE_BUTTON_MORE}
|
|
698
724
|
>
|
|
699
725
|
<Icon name={'more'} size={27} color={Colors.Black} />
|
|
700
726
|
</TouchableOpacity>
|
|
@@ -717,6 +743,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
717
743
|
headerAniStyle={styles.header}
|
|
718
744
|
rightComponent={HeaderRight}
|
|
719
745
|
onRefresh={onRefresh}
|
|
746
|
+
scrollEnabled={!(Platform.OS === 'ios' && isLockWhenPickColor)}
|
|
720
747
|
>
|
|
721
748
|
<View style={styles.wrapTemplate}>
|
|
722
749
|
{loading.displayTemplate === false &&
|
|
@@ -725,7 +752,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
725
752
|
renderSensorConnected()}
|
|
726
753
|
</View>
|
|
727
754
|
{isNetworkConnected &&
|
|
728
|
-
isConnected &&
|
|
755
|
+
displayValuesData?.isConnected &&
|
|
729
756
|
isShowSetupEmergencyContact &&
|
|
730
757
|
canManageSubUnit && (
|
|
731
758
|
<BottomButtonView
|
|
@@ -783,7 +810,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
783
810
|
onHide={releaseLockShowing}
|
|
784
811
|
/>
|
|
785
812
|
<ButtonPopup
|
|
786
|
-
|
|
813
|
+
accessibilityLabel={AccessibilityLabel.BUTTON_POPUP_RESOLVED}
|
|
787
814
|
visible={showPopupResolveSuccess && !lockShowing}
|
|
788
815
|
mainTitle={t('ok')}
|
|
789
816
|
onPressMain={onCloseShowPopupResolveSuccess}
|
|
@@ -793,14 +820,14 @@ const DeviceDetail = ({ route }) => {
|
|
|
793
820
|
>
|
|
794
821
|
<View style={styles.locationName}>
|
|
795
822
|
<Text
|
|
796
|
-
|
|
823
|
+
accessibilityLabel={AccessibilityLabel.BUTTON_POPUP_RESOLVED_TITLE}
|
|
797
824
|
type="H4"
|
|
798
825
|
style={styles.textName}
|
|
799
826
|
>
|
|
800
827
|
{unit?.name} - {sensor?.station?.name}
|
|
801
828
|
</Text>
|
|
802
829
|
<IconFill
|
|
803
|
-
|
|
830
|
+
accessibilityLabel={AccessibilityLabel.BUTTON_POPUP_RESOLVED_ICON}
|
|
804
831
|
name="check-circle"
|
|
805
832
|
size={42}
|
|
806
833
|
color={Colors.Green6}
|
|
@@ -11,7 +11,6 @@ const evaluateRange = (value, configuration) => {
|
|
|
11
11
|
}
|
|
12
12
|
*/
|
|
13
13
|
if (!value) {
|
|
14
|
-
// eslint-disable-next-line no-param-reassign
|
|
15
14
|
value = 0;
|
|
16
15
|
}
|
|
17
16
|
|
|
@@ -46,7 +45,6 @@ const evaluateBoolean = (value, configuration) => {
|
|
|
46
45
|
}
|
|
47
46
|
*/
|
|
48
47
|
if (!value) {
|
|
49
|
-
// eslint-disable-next-line no-param-reassign
|
|
50
48
|
value = 0;
|
|
51
49
|
}
|
|
52
50
|
if (value === configuration.on?.value) {
|
|
@@ -17,14 +17,16 @@ export const useFavoriteDevice = (device) => {
|
|
|
17
17
|
API.DEVICE.ADD_TO_FAVOURITES(device?.id)
|
|
18
18
|
);
|
|
19
19
|
success && setAction(Action.ADD_DEVICES_TO_FAVORITES, [device.id]);
|
|
20
|
-
|
|
20
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21
|
+
}, [device]);
|
|
21
22
|
|
|
22
23
|
const removeFromFavorites = useCallback(async () => {
|
|
23
24
|
const { success } = await axiosPost(
|
|
24
25
|
API.DEVICE.REMOVE_FROM_FAVOURITES(device?.id)
|
|
25
26
|
);
|
|
26
27
|
success && setAction(Action.REMOVE_DEVICES_FROM_FAVORITES, [device.id]);
|
|
27
|
-
|
|
28
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
29
|
+
}, [device]);
|
|
28
30
|
|
|
29
31
|
return {
|
|
30
32
|
isFavorite,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { create } from 'react-test-renderer';
|
|
3
3
|
import { act } from '@testing-library/react-hooks';
|
|
4
|
-
import {
|
|
4
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
5
5
|
import DeviceInfo from '../';
|
|
6
6
|
import { View } from 'react-native';
|
|
7
7
|
import { SCProvider } from '../../../context';
|
|
@@ -48,19 +48,23 @@ describe('Test DeviceInfo', () => {
|
|
|
48
48
|
});
|
|
49
49
|
const instance = tree.root;
|
|
50
50
|
const battety = instance.findAll(
|
|
51
|
-
(el) =>
|
|
51
|
+
(el) =>
|
|
52
|
+
el.props.accessibilityLabel ===
|
|
53
|
+
AccessibilityLabel.DEVICE_INFO_BATTERY && el.type === View
|
|
52
54
|
);
|
|
53
55
|
expect(battety.length).toEqual(1);
|
|
54
56
|
|
|
55
57
|
const rssiNode = instance.findAll(
|
|
56
58
|
(el) =>
|
|
57
|
-
el.props.
|
|
59
|
+
el.props.accessibilityLabel ===
|
|
60
|
+
AccessibilityLabel.DEVICE_INFO_RSSI_NODE && el.type === View
|
|
58
61
|
);
|
|
59
62
|
expect(rssiNode.length).toEqual(1);
|
|
60
63
|
|
|
61
64
|
const chip = instance.findAll(
|
|
62
65
|
(el) =>
|
|
63
|
-
el.props.
|
|
66
|
+
el.props.accessibilityLabel ===
|
|
67
|
+
AccessibilityLabel.DEVICE_INFO_CHIP_INFO && el.type === View
|
|
64
68
|
);
|
|
65
69
|
expect(chip.length).toEqual(5);
|
|
66
70
|
});
|
|
@@ -5,7 +5,7 @@ import { HeaderCustom } from '../../commons/Header';
|
|
|
5
5
|
import { useRoute } from '@react-navigation/native';
|
|
6
6
|
import Text from '../../commons/Text';
|
|
7
7
|
import styles from './DeviceInfoStyles';
|
|
8
|
-
import {
|
|
8
|
+
import { AccessibilityLabel } from '../../configs/Constants';
|
|
9
9
|
|
|
10
10
|
const DeviceInfo = () => {
|
|
11
11
|
const t = useTranslations();
|
|
@@ -13,10 +13,10 @@ const DeviceInfo = () => {
|
|
|
13
13
|
const { deviceInfo } = params;
|
|
14
14
|
const configuration = deviceInfo[0] ? deviceInfo[0].configuration : {};
|
|
15
15
|
|
|
16
|
-
const renderRow = (
|
|
16
|
+
const renderRow = (accessibilityLabel, textLeft, textRight) => {
|
|
17
17
|
return (
|
|
18
18
|
<>
|
|
19
|
-
<View style={styles.row}
|
|
19
|
+
<View style={styles.row} accessibilityLabel={accessibilityLabel}>
|
|
20
20
|
<Text style={styles.textLeft}>{t(textLeft)}</Text>
|
|
21
21
|
<Text style={styles.textRight}>{textRight}</Text>
|
|
22
22
|
</View>
|
|
@@ -31,21 +31,25 @@ const DeviceInfo = () => {
|
|
|
31
31
|
<View style={styles.content}>
|
|
32
32
|
{!!configuration.battery &&
|
|
33
33
|
renderRow(
|
|
34
|
-
|
|
34
|
+
AccessibilityLabel.DEVICE_INFO_BATTERY,
|
|
35
35
|
'battery',
|
|
36
36
|
configuration.battery
|
|
37
37
|
)}
|
|
38
38
|
|
|
39
39
|
{!!configuration.rssi_node &&
|
|
40
40
|
renderRow(
|
|
41
|
-
|
|
41
|
+
AccessibilityLabel.DEVICE_INFO_RSSI_NODE,
|
|
42
42
|
'rssi_node',
|
|
43
43
|
configuration.rssi_node
|
|
44
44
|
)}
|
|
45
45
|
|
|
46
46
|
{configuration.chip_info &&
|
|
47
47
|
Object.entries(configuration.chip_info).map((item) => {
|
|
48
|
-
return renderRow(
|
|
48
|
+
return renderRow(
|
|
49
|
+
AccessibilityLabel.DEVICE_INFO_CHIP_INFO,
|
|
50
|
+
item[0],
|
|
51
|
+
item[1]
|
|
52
|
+
);
|
|
49
53
|
})}
|
|
50
54
|
</View>
|
|
51
55
|
</View>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback, useContext } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
View,
|
|
4
4
|
Image,
|
|
@@ -14,20 +14,25 @@ import t from '../../hooks/Common/useTranslations';
|
|
|
14
14
|
import { Images, Colors } from '../../configs';
|
|
15
15
|
import Text from '../../commons/Text';
|
|
16
16
|
import Routes from '../../utils/Route';
|
|
17
|
-
import {
|
|
18
|
-
import { useSCContextSelector } from '../../context';
|
|
17
|
+
import { AccessibilityLabel } from '../../configs/Constants';
|
|
18
|
+
import { SCContext, useSCContextSelector } from '../../context';
|
|
19
19
|
import { CommonActions, useNavigation } from '@react-navigation/native';
|
|
20
|
+
import { Action } from '../../context/actionType';
|
|
20
21
|
|
|
21
22
|
const DrawerContainer = ({ navigation }) => {
|
|
22
23
|
const user = useSCContextSelector((state) => state.auth.account.user);
|
|
23
24
|
const { dispatch } = useNavigation();
|
|
24
|
-
const
|
|
25
|
+
const { setAction } = useContext(SCContext);
|
|
26
|
+
|
|
27
|
+
const doLogout = useCallback(() => {
|
|
25
28
|
const resetAction = CommonActions.reset({
|
|
26
29
|
index: 0,
|
|
27
30
|
routes: [{ name: Routes.Main }],
|
|
28
31
|
});
|
|
29
32
|
dispatch(resetAction);
|
|
30
|
-
|
|
33
|
+
setAction(Action.SET_IS_EDITING_TEMPLATE);
|
|
34
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
+
}, []);
|
|
31
36
|
|
|
32
37
|
const goToHelp = () => {};
|
|
33
38
|
|
|
@@ -40,7 +45,7 @@ const DrawerContainer = ({ navigation }) => {
|
|
|
40
45
|
<Image
|
|
41
46
|
source={Images.logo}
|
|
42
47
|
style={styles.logo}
|
|
43
|
-
|
|
48
|
+
accessibilityLabel={AccessibilityLabel.SIDE_MENU_LOGO}
|
|
44
49
|
/>
|
|
45
50
|
|
|
46
51
|
<View style={styles.avatarBackground}>
|
|
@@ -48,21 +53,27 @@ const DrawerContainer = ({ navigation }) => {
|
|
|
48
53
|
<Image
|
|
49
54
|
source={{ uri: user.avatar }}
|
|
50
55
|
style={styles.avatar}
|
|
51
|
-
|
|
56
|
+
accessibilityLabel={AccessibilityLabel.SIDE_MENU_AVATAR_USER}
|
|
52
57
|
/>
|
|
53
58
|
) : (
|
|
54
|
-
<View
|
|
59
|
+
<View
|
|
60
|
+
style={styles.avatar}
|
|
61
|
+
accessibilityLabel={AccessibilityLabel.SIDE_MENU_AVATAR_USER}
|
|
62
|
+
>
|
|
55
63
|
<Icon name={'user'} size={27} />
|
|
56
64
|
</View>
|
|
57
65
|
)}
|
|
58
66
|
<View style={styles.textContainer}>
|
|
59
67
|
<Text
|
|
60
68
|
style={[styles.fullName]}
|
|
61
|
-
|
|
69
|
+
accessibilityLabel={AccessibilityLabel.SIDE_MENU_USER_NAME}
|
|
62
70
|
>
|
|
63
71
|
{user?.name || ''}
|
|
64
72
|
</Text>
|
|
65
|
-
<Text
|
|
73
|
+
<Text
|
|
74
|
+
style={[styles.email]}
|
|
75
|
+
accessibilityLabel={AccessibilityLabel.SIDE_MENU_USER_PHONE}
|
|
76
|
+
>
|
|
66
77
|
{user ? user.phone_number : ''}
|
|
67
78
|
</Text>
|
|
68
79
|
</View>
|
|
@@ -75,7 +86,7 @@ const DrawerContainer = ({ navigation }) => {
|
|
|
75
86
|
onPress={goToAbloutUs}
|
|
76
87
|
image={'mail'}
|
|
77
88
|
name={t('about_us')}
|
|
78
|
-
|
|
89
|
+
accessibilityLabel={AccessibilityLabel.SIDE_MENU_POLICY_ITEM}
|
|
79
90
|
/>
|
|
80
91
|
<Row
|
|
81
92
|
onPress={doLogout}
|
|
@@ -89,7 +100,13 @@ const DrawerContainer = ({ navigation }) => {
|
|
|
89
100
|
);
|
|
90
101
|
};
|
|
91
102
|
|
|
92
|
-
export const Row = ({
|
|
103
|
+
export const Row = ({
|
|
104
|
+
name,
|
|
105
|
+
onPress,
|
|
106
|
+
image,
|
|
107
|
+
borderBottom,
|
|
108
|
+
accessibilityLabel,
|
|
109
|
+
}) => {
|
|
93
110
|
return (
|
|
94
111
|
<TouchableOpacity
|
|
95
112
|
onPress={onPress}
|
|
@@ -98,7 +115,7 @@ export const Row = ({ name, onPress, image, borderBottom, testID }) => {
|
|
|
98
115
|
styles.optionWrap,
|
|
99
116
|
borderBottom && styles.borderBottom,
|
|
100
117
|
]}
|
|
101
|
-
|
|
118
|
+
accessibilityLabel={accessibilityLabel}
|
|
102
119
|
>
|
|
103
120
|
<IconOutline name={image} size={24} />
|
|
104
121
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import React, { useCallback, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { StyleSheet, TextInput, View } from 'react-native';
|
|
3
3
|
import { useNavigation } from '@react-navigation/native';
|
|
4
4
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
5
5
|
import { Section, ViewButtonBottom } from '../../commons';
|
|
6
6
|
import WrapHeaderScrollable from '../../commons/Sharing/WrapHeaderScrollable';
|
|
7
7
|
import { API, Colors } from '../../configs';
|
|
8
|
-
import {
|
|
8
|
+
import { AccessibilityLabel } from '../../configs/Constants';
|
|
9
9
|
import { axiosPost } from '../../utils/Apis/axios';
|
|
10
10
|
import { ToastBottomHelper } from '../../utils/Utils';
|
|
11
11
|
import { isValidPhoneNumber } from '../../utils/Validation';
|
|
12
12
|
|
|
13
13
|
export const EmergencyContactsAddNew = ({ route }) => {
|
|
14
14
|
const t = useTranslations();
|
|
15
|
-
const { group } = route
|
|
15
|
+
const { group } = route?.params || {};
|
|
16
16
|
const { goBack } = useNavigation();
|
|
17
17
|
const [textName, setTextName] = useState('');
|
|
18
18
|
const [textPhone, setTextPhone] = useState('');
|
|
@@ -53,11 +53,13 @@ export const EmergencyContactsAddNew = ({ route }) => {
|
|
|
53
53
|
}, [goBack, group.id, t, textName, textPhone]);
|
|
54
54
|
|
|
55
55
|
return (
|
|
56
|
-
<
|
|
56
|
+
<View style={styles.wrap}>
|
|
57
57
|
<WrapHeaderScrollable title={t('create_contact')}>
|
|
58
58
|
<Section type={'border'}>
|
|
59
59
|
<TextInput
|
|
60
|
-
|
|
60
|
+
accessibilityLabel={
|
|
61
|
+
AccessibilityLabel.ON_CHANGE_NAME_EMERGENCY_CONTACT
|
|
62
|
+
}
|
|
61
63
|
value={textName}
|
|
62
64
|
style={styles.textInput}
|
|
63
65
|
placeholder={t('text_name')}
|
|
@@ -66,7 +68,9 @@ export const EmergencyContactsAddNew = ({ route }) => {
|
|
|
66
68
|
maxLength={64}
|
|
67
69
|
/>
|
|
68
70
|
<TextInput
|
|
69
|
-
|
|
71
|
+
accessibilityLabel={
|
|
72
|
+
AccessibilityLabel.ON_CHANGE_PHONE_EMERGENCY_CONTACT
|
|
73
|
+
}
|
|
70
74
|
value={textPhone}
|
|
71
75
|
style={styles.textInput}
|
|
72
76
|
placeholder={t('phone_number')}
|
|
@@ -87,7 +91,7 @@ export const EmergencyContactsAddNew = ({ route }) => {
|
|
|
87
91
|
onRightClick={onSave}
|
|
88
92
|
/>
|
|
89
93
|
</View>
|
|
90
|
-
</
|
|
94
|
+
</View>
|
|
91
95
|
);
|
|
92
96
|
};
|
|
93
97
|
|
|
@@ -18,7 +18,7 @@ const MAX_EMERGENCY_CONTACTS = 5;
|
|
|
18
18
|
|
|
19
19
|
export const EmergencyContactsList = ({ route }) => {
|
|
20
20
|
const t = useTranslations();
|
|
21
|
-
const { unitId, group } = route
|
|
21
|
+
const { unitId, group } = route?.params || {};
|
|
22
22
|
const { navigate } = useNavigation();
|
|
23
23
|
const isFocused = useIsFocused();
|
|
24
24
|
const [showingAddnewModal, setShowAddnewModal, setHideAddnewModal] =
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
3
|
import { IconOutline } from '@ant-design/icons-react-native';
|
|
4
4
|
import { useNavigation } from '@react-navigation/native';
|
|
5
5
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
@@ -7,7 +7,7 @@ import { Section, ViewButtonBottom } from '../../commons';
|
|
|
7
7
|
import { RowUser } from '../../commons/RowUser';
|
|
8
8
|
import WrapHeaderScrollable from '../../commons/Sharing/WrapHeaderScrollable';
|
|
9
9
|
import { API, Colors, Theme } from '../../configs';
|
|
10
|
-
import {
|
|
10
|
+
import { AccessibilityLabel } from '../../configs/Constants';
|
|
11
11
|
|
|
12
12
|
import { axiosGet, axiosPost } from '../../utils/Apis/axios';
|
|
13
13
|
import { ToastBottomHelper } from '../../utils/Utils';
|
|
@@ -17,7 +17,7 @@ const MAX_EMERGENCY_CONTACTS = 5;
|
|
|
17
17
|
export const EmergencyContactsSelectContacts = ({ route }) => {
|
|
18
18
|
const t = useTranslations();
|
|
19
19
|
const { goBack } = useNavigation();
|
|
20
|
-
const { unitId, group, lengthListContacts } = route
|
|
20
|
+
const { unitId, group, lengthListContacts } = route?.params || {};
|
|
21
21
|
const [dataContact, setDataContact] = useState([]);
|
|
22
22
|
const [currentContacts, setCurrentContact] = useState([]);
|
|
23
23
|
const [loading, setLoading] = useState(true);
|
|
@@ -70,13 +70,15 @@ export const EmergencyContactsSelectContacts = ({ route }) => {
|
|
|
70
70
|
loadMembers(unitId);
|
|
71
71
|
}, [loadMembers, unitId]);
|
|
72
72
|
return (
|
|
73
|
-
<
|
|
73
|
+
<View style={styles.container}>
|
|
74
74
|
<WrapHeaderScrollable title={t('select_contacts')} loading={loading}>
|
|
75
|
-
<Section type={'border'}
|
|
75
|
+
<Section type={'border'}>
|
|
76
76
|
{dataContact.map((contact, index) => (
|
|
77
77
|
<RowUser
|
|
78
78
|
key={contact.id.toString()}
|
|
79
|
-
|
|
79
|
+
accessibilityLabel={
|
|
80
|
+
AccessibilityLabel.EMERGENCY_SELECT_CONTACT + index
|
|
81
|
+
}
|
|
80
82
|
index={index}
|
|
81
83
|
leftIcon={
|
|
82
84
|
<IconOutline name={'user'} size={20} color={Colors.White} />
|
|
@@ -108,7 +110,7 @@ export const EmergencyContactsSelectContacts = ({ route }) => {
|
|
|
108
110
|
onRightClick={goSave}
|
|
109
111
|
rightDisabled={false}
|
|
110
112
|
/>
|
|
111
|
-
</
|
|
113
|
+
</View>
|
|
112
114
|
);
|
|
113
115
|
};
|
|
114
116
|
|
|
@@ -117,9 +119,6 @@ const styles = StyleSheet.create({
|
|
|
117
119
|
flex: 1,
|
|
118
120
|
backgroundColor: Colors.Gray2,
|
|
119
121
|
},
|
|
120
|
-
section: {
|
|
121
|
-
marginTop: Platform.OS === 'ios' ? 40 : 0,
|
|
122
|
-
},
|
|
123
122
|
buttonRemove: {
|
|
124
123
|
height: 40,
|
|
125
124
|
width: 40,
|