@eohjsc/react-native-smart-city 0.2.85 → 0.2.88
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/Common/Calendar.svg +3 -0
- package/assets/images/Common/SmartPhone.svg +3 -0
- package/assets/images/Device/button-lock.svg +3 -0
- package/assets/images/Device/button-unlock.svg +3 -0
- package/assets/images/Hanet/CaptureFaceID.svg +25 -0
- package/assets/images/Hanet/FaceFrame.svg +6 -0
- package/assets/images/brightnessBlack.svg +12 -0
- package/index.js +4 -0
- package/package.json +2 -2
- package/src/Images/SmartIr/AC.svg +14 -0
- package/src/Images/SmartIr/DIY.svg +3 -0
- package/src/Images/SmartIr/Fan.svg +10 -0
- package/src/Images/SmartIr/Fridge.svg +5 -0
- package/src/Images/SmartIr/Remote.svg +15 -0
- package/src/Images/SmartIr/SmartIr.svg +4 -0
- package/src/Images/SmartIr/TV.svg +10 -0
- package/src/Images/SmartIr/Union.svg +9 -0
- package/src/Images/SmartIr/WM.svg +11 -0
- package/src/Images/SmartIr/index.js +10 -0
- package/src/commons/ActionGroup/ColorPickerTemplate.js +51 -0
- package/src/commons/ActionGroup/ColorPickerTemplateStyles.js +17 -0
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/AutoLockStyles.js +40 -0
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapper.js +65 -0
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapperStyles.js +43 -0
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/__test__/index.test.js +48 -0
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/index.js +57 -0
- package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLock.js +48 -0
- package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLockStyle.js +51 -0
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscode.js +48 -0
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscodeStyles.js +42 -0
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/PasscodeListStyles.js +49 -0
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +66 -0
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/ButtonWrapper.js +96 -0
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/SetupGeneratePasscodeStyles.js +98 -0
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +62 -0
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/index.js +249 -0
- package/src/commons/ActionGroup/OnOffTemplate/index.js +4 -2
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +2 -1
- package/src/commons/ActionGroup/SliderRangeTemplate.js +64 -0
- package/src/commons/ActionGroup/{LightActionTemplateStyles.js → SliderRangeTemplateStyles.js} +0 -8
- package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +167 -186
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +2 -1
- package/src/commons/ActionGroup/index.js +9 -3
- package/src/commons/BottomSheet/index.js +2 -1
- package/src/commons/ConnectingProcess/index.js +5 -2
- package/src/commons/Device/DisconnectedView.js +7 -1
- package/src/commons/Device/Hanet/ItemHanetDevice.js +109 -0
- package/src/commons/Device/HistoryChart.js +2 -2
- package/src/commons/Device/HorizontalBarChart.js +7 -0
- package/src/commons/Device/ItemDevice.js +24 -16
- package/src/commons/Device/LinearChart.js +14 -41
- package/src/commons/Device/__test__/DisconnectedView.test.js +13 -2
- package/src/commons/MediaPlayer/__test__/index.test.js +45 -0
- package/src/commons/RowItem/index.js +12 -7
- package/src/commons/SubUnit/Favorites/index.js +2 -2
- package/src/commons/SubUnit/ShortDetail.js +48 -41
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +57 -48
- package/src/commons/WheelDateTimePicker/index.js +18 -4
- package/src/configs/API.js +24 -2
- package/src/configs/Colors.js +1 -0
- package/src/configs/Constants.js +61 -0
- package/src/configs/SCConfig.js +1 -1
- package/src/context/actionType.ts +4 -0
- package/src/context/mockStore.ts +3 -0
- package/src/context/reducer.ts +20 -0
- package/src/iot/RemoteControl/Bluetooth.js +3 -22
- package/src/iot/RemoteControl/index.js +0 -1
- package/src/navigations/HanetCameraStack.js +41 -0
- package/src/navigations/SmartIrStack.js +31 -0
- package/src/navigations/SmartLockStack.js +51 -0
- package/src/navigations/UnitStack.js +46 -4
- package/src/screens/ActivityLog/hooks/index.js +17 -3
- package/src/screens/ActivityLog/index.js +3 -0
- package/src/screens/AddCommon/SelectSubUnit.js +1 -0
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +1 -1
- package/src/screens/AddNewAction/SelectSensorDevices.js +4 -2
- package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +88 -73
- package/src/screens/AddNewGateway/PlugAndPlay/FirstWarning.js +4 -2
- package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +155 -27
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectWifiWarning.test.js +65 -0
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/GatewayWifiList.test.js +26 -2
- package/src/screens/AddNewOneTap/index.js +32 -17
- package/src/screens/Automate/index.js +2 -2
- package/src/screens/Device/EditDevice/index.js +5 -3
- package/src/screens/Device/__test__/detail.test.js +0 -10
- package/src/screens/Device/components/SensorConnectStatusViewHeader.js +13 -2
- package/src/screens/Device/components/SensorDisplayItem.js +3 -0
- package/src/screens/Device/detail.js +119 -38
- package/src/screens/Device/hooks/useDisconnectedDevice.js +28 -16
- package/src/screens/GuestInfo/components/AccessScheduleItem.js +9 -2
- package/src/screens/GuestInfo/components/RecurringDetail.js +3 -2
- package/src/screens/GuestInfo/components/TemporaryDetail.js +3 -2
- package/src/screens/GuestInfo/styles/AccessScheduleItemStyles.js +3 -0
- package/src/screens/HanetCamera/CaptureFaceID.js +210 -0
- package/src/screens/HanetCamera/Detail.js +252 -0
- package/src/screens/HanetCamera/ManageAccess.js +173 -0
- package/src/screens/HanetCamera/MemberInfo.js +208 -0
- package/src/screens/HanetCamera/__test__/CaptureFaceID.test.js +133 -0
- package/src/screens/HanetCamera/__test__/Detail.test.js +185 -0
- package/src/screens/HanetCamera/__test__/ManageAccess.test.js +152 -0
- package/src/screens/HanetCamera/__test__/MemberInfo.test.js +178 -0
- package/src/screens/HanetCamera/components/CheckinHeader.js +37 -0
- package/src/screens/HanetCamera/hooks/__test__/useHanetCheckinData.test.js +151 -0
- package/src/screens/HanetCamera/hooks/__test__/useHanetPlaceMembers.test.js +71 -0
- package/src/screens/HanetCamera/hooks/index.js +5 -0
- package/src/screens/HanetCamera/hooks/useHanetCheckinData.js +116 -0
- package/src/screens/HanetCamera/hooks/useHanetPlaceMembers.js +86 -0
- package/src/screens/HanetCamera/hooks/useStateAlertAction.js +62 -0
- package/src/screens/HanetCamera/styles/captureFaceIDStyles.js +50 -0
- package/src/screens/HanetCamera/styles/checkinHeaderStyles.js +24 -0
- package/src/screens/HanetCamera/styles/detailStyles.js +107 -0
- package/src/screens/HanetCamera/styles/manageAccessStyles.js +49 -0
- package/src/screens/HanetCamera/styles/memberInfoStyles.js +73 -0
- package/src/screens/HanetCamera/utils/Monitor.js +52 -0
- package/src/screens/Notification/__test__/NotificationItem.test.js +16 -3
- package/src/screens/Notification/components/NotificationItem.js +68 -8
- package/src/screens/ScanChipQR/__test__/ScanChipQR.test.js +1 -0
- package/src/screens/ScanChipQR/hooks/index.js +90 -44
- package/src/screens/ScriptDetail/index.js +1 -6
- package/src/screens/SelectUnit/index.js +1 -0
- package/src/screens/SharedUnit/index.js +1 -1
- package/src/screens/SmartIr/__test__/ButtonsBottom.test.js +31 -0
- package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +80 -0
- package/src/screens/SmartIr/__test__/SelectBrand.test.js +65 -0
- package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +57 -0
- package/src/screens/SmartIr/__test__/SmartIr.test.js +62 -0
- package/src/screens/SmartIr/components/GroupButtonByType/ButtonsBottom.js +45 -0
- package/src/screens/SmartIr/components/GroupButtonByType/ButtonsBottomStyles.js +31 -0
- package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +208 -0
- package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByTypeStyles.js +113 -0
- package/src/screens/SmartIr/components/SelectBrand.js +61 -0
- package/src/screens/SmartIr/components/SelectBrandStyles.js +14 -0
- package/src/screens/SmartIr/components/SelectDeviceType.js +96 -0
- package/src/screens/SmartIr/components/SelectDeviceTypeStyles.js +30 -0
- package/src/screens/SmartIr/index.js +28 -0
- package/src/screens/SmartIr/styles.js +14 -0
- package/src/screens/Unit/AddMenu.js +4 -1
- package/src/screens/Unit/Detail.js +8 -12
- package/src/screens/Unit/__test__/Detail.test.js +0 -10
- package/src/screens/Unit/components/MyUnitDevice/index.js +2 -4
- package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +38 -9
- package/src/screens/UnitSummary/components/PowerConsumeHistoryChart/__test__/index.test.js +32 -1
- package/src/screens/UnitSummary/components/PowerConsumeHistoryChart/index.js +1 -1
- package/src/utils/I18n/translations/en.json +59 -2
- package/src/utils/I18n/translations/vi.json +59 -2
- package/src/utils/Route/index.js +14 -0
- package/src/commons/ActionGroup/LightActionTemplate.js +0 -103
- package/src/commons/ActionGroup/__test__/LightActionTemplate.test.js +0 -59
package/src/configs/Constants.js
CHANGED
|
@@ -73,6 +73,16 @@ export const Constants = {
|
|
|
73
73
|
|
|
74
74
|
export const DEVICE_TYPE = {
|
|
75
75
|
LG_THINQ: 'LG_THINQ',
|
|
76
|
+
HANET: 'HANET',
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const marginItem = 12;
|
|
80
|
+
const marginHorizontal = 16;
|
|
81
|
+
const widthItem = (Constants.width - marginHorizontal * 2 - marginItem) / 2;
|
|
82
|
+
const heightItem = (widthItem / 166) * 106;
|
|
83
|
+
export const DEVICE_SIZE = {
|
|
84
|
+
width: widthItem,
|
|
85
|
+
height: heightItem,
|
|
76
86
|
};
|
|
77
87
|
|
|
78
88
|
export const SCANNING_STATUS = {
|
|
@@ -100,6 +110,26 @@ export const AUTOMATE_TYPE = {
|
|
|
100
110
|
SCENARIO: 'scenario',
|
|
101
111
|
};
|
|
102
112
|
|
|
113
|
+
export const SMART_TIVI_BUTTON = {
|
|
114
|
+
ONOFF_BUTTON: 'OnOff',
|
|
115
|
+
EXIT_BUTTON: 'Exit',
|
|
116
|
+
VOLUME_UP_BUTTON: 'VolumeUp',
|
|
117
|
+
VOLUME_DOWN_BUTTON: 'VolumeDown',
|
|
118
|
+
CH_UP: 'ChUp',
|
|
119
|
+
CH_DOWN: 'ChDown',
|
|
120
|
+
PREV_BUTTON: 'Prev',
|
|
121
|
+
STOP_BUTTON: 'Stop',
|
|
122
|
+
NEXT_BUTTON: 'Next',
|
|
123
|
+
UP_BUTTON: 'Up',
|
|
124
|
+
DOWN_BUTTON: 'Down',
|
|
125
|
+
LEFT_BUTTON: 'Left',
|
|
126
|
+
RIGHT_BUTTON: 'Right',
|
|
127
|
+
OK_BUTTON: 'Ok',
|
|
128
|
+
HOME_BUTTON: 'Home',
|
|
129
|
+
BACK_BUTTON: 'Back',
|
|
130
|
+
CHANNEL_BUTTON: 'Channel',
|
|
131
|
+
};
|
|
132
|
+
|
|
103
133
|
export const AUTOMATE_SELECT = {
|
|
104
134
|
SELECT_DEVICE: 'select_device',
|
|
105
135
|
SELECT_SENSOR: 'select_sensor',
|
|
@@ -636,6 +666,23 @@ export const TESTID = {
|
|
|
636
666
|
|
|
637
667
|
// MoveToAnotherSubUnit
|
|
638
668
|
ROW_SUB_UNIT: 'ROW_SUB_UNIT',
|
|
669
|
+
|
|
670
|
+
// HanetCameraDetail
|
|
671
|
+
TEXT_COUNT_MEMBER: 'TEXT_COUNT_MEMBER',
|
|
672
|
+
TEXT_COUNT_STRANGER: 'TEXT_COUNT_STRANGER',
|
|
673
|
+
ROW_HANET_MANAGE_ACCESS: 'ROW_HANET_MANAGE_ACCESS',
|
|
674
|
+
HANET_MANAGE_ACCESS_ADD_BUTTON: 'HANET_MANAGE_ACCESS_ADD_BUTTON',
|
|
675
|
+
HANET_ADD_MEMBER_OPTION: 'HANET_ADD_MEMBER_OPTION',
|
|
676
|
+
|
|
677
|
+
//SetupGeneratePasscode
|
|
678
|
+
GENERATE_PASSCODE_CHOOSE_USER: 'GENERATE_PASSCODE_CHOOSE_USER',
|
|
679
|
+
GENERATE_PASSCODE_SET_TIME: 'GENERATE_PASSCODE_SET_TIME',
|
|
680
|
+
GENERATE_PASSCODE_SET_DURATION: 'GENERATE_PASSCODE_SET_DURATION',
|
|
681
|
+
|
|
682
|
+
//AutoLock
|
|
683
|
+
AUTO_LOCK_BUTTON_ENABLE: 'AUTO_LOCK_BUTTON_ENABLE',
|
|
684
|
+
AUTO_LOCK_BUTTON_INSTANT: 'AUTO_LOCK_BUTTON_INSTANT',
|
|
685
|
+
AUTO_LOCK_BUTTON_RELOCK_TIMING: 'AUTO_LOCK_BUTTON_RELOCK_TIMING',
|
|
639
686
|
};
|
|
640
687
|
|
|
641
688
|
export const NOTIFICATION_TYPES = {
|
|
@@ -663,6 +710,8 @@ export const NOTIFICATION_TYPES = {
|
|
|
663
710
|
NOTIFY_DEVICE_DISCONNECT: 'NOTIFY_DEVICE_DISCONNECT',
|
|
664
711
|
NOTIFY_RENAME_SUB_UNIT: 'NOTIFY_RENAME_SUB_UNIT',
|
|
665
712
|
NOTIFY_UPDATE_ADDRESS: 'NOTIFY_UPDATE_ADDRESS',
|
|
713
|
+
NOTIFY_REMOVE_SUB_UNIT: 'NOTIFY_REMOVE_SUB_UNIT',
|
|
714
|
+
NOTIFY_REMOVE_DEVICE: 'NOTIFY_REMOVE_DEVICE',
|
|
666
715
|
};
|
|
667
716
|
|
|
668
717
|
export const ACTIVITY_LOG_TYPES = {
|
|
@@ -670,3 +719,15 @@ export const ACTIVITY_LOG_TYPES = {
|
|
|
670
719
|
ACTIVATED_BY: 'ACTIVATED_BY',
|
|
671
720
|
SCRIPT_UPDATED_BY: 'SCRIPT_UPDATED_BY',
|
|
672
721
|
};
|
|
722
|
+
|
|
723
|
+
export const SENSOR_TYPE = {
|
|
724
|
+
AIR_QUALITY: 'air_quality',
|
|
725
|
+
TURBIDITY: 'turbidity',
|
|
726
|
+
PH: 'ph',
|
|
727
|
+
CLO: 'clo',
|
|
728
|
+
UV: 'uv',
|
|
729
|
+
SMOKE: 'smoke',
|
|
730
|
+
FIRE: 'fire',
|
|
731
|
+
SOS: 'sos',
|
|
732
|
+
FILTER_WATER: 'filter_water',
|
|
733
|
+
};
|
package/src/configs/SCConfig.js
CHANGED
|
@@ -7,6 +7,8 @@ export const Action = {
|
|
|
7
7
|
IS_FIRST_OPEN_CAMERA: 'IS_FIRST_OPEN_CAMERA',
|
|
8
8
|
IS_LAVIDA_SOURCE: 'IS_LAVIDA_SOURCE',
|
|
9
9
|
IS_CONNECT_WIFI_GATEWAY: 'IS_CONNECT_WIFI_GATEWAY',
|
|
10
|
+
SET_BLUETOOTH_STATE: 'SET_BLUETOOTH_STATE',
|
|
11
|
+
SET_NETWORK_CONNECTED: 'SET_NETWORK_CONNECTED',
|
|
10
12
|
};
|
|
11
13
|
|
|
12
14
|
export type AuthData = {
|
|
@@ -52,4 +54,6 @@ export type AppType = {
|
|
|
52
54
|
isFirstOpenCamera: boolean;
|
|
53
55
|
isLavidaSource: boolean;
|
|
54
56
|
isConnectWifiGateway: boolean;
|
|
57
|
+
isBluetoothEnabled: boolean;
|
|
58
|
+
isNetworkConnected: boolean;
|
|
55
59
|
};
|
package/src/context/mockStore.ts
CHANGED
|
@@ -49,6 +49,9 @@ export const mockSCStore = (data: ContextData): ContextData => {
|
|
|
49
49
|
listAction: [...mockDataStore.listAction, ...(data?.listAction || [])],
|
|
50
50
|
app: {
|
|
51
51
|
isFirstOpenCamera: true,
|
|
52
|
+
isConnectWifiGateway: false,
|
|
53
|
+
isBluetoothEnabled: true,
|
|
54
|
+
isNetworkConnected: true,
|
|
52
55
|
},
|
|
53
56
|
};
|
|
54
57
|
};
|
package/src/context/reducer.ts
CHANGED
|
@@ -41,6 +41,8 @@ export const initialState = {
|
|
|
41
41
|
isFirstOpenCamera: true,
|
|
42
42
|
isLavidaSource: false,
|
|
43
43
|
isConnectWifiGateway: false,
|
|
44
|
+
isBluetoothEnabled: false,
|
|
45
|
+
isNetworkConnected: false,
|
|
44
46
|
},
|
|
45
47
|
};
|
|
46
48
|
|
|
@@ -117,6 +119,24 @@ export const reducer = (currentState: ContextData, action: Action) => {
|
|
|
117
119
|
},
|
|
118
120
|
};
|
|
119
121
|
}
|
|
122
|
+
case Action.SET_BLUETOOTH_STATE: {
|
|
123
|
+
return {
|
|
124
|
+
...currentState,
|
|
125
|
+
app: {
|
|
126
|
+
...currentState.app,
|
|
127
|
+
isBluetoothEnabled: payload,
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
case Action.SET_NETWORK_CONNECTED: {
|
|
132
|
+
return {
|
|
133
|
+
...currentState,
|
|
134
|
+
app: {
|
|
135
|
+
...currentState.app,
|
|
136
|
+
isNetworkConnected: payload,
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
}
|
|
120
140
|
default:
|
|
121
141
|
return currentState;
|
|
122
142
|
}
|
|
@@ -5,7 +5,6 @@ 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';
|
|
8
|
-
import { useEffect, useState } from 'react';
|
|
9
8
|
|
|
10
9
|
const bluetoothDevices = {};
|
|
11
10
|
const needToScanDevices = [];
|
|
@@ -185,31 +184,13 @@ export const sendDataOverBluetooth = async (
|
|
|
185
184
|
return result;
|
|
186
185
|
}
|
|
187
186
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
187
|
+
const timeout = setTimeout(() => {
|
|
188
|
+
device.cancelConnection();
|
|
189
|
+
clearTimeout(timeout);
|
|
191
190
|
}, responseTime);
|
|
192
191
|
return result;
|
|
193
192
|
};
|
|
194
193
|
|
|
195
|
-
export const isBluetoothEnabled = async () => {
|
|
196
|
-
const state = await bleManager.state();
|
|
197
|
-
return state === 'PoweredOn';
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
export const useIsBluetoothEnabled = () => {
|
|
201
|
-
const [isEnabled, setIsEnabled] = useState(null);
|
|
202
|
-
|
|
203
|
-
useEffect(() => {
|
|
204
|
-
const subscription = bleManager.onStateChange((state) => {
|
|
205
|
-
setIsEnabled(state === 'PoweredOn');
|
|
206
|
-
}, true);
|
|
207
|
-
|
|
208
|
-
return () => subscription.remove();
|
|
209
|
-
}, []);
|
|
210
|
-
return isEnabled;
|
|
211
|
-
};
|
|
212
|
-
|
|
213
194
|
export const enableBluetoothForAndroid = async () => {
|
|
214
195
|
await bleManager.enable();
|
|
215
196
|
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createStackNavigator } from '@react-navigation/stack';
|
|
2
|
+
import React, { memo } from 'react';
|
|
3
|
+
import HanetCameraDetail from '../screens/HanetCamera/Detail';
|
|
4
|
+
import HanetManageAccess from '../screens/HanetCamera/ManageAccess';
|
|
5
|
+
import HanetMemberInfo from '../screens/HanetCamera/MemberInfo';
|
|
6
|
+
import HanetCaptureFaceID from '../screens/HanetCamera/CaptureFaceID';
|
|
7
|
+
import Route from '../utils/Route';
|
|
8
|
+
import { screenOptions } from './utils';
|
|
9
|
+
|
|
10
|
+
const Stack = createStackNavigator();
|
|
11
|
+
|
|
12
|
+
export const HanetCameraStack = memo(() => {
|
|
13
|
+
return (
|
|
14
|
+
<Stack.Navigator
|
|
15
|
+
screenOptions={{
|
|
16
|
+
...screenOptions,
|
|
17
|
+
}}
|
|
18
|
+
>
|
|
19
|
+
<Stack.Screen
|
|
20
|
+
name={Route.HanetCameraDetail}
|
|
21
|
+
component={HanetCameraDetail}
|
|
22
|
+
options={{ headerShown: false }}
|
|
23
|
+
/>
|
|
24
|
+
<Stack.Screen
|
|
25
|
+
name={Route.HanetManageAccess}
|
|
26
|
+
component={HanetManageAccess}
|
|
27
|
+
options={{ headerShown: false }}
|
|
28
|
+
/>
|
|
29
|
+
<Stack.Screen
|
|
30
|
+
name={Route.HanetMemberInfo}
|
|
31
|
+
component={HanetMemberInfo}
|
|
32
|
+
options={{ headerShown: false }}
|
|
33
|
+
/>
|
|
34
|
+
<Stack.Screen
|
|
35
|
+
name={Route.HanetCaptureFaceID}
|
|
36
|
+
component={HanetCaptureFaceID}
|
|
37
|
+
options={{ headerShown: false }}
|
|
38
|
+
/>
|
|
39
|
+
</Stack.Navigator>
|
|
40
|
+
);
|
|
41
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createStackNavigator } from '@react-navigation/stack';
|
|
2
|
+
import React, { memo } from 'react';
|
|
3
|
+
|
|
4
|
+
import SelectDeviceType from '../screens/SmartIr/components/SelectDeviceType';
|
|
5
|
+
import SelectBrand from '../screens/SmartIr/components/SelectBrand';
|
|
6
|
+
import GroupButtonByType from '../screens/SmartIr/components/GroupButtonByType/GroupButtonByType';
|
|
7
|
+
import Route from '../utils/Route';
|
|
8
|
+
import { screenOptions } from './utils';
|
|
9
|
+
|
|
10
|
+
const Stack = createStackNavigator();
|
|
11
|
+
|
|
12
|
+
export const SmartIrStack = memo(() => {
|
|
13
|
+
return (
|
|
14
|
+
<Stack.Navigator
|
|
15
|
+
screenOptions={{
|
|
16
|
+
...screenOptions,
|
|
17
|
+
headerShown: false,
|
|
18
|
+
}}
|
|
19
|
+
>
|
|
20
|
+
<Stack.Screen
|
|
21
|
+
name={Route.SelectDeviceType}
|
|
22
|
+
component={SelectDeviceType}
|
|
23
|
+
/>
|
|
24
|
+
<Stack.Screen name={Route.SelectBrand} component={SelectBrand} />
|
|
25
|
+
<Stack.Screen
|
|
26
|
+
name={Route.GroupButtonByType}
|
|
27
|
+
component={GroupButtonByType}
|
|
28
|
+
/>
|
|
29
|
+
</Stack.Navigator>
|
|
30
|
+
);
|
|
31
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { createStackNavigator } from '@react-navigation/stack';
|
|
2
|
+
import React, { memo } from 'react';
|
|
3
|
+
|
|
4
|
+
import Route from '../utils/Route';
|
|
5
|
+
import { screenOptions } from './utils';
|
|
6
|
+
import SetupGeneratePasscode from '../commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/index';
|
|
7
|
+
import AutoLock from '../commons/ActionGroup/OnOffSmartLock/AutoLock/index';
|
|
8
|
+
import PasscodeList from '../commons/ActionGroup/OnOffSmartLock/PasscodeList/index';
|
|
9
|
+
import ItemPasscode from '../commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscode';
|
|
10
|
+
|
|
11
|
+
const Stack = createStackNavigator();
|
|
12
|
+
|
|
13
|
+
export const SmartLockStack = memo(() => {
|
|
14
|
+
return (
|
|
15
|
+
<Stack.Navigator
|
|
16
|
+
screenOptions={{
|
|
17
|
+
...screenOptions,
|
|
18
|
+
headerShown: false,
|
|
19
|
+
}}
|
|
20
|
+
>
|
|
21
|
+
<Stack.Screen
|
|
22
|
+
name={Route.SetupGeneratePasscode}
|
|
23
|
+
component={SetupGeneratePasscode}
|
|
24
|
+
options={{
|
|
25
|
+
headerShown: false,
|
|
26
|
+
}}
|
|
27
|
+
/>
|
|
28
|
+
<Stack.Screen
|
|
29
|
+
name={Route.AutoLock}
|
|
30
|
+
component={AutoLock}
|
|
31
|
+
options={{
|
|
32
|
+
headerShown: false,
|
|
33
|
+
}}
|
|
34
|
+
/>
|
|
35
|
+
<Stack.Screen
|
|
36
|
+
name={Route.PasscodeList}
|
|
37
|
+
component={PasscodeList}
|
|
38
|
+
options={{
|
|
39
|
+
headerShown: false,
|
|
40
|
+
}}
|
|
41
|
+
/>
|
|
42
|
+
<Stack.Screen
|
|
43
|
+
name={Route.ItemPasscode}
|
|
44
|
+
component={ItemPasscode}
|
|
45
|
+
options={{
|
|
46
|
+
headerShown: false,
|
|
47
|
+
}}
|
|
48
|
+
/>
|
|
49
|
+
</Stack.Navigator>
|
|
50
|
+
);
|
|
51
|
+
});
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import React, { memo } from 'react';
|
|
1
|
+
import React, { memo, useContext, useEffect } from 'react';
|
|
2
2
|
import { View, StyleSheet } from 'react-native';
|
|
3
3
|
import { IconOutline } from '@ant-design/icons-react-native';
|
|
4
4
|
import { createStackNavigator } from '@react-navigation/stack';
|
|
5
|
+
import { BleManager } from 'react-native-ble-plx';
|
|
6
|
+
import NetInfo from '@react-native-community/netinfo';
|
|
5
7
|
import { get } from 'lodash';
|
|
6
8
|
|
|
7
9
|
import Text from '../commons/Text';
|
|
@@ -10,6 +12,8 @@ import { Colors, Device } from '../configs';
|
|
|
10
12
|
import Route from '../utils/Route';
|
|
11
13
|
import ActivityLogScreen from '../screens/ActivityLog';
|
|
12
14
|
import { screenOptions } from './utils';
|
|
15
|
+
import { SCContext } from '../context';
|
|
16
|
+
import { Action } from '../context/actionType';
|
|
13
17
|
|
|
14
18
|
import AQIGuide from '../screens/AQIGuide';
|
|
15
19
|
import DeviceDetail from '../screens/Device/detail';
|
|
@@ -45,11 +49,33 @@ import SetUpSensor from '../screens/AddNewAction/SetupSensor';
|
|
|
45
49
|
import EditDevice from '../screens/Device/EditDevice/index';
|
|
46
50
|
import EmergencySetting from '../screens/EmergencySetting';
|
|
47
51
|
import ConfirmUnitDeletion from '../screens/ConfirmUnitDeletion';
|
|
52
|
+
import { HanetCameraStack } from './HanetCameraStack';
|
|
48
53
|
|
|
49
54
|
const Stack = createStackNavigator();
|
|
50
55
|
|
|
56
|
+
const bleManager = new BleManager();
|
|
57
|
+
|
|
51
58
|
export const UnitStack = memo((props) => {
|
|
52
59
|
const t = useTranslations();
|
|
60
|
+
const { setAction } = useContext(SCContext);
|
|
61
|
+
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
const unsubscribe = NetInfo.addEventListener((state) => {
|
|
64
|
+
setAction(Action.SET_NETWORK_CONNECTED, state.isConnected);
|
|
65
|
+
});
|
|
66
|
+
return () => unsubscribe();
|
|
67
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
68
|
+
}, []);
|
|
69
|
+
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
const subscription = bleManager.onStateChange((state) => {
|
|
72
|
+
setAction(Action.SET_BLUETOOTH_STATE, state === 'PoweredOn');
|
|
73
|
+
}, true);
|
|
74
|
+
|
|
75
|
+
return () => subscription.remove();
|
|
76
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
77
|
+
}, []);
|
|
78
|
+
|
|
53
79
|
return (
|
|
54
80
|
<Stack.Navigator
|
|
55
81
|
screenOptions={{
|
|
@@ -117,12 +143,16 @@ export const UnitStack = memo((props) => {
|
|
|
117
143
|
component={ChooseLocation}
|
|
118
144
|
options={{
|
|
119
145
|
headerShown: true,
|
|
146
|
+
headerTitleStyle: {
|
|
147
|
+
...styles.headerLocation,
|
|
148
|
+
},
|
|
120
149
|
headerTitle: () => (
|
|
121
|
-
<View style={styles.
|
|
150
|
+
<View style={styles.headerLocation}>
|
|
122
151
|
<Text type="H3" color={Colors.Gray9} bold>
|
|
123
152
|
{t('choose_on_map')}
|
|
124
153
|
</Text>
|
|
125
|
-
|
|
154
|
+
|
|
155
|
+
<Text type="H4" color={Colors.Gray8} style={styles.headerContent}>
|
|
126
156
|
{t('plan_and_zoom_to_adjust')}
|
|
127
157
|
</Text>
|
|
128
158
|
</View>
|
|
@@ -162,6 +192,13 @@ export const UnitStack = memo((props) => {
|
|
|
162
192
|
headerShown: false,
|
|
163
193
|
}}
|
|
164
194
|
/>
|
|
195
|
+
<Stack.Screen
|
|
196
|
+
name={Route.HanetCameraStack}
|
|
197
|
+
component={HanetCameraStack}
|
|
198
|
+
options={{
|
|
199
|
+
headerShown: false,
|
|
200
|
+
}}
|
|
201
|
+
/>
|
|
165
202
|
<Stack.Screen
|
|
166
203
|
name={Route.UVIndexGuide}
|
|
167
204
|
component={UVIndexGuide}
|
|
@@ -323,7 +360,12 @@ const styles = StyleSheet.create({
|
|
|
323
360
|
icLeft: {
|
|
324
361
|
marginLeft: Device.isIOS ? 8 : 0,
|
|
325
362
|
},
|
|
326
|
-
|
|
363
|
+
headerLocation: {
|
|
327
364
|
alignItems: 'center',
|
|
365
|
+
justifyContent: 'center',
|
|
366
|
+
},
|
|
367
|
+
headerContent: {
|
|
368
|
+
textAlign: 'center',
|
|
369
|
+
paddingBottom: 8,
|
|
328
370
|
},
|
|
329
371
|
});
|
|
@@ -37,6 +37,7 @@ String.prototype.capitalize = function () {
|
|
|
37
37
|
return this.charAt(0).toUpperCase() + this.slice(1);
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
+
let onEndReachedCalledDuringMomentum = false;
|
|
40
41
|
let dataTemp = [];
|
|
41
42
|
|
|
42
43
|
export default ({ id, type, share, filterEnabled }) => {
|
|
@@ -59,7 +60,7 @@ export default ({ id, type, share, filterEnabled }) => {
|
|
|
59
60
|
if (page === 1) {
|
|
60
61
|
setIsRefreshing(true);
|
|
61
62
|
} else {
|
|
62
|
-
if (!isCanLoadMore
|
|
63
|
+
if (!isCanLoadMore) {
|
|
63
64
|
return;
|
|
64
65
|
}
|
|
65
66
|
setIsLoading(true);
|
|
@@ -81,6 +82,7 @@ export default ({ id, type, share, filterEnabled }) => {
|
|
|
81
82
|
params.append(key, value);
|
|
82
83
|
}
|
|
83
84
|
params.append('page', page);
|
|
85
|
+
|
|
84
86
|
const { success, data } = await axiosGet(api.url(id), {
|
|
85
87
|
params: params,
|
|
86
88
|
});
|
|
@@ -110,9 +112,20 @@ export default ({ id, type, share, filterEnabled }) => {
|
|
|
110
112
|
}
|
|
111
113
|
};
|
|
112
114
|
|
|
113
|
-
const onRefresh = () =>
|
|
115
|
+
const onRefresh = () => {
|
|
116
|
+
setIsCanLoadMore(true);
|
|
117
|
+
fetchData({ ...filters, page: 1 });
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const onLoadMore = () => {
|
|
121
|
+
if (!onEndReachedCalledDuringMomentum) {
|
|
122
|
+
onEndReachedCalledDuringMomentum = true;
|
|
123
|
+
fetchData({ ...filters, page: page + 1 });
|
|
124
|
+
}
|
|
125
|
+
};
|
|
114
126
|
|
|
115
|
-
const
|
|
127
|
+
const onMomentumScrollBegin = () =>
|
|
128
|
+
(onEndReachedCalledDuringMomentum = false);
|
|
116
129
|
|
|
117
130
|
return {
|
|
118
131
|
data,
|
|
@@ -124,5 +137,6 @@ export default ({ id, type, share, filterEnabled }) => {
|
|
|
124
137
|
fetchMembers,
|
|
125
138
|
filters,
|
|
126
139
|
setFilters,
|
|
140
|
+
onMomentumScrollBegin,
|
|
127
141
|
};
|
|
128
142
|
};
|
|
@@ -34,7 +34,9 @@ const ActivityLogScreen = ({ route }) => {
|
|
|
34
34
|
fetchMembers,
|
|
35
35
|
filters,
|
|
36
36
|
setFilters,
|
|
37
|
+
onMomentumScrollBegin,
|
|
37
38
|
} = useActivityLog({ id, type, share, filterEnabled });
|
|
39
|
+
|
|
38
40
|
const [showFilterPopup, setShowFilterPopup, setHideFilterPopup] =
|
|
39
41
|
useBoolean();
|
|
40
42
|
|
|
@@ -113,6 +115,7 @@ const ActivityLogScreen = ({ route }) => {
|
|
|
113
115
|
removeClippedSubviews={true}
|
|
114
116
|
maxToRenderPerBatch={20}
|
|
115
117
|
contentContainerStyle={styles.contentContainerStyle}
|
|
118
|
+
onMomentumScrollBegin={onMomentumScrollBegin}
|
|
116
119
|
/>
|
|
117
120
|
</View>
|
|
118
121
|
{(filterEnabled.user || filterEnabled.date) && (
|
|
@@ -152,7 +152,7 @@ describe('Test SelectSubUnit container', () => {
|
|
|
152
152
|
case 'AddVconnexDevice':
|
|
153
153
|
expect(mockedNavigate).toBeCalledWith('Browser', {
|
|
154
154
|
// eslint-disable-next-line max-len
|
|
155
|
-
link: 'https://partner-api
|
|
155
|
+
link: 'https://partner-api.vconnex.vn/oauth/authorize?client_id=&redirect_uri=&response_type=code&scope=SYNCH&scope=CONTROL&scope=QUERY&state=undefined@undefined@undefined',
|
|
156
156
|
});
|
|
157
157
|
break;
|
|
158
158
|
case 'AddDeviceNewFlow':
|
|
@@ -175,7 +175,7 @@ const SelectSensorDevices = memo(({ route }) => {
|
|
|
175
175
|
{t(title)}
|
|
176
176
|
</Text>
|
|
177
177
|
|
|
178
|
-
{
|
|
178
|
+
{listStation ? (
|
|
179
179
|
<NavBar
|
|
180
180
|
listStation={listStation}
|
|
181
181
|
listMenuItem={listMenuItem}
|
|
@@ -185,7 +185,9 @@ const SelectSensorDevices = memo(({ route }) => {
|
|
|
185
185
|
/>
|
|
186
186
|
) : (
|
|
187
187
|
<View style={styles.noneData}>
|
|
188
|
-
<Text center>
|
|
188
|
+
<Text center>
|
|
189
|
+
{t('you_do_not_have_the_device_or_have_share_control_device')}
|
|
190
|
+
</Text>
|
|
189
191
|
</View>
|
|
190
192
|
)}
|
|
191
193
|
|