@eohjsc/react-native-smart-city 0.2.21 → 0.2.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/assets/images/Add.svg +5 -0
- package/assets/images/AddLocationMaps/Point.svg +3 -0
- package/assets/images/CheckCircle.svg +4 -0
- package/assets/images/Close.svg +3 -0
- package/assets/images/HowToStart.svg +14 -0
- package/assets/images/Illustrations.svg +83 -0
- package/assets/images/OneTap.svg +14 -0
- package/assets/images/OneTap@1x.svg +14 -0
- package/assets/images/Rearrange.svg +3 -0
- package/assets/images/Schedule.svg +39 -0
- package/assets/images/ValueChange.svg +49 -0
- package/index.js +2 -0
- package/package.json +14 -2
- package/src/Images/Common/ActiveButton.png +0 -0
- package/src/Images/Common/ActiveButton@2x.png +0 -0
- package/src/Images/Common/ActiveButton@3x.png +0 -0
- package/src/Images/Common/arrow-back.png +0 -0
- package/src/Images/Common/checked@2x.png +0 -0
- package/src/Images/Common/checked@3x.png +0 -0
- package/src/Images/Common/file.png +0 -0
- package/src/Images/Common/fullscreen.png +0 -0
- package/src/Images/Common/refresh.png +0 -0
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +1 -1
- package/src/commons/ActionGroup/OnOffTemplate/index.js +9 -4
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +4 -3
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +2 -2
- package/src/commons/ActionGroup/ThreeButtonTemplate.js +13 -6
- package/src/commons/ActionGroup/ThreeButtonTemplateStyle.js +1 -1
- package/src/commons/ActionGroup/TimerActionTemplate.js +158 -33
- package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +294 -0
- package/src/commons/ActionGroup/__test__/NumberUpDownTemplateWithNullConfigValue.test.js +60 -0
- package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +8 -13
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +3 -3
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +26 -45
- package/src/commons/ActionGroup/__test__/ThreeButtonTemplate.test.js +11 -5
- package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +14 -8
- package/src/commons/ActionGroup/__test__/TimerActionTemplateWithutConfigValue.test.js +17 -23
- package/src/commons/ActionGroup/__test__/__snapshots__/ThreeButtonTemplate.test.js.snap +241 -223
- package/src/commons/ActionGroup/__test__/index.test.js +39 -107
- package/src/commons/ActionGroup/hooks/useDropdownAction.js +2 -1
- package/src/commons/ActionTemplate/ActionTemplateStyles.js +14 -0
- package/src/commons/ActionTemplate/OnOffButtonAction.js +40 -0
- package/src/commons/ActionTemplate/OnOffButtonActionStyles.js +11 -0
- package/src/commons/ActionTemplate/OneButtonAction.js +26 -0
- package/src/commons/ActionTemplate/OneButtonActionStyles.js +11 -0
- package/src/commons/ActionTemplate/ThreeButtonAction.js +55 -0
- package/src/commons/ActionTemplate/ThreeButtonActionStyles.js +11 -0
- package/src/commons/ActionTemplate/__test__/OnOffButtonAction.test.js +34 -0
- package/src/commons/ActionTemplate/__test__/OneButtonAction.test.js +33 -0
- package/src/commons/ActionTemplate/__test__/ThreeButtonAction.test.js +35 -0
- package/src/commons/ActionTemplate/__test__/index.test.js +71 -0
- package/src/commons/ActionTemplate/index.js +69 -0
- package/src/commons/AlertAction/__test__/AlertAction.test.js +6 -6
- package/src/commons/AlertAction/index.js +2 -0
- package/src/commons/Automate/ItemAddNewScriptActionStyles.js +38 -0
- package/src/commons/Automate/ItemAutomate.js +39 -0
- package/src/commons/Automate/ItemAutomateStyles.js +33 -0
- package/src/commons/Automate/ItemScriptAction.js +45 -0
- package/src/commons/Automate/ItemScriptActionStyles.js +42 -0
- package/src/commons/Automate/__test__/ItemAutomate.test.js +16 -0
- package/src/commons/Automate/__test__/ItemScriptAction.test.js +16 -0
- package/src/commons/BackDefault/__test__/BackDefault.test.js +21 -0
- package/src/commons/BottomScrollPicker/index.js +62 -0
- package/src/commons/BottomScrollPicker/styles.js +13 -0
- package/src/commons/BottomSheet/index.js +41 -0
- package/src/commons/BottomSheet/styles.js +37 -0
- package/src/commons/Button/index.js +6 -1
- package/src/commons/ButtonPopup/__test__/__snapshots__/ButtonPopup.test.js.snap +2 -0
- package/src/commons/ButtonPopup/index.js +2 -0
- package/src/commons/Calendar/index.js +72 -0
- package/src/commons/Calendar/styles.js +11 -0
- package/src/commons/CameraDevice/index.js +2 -1
- package/src/commons/ChartLoading/__test__/ChartLoading.test.js +9 -7
- package/src/commons/ChartLoading/index.js +2 -1
- package/src/commons/DateTimeRangeChange/index.js +2 -1
- package/src/commons/Device/ConnectedViewHeader.js +3 -1
- package/src/commons/Device/DeviceAlertStatus.js +5 -2
- package/src/commons/Device/DisconnectedView.js +34 -26
- package/src/commons/Device/Emergency/EmergencyButton.js +2 -1
- package/src/commons/Device/Emergency/EmergencyDetail.js +2 -1
- package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +14 -6
- package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +10 -2
- package/src/commons/Device/FlatListItems.js +3 -2
- package/src/commons/Device/FooterInfo.js +2 -1
- package/src/commons/Device/HistoryChart.js +2 -1
- package/src/commons/Device/ItemAddNew/index.js +8 -3
- package/src/commons/Device/SensorConnectedStatus.js +2 -1
- package/src/commons/Device/WindDirection/Compass/Compass.test.js +19 -11
- package/src/commons/Device/WindDirection/Compass/index.js +1 -1
- package/src/commons/Device/WindSpeed/LinearChart/__test__/LinearChart.test.js +9 -3
- package/src/commons/Device/WindSpeed/LinearChart/__test__/__snapshots__/LinearChart.test.js.snap +0 -81
- package/src/commons/Device/WindSpeed/LinearChart/index.js +2 -1
- package/src/commons/Device/__test__/ConnectedViewHeader.test.js +16 -8
- package/src/commons/Device/__test__/DeviceAlertStatus.test.js +13 -5
- package/src/commons/Device/__test__/DisconnectedView.test.js +13 -5
- package/src/commons/Device/__test__/FlatListItems.test.js +9 -1
- package/src/commons/Device/__test__/FooterInfo.test.js +13 -4
- package/src/commons/Device/__test__/SensorConnectedStatus.test.js +9 -1
- package/src/commons/Device/__test__/__snapshots__/DisconnectedView.test.js.snap +20 -20
- package/src/commons/DisplayChecking/__test__/DisplayChecking.test.js +28 -0
- package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -1
- package/src/commons/EmergencyButton/AlertSent.js +3 -2
- package/src/commons/Explore/CityItem/index.js +2 -1
- package/src/commons/Explore/HeaderExplore/index.js +2 -1
- package/src/commons/Explore/HeaderLabel/index.js +2 -1
- package/src/commons/Explore/SearchBox/__test__/SearchBox.test.js +9 -2
- package/src/commons/Explore/SearchBox/index.js +2 -1
- package/src/commons/Explore/__test__/CityItem.test.js +13 -15
- package/src/commons/Explore/__test__/HeaderExplore.test.js +11 -7
- package/src/commons/Explore/__test__/HeaderLabel.test.js +15 -9
- package/src/commons/Explore/__test__/LocationItem.test.js +31 -0
- package/src/commons/Header/HeaderCustom.js +22 -2
- package/src/commons/Header/Styles/HeaderCustomStyles.js +2 -2
- package/src/commons/Header/__test__/HeaderCT.test.js +12 -4
- package/src/commons/HeaderAni/index.js +36 -5
- package/src/commons/HorizontalPicker/index.js +134 -0
- package/src/commons/HorizontalPicker/styles.js +56 -0
- package/src/commons/ImagePicker/__test__/ImagePicker.test.js +19 -13
- package/src/commons/ImagePicker/index.js +3 -1
- package/src/commons/MediaPlayer/index.js +2 -1
- package/src/commons/MediaPlayerDetail/__test__/MediaPlayerDetail.test.js +14 -8
- package/src/commons/MediaPlayerDetail/index.js +4 -1
- package/src/commons/MenuActionAddnew/__test__/MenuActionAddNew.test.js +11 -20
- package/src/commons/MenuActionAddnew/index.js +2 -1
- package/src/commons/Modal/ModalBottom.js +51 -0
- package/src/commons/Modal/ModalFullVideo.js +2 -1
- package/src/commons/Modal/Styles/ModalBottomStyles.js +35 -0
- package/src/commons/Modal/__test__/ModalBottom.test.js +39 -0
- package/src/commons/Modal/index.js +2 -1
- package/src/commons/NavBar/index.js +2 -2
- package/src/commons/RowItem/__test__/RowItem.test.js +16 -0
- package/src/commons/RowItem/index.js +61 -0
- package/src/commons/RowItem/styles.js +53 -0
- package/src/commons/SelectActionCard/SelectActionStyles.js +16 -0
- package/src/commons/SelectActionCard/index.js +30 -0
- package/src/commons/Sharing/DevicePermissionsCheckbox.js +2 -1
- package/src/commons/Sharing/MemberList.js +3 -1
- package/src/commons/Sharing/RowMember.js +3 -2
- package/src/commons/Sharing/StationDevicePermissions.js +2 -1
- package/src/commons/Sharing/WrapHeaderScrollable.js +78 -74
- package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +15 -9
- package/src/commons/Sharing/__test__/MemberList.test.js +17 -25
- package/src/commons/Sharing/__test__/StationDevicePermission.test.js +17 -12
- package/src/commons/Sharing/__test__/WrapHeaderScrollable.test.js +0 -9
- package/src/commons/SubUnit/OneTap/ItemOneTap.js +101 -0
- package/src/commons/SubUnit/OneTap/ItemOneTapStyles.js +41 -0
- package/src/commons/SubUnit/OneTap/OneTapStyles.js +36 -0
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +195 -0
- package/src/commons/SubUnit/OneTap/index.js +39 -0
- package/src/commons/SubUnit/ShortDetail.js +11 -6
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +14 -6
- package/src/commons/Today/__test__/Today.test.js +9 -1
- package/src/commons/Today/__test__/__snapshots__/Today.test.js.snap +1 -1
- package/src/commons/Today/index.js +2 -1
- package/src/commons/Unit/SharedUnit.js +2 -1
- package/src/commons/Unit/__test__/SharedUnit.test.js +330 -0
- package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +1 -2
- package/src/commons/UnitSummary/AirQuality/__test__/index.test.js +16 -17
- package/src/commons/UnitSummary/AirQuality/index.js +5 -120
- package/src/commons/UnitSummary/AirQuality/styles.js +112 -0
- package/src/commons/UnitSummary/TotalPowerConsumption/index.js +2 -1
- package/src/commons/UnitSummary/__test__/TotalPowerConsumption.test.js +15 -9
- package/src/commons/WheelDateTimePicker/Picker.js +57 -0
- package/src/commons/WheelDateTimePicker/index.js +168 -0
- package/src/commons/WheelDateTimePicker/styles.js +21 -0
- package/src/commons/index.js +2 -0
- package/src/configs/API.js +29 -0
- package/src/configs/Colors.js +1 -0
- package/src/configs/Constants.js +61 -0
- package/src/configs/Images.js +1 -0
- package/src/configs/SCConfig.js +7 -0
- package/src/configs/Theme.js +20 -0
- package/src/context/SCContext.tsx +9 -39
- package/src/context/actionType.ts +11 -0
- package/src/context/mockStore.ts +51 -0
- package/src/context/reducer.ts +23 -0
- package/src/hooks/Common/__test__/useStatusbar.test.js +28 -0
- package/src/hooks/Common/__test__/useTranslations.test.js +23 -0
- package/src/hooks/Common/index.js +2 -0
- package/src/hooks/Common/useGetIdUser.js +9 -0
- package/src/hooks/Common/useTranslations.ts +34 -0
- package/src/iot/Monitor.js +2 -1
- package/src/iot/RemoteControl/Bluetooth.js +2 -6
- package/src/iot/RemoteControl/GoogleHome.js +1 -1
- package/src/iot/RemoteControl/Internet.js +1 -1
- package/src/iot/RemoteControl/LG.js +57 -15
- package/src/iot/RemoteControl/__test__/Bluetooth.test.js +3 -5
- package/src/iot/RemoteControl/__test__/GoogleHome.test.js +3 -3
- package/src/iot/RemoteControl/__test__/Internet.test.js +1 -8
- package/src/iot/RemoteControl/__test__/LgThinq.test.js +7 -10
- package/src/iot/RemoteControl/index.js +1 -1
- package/src/iot/states.js +1 -0
- package/src/navigations/AutomateStack.js +45 -0
- package/src/navigations/SharedStack.js +2 -1
- package/src/navigations/UnitStack.js +86 -6
- package/src/navigations/utils.js +8 -0
- package/src/screens/AQIGuide/__test__/AQIGuide.test.js +9 -1
- package/src/screens/AQIGuide/index.js +2 -2
- package/src/screens/ActivityLog/__test__/index.test.js +14 -39
- package/src/screens/ActivityLog/index.js +2 -1
- package/src/screens/AddCommon/SelectSubUnit.js +5 -4
- package/src/screens/AddCommon/SelectUnit.js +3 -2
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +61 -0
- package/src/screens/AddCommon/__test__/SelectUnit.test.js +18 -10
- package/src/screens/AddLocationMaps/index.js +2 -1
- package/src/screens/AddNewAction/Components/LoadingSelectAction.js +40 -0
- package/src/screens/AddNewAction/Components/index.js +3 -0
- package/src/screens/AddNewAction/Device/DeviceStyles.js +43 -0
- package/src/screens/AddNewAction/Device/__test__/index.test.js +42 -0
- package/src/screens/AddNewAction/Device/index.js +33 -0
- package/src/screens/AddNewAction/SelectAction.js +237 -0
- package/src/screens/AddNewAction/SelectSensorDevices.js +150 -0
- package/src/screens/AddNewAction/SetupSensor.js +221 -0
- package/src/screens/AddNewAction/Styles/SelectActionStyles.js +62 -0
- package/src/screens/AddNewAction/Styles/SelectSensorDevicesStyles.js +36 -0
- package/src/screens/AddNewAction/Styles/SetupSensorStyles.js +76 -0
- package/src/screens/AddNewAction/__test__/SelectAction.test.js +153 -0
- package/src/screens/AddNewAction/__test__/SelectSensorDevices.test.js +191 -0
- package/src/screens/AddNewAction/__test__/SetupSensor.test.js +125 -0
- package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +112 -0
- package/src/screens/AddNewAutoSmart/index.js +113 -0
- package/src/screens/AddNewAutoSmart/styles/AddNewAutoSmartStyles.js +36 -0
- package/src/screens/AddNewDevice/ConnectDevices.js +2 -1
- package/src/screens/AddNewDevice/ConnectingDevices.js +2 -1
- package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +29 -13
- package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +19 -7
- package/src/screens/AddNewDevice/__test__/ConnectingDevices.test.js +16 -6
- package/src/screens/AddNewDevice/hooks/useStateAlertRename.js +2 -1
- package/src/screens/AddNewDevice/index.js +2 -1
- package/src/screens/AddNewGateway/ConnectedGateway.js +2 -1
- package/src/screens/AddNewGateway/ConnectingGateway.js +99 -24
- package/src/screens/AddNewGateway/ConnectingGatewayStyles.js +92 -0
- package/src/screens/AddNewGateway/SetupGatewayWifi.js +3 -2
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +35 -72
- package/src/screens/AddNewGateway/__test__/ConnectedGateway.test.js +14 -4
- package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +20 -10
- package/src/screens/AddNewGateway/hooks/useStateAlertRename.js +2 -1
- package/src/screens/AddNewGateway/index.js +2 -1
- package/src/screens/AddNewOneTap/AddNewOneTapStyles.js +44 -0
- package/src/screens/AddNewOneTap/__test__/AddNewOneTap.test.js +130 -0
- package/src/screens/AddNewOneTap/index.js +83 -0
- package/src/screens/AllCamera/__test__/index.test.js +103 -0
- package/src/screens/AllCamera/index.js +2 -1
- package/src/screens/Automate/Components/Loading.js +64 -0
- package/src/screens/Automate/Styles/indexStyles.js +64 -0
- package/src/screens/Automate/__test__/Loading.test.js +16 -0
- package/src/screens/Automate/__test__/index.test.js +93 -0
- package/src/screens/Automate/index.js +148 -0
- package/src/screens/Device/HeaderDevice/styles.js +2 -2
- package/src/screens/Device/__test__/detail.test.js +90 -18
- package/src/screens/Device/detail.js +73 -35
- package/src/screens/Device/hooks/useCountUp.js +4 -0
- package/src/screens/Device/hooks/useEmergencyButton.js +3 -2
- package/src/screens/Device/styles.js +5 -1
- package/src/screens/DeviceInfo/__test__/index.test.js +12 -3
- package/src/screens/DeviceInfo/index.js +2 -1
- package/src/screens/EditActionsList/Styles/indexStyles.js +84 -0
- package/src/screens/EditActionsList/index.js +186 -0
- package/src/screens/EmergencyContacts/EmergencyContactsAddNew.js +3 -2
- package/src/screens/EmergencyContacts/EmergencyContactsList.js +9 -2
- package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +2 -1
- package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +15 -18
- package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +19 -23
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +10 -25
- package/src/screens/EmergencyContacts/hook.js +3 -2
- package/src/screens/Explore/index.js +3 -2
- package/src/screens/GuestInfo/__test__/index.test.js +176 -0
- package/src/screens/GuestInfo/components/AccessScheduleItem.js +32 -0
- package/src/screens/GuestInfo/components/AccessScheduleSheet.js +204 -0
- package/src/screens/GuestInfo/components/HeaderGuestInfo.js +36 -0
- package/src/screens/GuestInfo/components/RecurringDetail.js +106 -0
- package/src/screens/GuestInfo/components/RowGuestInfo.js +31 -0
- package/src/screens/GuestInfo/components/TemporaryDetail.js +53 -0
- package/src/screens/GuestInfo/constant.js +59 -0
- package/src/screens/GuestInfo/index.js +150 -0
- package/src/screens/GuestInfo/styles/AccessScheduleDetailStyles.js +31 -0
- package/src/screens/GuestInfo/styles/AccessScheduleItemStyles.js +22 -0
- package/src/screens/GuestInfo/styles/HeaderGuestInfoStyles.js +31 -0
- package/src/screens/GuestInfo/styles/indexStyles.js +38 -0
- package/src/screens/ManageAccess/__test__/ManageAccess.test.js +13 -1
- package/src/screens/ManageAccess/hooks/index.js +4 -0
- package/src/screens/ManageAccess/index.js +49 -20
- package/src/screens/ManageAccess/styles/ManageAccessStyles.js +3 -0
- package/src/screens/PlayBackCamera/Timer.js +1 -1
- package/src/screens/PlayBackCamera/index.js +9 -5
- package/src/screens/ScanChipQR/__test__/ScanChipQR.test.js +2 -11
- package/src/screens/ScanChipQR/components/QRScan/index.js +2 -1
- package/src/screens/ScriptDetail/Styles/indexStyles.js +157 -0
- package/src/screens/ScriptDetail/__test__/index.test.js +119 -0
- package/src/screens/ScriptDetail/hooks/index.js +55 -0
- package/src/screens/ScriptDetail/index.js +344 -0
- package/src/screens/SelectUnit/Styles/indexStyles.js +55 -0
- package/src/screens/SelectUnit/__test__/index.test.js +85 -0
- package/src/screens/SelectUnit/index.js +100 -0
- package/src/screens/SetSchedule/__test__/index.test.js +97 -0
- package/src/screens/SetSchedule/components/RepeatOptionsPopup.js +56 -0
- package/src/screens/SetSchedule/components/RowItem.js +27 -0
- package/src/screens/SetSchedule/components/SelectWeekday.js +65 -0
- package/src/screens/SetSchedule/index.js +139 -0
- package/src/screens/SetSchedule/styles/RepeatOptionsPopupStyles.js +22 -0
- package/src/screens/SetSchedule/styles/RowItemStyles.js +29 -0
- package/src/screens/SetSchedule/styles/SelectWeekdayStyles.js +26 -0
- package/src/screens/SetSchedule/styles/indexStyles.js +22 -0
- package/src/screens/SharedUnit/TabHeader.js +2 -1
- package/src/screens/SharedUnit/__test__/TabHeader.test.js +40 -0
- package/src/screens/SharedUnit/index.js +3 -2
- package/src/screens/Sharing/MemberList.js +2 -1
- package/src/screens/Sharing/SelectPermission.js +2 -1
- package/src/screens/Sharing/SelectUser.js +3 -2
- package/src/screens/Sharing/__test__/MemberList.test.js +25 -28
- package/src/screens/Sharing/__test__/SelectPermission.test.js +16 -8
- package/src/screens/Sharing/__test__/SelectUser.test.js +33 -15
- package/src/screens/Sharing/hooks/index.js +22 -17
- package/src/screens/SubUnit/AddSubUnit.js +3 -2
- package/src/screens/SubUnit/Detail.js +5 -4
- package/src/screens/SubUnit/EditSubUnit.js +274 -0
- package/src/screens/SubUnit/EditSubUnitStyles.js +119 -0
- package/src/screens/SubUnit/ManageSubUnit.js +114 -371
- package/src/screens/SubUnit/ManageSubUnitStyles.js +40 -0
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +17 -11
- package/src/screens/SubUnit/__test__/Detail.test.js +11 -31
- package/src/screens/SubUnit/__test__/EditSubUnit.test.js +427 -0
- package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +51 -384
- package/src/screens/SubUnit/hooks/__test__/useManageSubUnit.test.js +85 -0
- package/src/screens/SubUnit/hooks/useManageSubUnit.js +35 -0
- package/src/screens/SyncLGDevice/AddLGDevice.js +3 -2
- package/src/screens/TDSGuide/__test__/TDSGuide.test.js +9 -1
- package/src/screens/TDSGuide/index.js +2 -1
- package/src/screens/UVIndexGuide/__test__/UVIndexGuide.test.js +9 -1
- package/src/screens/UVIndexGuide/index.js +2 -1
- package/src/screens/Unit/AddMenu.js +3 -2
- package/src/screens/Unit/Detail.js +66 -20
- package/src/screens/Unit/ManageUnit/index.js +4 -3
- package/src/screens/Unit/ManageUnit.js +15 -4
- package/src/screens/Unit/MoreMenu.js +3 -2
- package/src/screens/Unit/SelectLocation.js +8 -2
- package/src/screens/Unit/SelectLocationStyles.js +11 -0
- package/src/screens/Unit/__test__/AddMenu.test.js +15 -15
- package/src/screens/Unit/__test__/CheckSendEmail.test.js +19 -10
- package/src/screens/Unit/__test__/Detail.test.js +92 -33
- package/src/screens/Unit/__test__/ManageUnit.test.js +16 -23
- package/src/screens/Unit/components/Header/index.js +2 -1
- package/src/screens/Unit/components/ListMyAllUnit/index.js +2 -1
- package/src/screens/Unit/components/MyUnit/index.js +2 -1
- package/src/screens/Unit/components/SearchLocation/__test__/RowLocation.test.js +36 -0
- package/src/screens/Unit/components/SearchLocation/index.js +2 -1
- package/src/screens/Unit/components/SharedUnit/index.js +2 -1
- package/src/screens/Unit/components/__test__/MyUnit.test.js +22 -72
- package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +32 -0
- package/src/screens/Unit/components/__test__/SharedUnit.test.js +11 -2
- package/src/screens/UnitSummary/__test__/index.test.js +12 -4
- package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +13 -3
- package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +2 -1
- package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +16 -12
- package/src/screens/UnitSummary/components/PowerConsumption/index.js +2 -1
- package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +2 -2
- package/src/screens/UnitSummary/components/Temperature/index.js +2 -1
- package/src/screens/UnitSummary/components/TotalPowerConsumption/index.js +2 -1
- package/src/screens/UnitSummary/components/UvIndex/__test__/__snapshots__/index.test.js.snap +37 -37
- package/src/screens/UnitSummary/components/UvIndex/__test__/index.test.js +14 -6
- package/src/screens/UnitSummary/components/UvIndex/index.js +2 -1
- package/src/screens/UnitSummary/components/WaterQuality/__test__/index.test.js +11 -5
- package/src/screens/UnitSummary/components/WaterQuality/index.js +2 -1
- package/src/screens/UnitSummary/components/__test__/TotalPowerConsumption.test.js +13 -7
- package/src/screens/UnitSummary/components/__test__/UnitSummary.test.js +67 -0
- package/src/screens/UnitSummary/components/__test__/index.test.js +48 -0
- package/src/screens/UnitSummary/components/index.js +1 -37
- package/src/screens/UnitSummary/components/indexstyles.js +39 -0
- package/src/screens/UnitSummary/index.js +2 -1
- package/src/screens/WaterQualityGuide/__test__/index.test.js +12 -12
- package/src/screens/WaterQualityGuide/index.js +2 -1
- package/src/utils/Apis/axios.js +0 -4
- package/src/utils/Converter/array.js +4 -0
- package/src/utils/Converter/time.js +29 -4
- package/src/utils/I18n/index.ts +6 -0
- package/src/utils/I18n/translations/en.json +77 -5
- package/src/utils/I18n/translations/vi.json +73 -3
- package/src/utils/I18n/translations.ts +45 -0
- package/src/utils/Route/index.js +13 -0
- package/src/utils/__test__/InitData.test.js +20 -0
- package/src/commons/ChartLoading/__test__/__snapshots__/ChartLoading.test.js.snap +0 -66
- package/src/commons/Device/HistoryChart/__test__/HistoryChart.test.js +0 -57
- package/src/commons/Device/HistoryChart/__test__/__snapshots__/HistoryChart.test.js.snap +0 -593
- package/src/commons/Explore/SearchBox/__test__/__snapshots__/SearchBox.test.js.snap +0 -59
- package/src/commons/Header/__test__/Header.test.js +0 -24
- package/src/commons/MenuActionAddnew/__test__/__snapshots__/MenuActionAddNew.test.js.snap +0 -788
- package/src/commons/Sharing/__test__/__snapshots__/WrapHeaderScrollable.test.js.snap +0 -174
- package/src/commons/UnitSummary/AirQuality/__test__/__snapshots__/index.test.js.snap +0 -26679
- package/src/iot/RemoteControl/__test__/index.test.js +0 -101
- package/src/iot/__test__/Monitor.test.js +0 -119
- package/src/screens/EmergencyContacts/__test__/__snapshots__/EmergencyContactAddNew.test.js.snap +0 -1706
- package/src/screens/EmergencyContacts/__test__/__snapshots__/EmergencyContactList.test.js.snap +0 -4276
- package/src/screens/EmergencyContacts/__test__/__snapshots__/EmergencyContactsSelectContacts.test.js.snap +0 -2240
- package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +0 -358
- package/src/screens/Unit/MyAllUnit/__test__/__snapshots__/index.test.js.snap +0 -1001
- package/src/screens/Unit/MyAllUnit/__test__/index.test.js +0 -48
- package/src/screens/Unit/components/MyAllUnit/__test__/__snapshots__/index.test.js.snap +0 -1001
- package/src/screens/Unit/components/MyAllUnit/__test__/index.test.js +0 -48
- package/src/screens/UnitSummary/components/WaterQuality/__test__/__snapshots__/index.test.js.snap +0 -1574
- package/src/screens/WaterQualityGuide/__test__/__snapshots__/index.test.js.snap +0 -3375
- package/src/utils/Converter/__test__/time.test.js +0 -126
- package/src/utils/I18n/index.js +0 -19
- package/src/utils/I18n/index.test.js +0 -7
package/src/configs/Constants.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Platform, Dimensions, StatusBar } from 'react-native';
|
|
2
2
|
import { RFValue } from 'react-native-responsive-fontsize';
|
|
3
|
+
import OneTap from '../../assets/images/OneTap.svg';
|
|
4
|
+
import ValueChange from '../../assets/images/ValueChange.svg';
|
|
5
|
+
import Schedule from '../../assets/images/Schedule.svg';
|
|
3
6
|
|
|
4
7
|
const X_WIDTH = 375;
|
|
5
8
|
const X_HEIGHT = 812;
|
|
@@ -67,6 +70,10 @@ export const Constants = {
|
|
|
67
70
|
DEEP_LINK,
|
|
68
71
|
};
|
|
69
72
|
|
|
73
|
+
export const DEVICE_TYPE = {
|
|
74
|
+
LG_THINQ: 'LG_THINQ',
|
|
75
|
+
};
|
|
76
|
+
|
|
70
77
|
export const SCANNING_STATUS = {
|
|
71
78
|
BOOKING_ACTIVATED: 'booking_activated',
|
|
72
79
|
WRONG_SPOT: 'wrong_spot',
|
|
@@ -76,6 +83,42 @@ export const SCANNING_STATUS = {
|
|
|
76
83
|
SPOT_DOES_NOT_EXIST: 'spot_does_not_exist',
|
|
77
84
|
};
|
|
78
85
|
|
|
86
|
+
export const SubUnitName = {
|
|
87
|
+
scenario: 'Kịch Bản',
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const AUTOMATE_TYPE = {
|
|
91
|
+
ONE_TAP: 'one_tap',
|
|
92
|
+
VALUE_CHANGE: 'value_change',
|
|
93
|
+
SCHEDULE: 'schedule',
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const AUTOMATE_SELECT = {
|
|
97
|
+
SELECT_DEVICES: 'select_devices',
|
|
98
|
+
SELECT_SENSOR: 'select_sensor',
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export const AUTOMATES = {
|
|
102
|
+
one_tap: {
|
|
103
|
+
value: AUTOMATE_TYPE.ONE_TAP,
|
|
104
|
+
title: 'Launch One-Tap',
|
|
105
|
+
explanation: 'Do everything with just one button',
|
|
106
|
+
icon: OneTap,
|
|
107
|
+
},
|
|
108
|
+
value_change: {
|
|
109
|
+
value: AUTOMATE_TYPE.VALUE_CHANGE,
|
|
110
|
+
title: 'Value change',
|
|
111
|
+
explanation: 'Short Explanation',
|
|
112
|
+
icon: ValueChange,
|
|
113
|
+
},
|
|
114
|
+
schedule: {
|
|
115
|
+
value: AUTOMATE_TYPE.SCHEDULE,
|
|
116
|
+
title: 'Schedule',
|
|
117
|
+
explanation: 'Short Explanation',
|
|
118
|
+
icon: Schedule,
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
|
|
79
122
|
export const TESTID = {
|
|
80
123
|
// Dashboard
|
|
81
124
|
DASHBOARD_TAB_HOME: 'DASHBOARD_TAB_HOME',
|
|
@@ -115,6 +158,7 @@ export const TESTID = {
|
|
|
115
158
|
MY_UNIT_NO_UNIT: 'MY_UNIT_NO_UNIT',
|
|
116
159
|
|
|
117
160
|
// sub unit
|
|
161
|
+
SUB_UNIT_FULL_CAMERA: 'SUB_UNIT_FULL_CAMERA',
|
|
118
162
|
SUB_UNIT_CAMERA_VIEW: 'SUB_UNIT_CAMERA_VIEW',
|
|
119
163
|
SUB_UNIT_BACKGROUND: 'SUB_UNIT_BACKGROUND',
|
|
120
164
|
SUB_UNIT_GO_TO_DETAIL: 'SUB_UNIT_GO_TO_DETAIL',
|
|
@@ -216,6 +260,11 @@ export const TESTID = {
|
|
|
216
260
|
ITEM_TEXT_INPUT: 'ITEM_TEXT_INPUT',
|
|
217
261
|
ITEM_TEXT_ERROR: 'ITEM_TEXT_ERROR',
|
|
218
262
|
SEARCH_BAR_INPUT: 'SEARCH_BAR_INPUT',
|
|
263
|
+
GO_DETAIL: 'GO_DETAIL',
|
|
264
|
+
|
|
265
|
+
// Automate
|
|
266
|
+
AUTOMATE_SCRIPT_ACTION: 'AUTOMATE_SCRIPT_ACTION',
|
|
267
|
+
NAME_YOUR_BUTTON: 'NAME_YOUR_BUTTON',
|
|
219
268
|
|
|
220
269
|
// Parking input maunaly spot
|
|
221
270
|
PARKING_SPOT_INFO_BUTTON: 'PARKING_SPOT_INFO_BUTTON',
|
|
@@ -259,6 +308,7 @@ export const TESTID = {
|
|
|
259
308
|
SENSOR_DISPLAY_ITEM: 'SENSOR_DISPLAY_ITEM',
|
|
260
309
|
ITEM_QUICK_ACTION_PRESS: 'ITEM_QUICK_ACTION_PRESS',
|
|
261
310
|
TIME_COUNT_DOWN_TEXT: 'TIME_COUNT_DOWN_TEXT',
|
|
311
|
+
ACTION_ITEM: 'ACTION_ITEM',
|
|
262
312
|
|
|
263
313
|
// DeviceInfo
|
|
264
314
|
DEVICE_INFO_BATTERY: 'DEVICE_INFO_BATTERY',
|
|
@@ -389,6 +439,7 @@ export const TESTID = {
|
|
|
389
439
|
MANAGE_UNIT: 'MANAGE_UNIT',
|
|
390
440
|
MANAGE_UNIT_ALERT: 'MANAGE_UNIT_ALERT',
|
|
391
441
|
SELECT_UNIT: 'SELECT_UNIT',
|
|
442
|
+
BUTTON_ADD_AUTO_SMART: 'BUTTON_ADD_AUTO_SMART',
|
|
392
443
|
},
|
|
393
444
|
|
|
394
445
|
TERM_AND_POLICY_TITLE: 'TERM_AND_POLICY_TITLE',
|
|
@@ -475,4 +526,14 @@ export const TESTID = {
|
|
|
475
526
|
// Add New Device LG
|
|
476
527
|
ADD_NEW_DEVICE_LG_ADD: 'ADD_NEW_DEVICE_LG_ADD',
|
|
477
528
|
ADD_NEW_DEVICE_LG_THEN_SELECT: 'ADD_NEW_DEVICE_LG_THEN_SELECT',
|
|
529
|
+
|
|
530
|
+
// WheelDateTimePicker
|
|
531
|
+
WHEEL_DATE_TIME_PICKER: 'WHEEL_DATE_TIME_PICKER',
|
|
532
|
+
|
|
533
|
+
// GuestInfo
|
|
534
|
+
SAVE_ACCESS_SCHEDULE: 'SAVE_ACCESS_SCHEDULE',
|
|
535
|
+
ACCESS_SCHEDULE_RADIO_BUTTON: 'ACCESS_SCHEDULE_RADIO_BUTTON',
|
|
536
|
+
ACCESS_SCHEDULE_SHEET: 'ACCESS_SCHEDULE_SHEET',
|
|
537
|
+
RECURRING_TEXT_BUTTON: 'RECURRING_TEXT_BUTTON',
|
|
538
|
+
TEMPORARY_TEXT_BUTTON: 'TEMPORARY_TEXT_BUTTON',
|
|
478
539
|
};
|
package/src/configs/Images.js
CHANGED
package/src/configs/SCConfig.js
CHANGED
|
@@ -90,6 +90,8 @@ const SCDefaultConfig = {
|
|
|
90
90
|
LG_CLIENT_ID: '2b85aee334f046848341547894bb7c4e',
|
|
91
91
|
LG_REDIRECT_URI_APP: 'app://eoh/sync-lg-device',
|
|
92
92
|
LG_URL: 'https://qt-vn.m.lgaccount.com/emp/v2',
|
|
93
|
+
pusherAppKey: '9a591ae4a764acc08714',
|
|
94
|
+
pusherAppCluster: 'ap1',
|
|
93
95
|
};
|
|
94
96
|
|
|
95
97
|
export class SCConfig {
|
|
@@ -98,6 +100,8 @@ export class SCConfig {
|
|
|
98
100
|
static LG_CLIENT_ID = SCDefaultConfig.LG_CLIENT_ID;
|
|
99
101
|
static LG_REDIRECT_URI_APP = SCDefaultConfig.LG_REDIRECT_URI_APP;
|
|
100
102
|
static LG_URL = SCDefaultConfig.LG_URL;
|
|
103
|
+
static pusherAppKey = SCDefaultConfig.pusherAppKey;
|
|
104
|
+
static pusherAppCluste = SCDefaultConfig.pusherAppCluster;
|
|
101
105
|
}
|
|
102
106
|
|
|
103
107
|
export const initSCConfig = (config) => {
|
|
@@ -109,4 +113,7 @@ export const initSCConfig = (config) => {
|
|
|
109
113
|
SCConfig.LG_REDIRECT_URI_APP =
|
|
110
114
|
config.LG_REDIRECT_URI_APP ?? SCDefaultConfig.LG_REDIRECT_URI_APP;
|
|
111
115
|
SCConfig.LG_URL = config.LG_URL ?? SCDefaultConfig.LG_URL;
|
|
116
|
+
SCConfig.pusherAppKey = config.pusherAppKey ?? SCDefaultConfig.pusherAppKey;
|
|
117
|
+
SCConfig.pusherAppCluster =
|
|
118
|
+
config.pusherAppCluster ?? SCDefaultConfig.pusherAppCluster;
|
|
112
119
|
};
|
package/src/configs/Theme.js
CHANGED
|
@@ -85,4 +85,24 @@ export default StyleSheet.create({
|
|
|
85
85
|
justifyContent: 'center',
|
|
86
86
|
alignItems: 'center',
|
|
87
87
|
},
|
|
88
|
+
menuIcon: {
|
|
89
|
+
paddingLeft: 16,
|
|
90
|
+
height: '100%',
|
|
91
|
+
justifyContent: 'center',
|
|
92
|
+
},
|
|
93
|
+
wrap: {
|
|
94
|
+
flex: 1,
|
|
95
|
+
backgroundColor: Colors.White,
|
|
96
|
+
},
|
|
97
|
+
shadowView: {
|
|
98
|
+
shadowColor: Colors.Gray7,
|
|
99
|
+
backgroundColor: Colors.White,
|
|
100
|
+
shadowOffset: {
|
|
101
|
+
width: 0,
|
|
102
|
+
height: 3,
|
|
103
|
+
},
|
|
104
|
+
shadowOpacity: 0.22,
|
|
105
|
+
shadowRadius: 3,
|
|
106
|
+
elevation: 3,
|
|
107
|
+
},
|
|
88
108
|
});
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import React, { useContext, useReducer } from 'react';
|
|
2
|
-
import { StyleSheet, View, Text } from 'react-native';
|
|
3
|
-
import Toast from 'react-native-toast-message';
|
|
4
2
|
|
|
5
|
-
import { Alert } from '../commons';
|
|
6
|
-
import { Colors } from '../configs';
|
|
7
|
-
import { setLanguage, updateTranslation } from '../utils/I18n';
|
|
8
3
|
import {
|
|
9
4
|
ActionDataMap,
|
|
10
5
|
ActionType,
|
|
@@ -13,22 +8,13 @@ import {
|
|
|
13
8
|
StatusBar,
|
|
14
9
|
} from './actionType';
|
|
15
10
|
import { initialState, Action, ContextData, reducer } from './reducer';
|
|
16
|
-
|
|
17
|
-
const toastConfig = {
|
|
18
|
-
// only for error for now
|
|
19
|
-
error: (internalState) => (
|
|
20
|
-
<View style={styles.toastContainer}>
|
|
21
|
-
<Text style={styles.textWhite}>{internalState.text1}</Text>
|
|
22
|
-
</View>
|
|
23
|
-
),
|
|
24
|
-
};
|
|
11
|
+
import { setConfigGlobalState } from '../iot/states.js';
|
|
25
12
|
|
|
26
13
|
type SCContextType = {
|
|
27
14
|
stateData: ContextData;
|
|
28
15
|
setAuth: (authData: AuthData) => void;
|
|
29
16
|
setLocale: (language: Language) => void;
|
|
30
17
|
setStatusBar: (statusBar: StatusBar) => void;
|
|
31
|
-
updateLocale: (langTranslate: any) => void;
|
|
32
18
|
setAction: <T extends ActionType>(
|
|
33
19
|
action: T,
|
|
34
20
|
payload?: ActionDataMap[T]
|
|
@@ -43,27 +29,23 @@ type Reducer<StateData, Action> = (
|
|
|
43
29
|
action: Action
|
|
44
30
|
) => StateData;
|
|
45
31
|
|
|
46
|
-
export const SCProvider = ({ children }) => {
|
|
32
|
+
export const SCProvider = ({ children, initState = initialState }) => {
|
|
47
33
|
const [stateData, dispatch] = useReducer<Reducer<ContextData, Action>>(
|
|
48
34
|
reducer,
|
|
49
|
-
|
|
35
|
+
initState
|
|
50
36
|
);
|
|
51
37
|
|
|
52
38
|
const setAuth = (authData: AuthData) => {
|
|
53
39
|
setAction('UPDATE_AUTH', authData);
|
|
54
40
|
};
|
|
55
41
|
|
|
56
|
-
const setLocale = (language: Language) => {
|
|
57
|
-
setLanguage(language);
|
|
58
|
-
setAction('UPDATE_LANGUAGE', language);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
42
|
const setStatusBar = (statusBar: StatusBar) => {
|
|
62
43
|
setAction('STORE_STATUS_BAR', statusBar);
|
|
63
44
|
};
|
|
64
45
|
|
|
65
|
-
const
|
|
66
|
-
|
|
46
|
+
const setLocale = (language: Language) => {
|
|
47
|
+
setConfigGlobalState('lang', language);
|
|
48
|
+
setAction('UPDATE_LANGUAGE', language);
|
|
67
49
|
};
|
|
68
50
|
|
|
69
51
|
const setAction = <T extends ActionType>(
|
|
@@ -76,17 +58,16 @@ export const SCProvider = ({ children }) => {
|
|
|
76
58
|
const providerValue = {
|
|
77
59
|
stateData,
|
|
78
60
|
setAuth,
|
|
79
|
-
setLocale,
|
|
80
61
|
setAction,
|
|
62
|
+
setLocale,
|
|
81
63
|
setStatusBar,
|
|
82
|
-
updateLocale,
|
|
83
64
|
};
|
|
84
65
|
|
|
85
66
|
return (
|
|
86
67
|
<SCContext.Provider value={providerValue}>
|
|
87
68
|
{children}
|
|
88
|
-
<Alert ref={(ref) => Alert.setRef(ref)} />
|
|
89
|
-
<Toast config={toastConfig} ref={(ref) => Toast.setRef(ref)} />
|
|
69
|
+
{/* <Alert ref={(ref) => Alert.setRef(ref)} />
|
|
70
|
+
<Toast config={toastConfig} ref={(ref) => Toast.setRef(ref)} /> */}
|
|
90
71
|
</SCContext.Provider>
|
|
91
72
|
);
|
|
92
73
|
};
|
|
@@ -97,14 +78,3 @@ export const useSCContextSelector = (
|
|
|
97
78
|
const { stateData } = useContext(SCContext);
|
|
98
79
|
return selector(stateData);
|
|
99
80
|
};
|
|
100
|
-
|
|
101
|
-
const styles = StyleSheet.create({
|
|
102
|
-
toastContainer: {
|
|
103
|
-
borderRadius: 5,
|
|
104
|
-
padding: 10,
|
|
105
|
-
backgroundColor: Colors.Black,
|
|
106
|
-
},
|
|
107
|
-
textWhite: {
|
|
108
|
-
color: Colors.White,
|
|
109
|
-
},
|
|
110
|
-
});
|
|
@@ -3,6 +3,7 @@ export const Action = {
|
|
|
3
3
|
UPDATE_LANGUAGE: 'UPDATE_LANGUAGE',
|
|
4
4
|
STORE_STATUS_BAR: 'STORE_STATUS_BAR',
|
|
5
5
|
LIST_DEVICE_TYPES: 'LIST_DEVICE_TYPES',
|
|
6
|
+
LIST_ACTION: 'LIST_ACTION',
|
|
6
7
|
};
|
|
7
8
|
|
|
8
9
|
export type AuthData = {
|
|
@@ -25,6 +26,15 @@ export type ListDevice = {
|
|
|
25
26
|
sentEmail: boolean;
|
|
26
27
|
};
|
|
27
28
|
|
|
29
|
+
export type ListAction = {
|
|
30
|
+
action: string;
|
|
31
|
+
unit_name: string;
|
|
32
|
+
action_name: string;
|
|
33
|
+
sensor_name: string;
|
|
34
|
+
sensor_icon_kit: string;
|
|
35
|
+
station_name: string;
|
|
36
|
+
}[];
|
|
37
|
+
|
|
28
38
|
export type ActionType = keyof typeof Action;
|
|
29
39
|
|
|
30
40
|
export type ActionDataMap = {
|
|
@@ -32,4 +42,5 @@ export type ActionDataMap = {
|
|
|
32
42
|
UPDATE_LANGUAGE: Language;
|
|
33
43
|
STORE_STATUS_BAR: StatusBar;
|
|
34
44
|
LIST_DEVICE_TYPES: ListDevice;
|
|
45
|
+
LIST_ACTION: ListAction;
|
|
35
46
|
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ContextData } from './reducer';
|
|
2
|
+
|
|
3
|
+
export const mockDataStore: ContextData = {
|
|
4
|
+
auth: {
|
|
5
|
+
account: {
|
|
6
|
+
token: 'TOKEN',
|
|
7
|
+
user: {
|
|
8
|
+
avatar: null,
|
|
9
|
+
email: 'test@gmail.com',
|
|
10
|
+
id: 1,
|
|
11
|
+
is_using_social_avatar: false,
|
|
12
|
+
name: 'TEST',
|
|
13
|
+
org: 2,
|
|
14
|
+
phone_number: '012345678',
|
|
15
|
+
social_avatar_hash: '',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
language: 'en',
|
|
20
|
+
listDevice: {
|
|
21
|
+
sentEmail: false,
|
|
22
|
+
},
|
|
23
|
+
statusBar: {
|
|
24
|
+
backgroundColor: '',
|
|
25
|
+
barStyle: '',
|
|
26
|
+
},
|
|
27
|
+
listAction: [],
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const mockSCStore = (data: ContextData): ContextData => {
|
|
31
|
+
return {
|
|
32
|
+
auth: {
|
|
33
|
+
account: {
|
|
34
|
+
...mockDataStore.auth.account,
|
|
35
|
+
...data.auth?.account,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
language: data.language ? data.language : mockDataStore.language,
|
|
39
|
+
listDevice: {
|
|
40
|
+
...mockDataStore.listDevice,
|
|
41
|
+
...data.listDevice,
|
|
42
|
+
},
|
|
43
|
+
statusBar: {
|
|
44
|
+
backgroundColor:
|
|
45
|
+
data?.statusBar?.backgroundColor ||
|
|
46
|
+
mockDataStore?.statusBar?.backgroundColor,
|
|
47
|
+
barStyle: data?.statusBar?.barStyle || mockDataStore?.statusBar?.barStyle,
|
|
48
|
+
},
|
|
49
|
+
listAction: [...mockDataStore.listAction, ...(data?.listAction || [])],
|
|
50
|
+
};
|
|
51
|
+
};
|
package/src/context/reducer.ts
CHANGED
|
@@ -6,12 +6,15 @@ import {
|
|
|
6
6
|
StatusBar,
|
|
7
7
|
Action,
|
|
8
8
|
ListDevice,
|
|
9
|
+
ListAction,
|
|
9
10
|
} from './actionType';
|
|
10
11
|
|
|
11
12
|
export type ContextData = {
|
|
12
13
|
auth: AuthData;
|
|
13
14
|
language: Language;
|
|
14
15
|
listDevice: ListDevice;
|
|
16
|
+
listAction: ListAction;
|
|
17
|
+
statusBar: StatusBar;
|
|
15
18
|
};
|
|
16
19
|
|
|
17
20
|
export type Action = {
|
|
@@ -31,6 +34,7 @@ export const initialState = {
|
|
|
31
34
|
language: 'en' as Language,
|
|
32
35
|
statusBar: {} as StatusBar,
|
|
33
36
|
listDevice: {} as ListDevice,
|
|
37
|
+
listAction: [] as ListAction,
|
|
34
38
|
};
|
|
35
39
|
|
|
36
40
|
export const reducer = (currentState: ContextData, action: Action) => {
|
|
@@ -41,6 +45,8 @@ export const reducer = (currentState: ContextData, action: Action) => {
|
|
|
41
45
|
return { ...currentState, auth: payload };
|
|
42
46
|
case Action.STORE_STATUS_BAR:
|
|
43
47
|
return { ...currentState, statusBar: payload };
|
|
48
|
+
case Action.UPDATE_LANGUAGE:
|
|
49
|
+
return { ...currentState, language: payload };
|
|
44
50
|
case Action.LIST_DEVICE_TYPES:
|
|
45
51
|
if (currentState.listDevice) {
|
|
46
52
|
currentState.listDevice[action.payload.chipId] = {
|
|
@@ -60,6 +66,23 @@ export const reducer = (currentState: ContextData, action: Action) => {
|
|
|
60
66
|
};
|
|
61
67
|
}
|
|
62
68
|
|
|
69
|
+
case Action.LIST_ACTION:
|
|
70
|
+
let newListAction = [...currentState.listAction];
|
|
71
|
+
|
|
72
|
+
if (Object.keys(payload).length === 0) {
|
|
73
|
+
newListAction = [];
|
|
74
|
+
} else {
|
|
75
|
+
const order = newListAction.length + 1;
|
|
76
|
+
|
|
77
|
+
const isHaveAction = newListAction.findIndex(
|
|
78
|
+
(item) => item.action === payload.action
|
|
79
|
+
);
|
|
80
|
+
if (isHaveAction < 0) {
|
|
81
|
+
newListAction.push({ ...payload, order });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return { ...currentState, listAction: newListAction };
|
|
63
86
|
default:
|
|
64
87
|
return currentState;
|
|
65
88
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useStatusBarPreview, useHiddenStatusBar } from '../useStatusBar';
|
|
2
|
+
|
|
3
|
+
describe('test useStatusBarPreview', () => {
|
|
4
|
+
let Platform;
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
Platform = require('react-native').Platform;
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('test useStatusBarPreview on android', () => {
|
|
10
|
+
Platform.OS = 'ios';
|
|
11
|
+
useStatusBarPreview();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('test useStatusBarPreview on iOS', () => {
|
|
15
|
+
Platform.OS = 'android';
|
|
16
|
+
useStatusBarPreview();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('test useHiddenStatusBar on android', () => {
|
|
20
|
+
Platform.OS = 'ios';
|
|
21
|
+
useHiddenStatusBar(false);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('test useHiddenStatusBar on iOS', () => {
|
|
25
|
+
Platform.OS = 'android';
|
|
26
|
+
useHiddenStatusBar(true);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { renderHook } from '@testing-library/react-hooks';
|
|
3
|
+
import { SCProvider } from '../../../context';
|
|
4
|
+
import { mockSCStore } from '../../../context/mockStore';
|
|
5
|
+
import { useTranslations } from '../useTranslations';
|
|
6
|
+
|
|
7
|
+
const mockedSetAction = jest.fn();
|
|
8
|
+
|
|
9
|
+
const wrapper = ({ children }) => <SCProvider>{children}</SCProvider>;
|
|
10
|
+
|
|
11
|
+
const mockUseContext = jest.fn().mockImplementation(() => ({
|
|
12
|
+
stateData: mockSCStore({}),
|
|
13
|
+
setAction: mockedSetAction,
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
React.useContext = mockUseContext;
|
|
17
|
+
|
|
18
|
+
describe('Test useTranslations', () => {
|
|
19
|
+
it('test useTranslations', () => {
|
|
20
|
+
// eslint-disable-next-line no-unused-vars
|
|
21
|
+
const { result } = renderHook(() => useTranslations(), { wrapper });
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -8,6 +8,7 @@ import useControllList from './useControllList';
|
|
|
8
8
|
import { useBlockBackAndroid } from './useBlockBackAndroid';
|
|
9
9
|
import { useIsOwnerOfUnit } from './useIsOwnerOfUnit';
|
|
10
10
|
import { useStatusBar } from './useStatusBar';
|
|
11
|
+
import { useGetIdUser } from './useGetIdUser';
|
|
11
12
|
|
|
12
13
|
export {
|
|
13
14
|
useAndroidTranslucentStatusBar,
|
|
@@ -20,4 +21,5 @@ export {
|
|
|
20
21
|
useBlockBackAndroid,
|
|
21
22
|
useIsOwnerOfUnit,
|
|
22
23
|
useStatusBar,
|
|
24
|
+
useGetIdUser,
|
|
23
25
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getTranslate,
|
|
3
|
+
InterPolateString,
|
|
4
|
+
Language,
|
|
5
|
+
TranslationString,
|
|
6
|
+
} from '../../utils/I18n';
|
|
7
|
+
import { useCallback } from 'react';
|
|
8
|
+
import { useSCContextSelector } from '../../context';
|
|
9
|
+
import { getConfigGlobalState } from '../../iot/states.js';
|
|
10
|
+
|
|
11
|
+
export const useTranslations = () => {
|
|
12
|
+
const lang = useSCContextSelector((state) => state.language);
|
|
13
|
+
|
|
14
|
+
const language: Language = lang as Language;
|
|
15
|
+
|
|
16
|
+
const t = useCallback(
|
|
17
|
+
(translations: TranslationString, interpolateStr?: InterPolateString) =>
|
|
18
|
+
getTranslate(language, translations, interpolateStr),
|
|
19
|
+
[language]
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const t = (
|
|
26
|
+
translations: TranslationString,
|
|
27
|
+
interpolateStr?: InterPolateString
|
|
28
|
+
) => {
|
|
29
|
+
const lang = getConfigGlobalState('lang');
|
|
30
|
+
const language: Language = lang as Language;
|
|
31
|
+
return getTranslate(language, translations, interpolateStr);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default t;
|
package/src/iot/Monitor.js
CHANGED
|
@@ -3,13 +3,14 @@ import { getConfigGlobalState, setConfigGlobalState } from './states';
|
|
|
3
3
|
import _ from 'lodash';
|
|
4
4
|
import Pusher from 'pusher-js/react-native';
|
|
5
5
|
import { axiosPost } from '../utils/Apis/axios';
|
|
6
|
+
import { SCConfig } from '../configs';
|
|
6
7
|
|
|
7
8
|
Pusher.logToConsole = true;
|
|
8
9
|
let pusher = null;
|
|
9
10
|
|
|
10
11
|
const getPusher = () => {
|
|
11
12
|
if (!pusher) {
|
|
12
|
-
pusher = new Pusher(
|
|
13
|
+
pusher = new Pusher(SCConfig.pusherAppKey, {
|
|
13
14
|
cluster: 'ap1',
|
|
14
15
|
authorizer: function (channel, option) {
|
|
15
16
|
return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable promise/prefer-await-to-then */
|
|
2
2
|
/* eslint-disable promise/prefer-await-to-callbacks */
|
|
3
3
|
import { BLE } from '../../configs';
|
|
4
|
-
import
|
|
4
|
+
import t from '../../hooks/Common/useTranslations';
|
|
5
5
|
import base64 from 'react-native-base64';
|
|
6
6
|
import { BleManager } from 'react-native-ble-plx';
|
|
7
7
|
import { ToastBottomHelper } from '../../utils/Utils';
|
|
@@ -68,11 +68,7 @@ const realScanBluetoothDevices = () => {
|
|
|
68
68
|
const index = needToScanDevices.indexOf(name);
|
|
69
69
|
needToScanDevices.splice(index, 1);
|
|
70
70
|
|
|
71
|
-
ToastBottomHelper.success(
|
|
72
|
-
t('Found bluetooth %{name} for remote control', {
|
|
73
|
-
name,
|
|
74
|
-
})
|
|
75
|
-
);
|
|
71
|
+
ToastBottomHelper.success(t(`Found bluetooth ${name} for remote control`));
|
|
76
72
|
|
|
77
73
|
bluetoothDevices[name] = device;
|
|
78
74
|
if (!needToScanDevices.length) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Auth, createConnection, getStates } from 'home-assistant-js-websocket';
|
|
2
|
-
import
|
|
2
|
+
import t from '../../hooks/Common/useTranslations';
|
|
3
3
|
import { getConfigGlobalState, setConfigGlobalState } from '../states';
|
|
4
4
|
import { ToastBottomHelper } from '../../utils/Utils';
|
|
5
5
|
import { API } from '../../configs';
|
|
@@ -4,12 +4,19 @@ import { getConfigGlobalState, setConfigGlobalState } from '../states';
|
|
|
4
4
|
import { sendCommandOverInternet } from './Internet';
|
|
5
5
|
|
|
6
6
|
let deviceMaps = {};
|
|
7
|
-
|
|
7
|
+
const propertyListMaps = {
|
|
8
8
|
temperature: 'targetTemperature',
|
|
9
9
|
doorStatus: 'doorState',
|
|
10
10
|
};
|
|
11
|
+
const propertyTimer = [
|
|
12
|
+
'absoluteHourToStart',
|
|
13
|
+
'absoluteMinuteToStart',
|
|
14
|
+
'absoluteHourToStop',
|
|
15
|
+
'absoluteMinuteToStop',
|
|
16
|
+
];
|
|
11
17
|
|
|
12
18
|
function updateConfigValues(device, configValues, name, value) {
|
|
19
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
13
20
|
if (device.hasOwnProperty(name)) {
|
|
14
21
|
const [configId] = device[name];
|
|
15
22
|
configValues[configId] = value;
|
|
@@ -17,16 +24,9 @@ function updateConfigValues(device, configValues, name, value) {
|
|
|
17
24
|
return configValues;
|
|
18
25
|
}
|
|
19
26
|
|
|
20
|
-
|
|
21
|
-
const device = deviceMaps[device_id];
|
|
22
|
-
|
|
23
|
-
if (!device) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
let configValues = getConfigGlobalState('configValues');
|
|
28
|
-
// eslint-disable-next-line no-unused-vars
|
|
27
|
+
function parseData(configValues, device, data) {
|
|
29
28
|
for (const [resource, property] of Object.entries(data)) {
|
|
29
|
+
// base on data
|
|
30
30
|
if (Array.isArray(property)) {
|
|
31
31
|
const valueName = propertyListMaps[resource];
|
|
32
32
|
if (valueName) {
|
|
@@ -52,6 +52,41 @@ export async function updateStateByLgThinq(device_id, data) {
|
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
+
|
|
56
|
+
// For timer, if there is not exist in data, set undefined
|
|
57
|
+
for (let i = 0; i < propertyTimer.length; i++) {
|
|
58
|
+
// base on device
|
|
59
|
+
const name = propertyTimer[i];
|
|
60
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
61
|
+
if (device.hasOwnProperty(name)) {
|
|
62
|
+
const timer = data.timer;
|
|
63
|
+
const value = timer ? timer[name] : -1;
|
|
64
|
+
const [configId] = device[name];
|
|
65
|
+
configValues[configId] = value;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return configValues;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export async function updateStateByLgThinq(device_id, data) {
|
|
73
|
+
const device = deviceMaps[device_id];
|
|
74
|
+
|
|
75
|
+
if (!device) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let configValues = getConfigGlobalState('configValues');
|
|
80
|
+
|
|
81
|
+
if (Array.isArray(data)) {
|
|
82
|
+
for (let i = 0; i < data.length; i++) {
|
|
83
|
+
const dataItem = data[i];
|
|
84
|
+
configValues = parseData(configValues, device, dataItem);
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
configValues = parseData(configValues, device, data);
|
|
88
|
+
}
|
|
89
|
+
|
|
55
90
|
setConfigGlobalState('configValues', { ...configValues });
|
|
56
91
|
}
|
|
57
92
|
|
|
@@ -110,13 +145,21 @@ export const sendCommandOverLGThinq = async (sensor, action, data) => {
|
|
|
110
145
|
|
|
111
146
|
const item = action.lg_actions[i];
|
|
112
147
|
let new_message = {};
|
|
148
|
+
let isFirstResourceDone = false;
|
|
113
149
|
for (const [key, value] of Object.entries(item.message)) {
|
|
114
150
|
let new_property = {};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
151
|
+
|
|
152
|
+
if (!isFirstResourceDone) {
|
|
153
|
+
let index = 0;
|
|
154
|
+
for (const [key1, value1] of Object.entries(value)) {
|
|
155
|
+
new_property[key1] = data[index] ? data[index] : value1; // new or keep old one
|
|
156
|
+
index += 1;
|
|
157
|
+
}
|
|
158
|
+
isFirstResourceDone = true;
|
|
159
|
+
} else {
|
|
160
|
+
new_property = value; // from next resource, keep old one
|
|
119
161
|
}
|
|
162
|
+
|
|
120
163
|
new_message[key] = new_property;
|
|
121
164
|
}
|
|
122
165
|
|
|
@@ -127,5 +170,4 @@ export const sendCommandOverLGThinq = async (sensor, action, data) => {
|
|
|
127
170
|
'lg_thinq'
|
|
128
171
|
);
|
|
129
172
|
}
|
|
130
|
-
await fetchDeviceStatusLG(sensor);
|
|
131
173
|
};
|