@eohjsc/react-native-smart-city 0.2.19 → 0.2.23
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/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/Event.svg +9 -0
- package/assets/images/HowToStart.svg +14 -0
- package/assets/images/OneTap.svg +14 -0
- package/assets/images/Rearrange.svg +3 -0
- package/assets/images/Schedule.svg +39 -0
- package/assets/images/WeatherChange.svg +49 -0
- package/index.js +2 -0
- package/package.json +7 -4
- 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/file@2x.png +0 -0
- package/src/Images/Common/file@3x.png +0 -0
- package/src/Images/Common/fullscreen@2x.png +0 -0
- package/src/Images/Common/fullscreen@3x.png +0 -0
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +6 -3
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +10 -1
- 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__/OptionsDropdownTemplate.test.js +2 -1
- package/src/commons/ActionGroup/hooks/useDropdownAction.js +2 -1
- package/src/commons/Automate/ItemAddNewScriptAction.js +30 -0
- package/src/commons/Automate/ItemAddNewScriptActionStyles.js +38 -0
- package/src/commons/Automate/ItemAutomate.js +63 -0
- package/src/commons/Automate/ItemAutomateStyles.js +30 -0
- package/src/commons/Automate/ItemScriptAction.js +41 -0
- package/src/commons/Automate/ItemScriptActionStyles.js +38 -0
- package/src/commons/BottomScrollPicker/index.js +58 -0
- package/src/commons/BottomScrollPicker/styles.js +13 -0
- package/src/commons/BottomSheet/index.js +36 -0
- package/src/commons/BottomSheet/styles.js +37 -0
- package/src/commons/Button/index.js +6 -1
- package/src/commons/CameraDevice/index.js +22 -10
- 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 +2 -1
- 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/FlatListItems.js +2 -1
- package/src/commons/Device/FooterInfo.js +2 -1
- package/src/commons/Device/HistoryChart.js +2 -1
- package/src/commons/Device/HorizontalBarChart.js +3 -3
- package/src/commons/Device/PMSensor/PMSensorIndicatior.js +7 -2
- package/src/commons/Device/PMSensor/PMSensorIndicatorStyles.js +3 -1
- package/src/commons/Device/RainningSensor/CurrentRainSensor.js +3 -1
- package/src/commons/Device/SensorConnectedStatus.js +2 -1
- package/src/commons/Device/WindDirection/Compass/index.js +1 -1
- package/src/commons/Device/WindSpeed/LinearChart/index.js +2 -1
- package/src/commons/Device/__test__/DeviceAlertStatus.test.js +2 -1
- 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/index.js +2 -1
- package/src/commons/Header/HeaderCustom.js +36 -10
- package/src/commons/Header/Styles/HeaderCustomStyles.js +8 -3
- package/src/commons/HeaderAni/index.js +6 -3
- package/src/commons/IconComponent/index.js +18 -3
- package/src/commons/ImagePicker/index.js +3 -1
- package/src/commons/MediaPlayer/index.js +118 -62
- package/src/commons/MediaPlayer/styles.js +56 -0
- package/src/commons/MediaPlayerDetail/MediaPlayerDetailStyles.js +15 -0
- package/src/commons/MediaPlayerDetail/index.js +149 -64
- package/src/commons/MenuActionAddnew/index.js +2 -1
- package/src/commons/Modal/ModalCustom.js +22 -0
- package/src/commons/Modal/ModalFullVideo.js +48 -0
- package/src/commons/Modal/Styles/ModalFullVideoStyles.js +26 -0
- package/src/commons/Modal/index.js +4 -0
- package/src/commons/NavBar/index.js +2 -2
- 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/SubUnit/OneTap/ItemOneTap.js +86 -0
- package/src/commons/SubUnit/OneTap/ItemOneTapStyles.js +41 -0
- package/src/commons/SubUnit/OneTap/OneTapStyles.js +36 -0
- package/src/commons/SubUnit/OneTap/index.js +29 -0
- package/src/commons/SubUnit/ShortDetail.js +3 -1
- package/src/commons/Today/index.js +2 -1
- package/src/commons/Unit/SharedUnit.js +2 -1
- package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +1 -2
- 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/WheelDateTimePicker/Picker.js +57 -0
- package/src/commons/WheelDateTimePicker/index.js +160 -0
- package/src/commons/WheelDateTimePicker/styles.js +21 -0
- package/src/configs/API.js +25 -3
- package/src/configs/Colors.js +1 -0
- package/src/configs/Constants.js +4 -0
- package/src/configs/Images.js +4 -0
- package/src/configs/SCConfig.js +94 -0
- package/src/context/SCContext.tsx +5 -11
- package/src/context/reducer.ts +2 -0
- package/src/hooks/Common/useStatusBar.js +3 -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 +2 -1
- package/src/iot/RemoteControl/__test__/GoogleHome.test.js +2 -1
- package/src/iot/RemoteControl/__test__/Internet.test.js +2 -1
- package/src/iot/RemoteControl/__test__/index.test.js +2 -1
- package/src/iot/RemoteControl/index.js +1 -1
- package/src/iot/states.js +1 -0
- package/src/navigations/AddGatewayStack.js +5 -0
- package/src/navigations/AddNewActionStack.js +23 -0
- package/src/navigations/SharedStack.js +2 -1
- package/src/navigations/UnitStack.js +72 -1
- package/src/screens/AQIGuide/index.js +2 -2
- package/src/screens/ActivityLog/hooks/index.js +1 -1
- package/src/screens/ActivityLog/index.js +2 -1
- package/src/screens/AddCommon/SelectSubUnit.js +143 -0
- package/src/screens/AddCommon/SelectSubUnitStyles.js +55 -0
- package/src/screens/AddCommon/SelectUnit.js +3 -2
- package/src/screens/AddLocationMaps/index.js +2 -1
- package/src/screens/AddNewAction/Device/DeviceStyles.js +43 -0
- package/src/screens/AddNewAction/Device/index.js +33 -0
- package/src/screens/AddNewAction/SelectDevice.js +106 -0
- package/src/screens/AddNewAction/Styles/SelectDeviceStyles.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 +2 -1
- package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +2 -1
- package/src/screens/AddNewDevice/__test__/ConnectingDevices.test.js +2 -1
- package/src/screens/AddNewDevice/hooks/useStateAlertRename.js +2 -1
- package/src/screens/AddNewDevice/index.js +23 -4
- package/src/screens/AddNewGateway/AddNewGatewayStyles.js +29 -0
- package/src/screens/AddNewGateway/ConnectedGateway.js +2 -1
- package/src/screens/AddNewGateway/ConnectingGateway.js +100 -25
- package/src/screens/AddNewGateway/ConnectingGatewayStyles.js +92 -0
- package/src/screens/AddNewGateway/SetupGatewayWifi.js +25 -3
- package/src/screens/AddNewGateway/SetupGatewayWifiStyles.js +6 -1
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +2 -1
- package/src/screens/AddNewGateway/__test__/ConnectedGateway.test.js +2 -1
- package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +2 -1
- package/src/screens/AddNewGateway/hooks/useStateAlertRename.js +2 -1
- package/src/screens/AddNewGateway/index.js +28 -110
- package/src/screens/AddNewOneTap/AddNewOneTapStyles.js +43 -0
- package/src/screens/AddNewOneTap/index.js +67 -0
- package/src/screens/AddNewScriptAction/AddNewScriptActionStyles.js +27 -0
- package/src/screens/AddNewScriptAction/index.js +92 -0
- package/src/screens/AllCamera/Styles/index.js +101 -0
- package/src/screens/AllCamera/index.js +208 -0
- package/src/screens/Device/HeaderDevice/styles.js +2 -2
- package/src/screens/Device/__test__/detail.test.js +2 -1
- package/src/screens/Device/detail.js +66 -23
- package/src/screens/Device/hooks/useEmergencyButton.js +7 -6
- package/src/screens/Device/styles.js +3 -0
- package/src/screens/DeviceInfo/index.js +3 -2
- package/src/screens/EditActionsList/Styles/indexStyles.js +73 -0
- package/src/screens/EditActionsList/index.js +122 -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 +2 -1
- package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +2 -1
- package/src/screens/EmergencyContacts/hook.js +3 -2
- package/src/screens/Explore/index.js +3 -2
- package/src/screens/GuestInfo/components/AccessScheduleItem.js +27 -0
- package/src/screens/GuestInfo/components/AccessScheduleSheet.js +193 -0
- package/src/screens/GuestInfo/components/HeaderGuestInfo.js +31 -0
- package/src/screens/GuestInfo/components/RecurringDetail.js +99 -0
- package/src/screens/GuestInfo/components/RowGuestInfo.js +31 -0
- package/src/screens/GuestInfo/components/TemporaryDetail.js +46 -0
- package/src/screens/GuestInfo/constant.js +59 -0
- package/src/screens/GuestInfo/index.js +151 -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 +82 -0
- package/src/screens/ManageAccess/hooks/index.js +32 -0
- package/src/screens/ManageAccess/index.js +126 -0
- package/src/screens/ManageAccess/styles/ManageAccessStyles.js +72 -0
- package/src/screens/PlayBackCamera/Styles/TimerStyles.js +22 -0
- package/src/screens/PlayBackCamera/Styles/index.js +81 -0
- package/src/screens/PlayBackCamera/Timer.js +127 -0
- package/src/screens/PlayBackCamera/index.js +233 -0
- package/src/screens/ScanChipQR/components/QRScan/index.js +2 -1
- package/src/screens/ScanChipQR/hooks/index.js +4 -11
- package/src/screens/ScriptDetail/Styles/indexStyles.js +140 -0
- package/src/screens/ScriptDetail/index.js +241 -0
- package/src/screens/SharedUnit/TabHeader.js +2 -1
- 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 +2 -1
- package/src/screens/Sharing/__test__/SelectUser.test.js +2 -1
- package/src/screens/Sharing/hooks/index.js +22 -17
- package/src/screens/SubUnit/AddSubUnit.js +14 -72
- package/src/screens/SubUnit/AddSubUnitStyles.js +66 -0
- package/src/screens/SubUnit/Detail.js +5 -63
- package/src/screens/SubUnit/DetailStyles.js +46 -0
- package/src/screens/SubUnit/ManageSubUnit.js +5 -4
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +2 -1
- package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +2 -1
- package/src/screens/SyncLGDevice/AddLGDevice.js +3 -2
- package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +2 -1
- package/src/screens/TDSGuide/index.js +2 -1
- package/src/screens/UVIndexGuide/index.js +2 -1
- package/src/screens/Unit/AddMenu.js +3 -2
- package/src/screens/Unit/Detail.js +75 -20
- package/src/screens/Unit/ManageUnit/index.js +4 -3
- package/src/screens/Unit/ManageUnit.js +4 -3
- package/src/screens/Unit/MoreMenu.js +3 -2
- package/src/screens/Unit/SelectLocation.js +10 -2
- package/src/screens/Unit/SelectLocationStyles.js +11 -0
- 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/index.js +2 -1
- package/src/screens/Unit/components/SharedUnit/index.js +2 -1
- package/src/screens/Unit/styles.js +4 -0
- package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +2 -1
- package/src/screens/UnitSummary/components/PowerConsumption/index.js +2 -1
- 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/index.js +2 -1
- package/src/screens/UnitSummary/components/WaterQuality/index.js +2 -1
- package/src/screens/UnitSummary/index.js +2 -1
- package/src/screens/WaterQualityGuide/index.js +2 -1
- package/src/utils/Converter/__test__/time.test.js +3 -1
- 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 +51 -2
- package/src/utils/I18n/translations/vi.json +48 -1
- package/src/utils/I18n/translations.ts +45 -0
- package/src/utils/Route/index.js +11 -0
- package/src/utils/I18n/index.js +0 -19
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createConnection, getStates } from 'home-assistant-js-websocket';
|
|
2
2
|
import Toast from 'react-native-toast-message';
|
|
3
|
-
import {
|
|
3
|
+
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
4
4
|
import axios from 'axios';
|
|
5
5
|
import {
|
|
6
6
|
googleHomeConnect,
|
|
@@ -30,6 +30,7 @@ getStates.mockImplementation(() => []);
|
|
|
30
30
|
createConnection.mockImplementation(() => connection);
|
|
31
31
|
|
|
32
32
|
describe('Remote Control Google Home', () => {
|
|
33
|
+
const t = useTranslations();
|
|
33
34
|
const options = [
|
|
34
35
|
{
|
|
35
36
|
auth: {},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
2
2
|
|
|
3
3
|
import Toast from 'react-native-toast-message';
|
|
4
4
|
import axios from 'axios';
|
|
@@ -7,6 +7,7 @@ import { sendCommandOverInternet } from '../Internet';
|
|
|
7
7
|
jest.mock('axios');
|
|
8
8
|
|
|
9
9
|
describe('Test IOT Remote Control Internet', () => {
|
|
10
|
+
const t = useTranslations();
|
|
10
11
|
beforeEach(() => {
|
|
11
12
|
Toast.show.mockClear();
|
|
12
13
|
axios.post.mockClear();
|
|
@@ -6,10 +6,11 @@ import {
|
|
|
6
6
|
} from './index.mock.js'; // need to be imported first in the file
|
|
7
7
|
import { sendRemoteCommand } from '../index';
|
|
8
8
|
import Toast from 'react-native-toast-message';
|
|
9
|
-
import {
|
|
9
|
+
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
10
10
|
import { SEND_COMMAND_OVER_BLUETOOTH_FAIL } from '../Bluetooth';
|
|
11
11
|
|
|
12
12
|
describe('Test Remote Control', () => {
|
|
13
|
+
const t = useTranslations();
|
|
13
14
|
beforeEach(() => {
|
|
14
15
|
Toast.show.mockClear();
|
|
15
16
|
mockSendCommandOverBluetooth.mockClear();
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import { sendCommandOverInternet } from './Internet';
|
|
6
6
|
import { sendCommandOverGoogleHome } from './GoogleHome';
|
|
7
7
|
import { ToastBottomHelper } from '../../utils/Utils';
|
|
8
|
-
import
|
|
8
|
+
import t from '../../hooks/Common/useTranslations';
|
|
9
9
|
import { sendCommandOverLGThinq } from './LG';
|
|
10
10
|
|
|
11
11
|
export const sendRemoteCommand = async (sensor, action, data) => {
|
package/src/iot/states.js
CHANGED
|
@@ -7,6 +7,7 @@ import Route from '../utils/Route';
|
|
|
7
7
|
import ConnectedGateway from '../screens/AddNewGateway/ConnectedGateway';
|
|
8
8
|
import ConnectingGateway from '../screens/AddNewGateway/ConnectingGateway';
|
|
9
9
|
import SetupGatewayWifi from '../screens/AddNewGateway/SetupGatewayWifi';
|
|
10
|
+
import AddCommonSelectSubUnit from '../screens/AddCommon/SelectSubUnit';
|
|
10
11
|
|
|
11
12
|
const Stack = createStackNavigator();
|
|
12
13
|
|
|
@@ -22,6 +23,10 @@ export const AddGatewayStack = memo(() => {
|
|
|
22
23
|
component={SetupGatewayWifi}
|
|
23
24
|
/>
|
|
24
25
|
<Stack.Screen name={Route.AddNewGateway} component={AddNewGateway} />
|
|
26
|
+
<Stack.Screen
|
|
27
|
+
name={Route.AddCommonSelectSubUnit}
|
|
28
|
+
component={AddCommonSelectSubUnit}
|
|
29
|
+
/>
|
|
25
30
|
<Stack.Screen name={Route.ScanChipQR} component={ScanChipQR} />
|
|
26
31
|
<Stack.Screen
|
|
27
32
|
name={Route.ConnectingGateway}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createStackNavigator } from '@react-navigation/stack';
|
|
2
|
+
import React, { memo } from 'react';
|
|
3
|
+
|
|
4
|
+
import SelectDevice from '../screens/AddNewAction/SelectDevice';
|
|
5
|
+
import Route from '../utils/Route';
|
|
6
|
+
|
|
7
|
+
const Stack = createStackNavigator();
|
|
8
|
+
|
|
9
|
+
export const AddNewActionStack = memo((props) => {
|
|
10
|
+
return (
|
|
11
|
+
<Stack.Navigator
|
|
12
|
+
screenOptions={{
|
|
13
|
+
headerShown: false,
|
|
14
|
+
}}
|
|
15
|
+
>
|
|
16
|
+
<Stack.Screen
|
|
17
|
+
name={Route.SelectDevice}
|
|
18
|
+
component={SelectDevice}
|
|
19
|
+
options={{ headerShown: false }}
|
|
20
|
+
/>
|
|
21
|
+
</Stack.Navigator>
|
|
22
|
+
);
|
|
23
|
+
});
|
|
@@ -3,7 +3,7 @@ import { createStackNavigator } from '@react-navigation/stack';
|
|
|
3
3
|
import { TouchableOpacity, StyleSheet } from 'react-native';
|
|
4
4
|
import { useNavigation } from '@react-navigation/native';
|
|
5
5
|
import { Icon } from '@ant-design/react-native';
|
|
6
|
-
import {
|
|
6
|
+
import { useTranslations } from '../hooks/Common/useTranslations';
|
|
7
7
|
|
|
8
8
|
import Shared from '../screens/SharedUnit';
|
|
9
9
|
import { Colors } from '../configs';
|
|
@@ -11,6 +11,7 @@ import Routes from '../utils/Route';
|
|
|
11
11
|
|
|
12
12
|
const Stack = createStackNavigator();
|
|
13
13
|
const SharedStack = memo(() => {
|
|
14
|
+
const t = useTranslations();
|
|
14
15
|
const navigation = useNavigation();
|
|
15
16
|
return (
|
|
16
17
|
<Stack.Navigator>
|
|
@@ -2,7 +2,7 @@ import React, { memo } from 'react';
|
|
|
2
2
|
import { StyleSheet } from 'react-native';
|
|
3
3
|
import { IconOutline } from '@ant-design/icons-react-native';
|
|
4
4
|
import { createStackNavigator } from '@react-navigation/stack';
|
|
5
|
-
import {
|
|
5
|
+
import { useTranslations } from '../hooks/Common/useTranslations';
|
|
6
6
|
import { Colors, Device } from '../configs';
|
|
7
7
|
import Route from '../utils/Route';
|
|
8
8
|
import ActivityLogScreen from '../screens/ActivityLog';
|
|
@@ -21,12 +21,22 @@ import UVIndexGuide from '../screens/UVIndexGuide';
|
|
|
21
21
|
import TDSGuide from '../screens/TDSGuide';
|
|
22
22
|
import WaterQualityGuide from '../screens/WaterQualityGuide';
|
|
23
23
|
import DeviceInfo from '../screens/DeviceInfo';
|
|
24
|
+
import AddNewOneTap from '../screens/AddNewOneTap';
|
|
25
|
+
import AddNewScriptAction from '../screens/AddNewScriptAction';
|
|
26
|
+
import PlaybackCamera from '../screens/PlayBackCamera';
|
|
27
|
+
import AllCamera from '../screens/AllCamera';
|
|
28
|
+
import ManageAccessScreen from '../screens/ManageAccess';
|
|
29
|
+
import GuestInfo from '../screens/GuestInfo';
|
|
30
|
+
import ScriptDetail from '../screens/ScriptDetail';
|
|
31
|
+
import EditActionsList from '../screens/EditActionsList';
|
|
32
|
+
import SelectDevice from '../screens/AddNewAction/SelectDevice';
|
|
24
33
|
|
|
25
34
|
import _ from 'lodash';
|
|
26
35
|
|
|
27
36
|
const Stack = createStackNavigator();
|
|
28
37
|
|
|
29
38
|
export const UnitStack = memo((props) => {
|
|
39
|
+
const t = useTranslations();
|
|
30
40
|
return (
|
|
31
41
|
<Stack.Navigator
|
|
32
42
|
screenOptions={{
|
|
@@ -149,6 +159,67 @@ export const UnitStack = memo((props) => {
|
|
|
149
159
|
headerShown: false,
|
|
150
160
|
}}
|
|
151
161
|
/>
|
|
162
|
+
<Stack.Screen
|
|
163
|
+
name={Route.PlaybackCamera}
|
|
164
|
+
component={PlaybackCamera}
|
|
165
|
+
options={{
|
|
166
|
+
headerShown: false,
|
|
167
|
+
}}
|
|
168
|
+
/>
|
|
169
|
+
<Stack.Screen
|
|
170
|
+
name={Route.AllCamera}
|
|
171
|
+
component={AllCamera}
|
|
172
|
+
options={{
|
|
173
|
+
headerShown: false,
|
|
174
|
+
}}
|
|
175
|
+
/>
|
|
176
|
+
<Stack.Screen
|
|
177
|
+
name={Route.ManageAccess}
|
|
178
|
+
component={ManageAccessScreen}
|
|
179
|
+
options={{
|
|
180
|
+
headerShown: false,
|
|
181
|
+
}}
|
|
182
|
+
/>
|
|
183
|
+
<Stack.Screen
|
|
184
|
+
name={Route.GuestInfo}
|
|
185
|
+
component={GuestInfo}
|
|
186
|
+
options={{
|
|
187
|
+
headerShown: false,
|
|
188
|
+
}}
|
|
189
|
+
/>
|
|
190
|
+
<Stack.Screen
|
|
191
|
+
name={Route.AddNewOneTap}
|
|
192
|
+
component={AddNewOneTap}
|
|
193
|
+
options={{
|
|
194
|
+
headerShown: false,
|
|
195
|
+
}}
|
|
196
|
+
/>
|
|
197
|
+
<Stack.Screen
|
|
198
|
+
name={Route.ScriptDetail}
|
|
199
|
+
component={ScriptDetail}
|
|
200
|
+
options={{
|
|
201
|
+
headerShown: false,
|
|
202
|
+
}}
|
|
203
|
+
/>
|
|
204
|
+
<Stack.Screen
|
|
205
|
+
name={Route.EditActionsList}
|
|
206
|
+
component={EditActionsList}
|
|
207
|
+
options={{
|
|
208
|
+
headerShown: false,
|
|
209
|
+
}}
|
|
210
|
+
/>
|
|
211
|
+
<Stack.Screen
|
|
212
|
+
name={Route.AddNewScriptAction}
|
|
213
|
+
component={AddNewScriptAction}
|
|
214
|
+
options={{
|
|
215
|
+
headerShown: false,
|
|
216
|
+
}}
|
|
217
|
+
/>
|
|
218
|
+
<Stack.Screen
|
|
219
|
+
name={Route.SelectDevice}
|
|
220
|
+
component={SelectDevice}
|
|
221
|
+
options={{ headerShown: false }}
|
|
222
|
+
/>
|
|
152
223
|
</Stack.Navigator>
|
|
153
224
|
);
|
|
154
225
|
});
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
TouchableOpacity,
|
|
7
7
|
SafeAreaView,
|
|
8
8
|
} from 'react-native';
|
|
9
|
-
import {
|
|
9
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
10
10
|
|
|
11
11
|
import { Colors, Theme } from '../../configs';
|
|
12
12
|
import useTitleHeader from '../../hooks/Common/useTitleHeader';
|
|
@@ -23,7 +23,7 @@ import { useSCContextSelector } from '../../context';
|
|
|
23
23
|
const AQIGuide = memo(() => {
|
|
24
24
|
useTitleHeader(t('AQI Guide'));
|
|
25
25
|
const language = useSCContextSelector((state) => state.language);
|
|
26
|
-
|
|
26
|
+
const t = useTranslations();
|
|
27
27
|
const data = useMemo(
|
|
28
28
|
() => ({
|
|
29
29
|
titles: [
|
|
@@ -53,8 +53,8 @@ export default (sensor) => {
|
|
|
53
53
|
} else {
|
|
54
54
|
dataTemp = dataTemp.concat(results);
|
|
55
55
|
setData(getDataForList(dataTemp));
|
|
56
|
-
setIsCanLoadMore(page < Math.ceil(data.count / 20));
|
|
57
56
|
}
|
|
57
|
+
setIsCanLoadMore(page < Math.ceil(data.count / 20));
|
|
58
58
|
}
|
|
59
59
|
page === 1 ? setIsRefreshing(false) : setIsLoading(false);
|
|
60
60
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React, { useEffect } from 'react';
|
|
3
3
|
import { View, Text, SectionList, ActivityIndicator } from 'react-native';
|
|
4
4
|
import moment from 'moment';
|
|
5
|
-
import {
|
|
5
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
6
6
|
import { Colors } from '../../configs';
|
|
7
7
|
import { HeaderCustom } from '../../commons/Header';
|
|
8
8
|
import { getTitleFromTime } from '../../utils/Converter/time';
|
|
@@ -13,6 +13,7 @@ import styles from './Styles/indexStyles';
|
|
|
13
13
|
const keyExtractor = (item) => item.id;
|
|
14
14
|
|
|
15
15
|
const ActivityLogScreen = () => {
|
|
16
|
+
const t = useTranslations();
|
|
16
17
|
const { params = {} } = useRoute();
|
|
17
18
|
const { sensor } = params;
|
|
18
19
|
const { data, isLoading, isRefreshing, onLoadMore, onRefresh } =
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { useIsFocused, useNavigation } from '@react-navigation/native';
|
|
2
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
3
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
4
|
+
import { SafeAreaView, ScrollView, TouchableOpacity, View } from 'react-native';
|
|
5
|
+
|
|
6
|
+
import { API } from '../../configs';
|
|
7
|
+
import { Section, RadioCircle, ViewButtonBottom } from '../../commons';
|
|
8
|
+
import { axiosGet } from '../../utils/Apis/axios';
|
|
9
|
+
import Text from '../../commons/Text';
|
|
10
|
+
import Routes from '../../utils/Route';
|
|
11
|
+
import { TESTID } from '../../configs/Constants';
|
|
12
|
+
import styles from './SelectSubUnitStyles';
|
|
13
|
+
import Button from '../../commons/Button';
|
|
14
|
+
|
|
15
|
+
const AddCommonSelectSubUnit = ({ route }) => {
|
|
16
|
+
const t = useTranslations();
|
|
17
|
+
const navigation = useNavigation();
|
|
18
|
+
const isFocused = useIsFocused();
|
|
19
|
+
const { addType, unit_id } = route.params;
|
|
20
|
+
const [selectedIndex, setSelectedIndex] = useState(-1);
|
|
21
|
+
const [unit, setUnit] = useState([]);
|
|
22
|
+
const [title, setTitle] = useState('');
|
|
23
|
+
const [subTitle, setSubTitle] = useState('');
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
switch (addType) {
|
|
27
|
+
case 'AddNewGateway':
|
|
28
|
+
setTitle(t('add_new_gateway'));
|
|
29
|
+
setSubTitle(t('select_a_sub_unit'));
|
|
30
|
+
break;
|
|
31
|
+
default:
|
|
32
|
+
setTitle(t('add_new_gateway'));
|
|
33
|
+
setSubTitle(t('select_a_sub_unit'));
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}, [title, subTitle, addType, t]);
|
|
37
|
+
|
|
38
|
+
const fetchDetails = useCallback(async () => {
|
|
39
|
+
const { success, data } = await axiosGet(
|
|
40
|
+
API.UNIT.UNIT_DETAIL(unit_id),
|
|
41
|
+
{},
|
|
42
|
+
true
|
|
43
|
+
);
|
|
44
|
+
if (success) {
|
|
45
|
+
setUnit(data);
|
|
46
|
+
}
|
|
47
|
+
}, [unit_id]);
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
isFocused && fetchDetails();
|
|
51
|
+
}, [fetchDetails, isFocused]);
|
|
52
|
+
|
|
53
|
+
const subUnits = unit.stations || [];
|
|
54
|
+
|
|
55
|
+
const onPressNext = useCallback(() => {
|
|
56
|
+
switch (addType) {
|
|
57
|
+
case 'AddNewGateway':
|
|
58
|
+
navigation.navigate(Routes.ScanChipQR, {
|
|
59
|
+
station: subUnits[selectedIndex].id,
|
|
60
|
+
unit_name: unit.name,
|
|
61
|
+
...route.params,
|
|
62
|
+
});
|
|
63
|
+
break;
|
|
64
|
+
default:
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
}, [addType, navigation, subUnits, selectedIndex, unit.name, route.params]);
|
|
68
|
+
|
|
69
|
+
const handleSelectIndex = (index) => {
|
|
70
|
+
if (index !== selectedIndex) {
|
|
71
|
+
setSelectedIndex(index);
|
|
72
|
+
} else {
|
|
73
|
+
setSelectedIndex(-1);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const addSubUnit = useCallback(() => {
|
|
78
|
+
navigation.navigate(Routes.AddSubUnitStack, {
|
|
79
|
+
screen: Routes.AddSubUnit,
|
|
80
|
+
params: { unit, ...route.params },
|
|
81
|
+
});
|
|
82
|
+
}, [navigation, unit, route.params]);
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<SafeAreaView style={styles.container}>
|
|
86
|
+
<Text semibold style={styles.title}>
|
|
87
|
+
{title}
|
|
88
|
+
</Text>
|
|
89
|
+
<Text style={styles.subtitle}>{subTitle}</Text>
|
|
90
|
+
<View style={styles.contentContainer}>
|
|
91
|
+
<ScrollView
|
|
92
|
+
style={styles.scrollContainer}
|
|
93
|
+
showsVerticalScrollIndicator={false}
|
|
94
|
+
>
|
|
95
|
+
<Section type={'border'}>
|
|
96
|
+
{subUnits.map((item, index) => (
|
|
97
|
+
<TouchableOpacity
|
|
98
|
+
key={index}
|
|
99
|
+
style={styles.rowContainer}
|
|
100
|
+
onPress={() => handleSelectIndex(index)}
|
|
101
|
+
>
|
|
102
|
+
<RadioCircle
|
|
103
|
+
active={selectedIndex === index}
|
|
104
|
+
testID={TESTID.SELECT_UNIT_RADIO_BUTTON}
|
|
105
|
+
/>
|
|
106
|
+
<TouchableOpacity
|
|
107
|
+
style={styles.row}
|
|
108
|
+
onPress={() => handleSelectIndex(index)}
|
|
109
|
+
testID={TESTID.SELECT_UNIT_SELECT}
|
|
110
|
+
>
|
|
111
|
+
<Text style={styles.text} testID={TESTID.SELECT_UNIT_NAME}>
|
|
112
|
+
{item.name}
|
|
113
|
+
</Text>
|
|
114
|
+
</TouchableOpacity>
|
|
115
|
+
</TouchableOpacity>
|
|
116
|
+
))}
|
|
117
|
+
</Section>
|
|
118
|
+
<View style={styles.buttonAdd}>
|
|
119
|
+
<Button
|
|
120
|
+
type="primaryBorder"
|
|
121
|
+
title={`${t('add_new_sub_unit')} +`}
|
|
122
|
+
onPress={addSubUnit}
|
|
123
|
+
width="auto"
|
|
124
|
+
height={32}
|
|
125
|
+
textType="setupBorder"
|
|
126
|
+
textSemiBold={false}
|
|
127
|
+
/>
|
|
128
|
+
</View>
|
|
129
|
+
</ScrollView>
|
|
130
|
+
<ViewButtonBottom
|
|
131
|
+
leftTitle={t('cancel')}
|
|
132
|
+
onLeftClick={() => navigation.goBack()}
|
|
133
|
+
rightTitle={t('next')}
|
|
134
|
+
rightDisabled={selectedIndex === -1}
|
|
135
|
+
onRightClick={onPressNext}
|
|
136
|
+
testIDPrefix={TESTID.PREFIX.SELECT_UNIT}
|
|
137
|
+
/>
|
|
138
|
+
</View>
|
|
139
|
+
</SafeAreaView>
|
|
140
|
+
);
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export default AddCommonSelectSubUnit;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Colors } from '../../configs';
|
|
2
|
+
|
|
3
|
+
import { StyleSheet, StatusBar, Platform } from 'react-native';
|
|
4
|
+
|
|
5
|
+
export default StyleSheet.create({
|
|
6
|
+
container: {
|
|
7
|
+
flex: 1,
|
|
8
|
+
backgroundColor: Colors.Gray2,
|
|
9
|
+
paddingTop: Platform.OS === 'android' ? StatusBar.currentHeight : 0,
|
|
10
|
+
},
|
|
11
|
+
contentContainer: {
|
|
12
|
+
flex: 1,
|
|
13
|
+
justifyContent: 'space-between',
|
|
14
|
+
},
|
|
15
|
+
scrollContainer: {
|
|
16
|
+
width: '100%',
|
|
17
|
+
flex: 1,
|
|
18
|
+
},
|
|
19
|
+
title: {
|
|
20
|
+
color: Colors.Gray9,
|
|
21
|
+
fontSize: 20,
|
|
22
|
+
lineHeight: 28,
|
|
23
|
+
marginTop: 8,
|
|
24
|
+
marginBottom: 4,
|
|
25
|
+
marginLeft: 16,
|
|
26
|
+
},
|
|
27
|
+
subtitle: {
|
|
28
|
+
color: Colors.Gray8,
|
|
29
|
+
fontSize: 14,
|
|
30
|
+
lineHeight: 22,
|
|
31
|
+
marginLeft: 16,
|
|
32
|
+
marginBottom: 16,
|
|
33
|
+
},
|
|
34
|
+
row: {
|
|
35
|
+
flex: 1,
|
|
36
|
+
paddingVertical: 16,
|
|
37
|
+
borderBottomColor: Colors.Gray4,
|
|
38
|
+
borderBottomWidth: 1,
|
|
39
|
+
marginRight: 24,
|
|
40
|
+
marginLeft: 16,
|
|
41
|
+
},
|
|
42
|
+
rowContainer: {
|
|
43
|
+
flexDirection: 'row',
|
|
44
|
+
alignItems: 'center',
|
|
45
|
+
paddingLeft: 16,
|
|
46
|
+
},
|
|
47
|
+
text: {
|
|
48
|
+
fontSize: 16,
|
|
49
|
+
lineHeight: 24,
|
|
50
|
+
color: Colors.Gray9,
|
|
51
|
+
},
|
|
52
|
+
buttonAdd: {
|
|
53
|
+
marginHorizontal: 16,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useNavigation } from '@react-navigation/native';
|
|
2
|
-
import {
|
|
2
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
3
3
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
4
4
|
import {
|
|
5
5
|
SafeAreaView,
|
|
@@ -19,6 +19,7 @@ import Routes from '../../utils/Route';
|
|
|
19
19
|
import { TESTID } from '../../configs/Constants';
|
|
20
20
|
|
|
21
21
|
const AddCommonSelectUnit = ({ route }) => {
|
|
22
|
+
const t = useTranslations();
|
|
22
23
|
const navigation = useNavigation();
|
|
23
24
|
const { addType } = route.params;
|
|
24
25
|
const [selectedIndex, setSelectedIndex] = useState(-1);
|
|
@@ -49,7 +50,7 @@ const AddCommonSelectUnit = ({ route }) => {
|
|
|
49
50
|
setSubTitle(t('add_new_subunit_select_unit'));
|
|
50
51
|
break;
|
|
51
52
|
}
|
|
52
|
-
}, [title, subTitle, addType]);
|
|
53
|
+
}, [title, subTitle, addType, t]);
|
|
53
54
|
|
|
54
55
|
useEffect(() => {
|
|
55
56
|
(async () => {
|
|
@@ -3,7 +3,7 @@ import { View, StyleSheet } from 'react-native';
|
|
|
3
3
|
import MapView, { Marker, Circle, PROVIDER_GOOGLE } from 'react-native-maps';
|
|
4
4
|
import { getStatusBarHeight } from 'react-native-iphone-x-helper';
|
|
5
5
|
import { useNavigation } from '@react-navigation/native';
|
|
6
|
-
import {
|
|
6
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
7
7
|
|
|
8
8
|
import { Colors } from '../../configs';
|
|
9
9
|
import Text from '../../commons/Text';
|
|
@@ -17,6 +17,7 @@ const initialRegion = {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
const AddLocationMaps = memo(() => {
|
|
20
|
+
const t = useTranslations();
|
|
20
21
|
const { goBack } = useNavigation();
|
|
21
22
|
const [color, setColor] = useState(Colors.Black);
|
|
22
23
|
useEffect(() => {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { Colors, Constants } from '../../../configs';
|
|
3
|
+
|
|
4
|
+
const marginItem = 12;
|
|
5
|
+
const marginHorizontal = 16;
|
|
6
|
+
const widthItem = (Constants.width - marginHorizontal * 2 - marginItem) / 2;
|
|
7
|
+
const heightItem = (widthItem / 166) * 96;
|
|
8
|
+
|
|
9
|
+
export default StyleSheet.create({
|
|
10
|
+
container: {
|
|
11
|
+
padding: 12,
|
|
12
|
+
borderRadius: 10,
|
|
13
|
+
shadowColor: Colors.Shadow,
|
|
14
|
+
shadowOffset: {
|
|
15
|
+
width: 0,
|
|
16
|
+
height: 2,
|
|
17
|
+
},
|
|
18
|
+
shadowOpacity: 0.1,
|
|
19
|
+
shadowRadius: 3,
|
|
20
|
+
elevation: 4,
|
|
21
|
+
width: widthItem,
|
|
22
|
+
height: heightItem,
|
|
23
|
+
backgroundColor: Colors.White,
|
|
24
|
+
justifyContent: 'space-between',
|
|
25
|
+
marginBottom: 16,
|
|
26
|
+
},
|
|
27
|
+
active: {
|
|
28
|
+
borderColor: Colors.Primary,
|
|
29
|
+
borderWidth: 2,
|
|
30
|
+
},
|
|
31
|
+
boxIcon: {
|
|
32
|
+
flexDirection: 'row',
|
|
33
|
+
justifyContent: 'space-between',
|
|
34
|
+
},
|
|
35
|
+
lineHeight22: {
|
|
36
|
+
lineHeight: 22,
|
|
37
|
+
},
|
|
38
|
+
iconSensor: {
|
|
39
|
+
width: 40,
|
|
40
|
+
height: 40,
|
|
41
|
+
resizeMode: 'contain',
|
|
42
|
+
},
|
|
43
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { TouchableWithoutFeedback, View } from 'react-native';
|
|
3
|
+
import { Colors } from '../../../configs';
|
|
4
|
+
import Text from '../../../commons/Text';
|
|
5
|
+
import IconComponent from '../../../commons/IconComponent';
|
|
6
|
+
import styles from './DeviceStyles';
|
|
7
|
+
|
|
8
|
+
const Device = memo(({ svgMain, sensor, title, isSelectDevice, onPress }) => {
|
|
9
|
+
const isActive = isSelectDevice && styles.active;
|
|
10
|
+
|
|
11
|
+
const onPressDevice = () => {
|
|
12
|
+
onPress && onPress(sensor);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<TouchableWithoutFeedback onPress={onPressDevice}>
|
|
17
|
+
<View style={[styles.container, isActive]}>
|
|
18
|
+
<View style={styles.boxIcon}>
|
|
19
|
+
<IconComponent
|
|
20
|
+
icon={svgMain}
|
|
21
|
+
iconKit={sensor.icon_kit}
|
|
22
|
+
style={styles.iconSensor}
|
|
23
|
+
/>
|
|
24
|
+
</View>
|
|
25
|
+
<Text numberOfLines={1} semibold type="Body" color={Colors.Gray9}>
|
|
26
|
+
{title}
|
|
27
|
+
</Text>
|
|
28
|
+
</View>
|
|
29
|
+
</TouchableWithoutFeedback>
|
|
30
|
+
);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export default Device;
|