@eohjsc/react-native-smart-city 0.3.30 → 0.3.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -5
- package/src/Images/DevMode/close.png +0 -0
- package/src/Images/DevMode/close@2x.png +0 -0
- package/src/Images/DevMode/close@3x.png +0 -0
- package/src/Images/DevMode/plus.png +0 -0
- package/src/Images/DevMode/plus@2x.png +0 -0
- package/src/Images/DevMode/plus@3x.png +0 -0
- package/src/Images/DevMode/remove_circle.png +0 -0
- package/src/Images/DevMode/remove_circle@2x.png +0 -0
- package/src/Images/DevMode/remove_circle@3x.png +0 -0
- package/src/commons/Action/ItemQuickAction.js +20 -4
- package/src/commons/Action/__test__/ItemQuickAction.test.js +35 -11
- package/src/commons/ActionGroup/ColorPickerTemplate.js +36 -17
- package/src/commons/ActionGroup/CurtainButtonTemplate.js +6 -6
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +23 -15
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapper.js +5 -2
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/__test__/index.test.js +10 -4
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/index.js +4 -4
- package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLock.js +38 -45
- package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLockStyle.js +1 -0
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscode.js +1 -1
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +2 -2
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +2 -2
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/ButtonWrapper.js +2 -2
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +12 -6
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/index.js +8 -4
- package/src/commons/ActionGroup/OnOffTemplate/OnOffButtonTemplate.js +9 -10
- package/src/commons/ActionGroup/OnOffTemplate/index.js +30 -12
- package/src/commons/ActionGroup/OneBigButtonTemplate.js +5 -5
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +51 -28
- package/src/commons/ActionGroup/SliderRangeTemplate.js +2 -2
- package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +25 -9
- package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/ControlPlay.test.js +13 -7
- package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/RectangleButton.test.js +9 -5
- package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/SmartTiviActionTemplate.test.js +25 -9
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButton.js +16 -6
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlay.js +10 -4
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/RectangleButton.js +7 -3
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +21 -7
- package/src/commons/ActionGroup/ThreeButtonTemplate.js +50 -60
- package/src/commons/ActionGroup/TwoButtonTemplate/index.js +135 -133
- package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +7 -7
- package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +3 -3
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +3 -3
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +9 -5
- package/src/commons/ActionGroup/__test__/index.test.js +7 -5
- package/src/commons/ActionGroup/index.js +35 -10
- package/src/commons/ActionTemplate/OnOffButtonAction.js +14 -5
- package/src/commons/ActionTemplate/__test__/OnOffButtonAction.test.js +23 -2
- package/src/commons/ActionTemplate/__test__/index.test.js +2 -0
- package/src/commons/ActionTemplate/index.js +1 -0
- package/src/commons/AlertAction/index.js +2 -2
- package/src/commons/Auth/AccountItem.js +9 -3
- package/src/commons/Auth/__test__/AccountItem.test.js +6 -3
- package/src/commons/Automate/ItemAutomate.js +22 -3
- package/src/commons/BackDefault/index.js +2 -2
- package/src/commons/BottomButtonView/index.js +4 -5
- package/src/commons/Button/index.js +0 -2
- package/src/commons/ButtonPopup/index.js +3 -3
- package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +3 -2
- package/src/commons/Dashboard/MyPinnedSharedUnit/index.js +4 -2
- package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +6 -3
- package/src/commons/Dashboard/MyUnit/index.js +5 -3
- package/src/commons/DevMode/CardDevMode.js +42 -0
- package/src/commons/DevMode/EmptyComponent.js +18 -0
- package/src/commons/DevMode/Item.js +21 -0
- package/src/commons/DevMode/Styles/CardStyles.js +40 -0
- package/src/commons/DevMode/Styles/EmptyComponentStyles.js +15 -0
- package/src/commons/DevMode/Styles/ItemStyles.js +27 -0
- package/src/commons/DevMode/Styles/TextWithLabelStyles.js +36 -0
- package/src/commons/DevMode/TextWithLabel.js +30 -0
- package/src/commons/DevMode/index.js +5 -1
- package/src/commons/Device/ConnectedViewHeader.js +2 -2
- package/src/commons/Device/DeviceAlertStatus.js +3 -3
- package/src/commons/Device/DisconnectedView.js +2 -2
- package/src/commons/Device/Emergency/EmergencyButton.js +2 -2
- package/src/commons/Device/Emergency/EmergencyDetail.js +1 -1
- package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +3 -2
- package/src/commons/Device/FlatListItems.js +2 -2
- package/src/commons/Device/ItemAddNew/index.js +7 -12
- package/src/commons/Device/ItemDevice.js +16 -11
- package/src/commons/Device/PMSensor/PMSensorIndicatior.js +1 -1
- package/src/commons/Device/RainningSensor/CurrentRainSensor.js +1 -1
- package/src/commons/Device/SensorConnectedStatus.js +5 -2
- package/src/commons/Device/WindDirection/Compass/index.js +6 -3
- package/src/commons/Device/WindSpeed/Anemometer/index.js +1 -1
- package/src/commons/Device/__test__/DeviceAlertStatus.test.js +8 -4
- package/src/commons/Device/__test__/FlatListItems.test.js +3 -2
- package/src/commons/Device/__test__/SensorConnectedStatus.test.js +4 -2
- package/src/commons/Explore/ActivityIndicator/index.js +5 -2
- package/src/commons/Explore/SearchBox/__test__/SearchBox.test.js +3 -3
- package/src/commons/Explore/SearchBox/index.js +2 -2
- package/src/commons/FieldTemplate/ChooseUserField/ChoosePopup.js +4 -4
- package/src/commons/FieldTemplate/ChooseUserField/__test__/index.test.js +11 -8
- package/src/commons/FieldTemplate/ChooseUserField/index.js +2 -2
- package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +3 -2
- package/src/commons/FieldTemplate/PasscodeField/index.js +2 -2
- package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +12 -7
- package/src/commons/Form/TextInput.js +2 -2
- package/src/commons/Form/TextInputPassword.js +2 -2
- package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +5 -3
- package/src/commons/GroupCheckBox/index.js +2 -2
- package/src/commons/Header/HeaderCustom.js +8 -2
- package/src/commons/HeaderAni/index.js +2 -3
- package/src/commons/MediaPlayerDetail/index.js +2 -2
- package/src/commons/MenuActionList/index.js +2 -2
- package/src/commons/MenuActionMore/index.js +5 -4
- package/src/commons/NavBar/index.js +2 -3
- package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +12 -6
- package/src/commons/OneTapTemplate/OptionsDropdownActionTemplate.js +7 -3
- package/src/commons/OneTapTemplate/StatesGridActionTemplate.js +4 -2
- package/src/commons/OneTapTemplate/__test__/NumberUpDownActionTemplate.test.js +11 -8
- package/src/commons/OneTapTemplate/__test__/OptionsDropdownActionTemplate.test.js +9 -5
- package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +5 -3
- package/src/commons/Popover/index.js +2 -13
- package/src/commons/PreventAccess/__test__/PreventAccess.test.js +5 -3
- package/src/commons/PreventAccess/index.js +3 -3
- package/src/commons/{Connecting → Processing}/__test__/Connecting.test.js +5 -4
- package/src/commons/Processing/index.js +93 -0
- package/src/commons/{Connecting → Processing}/styles.js +9 -1
- package/src/commons/SelectGateway/index.js +105 -0
- package/src/commons/SelectGateway/styles.js +55 -0
- package/src/commons/SelectSubUnit/__test__/SelectSubUnit.test.js +106 -0
- package/src/commons/SelectSubUnit/index.js +124 -0
- package/src/commons/SelectSubUnit/styles.js +55 -0
- package/src/commons/SelectUnit/__test__/SelectUnit.test.js +120 -0
- package/src/commons/SelectUnit/index.js +106 -0
- package/src/commons/SelectUnit/styles.js +54 -0
- package/src/commons/Sharing/WrapHeaderScrollable.js +6 -4
- package/src/commons/SubUnit/OneTap/ItemOneTap.js +4 -4
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +25 -10
- package/src/commons/SubUnit/OneTap/index.js +9 -4
- package/src/commons/SubUnit/ShortDetail.js +11 -29
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +15 -10
- package/src/commons/SummaryItem/index.js +2 -2
- package/src/commons/Tabbar/__test__/index.test.js +97 -0
- package/src/commons/Unit/HeaderUnit/index.js +4 -5
- package/src/commons/Unit/SharedUnit.js +10 -8
- package/src/commons/Unit/__test__/HeaderUnit.test.js +13 -5
- package/src/commons/Unit/__test__/SharedUnit.test.js +30 -11
- package/src/commons/UnitSummary/AirQuality/__test__/index.test.js +13 -8
- package/src/commons/UnitSummary/AirQuality/index.js +7 -3
- package/src/commons/UnitSummary/TotalPowerBox.js +2 -2
- package/src/commons/UnitSummary/TotalPowerConsumption/index.js +2 -2
- package/src/commons/UnitSummary/__test__/TotalPowerBox.test.js +3 -2
- package/src/commons/UnitSummary/__test__/TotalPowerConsumption.test.js +4 -2
- package/src/commons/ViewButtonBottom/index.js +4 -4
- package/src/commons/WheelDateTimePicker/index.js +5 -3
- package/src/commons/WrapParallaxScrollView/index.js +2 -1
- package/src/configs/API.js +12 -14
- package/src/configs/AccessibilityLabel.js +611 -0
- package/src/configs/Colors.js +4 -0
- package/src/configs/Constants.js +1 -604
- package/src/configs/Images.js +3 -0
- package/src/context/actionType.ts +19 -3
- package/src/context/mockStore.ts +18 -3
- package/src/context/reducer.ts +66 -9
- package/src/hoc/__test__/withRemoteControl.test.js +24 -0
- package/src/hoc/withRemoteControl.js +1 -0
- package/src/hooks/Common/__test__/useAndroidTranslucentStatusBar.test.js +55 -0
- package/src/hooks/Common/index.js +2 -2
- package/src/hooks/Common/useDevicesStatus.js +19 -15
- package/src/hooks/Common/{useGGHomeDeviceConnected.js → useHomeAssistantDeviceConnected.js} +3 -3
- package/src/hooks/Common/usePopover.js +6 -1
- package/src/hooks/IoT/__test__/{useGGHomeConnection.test.js → useHomeAssistantConnection.test.js} +18 -18
- package/src/hooks/IoT/__test__/useRemoteControl.test.js +17 -12
- package/src/hooks/IoT/index.js +2 -2
- package/src/hooks/IoT/useHomeAssistantConnection.js +91 -0
- package/src/hooks/IoT/useRemoteControl.js +6 -6
- package/src/hooks/__test__/useInitDeepLink.test.js +28 -0
- package/src/hooks/useReceiveNotifications.js +2 -4
- package/src/iot/RemoteControl/{GoogleHome.js → HomeAssistant.js} +21 -17
- package/src/iot/RemoteControl/LG.js +2 -1
- package/src/iot/RemoteControl/__test__/{GoogleHome.test.js → HomeAssistant.test.js} +30 -30
- package/src/navigations/AddDeviceStack.js +0 -14
- package/src/navigations/AddGatewayStack.js +51 -21
- package/src/navigations/Main.js +28 -4
- package/src/navigations/SmartIrStack.js +3 -3
- package/src/navigations/UnitStack.js +1 -1
- package/src/screens/AQIGuide/__test__/AQIGuide.test.js +5 -3
- package/src/screens/AQIGuide/index.js +5 -3
- package/src/screens/ActivityLog/FilterPopup.js +2 -2
- package/src/screens/ActivityLog/__test__/FilterPopup.test.js +2 -2
- package/src/screens/ActivityLog/__test__/index.test.js +3 -2
- package/src/screens/ActivityLog/index.js +3 -3
- package/src/screens/AddCommon/SelectSubUnit.js +44 -191
- package/src/screens/AddCommon/SelectUnit.js +51 -204
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +7 -50
- package/src/screens/AddCommon/__test__/SelectUnit.test.js +28 -26
- package/src/screens/AddLocationMaps/__test__/index.test.js +13 -7
- package/src/screens/AddLocationMaps/index.js +3 -3
- package/src/screens/AddNewAction/Device/index.js +2 -2
- package/src/screens/AddNewAction/SelectAction.js +16 -7
- package/src/screens/AddNewAction/SelectSensorDevices.js +3 -3
- package/src/screens/AddNewAction/__test__/SelectAction.test.js +2 -2
- package/src/screens/AddNewAction/__test__/SelectSensorDevices.test.js +8 -3
- package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +11 -7
- package/src/screens/AddNewAutoSmart/index.js +9 -12
- package/src/screens/AddNewDevice/ConnectingDevices.js +1 -1
- package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +7 -4
- package/src/screens/AddNewDevice/index.js +4 -4
- package/src/screens/AddNewGateway/ConnectingDevice.js +40 -0
- package/src/screens/AddNewGateway/ConnectingModbusDevice.js +61 -0
- package/src/screens/AddNewGateway/ConnectingWifiDevice.js +70 -0
- package/src/screens/AddNewGateway/ConnectingZigbeeDevice.js +60 -0
- package/src/screens/AddNewGateway/PlugAndPlay/FirstWarning.js +21 -8
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +23 -4
- package/src/screens/AddNewGateway/RenameNewDevices.js +141 -0
- package/src/screens/AddNewGateway/RenameNewDevicesStyles.js +75 -0
- package/src/screens/AddNewGateway/ScanGatewayQR.js +57 -0
- package/src/screens/AddNewGateway/ScanModbusQR.js +53 -0
- package/src/screens/AddNewGateway/ScanWifiDeviceQR.js +55 -0
- package/src/screens/AddNewGateway/SelectDeviceSubUnit.js +31 -0
- package/src/screens/AddNewGateway/SelectDeviceType.js +52 -0
- package/src/screens/AddNewGateway/SelectDeviceUnit.js +29 -0
- package/src/screens/AddNewGateway/SelectModbusGateway.js +34 -0
- package/src/screens/AddNewGateway/SelectZigbeeGateway.js +34 -0
- package/src/screens/AddNewGateway/ShareWifiPassword.js +302 -0
- package/src/screens/AddNewGateway/ShareWifiPasswordStyles.js +44 -0
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +7 -4
- package/src/screens/AddNewGateway/__test__/ConnectingModbusDevice.test.js +63 -0
- package/src/screens/AddNewGateway/__test__/{SelectGateway.test.js → ConnectingWifiDevice.test.js} +15 -10
- package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +62 -0
- package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +191 -0
- package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +73 -0
- package/src/screens/AddNewGateway/__test__/ScanModbusQR.test.js +75 -0
- package/src/screens/AddNewGateway/__test__/ScanWifiDeviceQR.test.js +73 -0
- package/src/screens/AddNewGateway/__test__/SelectDeviceSubUnit.test.js +47 -0
- package/src/screens/AddNewGateway/__test__/SelectDeviceType.test.js +89 -0
- package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +48 -0
- package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +77 -0
- package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +77 -0
- package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +294 -0
- package/src/screens/AddNewGateway/hooks/__Tests__/index.test.js +27 -0
- package/src/screens/AddNewGateway/index.js +4 -4
- package/src/screens/AddNewOneTap/__test__/AddNewOneTap.test.js +5 -4
- package/src/screens/AddNewOneTap/index.js +4 -4
- package/src/screens/Automate/__test__/index.test.js +2 -2
- package/src/screens/Automate/index.js +6 -2
- package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +3 -2
- package/src/screens/ConfirmUnitDeletion/index.js +3 -3
- package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +5 -5
- package/src/screens/Device/EditDevice/index.js +3 -3
- package/src/screens/Device/__test__/detail.test.js +38 -22
- package/src/screens/Device/components/DetailHistoryChart.js +7 -5
- package/src/screens/Device/components/SensorConnectStatusViewHeader.js +6 -6
- package/src/screens/Device/components/SensorDisplayItem.js +51 -26
- package/src/screens/Device/detail.js +31 -23
- package/src/screens/Device/hooks/useEvaluateValue.js +0 -2
- package/src/screens/DeviceInfo/__test__/index.test.js +8 -4
- package/src/screens/DeviceInfo/index.js +10 -6
- package/src/screens/Drawer/index.js +30 -13
- package/src/screens/EmergencyContacts/EmergencyContactsAddNew.js +8 -4
- package/src/screens/EmergencyContacts/EmergencyContactsList.js +1 -1
- package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +5 -3
- package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +9 -5
- package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +7 -3
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +7 -3
- package/src/screens/EmergencySetting/__test__/DropDownItem.test.js +3 -2
- package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
- package/src/screens/EnterPassword/__test__/EnterPassword.test.js +6 -3
- package/src/screens/EnterPassword/index.js +5 -3
- package/src/screens/GuestInfo/__test__/index.test.js +18 -12
- package/src/screens/GuestInfo/components/AccessScheduleItem.js +2 -2
- package/src/screens/GuestInfo/components/AccessScheduleSheet.js +3 -3
- package/src/screens/GuestInfo/components/HeaderGuestInfo.js +2 -2
- package/src/screens/GuestInfo/components/RecurringDetail.js +4 -4
- package/src/screens/GuestInfo/components/TemporaryDetail.js +3 -3
- package/src/screens/GuestInfo/index.js +1 -1
- package/src/screens/HanetCamera/Detail.js +10 -4
- package/src/screens/HanetCamera/ManageAccess.js +4 -4
- package/src/screens/HanetCamera/MemberInfo.js +1 -1
- package/src/screens/HanetCamera/__test__/Detail.test.js +5 -3
- package/src/screens/HanetCamera/__test__/ManageAccess.test.js +10 -4
- package/src/screens/HanetCamera/__test__/MemberInfo.test.js +4 -2
- package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +2 -2
- package/src/screens/ManageAccess/index.js +1 -1
- package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +4 -4
- package/src/screens/MoveToAnotherSubUnit/index.js +2 -2
- package/src/screens/PlayBackCamera/__test__/index.test.js +9 -6
- package/src/screens/PlayBackCamera/index.js +6 -6
- package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +1 -1
- package/src/screens/ScanChipQR/components/QRScan/index.js +10 -3
- package/src/screens/ScriptDetail/__test__/index.test.js +43 -38
- package/src/screens/ScriptDetail/index.js +26 -16
- package/src/screens/SelectUnit/__test__/index.test.js +4 -3
- package/src/screens/SelectUnit/index.js +3 -3
- package/src/screens/SetSchedule/index.js +1 -1
- package/src/screens/Sharing/Components/{SensorItem.js → DeviceItem.js} +16 -22
- package/src/screens/Sharing/Components/Styles/{SensorItemStyles.js → DeviceItemStyles.js} +0 -0
- package/src/screens/Sharing/Components/__test__/{SensorItem.test.js → DeviceItem.test.js} +10 -8
- package/src/screens/Sharing/Components/index.js +2 -2
- package/src/screens/Sharing/InfoMemberUnit.js +7 -6
- package/src/screens/Sharing/MemberList.js +4 -4
- package/src/screens/Sharing/SelectPermission.js +72 -72
- package/src/screens/Sharing/SelectUser.js +9 -5
- package/src/screens/Sharing/Styles/SelectPermissionStyles.js +2 -2
- package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +3 -2
- package/src/screens/Sharing/__test__/SelectPermission.test.js +12 -12
- package/src/screens/Sharing/__test__/SelectUser.test.js +7 -4
- package/src/screens/SideMenuDetail/__test__/index.test.js +11 -7
- package/src/screens/SideMenuDetail/index.js +2 -2
- package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +4 -2
- package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +5 -5
- package/src/screens/SmartIr/__test__/SmartIr.test.js +14 -6
- package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +4 -2
- package/src/screens/SmartIr/components/{SelectDeviceType.js → SelectIrDeviceType.js} +2 -2
- package/src/screens/SmartIr/index.js +1 -1
- package/src/screens/SubUnit/AddSubUnit.js +7 -3
- package/src/screens/SubUnit/Detail.js +6 -6
- package/src/screens/SubUnit/EditSubUnit.js +10 -6
- package/src/screens/SubUnit/ManageSubUnit.js +2 -2
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +6 -3
- package/src/screens/SubUnit/__test__/Detail.test.js +5 -3
- package/src/screens/SubUnit/__test__/EditSubUnit.test.js +9 -5
- package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +3 -2
- package/src/screens/SyncLGDevice/AddLGDevice.js +4 -4
- package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +7 -4
- package/src/screens/TDSGuide/__test__/TDSGuide.test.js +4 -2
- package/src/screens/TDSGuide/index.js +2 -2
- package/src/screens/Template/EditTemplate.js +152 -0
- package/src/screens/Template/GatewayList.js +51 -0
- package/src/screens/Template/Information.js +41 -0
- package/src/screens/Template/Styles/EditTemplateStyle.js +109 -0
- package/src/screens/Template/Styles/GatewayStyles.js +46 -0
- package/src/screens/Template/Styles/InformationStyles.js +16 -0
- package/src/screens/Template/Styles/detailStyles.js +35 -0
- package/src/screens/Template/Styles/indexStyles.js +2 -33
- package/src/screens/Template/__test__/EditTemplate.test.js +89 -0
- package/src/screens/Template/__test__/GatewayList.test.js +26 -0
- package/src/screens/Template/__test__/Information.test.js +16 -0
- package/src/screens/Template/__test__/detail.test.js +68 -0
- package/src/screens/Template/__test__/index.test.js +26 -1
- package/src/screens/Template/detail.js +154 -0
- package/src/screens/Template/index.js +38 -32
- package/src/screens/UVIndexGuide/__test__/UVIndexGuide.test.js +3 -2
- package/src/screens/UVIndexGuide/index.js +2 -2
- package/src/screens/Unit/AddMenu.js +6 -20
- package/src/screens/Unit/ChooseLocation.js +1 -1
- package/src/screens/Unit/Detail.js +10 -10
- package/src/screens/Unit/ManageUnit.js +21 -15
- package/src/screens/Unit/MyAllUnit/index.js +1 -1
- package/src/screens/Unit/SelectAddToFavorites.js +7 -8
- package/src/screens/Unit/SelectAddress.js +4 -4
- package/src/screens/Unit/SmartAccount.js +1 -1
- package/src/screens/Unit/SmartAccountItem.js +3 -3
- package/src/screens/Unit/Station/__test__/index.test.js +19 -3
- package/src/screens/Unit/Station/index.js +2 -2
- package/src/screens/Unit/Summaries.js +2 -2
- package/src/screens/Unit/__test__/CheckSendEmail.test.js +6 -6
- package/src/screens/Unit/__test__/Detail.test.js +90 -55
- package/src/screens/Unit/__test__/ManageUnit.test.js +40 -18
- package/src/screens/Unit/__test__/SelectAddress.test.js +15 -8
- package/src/screens/Unit/__test__/SmartAccount.test.js +42 -25
- package/src/screens/Unit/__test__/SmartAccountItem.test.js +4 -3
- package/src/screens/Unit/components/AutomateScript/index.js +5 -2
- package/src/screens/Unit/components/ListMyAllUnit/index.js +1 -1
- package/src/screens/Unit/components/MyAllUnit/__test__/Header.test.js +9 -5
- package/src/screens/Unit/components/MyAllUnit/index.js +1 -1
- package/src/screens/Unit/components/MyUnitDevice/index.js +8 -5
- package/src/screens/Unit/components/SharedUnit/index.js +12 -6
- package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +2 -2
- package/src/screens/Unit/components/__test__/SharedUnit.test.js +24 -9
- package/src/screens/Unit/hook/useUnitConnectRemoteDevices.js +25 -11
- package/src/screens/UnitSummary/__test__/index.test.js +4 -2
- package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +4 -2
- package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +2 -2
- package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +4 -2
- package/src/screens/UnitSummary/components/PowerConsumption/index.js +2 -2
- package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +5 -4
- package/src/screens/UnitSummary/components/RunningDevices/index.js +6 -3
- package/src/screens/UnitSummary/components/TotalPowerBox/index.js +2 -2
- package/src/screens/UnitSummary/components/TotalPowerConsumption/index.js +2 -2
- package/src/screens/UnitSummary/components/__test__/TotalPowerBox.test.js +3 -2
- package/src/screens/UnitSummary/components/__test__/TotalPowerConsumption.test.js +4 -2
- package/src/screens/UnitSummary/index.js +10 -8
- package/src/screens/WaterQualityGuide/__test__/index.test.js +17 -12
- package/src/screens/WaterQualityGuide/index.js +26 -10
- package/src/utils/Apis/axios.js +1 -0
- package/src/utils/I18n/translations/en.json +20 -10
- package/src/utils/I18n/translations/vi.json +17 -9
- package/src/utils/Route/index.js +22 -10
- package/src/utils/Utils.js +6 -7
- package/src/commons/Connecting/index.js +0 -67
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItem.js +0 -28
- package/src/commons/ConnectingProcess/DeviceItem/DeviceItemStyles.js +0 -41
- package/src/commons/ConnectingProcess/__test__/Connecting.test.js +0 -163
- package/src/commons/ConnectingProcess/__test__/DeviceItem.test.js +0 -19
- package/src/commons/ConnectingProcess/index.js +0 -213
- package/src/commons/ConnectingProcess/styles.js +0 -69
- package/src/hooks/IoT/useGGHomeConnection.js +0 -91
- package/src/iot/RemoteControl/index.js +0 -55
- package/src/screens/AddNewDevice/ConnectDevices.js +0 -184
- package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +0 -131
- package/src/screens/AddNewGateway/ConnectedGateway.js +0 -139
- package/src/screens/AddNewGateway/ConnectingGateway.js +0 -137
- package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +0 -214
- package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +0 -319
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectWifiWarning.test.js +0 -75
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/GatewayWifiList.test.js +0 -130
- package/src/screens/AddNewGateway/SelectGateway.js +0 -133
- package/src/screens/AddNewGateway/SetupGatewayWifi.js +0 -207
- package/src/screens/AddNewGateway/__test__/ConnectedGateway.test.js +0 -71
- package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +0 -96
- package/src/screens/AddNewGateway/__test__/SetupGateway.test.js +0 -120
- package/src/screens/ScanChipQR/__test__/ScanChipQR.test.js +0 -115
- package/src/screens/ScanChipQR/hooks/index.js +0 -120
- package/src/screens/ScanChipQR/index.js +0 -29
- package/src/screens/ScanSensorQR/__test__/ScanSensorQR.test.js +0 -111
- package/src/screens/ScanSensorQR/hooks/index.js +0 -40
- package/src/screens/ScanSensorQR/index.js +0 -39
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TouchableOpacity } from 'react-native';
|
|
3
2
|
import renderer, { act } from 'react-test-renderer';
|
|
4
3
|
import SmartIr from '../index';
|
|
5
4
|
import { SCProvider } from '../../../context';
|
|
6
5
|
import { mockSCStore } from '../../../context/mockStore';
|
|
6
|
+
import AccessibilityLabel from '../../../configs/AccessibilityLabel';
|
|
7
|
+
import { TouchableWithoutFeedback } from 'react-native';
|
|
7
8
|
|
|
8
9
|
const wrapComponent = (item) => (
|
|
9
10
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -36,8 +37,13 @@ describe('Test SmartIr', () => {
|
|
|
36
37
|
tree = renderer.create(wrapComponent(item));
|
|
37
38
|
});
|
|
38
39
|
const instance = tree.root;
|
|
39
|
-
const
|
|
40
|
-
|
|
40
|
+
const itemAddNewList = instance.findAll(
|
|
41
|
+
(el) =>
|
|
42
|
+
el.props.accessibilityLabel ===
|
|
43
|
+
AccessibilityLabel.SUB_UNIT_ADD_DEVICE &&
|
|
44
|
+
el.type === TouchableWithoutFeedback
|
|
45
|
+
);
|
|
46
|
+
expect(itemAddNewList).toHaveLength(1);
|
|
41
47
|
});
|
|
42
48
|
|
|
43
49
|
test('render SmartIr on AddNew', () => {
|
|
@@ -52,10 +58,12 @@ describe('Test SmartIr', () => {
|
|
|
52
58
|
tree = renderer.create(wrapComponent(item));
|
|
53
59
|
});
|
|
54
60
|
const instance = tree.root;
|
|
55
|
-
const itemAddNew = instance.
|
|
56
|
-
|
|
61
|
+
const itemAddNew = instance.find(
|
|
62
|
+
(el) =>
|
|
63
|
+
el.props.accessibilityLabel === AccessibilityLabel.SUB_UNIT_ADD_DEVICE
|
|
64
|
+
);
|
|
57
65
|
act(() => {
|
|
58
|
-
itemAddNew
|
|
66
|
+
itemAddNew.props.onPress();
|
|
59
67
|
});
|
|
60
68
|
expect(mockNavigate).toHaveBeenCalled();
|
|
61
69
|
});
|
|
@@ -13,7 +13,7 @@ import { ButtonsBottom } from './ButtonsBottom';
|
|
|
13
13
|
import { Remote, SmartIr, Union } from '../../../../Images/SmartIr';
|
|
14
14
|
|
|
15
15
|
import styles from './GroupButtonByTypeStyles';
|
|
16
|
-
import {
|
|
16
|
+
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
17
17
|
import { notImplemented } from '../../../../utils/Utils';
|
|
18
18
|
|
|
19
19
|
const GroupButtonByType = memo(({ route }) => {
|
|
@@ -143,7 +143,9 @@ const GroupButtonByType = memo(({ route }) => {
|
|
|
143
143
|
selectionColor={Colors.Primary}
|
|
144
144
|
/>
|
|
145
145
|
<ButtonsBottom
|
|
146
|
-
|
|
146
|
+
accessibilityLabel={
|
|
147
|
+
AccessibilityLabel.GROUP_BUTTON_TYPE.BUTTON_BOTTOM
|
|
148
|
+
}
|
|
147
149
|
onPressLeft={cancelButton}
|
|
148
150
|
onPressRight={ApplyButton}
|
|
149
151
|
textLeft={t('cancel')}
|
|
@@ -9,7 +9,7 @@ import Routes from '../../../utils/Route';
|
|
|
9
9
|
|
|
10
10
|
import styles from './SelectDeviceTypeStyles';
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const SelectIrDeviceType = memo(() => {
|
|
13
13
|
const t = useTranslations();
|
|
14
14
|
const { navigate } = useNavigation();
|
|
15
15
|
const tempDeviceType = [
|
|
@@ -93,4 +93,4 @@ const SelectDeviceType = memo(() => {
|
|
|
93
93
|
);
|
|
94
94
|
});
|
|
95
95
|
|
|
96
|
-
export default
|
|
96
|
+
export default SelectIrDeviceType;
|
|
@@ -11,7 +11,7 @@ const SmartIr = memo(({ item }) => {
|
|
|
11
11
|
const { navigate } = useNavigation();
|
|
12
12
|
const AddRemoteControl = useCallback(() => {
|
|
13
13
|
navigate(Routes.SmartIrStack, {
|
|
14
|
-
screen: Routes.
|
|
14
|
+
screen: Routes.SelectIrDeviceType,
|
|
15
15
|
});
|
|
16
16
|
}, [navigate]);
|
|
17
17
|
return (
|
|
@@ -22,7 +22,7 @@ import _TextInput from '../../commons/Form/TextInput';
|
|
|
22
22
|
import Routes from '../../utils/Route';
|
|
23
23
|
import { axiosPost, createFormData } from '../../utils/Apis/axios';
|
|
24
24
|
import { ToastBottomHelper } from '../../utils/Utils';
|
|
25
|
-
import {
|
|
25
|
+
import { AccessibilityLabel } from '../../configs/Constants';
|
|
26
26
|
import styles from './AddSubUnitStyles';
|
|
27
27
|
import useKeyboardShow from '../../hooks/Common/useKeyboardShow';
|
|
28
28
|
import { replace } from '../../navigations/utils';
|
|
@@ -190,7 +190,9 @@ const AddSubUnit = ({ route }) => {
|
|
|
190
190
|
|
|
191
191
|
{isAddUnit && (
|
|
192
192
|
<TouchableWithoutFeedback
|
|
193
|
-
|
|
193
|
+
accessibilityLabel={
|
|
194
|
+
AccessibilityLabel.ADD_SUB_UNIT_BUTTON_CHOOSE_LOCATION
|
|
195
|
+
}
|
|
194
196
|
onPress={onChooseLocation}
|
|
195
197
|
>
|
|
196
198
|
<View style={styles.wrapGeolocation}>
|
|
@@ -206,7 +208,9 @@ const AddSubUnit = ({ route }) => {
|
|
|
206
208
|
)}
|
|
207
209
|
|
|
208
210
|
<TouchableWithoutFeedback
|
|
209
|
-
|
|
211
|
+
accessibilityLabel={
|
|
212
|
+
AccessibilityLabel.ADD_SUB_UNIT_BUTTON_CHOOSE_PHOTO
|
|
213
|
+
}
|
|
210
214
|
onPress={onChoosePhoto}
|
|
211
215
|
>
|
|
212
216
|
<View style={styles.wrapWallpaper}>
|
|
@@ -16,7 +16,7 @@ import styles from './DetailStyles';
|
|
|
16
16
|
|
|
17
17
|
const SubUnitDetail = ({ route }) => {
|
|
18
18
|
const t = useTranslations();
|
|
19
|
-
const { unit, station } = route
|
|
19
|
+
const { unit, station } = route?.params || {};
|
|
20
20
|
const language = useSCContextSelector((state) => state.language);
|
|
21
21
|
const navigation = useNavigation();
|
|
22
22
|
const { childRef, showingPopover, showPopoverWithRef, hidePopover } =
|
|
@@ -73,12 +73,12 @@ const SubUnitDetail = ({ route }) => {
|
|
|
73
73
|
);
|
|
74
74
|
|
|
75
75
|
const onAdd = useCallback(() => {
|
|
76
|
-
navigation.navigate(Routes.
|
|
77
|
-
screen: Routes.
|
|
76
|
+
navigation.navigate(Routes.AddGatewayStack, {
|
|
77
|
+
screen: Routes.FirstWarning,
|
|
78
78
|
params: {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
stationId: station.id,
|
|
80
|
+
unitId: unit.id,
|
|
81
|
+
unitName: unit.name,
|
|
82
82
|
},
|
|
83
83
|
});
|
|
84
84
|
}, [navigation, station, unit]);
|
|
@@ -19,7 +19,7 @@ import AlertAction from '../../commons/AlertAction';
|
|
|
19
19
|
import _TextInput from '../../commons/Form/TextInput';
|
|
20
20
|
import ViewButtonBottom from '../../commons/ViewButtonBottom';
|
|
21
21
|
import Text from '../../commons/Text';
|
|
22
|
-
import {
|
|
22
|
+
import { AccessibilityLabel } from '../../configs/Constants';
|
|
23
23
|
import { IconOutline } from '@ant-design/icons-react-native';
|
|
24
24
|
import { useEmeragencyContacts } from './hooks/useEmergencyContacts';
|
|
25
25
|
import Animated from 'react-native-reanimated';
|
|
@@ -28,7 +28,7 @@ import styles from './EditSubUnitStyles';
|
|
|
28
28
|
import { ModalCustom } from '../../commons/Modal';
|
|
29
29
|
|
|
30
30
|
const EditSubUnit = ({ route }) => {
|
|
31
|
-
const { unit, station } = route
|
|
31
|
+
const { unit, station } = route?.params || {};
|
|
32
32
|
const t = useTranslations();
|
|
33
33
|
const navigation = useNavigation();
|
|
34
34
|
const isFocused = useIsFocused();
|
|
@@ -181,14 +181,16 @@ const EditSubUnit = ({ route }) => {
|
|
|
181
181
|
<View style={styles.subUnitData}>
|
|
182
182
|
<TouchableOpacity onPress={setshowEdit}>
|
|
183
183
|
<Text
|
|
184
|
-
|
|
184
|
+
accessibilityLabel={AccessibilityLabel.MANAGE_SUB_UNIT_NAME}
|
|
185
185
|
style={[styles.textWraper, styles.subUnitName]}
|
|
186
186
|
>
|
|
187
187
|
{newName}
|
|
188
188
|
</Text>
|
|
189
189
|
</TouchableOpacity>
|
|
190
190
|
<TouchableOpacity
|
|
191
|
-
|
|
191
|
+
accessibilityLabel={
|
|
192
|
+
AccessibilityLabel.MANAGE_SUB_UNIT_SELECT_FILE_BUTTON
|
|
193
|
+
}
|
|
192
194
|
onPress={selectFile}
|
|
193
195
|
style={[styles.backgroundContainer]}
|
|
194
196
|
>
|
|
@@ -233,7 +235,9 @@ const EditSubUnit = ({ route }) => {
|
|
|
233
235
|
/>
|
|
234
236
|
{!showEdit && (
|
|
235
237
|
<TouchableOpacity
|
|
236
|
-
|
|
238
|
+
accessibilityLabel={
|
|
239
|
+
AccessibilityLabel.MANAGE_SUB_UNIT_REMOVE_BUTTON
|
|
240
|
+
}
|
|
237
241
|
onPress={onPressRemove}
|
|
238
242
|
style={styles.removeButton}
|
|
239
243
|
>
|
|
@@ -250,7 +254,7 @@ const EditSubUnit = ({ route }) => {
|
|
|
250
254
|
</View>
|
|
251
255
|
</View>
|
|
252
256
|
<ModalCustom
|
|
253
|
-
|
|
257
|
+
accessibilityLabel={AccessibilityLabel.MANAGE_SUB_UNIT_MODAL}
|
|
254
258
|
isVisible={showEdit}
|
|
255
259
|
onBackButtonPress={setHideEdit}
|
|
256
260
|
onBackdropPress={setHideEdit}
|
|
@@ -20,7 +20,7 @@ import Routes from '../../utils/Route';
|
|
|
20
20
|
import { RowItem } from '../../commons/RowItem';
|
|
21
21
|
import NoSubUnitImage from '../../../assets/images/Illustrations.svg';
|
|
22
22
|
import useManageSubUnit from './hooks/useManageSubUnit';
|
|
23
|
-
import {
|
|
23
|
+
import { AccessibilityLabel } from '../../configs/Constants';
|
|
24
24
|
|
|
25
25
|
const ManageSubUnit = memo((props) => {
|
|
26
26
|
const t = useTranslations();
|
|
@@ -50,7 +50,7 @@ const ManageSubUnit = memo((props) => {
|
|
|
50
50
|
() => (
|
|
51
51
|
<View style={styles.rightComponent}>
|
|
52
52
|
<TouchableOpacity
|
|
53
|
-
|
|
53
|
+
accessibilityLabel={AccessibilityLabel.ADD_SUB_UNIT}
|
|
54
54
|
onPress={addSubUnit}
|
|
55
55
|
style={styles.headerButton}
|
|
56
56
|
>
|
|
@@ -6,7 +6,7 @@ import { ImagePicker, ViewButtonBottom } from '../../../commons';
|
|
|
6
6
|
import { act, create } from 'react-test-renderer';
|
|
7
7
|
import Toast from 'react-native-toast-message';
|
|
8
8
|
import Routes from '../../../utils/Route';
|
|
9
|
-
import {
|
|
9
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
10
10
|
import _TextInput from '../../../commons/Form/TextInput';
|
|
11
11
|
import AddSubUnit from '../AddSubUnit';
|
|
12
12
|
import { getTranslate } from '../../../utils/I18n';
|
|
@@ -82,7 +82,8 @@ describe('Test AddSubUnit', () => {
|
|
|
82
82
|
const instance = tree.root;
|
|
83
83
|
const buttonChoosePhoto = instance.find(
|
|
84
84
|
(el) =>
|
|
85
|
-
el.props.
|
|
85
|
+
el.props.accessibilityLabel ===
|
|
86
|
+
AccessibilityLabel.ADD_SUB_UNIT_BUTTON_CHOOSE_PHOTO &&
|
|
86
87
|
el.type === TouchableWithoutFeedback
|
|
87
88
|
);
|
|
88
89
|
const imagePicker = instance.findByType(ImagePicker);
|
|
@@ -218,7 +219,9 @@ describe('Test AddSubUnit', () => {
|
|
|
218
219
|
|
|
219
220
|
const instance = tree.root;
|
|
220
221
|
const buttonChooseLocation = instance.find(
|
|
221
|
-
(el) =>
|
|
222
|
+
(el) =>
|
|
223
|
+
el.props.accessibilityLabel ===
|
|
224
|
+
AccessibilityLabel.ADD_SUB_UNIT_BUTTON_CHOOSE_LOCATION
|
|
222
225
|
);
|
|
223
226
|
act(() => {
|
|
224
227
|
buttonChooseLocation.props.onPress();
|
|
@@ -9,7 +9,7 @@ import Routes from '../../../utils/Route';
|
|
|
9
9
|
import WrapParallaxScrollView from '../../../commons/WrapParallaxScrollView';
|
|
10
10
|
import { SCProvider } from '../../../context';
|
|
11
11
|
import { mockSCStore } from '../../../context/mockStore';
|
|
12
|
-
import {
|
|
12
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
13
13
|
import { TouchableOpacity } from 'react-native';
|
|
14
14
|
|
|
15
15
|
const mockedNavigate = jest.fn();
|
|
@@ -153,7 +153,8 @@ describe('Test SubUnitDetail', () => {
|
|
|
153
153
|
const instance = tree.root;
|
|
154
154
|
const button = instance.find(
|
|
155
155
|
(el) =>
|
|
156
|
-
el.props.
|
|
156
|
+
el.props.accessibilityLabel ===
|
|
157
|
+
AccessibilityLabel.HEADER_UNIT_BUTTON_BACK &&
|
|
157
158
|
el.type === TouchableOpacity
|
|
158
159
|
);
|
|
159
160
|
act(() => {
|
|
@@ -161,7 +162,8 @@ describe('Test SubUnitDetail', () => {
|
|
|
161
162
|
});
|
|
162
163
|
const buttonOnActionPress = instance.findAll(
|
|
163
164
|
(el) =>
|
|
164
|
-
el.props.
|
|
165
|
+
el.props.accessibilityLabel ===
|
|
166
|
+
AccessibilityLabel.HEADER_UNIT_BUTTON_MORE &&
|
|
165
167
|
el.type === TouchableOpacity
|
|
166
168
|
);
|
|
167
169
|
expect(buttonOnActionPress).toHaveLength(1);
|
|
@@ -10,7 +10,7 @@ import Toast from 'react-native-toast-message';
|
|
|
10
10
|
|
|
11
11
|
import Routes from '../../../utils/Route';
|
|
12
12
|
import EditSubUnit from '../EditSubUnit';
|
|
13
|
-
import {
|
|
13
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
14
14
|
import Text from '../../../commons/Text';
|
|
15
15
|
import _TextInput from '../../../commons/Form/TextInput';
|
|
16
16
|
import { SCProvider } from '../../../context';
|
|
@@ -209,7 +209,8 @@ describe('Test EditSubUnit', () => {
|
|
|
209
209
|
});
|
|
210
210
|
const instance = tree.root;
|
|
211
211
|
const modal = instance.find(
|
|
212
|
-
(el) =>
|
|
212
|
+
(el) =>
|
|
213
|
+
el.props.accessibilityLabel === AccessibilityLabel.MANAGE_SUB_UNIT_MODAL
|
|
213
214
|
);
|
|
214
215
|
const viewBottomButtons = instance.findAllByType(ViewButtonBottom);
|
|
215
216
|
const viewBottomButton = viewBottomButtons[0];
|
|
@@ -239,7 +240,8 @@ describe('Test EditSubUnit', () => {
|
|
|
239
240
|
const instance = tree.root;
|
|
240
241
|
const text = instance.find(
|
|
241
242
|
(el) =>
|
|
242
|
-
el.props.
|
|
243
|
+
el.props.accessibilityLabel ===
|
|
244
|
+
AccessibilityLabel.MANAGE_SUB_UNIT_NAME && el.type === Text
|
|
243
245
|
);
|
|
244
246
|
const viewBottomButtons = instance.findAllByType(ViewButtonBottom);
|
|
245
247
|
const viewBottomButton = viewBottomButtons[0];
|
|
@@ -273,7 +275,8 @@ describe('Test EditSubUnit', () => {
|
|
|
273
275
|
const instance = tree.root;
|
|
274
276
|
const button = instance.find(
|
|
275
277
|
(el) =>
|
|
276
|
-
el.props.
|
|
278
|
+
el.props.accessibilityLabel ===
|
|
279
|
+
AccessibilityLabel.MANAGE_SUB_UNIT_REMOVE_BUTTON &&
|
|
277
280
|
el.type === TouchableOpacity
|
|
278
281
|
);
|
|
279
282
|
const alertAction = instance.findByType(AlertAction);
|
|
@@ -305,7 +308,8 @@ describe('Test EditSubUnit', () => {
|
|
|
305
308
|
const instance = tree.root;
|
|
306
309
|
const button = instance.find(
|
|
307
310
|
(el) =>
|
|
308
|
-
el.props.
|
|
311
|
+
el.props.accessibilityLabel ===
|
|
312
|
+
AccessibilityLabel.MANAGE_SUB_UNIT_SELECT_FILE_BUTTON &&
|
|
309
313
|
el.type === TouchableOpacity
|
|
310
314
|
);
|
|
311
315
|
const imagePicker = instance.findByType(ImagePicker);
|
|
@@ -7,7 +7,7 @@ import { SCProvider } from '../../../context';
|
|
|
7
7
|
import { mockSCStore } from '../../../context/mockStore';
|
|
8
8
|
import { RowItem } from '../../../commons/RowItem';
|
|
9
9
|
import Routes from '../../../utils/Route';
|
|
10
|
-
import {
|
|
10
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
11
11
|
|
|
12
12
|
const mockSetState = jest.fn();
|
|
13
13
|
|
|
@@ -87,7 +87,8 @@ describe('Test ManageSubUnit', () => {
|
|
|
87
87
|
const instance = tree.root;
|
|
88
88
|
const buttonAddSubUnit = instance.find(
|
|
89
89
|
(el) =>
|
|
90
|
-
el.props.
|
|
90
|
+
el.props.accessibilityLabel === AccessibilityLabel.ADD_SUB_UNIT &&
|
|
91
|
+
el.type === TouchableOpacity
|
|
91
92
|
);
|
|
92
93
|
act(() => {
|
|
93
94
|
buttonAddSubUnit.props.onPress();
|
|
@@ -10,13 +10,13 @@ import Text from '../../commons/Text';
|
|
|
10
10
|
import GroupCheckBox from '../../commons/GroupCheckBox';
|
|
11
11
|
import { axiosGet, axiosPost } from '../../utils/Apis/axios';
|
|
12
12
|
import Routes from '../../utils/Route';
|
|
13
|
-
import {
|
|
13
|
+
import { AccessibilityLabel } from '../../configs/Constants';
|
|
14
14
|
import { ToastBottomHelper } from '../../utils/Utils';
|
|
15
15
|
import { SCConfig } from '../../configs';
|
|
16
16
|
|
|
17
17
|
const AddLGDevice = memo(({ route }) => {
|
|
18
18
|
const t = useTranslations();
|
|
19
|
-
const { unit_id, code, backend_url } = route
|
|
19
|
+
const { unit_id, code, backend_url } = route?.params || {};
|
|
20
20
|
const { navigate, goBack } = useNavigation();
|
|
21
21
|
const [unit, setUnit] = useState({ stations: [] });
|
|
22
22
|
const [stationId, setStationId] = useState(0);
|
|
@@ -79,7 +79,7 @@ const AddLGDevice = memo(({ route }) => {
|
|
|
79
79
|
return (
|
|
80
80
|
<SafeAreaView style={styles.wrap}>
|
|
81
81
|
<Text
|
|
82
|
-
|
|
82
|
+
accessibilityLabel={AccessibilityLabel.ADD_NEW_DEVICE_LG_ADD}
|
|
83
83
|
semibold
|
|
84
84
|
size={20}
|
|
85
85
|
color={Colors.Black}
|
|
@@ -88,7 +88,7 @@ const AddLGDevice = memo(({ route }) => {
|
|
|
88
88
|
{t('add_new_device')}
|
|
89
89
|
</Text>
|
|
90
90
|
<Text
|
|
91
|
-
|
|
91
|
+
accessibilityLabel={AccessibilityLabel.ADD_NEW_DEVICE_LG_THEN_SELECT}
|
|
92
92
|
size={14}
|
|
93
93
|
color={Colors.Gray8}
|
|
94
94
|
style={styles.txtNote}
|
|
@@ -4,7 +4,7 @@ import MockAdapter from 'axios-mock-adapter';
|
|
|
4
4
|
import AddLGDevice from '../AddLGDevice';
|
|
5
5
|
import API from '../../../configs/API';
|
|
6
6
|
import GroupCheckBox from '../../../commons/GroupCheckBox';
|
|
7
|
-
import {
|
|
7
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
8
8
|
import { getTranslate } from '../../../utils/I18n';
|
|
9
9
|
import { ViewButtonBottom } from '../../../commons';
|
|
10
10
|
import { ToastBottomHelper } from '../../../utils/Utils';
|
|
@@ -57,7 +57,7 @@ describe('Test Add LG Device', () => {
|
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
const getText = (instance, id) => {
|
|
60
|
-
return instance.find((el) => el.props.
|
|
60
|
+
return instance.find((el) => el.props.accessibilityLabel === id);
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
test('render', async () => {
|
|
@@ -65,8 +65,11 @@ describe('Test Add LG Device', () => {
|
|
|
65
65
|
tree = await create(wrapComponent(route));
|
|
66
66
|
});
|
|
67
67
|
const instance = tree.root;
|
|
68
|
-
const textAdd = getText(instance,
|
|
69
|
-
const textThen = getText(
|
|
68
|
+
const textAdd = getText(instance, AccessibilityLabel.ADD_NEW_DEVICE_LG_ADD);
|
|
69
|
+
const textThen = getText(
|
|
70
|
+
instance,
|
|
71
|
+
AccessibilityLabel.ADD_NEW_DEVICE_LG_THEN_SELECT
|
|
72
|
+
);
|
|
70
73
|
expect(textAdd.props.children).toEqual(
|
|
71
74
|
getTranslate('en', 'add_new_device')
|
|
72
75
|
);
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { create, act } from 'react-test-renderer';
|
|
3
3
|
import { Text } from 'react-native';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { AccessibilityLabel } from '../../../configs/Constants';
|
|
6
6
|
|
|
7
7
|
import TDSGuide from '../index';
|
|
8
8
|
import { SCProvider } from '../../../context';
|
|
@@ -34,7 +34,9 @@ describe('Test TDS Guide', () => {
|
|
|
34
34
|
|
|
35
35
|
const instance = tree.root;
|
|
36
36
|
const buttonOnActionPress = instance.find(
|
|
37
|
-
(el) =>
|
|
37
|
+
(el) =>
|
|
38
|
+
el.props.accessibilityLabel === AccessibilityLabel.TDS_GUIDE_TITLE &&
|
|
39
|
+
el.type === Text
|
|
38
40
|
);
|
|
39
41
|
expect(buttonOnActionPress).not.toBeUndefined();
|
|
40
42
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
2
|
import { StyleSheet, View, ScrollView } from 'react-native';
|
|
3
3
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
4
|
-
import {
|
|
4
|
+
import { AccessibilityLabel } from '../../configs/Constants';
|
|
5
5
|
|
|
6
6
|
import { Theme } from '../../configs';
|
|
7
7
|
import Text from '../../commons/Text';
|
|
@@ -21,7 +21,7 @@ const TDSGuide = memo(() => {
|
|
|
21
21
|
type="H3"
|
|
22
22
|
semibold
|
|
23
23
|
style={styles.titlePadding}
|
|
24
|
-
|
|
24
|
+
accessibilityLabel={AccessibilityLabel.TDS_GUIDE_TITLE}
|
|
25
25
|
>
|
|
26
26
|
{t('what_is_tds_title')}
|
|
27
27
|
</Text>
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
2
|
+
import React, {
|
|
3
|
+
useCallback,
|
|
4
|
+
useContext,
|
|
5
|
+
useEffect,
|
|
6
|
+
useMemo,
|
|
7
|
+
useState,
|
|
8
|
+
} from 'react';
|
|
9
|
+
import { Image, TouchableOpacity, View } from 'react-native';
|
|
10
|
+
import DraggableFlatList from 'react-native-draggable-flatlist';
|
|
11
|
+
|
|
12
|
+
import { EmptyComponent } from '../../commons/DevMode';
|
|
13
|
+
import { HeaderCustom } from '../../commons/Header';
|
|
14
|
+
import Text from '../../commons/Text';
|
|
15
|
+
import { Images } from '../../configs';
|
|
16
|
+
import { SCContext } from '../../context';
|
|
17
|
+
import { Action } from '../../context/actionType';
|
|
18
|
+
import t from '../../hooks/Common/useTranslations';
|
|
19
|
+
import { SensorDisplayItem } from '../Device/components/SensorDisplayItem';
|
|
20
|
+
import styles from './Styles/EditTemplateStyle';
|
|
21
|
+
import { notImplemented } from '../../utils/Utils';
|
|
22
|
+
|
|
23
|
+
const EditTemplate = () => {
|
|
24
|
+
const { setAction } = useContext(SCContext);
|
|
25
|
+
const { params = {} } = useRoute();
|
|
26
|
+
const { data = [], setData } = params;
|
|
27
|
+
const { goBack } = useNavigation();
|
|
28
|
+
const [actionsList, setActionList] = useState(
|
|
29
|
+
[...data].map((item) => {
|
|
30
|
+
return {
|
|
31
|
+
...item,
|
|
32
|
+
key: `item-${item?.id}`,
|
|
33
|
+
};
|
|
34
|
+
})
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const AddWidget = useCallback(() => {
|
|
38
|
+
return (
|
|
39
|
+
<TouchableOpacity style={styles.addWidgetButton}>
|
|
40
|
+
<View style={styles.wrapIconAdd}>
|
|
41
|
+
<Image source={Images.plus} />
|
|
42
|
+
</View>
|
|
43
|
+
<Text style={styles.addWidget}>{t('add_widget')}</Text>
|
|
44
|
+
</TouchableOpacity>
|
|
45
|
+
);
|
|
46
|
+
}, []);
|
|
47
|
+
|
|
48
|
+
const onDrag = useCallback(
|
|
49
|
+
(item, drag) => () => {
|
|
50
|
+
drag && drag();
|
|
51
|
+
setAction(Action.SET_WIDGET_DRAGGING, item?.id);
|
|
52
|
+
},
|
|
53
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
54
|
+
[]
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const onDragEnd = useCallback(({ data: dragData }) => {
|
|
58
|
+
setActionList(dragData);
|
|
59
|
+
setAction(Action.SET_WIDGET_DRAGGING);
|
|
60
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61
|
+
}, []);
|
|
62
|
+
|
|
63
|
+
const onPressSave = useCallback(() => {
|
|
64
|
+
setData && setData(actionsList);
|
|
65
|
+
goBack();
|
|
66
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
67
|
+
}, [actionsList]);
|
|
68
|
+
|
|
69
|
+
const onDelete = useCallback(() => {
|
|
70
|
+
notImplemented(t);
|
|
71
|
+
}, []);
|
|
72
|
+
|
|
73
|
+
const renderEmpty = useMemo(() => {
|
|
74
|
+
return (
|
|
75
|
+
<View style={styles.empty}>
|
|
76
|
+
<EmptyComponent text1={t('no_widgets')} text2={t('add_your_widget')} />
|
|
77
|
+
<AddWidget />
|
|
78
|
+
</View>
|
|
79
|
+
);
|
|
80
|
+
}, []);
|
|
81
|
+
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
setAction(Action.SET_IS_IN_EDIT_TEMPLATE_SCREEN, true);
|
|
84
|
+
return () => setAction(Action.SET_IS_IN_EDIT_TEMPLATE_SCREEN);
|
|
85
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
86
|
+
}, []);
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<View style={styles.wrap}>
|
|
90
|
+
<HeaderCustom
|
|
91
|
+
title={t('edit_template')}
|
|
92
|
+
wrapTitleStyle={styles.wrapTitleStyle}
|
|
93
|
+
iconLeft={Images.close}
|
|
94
|
+
iconBackStyle={styles.iconBackStyle}
|
|
95
|
+
titleStyles={styles.titleStyles}
|
|
96
|
+
/>
|
|
97
|
+
{!actionsList?.length ? (
|
|
98
|
+
renderEmpty
|
|
99
|
+
) : (
|
|
100
|
+
<>
|
|
101
|
+
<View style={styles.wrapDescription}>
|
|
102
|
+
<Text style={styles.description}>
|
|
103
|
+
{t('hold_and_hover_description')}
|
|
104
|
+
</Text>
|
|
105
|
+
</View>
|
|
106
|
+
<DraggableFlatList
|
|
107
|
+
showsVerticalScrollIndicator={false}
|
|
108
|
+
data={actionsList}
|
|
109
|
+
renderItem={({ item, index, drag }) => {
|
|
110
|
+
return (
|
|
111
|
+
<TouchableOpacity onLongPress={onDrag(item, drag)}>
|
|
112
|
+
<SensorDisplayItem
|
|
113
|
+
item={item}
|
|
114
|
+
getData={() => {}}
|
|
115
|
+
offsetTitle={'offsetTitle'}
|
|
116
|
+
setOffsetTitle={'setOffsetTitle'}
|
|
117
|
+
maxValue={100}
|
|
118
|
+
/>
|
|
119
|
+
<TouchableOpacity
|
|
120
|
+
style={styles.deleteButton}
|
|
121
|
+
onPress={onDelete}
|
|
122
|
+
>
|
|
123
|
+
<Image
|
|
124
|
+
source={Images.removeCircle}
|
|
125
|
+
style={styles.deleteIcon}
|
|
126
|
+
/>
|
|
127
|
+
</TouchableOpacity>
|
|
128
|
+
</TouchableOpacity>
|
|
129
|
+
);
|
|
130
|
+
}}
|
|
131
|
+
keyExtractor={(item) => `draggable-item-${item.key}`}
|
|
132
|
+
onDragEnd={onDragEnd}
|
|
133
|
+
extraData={actionsList}
|
|
134
|
+
containerStyle={styles.containerStyle}
|
|
135
|
+
ListFooterComponent={
|
|
136
|
+
<View style={styles.wrapListFooterComponent}>
|
|
137
|
+
<AddWidget />
|
|
138
|
+
</View>
|
|
139
|
+
}
|
|
140
|
+
/>
|
|
141
|
+
<View style={styles.wrapBottom}>
|
|
142
|
+
<TouchableOpacity style={styles.saveButton} onPress={onPressSave}>
|
|
143
|
+
<Text style={styles.save}>{t('save')}</Text>
|
|
144
|
+
</TouchableOpacity>
|
|
145
|
+
</View>
|
|
146
|
+
</>
|
|
147
|
+
)}
|
|
148
|
+
</View>
|
|
149
|
+
);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export default EditTemplate;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useNavigation } from '@react-navigation/native';
|
|
2
|
+
import React, { useCallback, useState } from 'react';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { Search } from '../../commons/DevMode';
|
|
5
|
+
import WrapHeaderScrollable from '../../commons/Sharing/WrapHeaderScrollable';
|
|
6
|
+
import Text from '../../commons/Text';
|
|
7
|
+
import t from '../../hooks/Common/useTranslations';
|
|
8
|
+
import styles from './Styles/GatewayStyles';
|
|
9
|
+
|
|
10
|
+
const GatewayList = () => {
|
|
11
|
+
const { goBack } = useNavigation();
|
|
12
|
+
const [data] = useState([
|
|
13
|
+
{
|
|
14
|
+
id: 1,
|
|
15
|
+
name: 'Gateway name',
|
|
16
|
+
templateName: 'Template name',
|
|
17
|
+
status: 'ACTIVE',
|
|
18
|
+
},
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
const GatewayItem = useCallback(({ item }) => {
|
|
22
|
+
return (
|
|
23
|
+
<View style={styles.wrapItem}>
|
|
24
|
+
<Text style={styles.gateWayName}>{item?.name}</Text>
|
|
25
|
+
<View>
|
|
26
|
+
<Text style={styles.templateName}>{item?.templateName}</Text>
|
|
27
|
+
<View style={styles.wrapStatus}>
|
|
28
|
+
<Text style={styles.status}>{item?.status}</Text>
|
|
29
|
+
</View>
|
|
30
|
+
</View>
|
|
31
|
+
</View>
|
|
32
|
+
);
|
|
33
|
+
}, []);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<View style={styles.wrap}>
|
|
37
|
+
<WrapHeaderScrollable
|
|
38
|
+
title={t('gateway_list')}
|
|
39
|
+
headerAniStyle={styles.headerAniStyle}
|
|
40
|
+
onGoBack={goBack}
|
|
41
|
+
>
|
|
42
|
+
<View style={styles.wrapContent}>
|
|
43
|
+
<Search />
|
|
44
|
+
{!!data.length && data.map((item) => <GatewayItem item={item} />)}
|
|
45
|
+
</View>
|
|
46
|
+
</WrapHeaderScrollable>
|
|
47
|
+
</View>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default GatewayList;
|