@eohjsc/react-native-smart-city 0.2.67 → 0.2.71
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/Popover/Dashboard/SmartAccount.svg +5 -0
- package/assets/images/scan-qr-gateway.svg +14 -0
- package/assets/images/wifi-gateway.svg +18 -0
- package/assets/images/wifi.svg +3 -0
- package/package.json +3 -1
- package/src/Images/Common/buttonLeftCurtain@2x.png +0 -0
- package/src/Images/Common/buttonLeftCurtain@3x.png +0 -0
- package/src/Images/Common/{buttonPause-center-curtain.png → buttonPauseCurtain.png} +0 -0
- package/src/Images/Common/buttonPauseCurtain@2x.png +0 -0
- package/src/Images/Common/buttonPauseCurtain@3x.png +0 -0
- package/src/Images/Common/buttonRightCurtain@2x.png +0 -0
- package/src/Images/Common/buttonRightCurtain@3x.png +0 -0
- package/src/commons/Action/ItemQuickAction.js +4 -3
- package/src/commons/ActionGroup/CurtainButtonTemplate.js +0 -30
- package/src/commons/ActionGroup/CurtainButtonTemplateStyle.js +0 -12
- package/src/commons/ActionGroup/__test__/CurtainButtonTemplate.test.js +1 -1
- package/src/commons/AlertAction/index.js +4 -3
- package/src/commons/CameraDevice/index.js +1 -1
- package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +70 -0
- package/src/commons/Device/HistoryChart.js +18 -18
- package/src/commons/Device/HorizontalBarChart.js +1 -2
- package/src/commons/Device/ItemDevice.js +1 -13
- package/src/commons/Device/LinearChart.js +13 -3
- package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +1 -1
- package/src/commons/SubUnit/OneTap/OneTapStyles.js +14 -5
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +5 -68
- package/src/commons/SubUnit/OneTap/index.js +24 -33
- package/src/commons/UnitSummary/ConfigHistoryChart/__test__/ConfigHistoryChart.test.js +29 -0
- package/src/commons/UnitSummary/ConfigHistoryChart.js +4 -6
- package/src/commons/ViewButtonBottom/index.js +4 -0
- package/src/configs/API.js +2 -0
- package/src/configs/BLE.js +3 -0
- package/src/configs/Constants.js +2 -0
- package/src/configs/Images.js +1 -1
- package/src/context/SCContext.tsx +2 -0
- package/src/iot/RemoteControl/Bluetooth.js +34 -6
- package/src/iot/RemoteControl/__test__/Bluetooth.test.js +1 -0
- package/src/iot/RemoteControl/__test__/index.mock.js +1 -0
- package/src/iot/RemoteControl/index.js +7 -2
- package/src/navigations/AddDeviceStack.js +2 -0
- package/src/navigations/AddGatewayStack.js +11 -0
- package/src/navigations/AddLGDeviceStack.js +2 -0
- package/src/navigations/AddMemberStack.js +2 -0
- package/src/navigations/AddSubUnitStack.js +2 -0
- package/src/navigations/AddUnitStack.js +2 -0
- package/src/navigations/EmergencyContactsStack.js +2 -0
- package/src/navigations/SharedStack.js +2 -0
- package/src/navigations/UnitStack.js +2 -0
- package/src/navigations/utils.js +3 -0
- package/src/screens/AddCommon/SelectSubUnit.js +12 -2
- package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +190 -0
- package/src/screens/AddNewGateway/PlugAndPlay/FirstWarning.js +73 -0
- package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +154 -0
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +60 -0
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/GatewayWifiList.test.js +35 -0
- package/src/screens/AddNewGateway/__test__/SetupGateway.test.js +90 -0
- package/src/screens/AddNewOneTap/__test__/AddNewOneTap.test.js +0 -22
- package/src/screens/AddNewOneTap/index.js +15 -13
- package/src/screens/Device/components/SensorDisplayItem.js +4 -2
- package/src/screens/Notification/components/NotificationItem.js +24 -1
- package/src/screens/Notification/styles/NotificationItemStyles.js +1 -1
- package/src/screens/ScanChipQR/hooks/index.js +14 -5
- package/src/screens/SharedUnit/index.js +7 -5
- package/src/screens/Sharing/Components/SensorItem.js +27 -12
- package/src/screens/Sharing/Components/Styles/SensorItemStyles.js +4 -0
- package/src/screens/Sharing/SelectPermission.js +44 -32
- package/src/screens/Sharing/SelectUser.js +13 -1
- package/src/screens/Sharing/__test__/SelectPermission.test.js +2 -1
- package/src/screens/SubUnit/AddSubUnit.js +4 -1
- package/src/screens/Unit/AddMenu.js +15 -0
- package/src/screens/Unit/Detail.js +15 -4
- package/src/screens/Unit/SmartAccount.js +36 -15
- package/src/screens/Unit/SmartAccountStyles.js +20 -0
- package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +10 -6
- package/src/screens/Unit/hook/useStateAlertRemove.js +4 -6
- package/src/screens/UnitSummary/components/PowerConsumption/index.js +2 -4
- package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +10 -6
- package/src/utils/I18n/translations/en.json +33 -4
- package/src/utils/I18n/translations/vi.json +34 -4
- package/src/utils/Route/index.js +4 -0
- package/src/utils/Utils.js +0 -4
- package/src/commons/ActionGroup/__test__/MenuActionAddSchedule.test.js +0 -71
- package/src/commons/ActionGroup/hooks/AccessScheduleDetailStyles.js +0 -41
- package/src/commons/ActionGroup/hooks/MenuActionAddSchedule.js +0 -110
- package/src/commons/ActionGroup/hooks/MenuActionAddScheduleStyle.js +0 -69
- package/src/commons/ActionGroup/hooks/RecurringDetail.js +0 -97
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { TouchableOpacity, View } from 'react-native';
|
|
3
|
-
import { Icon } from '@ant-design/react-native';
|
|
4
3
|
|
|
5
|
-
import {
|
|
4
|
+
import { Section } from '../..';
|
|
6
5
|
import ItemAddNew from '../../Device/ItemAddNew';
|
|
7
6
|
import ItemOneTap from './ItemOneTap';
|
|
8
7
|
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
9
8
|
import { useNavigation } from '@react-navigation/native';
|
|
10
9
|
import Routes from '../../../utils/Route/index.js';
|
|
11
10
|
import { AUTOMATE_TYPE, TESTID } from '../../../configs/Constants';
|
|
12
|
-
import { Colors } from '../../../configs/Colors.js';
|
|
13
|
-
import usePopover from '../../../hooks/Common/usePopover.js';
|
|
14
11
|
import Text from '../../Text/index.js';
|
|
15
12
|
|
|
16
13
|
import styles from './OneTapStyles.js';
|
|
@@ -33,11 +30,8 @@ const SubUnitAutomate = ({ isOwner, listAutomate, unit, wrapItemStyle }) => {
|
|
|
33
30
|
break;
|
|
34
31
|
}
|
|
35
32
|
};
|
|
36
|
-
const { childRef, showingPopover, showPopoverWithRef, hidePopover } =
|
|
37
|
-
usePopover();
|
|
38
33
|
|
|
39
34
|
const refMenuAction = useRef();
|
|
40
|
-
const handleShowMenuAction = () => showPopoverWithRef(refMenuAction);
|
|
41
35
|
|
|
42
36
|
const onItemClick = useCallback((item, index) => {
|
|
43
37
|
setAutomates(item);
|
|
@@ -50,23 +44,30 @@ const SubUnitAutomate = ({ isOwner, listAutomate, unit, wrapItemStyle }) => {
|
|
|
50
44
|
|
|
51
45
|
return (
|
|
52
46
|
<Section style={styles.noShadow}>
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
47
|
+
<View style={styles.boxScenario}>
|
|
48
|
+
{listAutomate.map((item, index) => (
|
|
49
|
+
<TouchableOpacity
|
|
50
|
+
style={
|
|
51
|
+
indexAutomate === index
|
|
52
|
+
? styles.borderSelection
|
|
53
|
+
: styles.notShowBorder
|
|
54
|
+
}
|
|
55
|
+
onPress={() => onItemClick(item, index)}
|
|
56
|
+
ref={refMenuAction}
|
|
57
|
+
testID={TESTID.SUB_UNIT_SELECT_AUTOMATE_TYPE}
|
|
64
58
|
>
|
|
65
|
-
{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
59
|
+
<View style={styles.boxTextScenarito}>
|
|
60
|
+
<Text
|
|
61
|
+
testID={TESTID.SUB_UNIT_TEXT_DROPDOWN}
|
|
62
|
+
style={styles.textSelection}
|
|
63
|
+
semibold
|
|
64
|
+
>
|
|
65
|
+
{item?.text}
|
|
66
|
+
</Text>
|
|
67
|
+
</View>
|
|
68
|
+
</TouchableOpacity>
|
|
69
|
+
))}
|
|
70
|
+
</View>
|
|
70
71
|
<View style={styles.boxDevices}>
|
|
71
72
|
{automates?.data &&
|
|
72
73
|
automates.data.map((item) => (
|
|
@@ -78,16 +79,6 @@ const SubUnitAutomate = ({ isOwner, listAutomate, unit, wrapItemStyle }) => {
|
|
|
78
79
|
wrapStyle={wrapItemStyle}
|
|
79
80
|
/>
|
|
80
81
|
</View>
|
|
81
|
-
<MenuActionMore
|
|
82
|
-
isVisible={showingPopover}
|
|
83
|
-
hideMore={hidePopover}
|
|
84
|
-
listMenuItem={listAutomate}
|
|
85
|
-
childRef={childRef}
|
|
86
|
-
onItemClick={onItemClick}
|
|
87
|
-
isTextCenter={false}
|
|
88
|
-
testID={TESTID.NAVBAR_MENU_ACTION_MORE}
|
|
89
|
-
wrapStyle={styles.wrapStyle}
|
|
90
|
-
/>
|
|
91
82
|
</Section>
|
|
92
83
|
);
|
|
93
84
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { act, create } from 'react-test-renderer';
|
|
3
|
+
import ConfigHistoryChart from '../';
|
|
4
|
+
import { SCProvider } from '../../../../context';
|
|
5
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
6
|
+
import HistoryChart from '../../../../commons/Device/HistoryChart';
|
|
7
|
+
|
|
8
|
+
const wrapComponent = (configs = []) => (
|
|
9
|
+
<SCProvider initState={mockSCStore({})}>
|
|
10
|
+
<ConfigHistoryChart configs={configs} />
|
|
11
|
+
</SCProvider>
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
describe('Test HistoryChart', () => {
|
|
15
|
+
let tree;
|
|
16
|
+
|
|
17
|
+
beforeAll(() => {
|
|
18
|
+
jest.useFakeTimers();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('Test render', async () => {
|
|
22
|
+
await act(() => {
|
|
23
|
+
tree = create(wrapComponent());
|
|
24
|
+
});
|
|
25
|
+
const instance = tree.root;
|
|
26
|
+
const HistoryCharts = instance.findAllByType(HistoryChart);
|
|
27
|
+
expect(HistoryCharts).toHaveLength(0);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -13,10 +13,8 @@ export const dateTimeType = {
|
|
|
13
13
|
|
|
14
14
|
const ConfigHistoryChart = memo(({ configs }) => {
|
|
15
15
|
const [chartData, setChartData] = useState(configs);
|
|
16
|
-
const [startDate, setStartDate] = useState(
|
|
17
|
-
|
|
18
|
-
);
|
|
19
|
-
const [endDate, setEndDate] = useState(moment().valueOf());
|
|
16
|
+
const [startDate, setStartDate] = useState(moment().subtract(1, 'days'));
|
|
17
|
+
const [endDate, setEndDate] = useState(moment());
|
|
20
18
|
|
|
21
19
|
useEffect(() => {
|
|
22
20
|
const fetchData = async () => {
|
|
@@ -25,8 +23,8 @@ const ConfigHistoryChart = memo(({ configs }) => {
|
|
|
25
23
|
configuration.map((item) => {
|
|
26
24
|
params.append('config', item.id);
|
|
27
25
|
});
|
|
28
|
-
params.append('date_from', startDate / 1000);
|
|
29
|
-
params.append('date_to', endDate / 1000);
|
|
26
|
+
params.append('date_from', startDate.valueOf() / 1000);
|
|
27
|
+
params.append('date_to', endDate.valueOf() / 1000);
|
|
30
28
|
const { success, data } = await axiosGet(API.CONFIG.DISPLAY_HISTORY(), {
|
|
31
29
|
params,
|
|
32
30
|
});
|
|
@@ -16,6 +16,8 @@ const ViewButtonBottom = ({
|
|
|
16
16
|
styleButton,
|
|
17
17
|
styleButtonLeftText,
|
|
18
18
|
styleButtonRightText,
|
|
19
|
+
styleButtonLeft,
|
|
20
|
+
styleButtonRight,
|
|
19
21
|
testIDPrefix = '',
|
|
20
22
|
}) => {
|
|
21
23
|
const useTwoButton = leftTitle && rightTitle;
|
|
@@ -27,6 +29,7 @@ const ViewButtonBottom = ({
|
|
|
27
29
|
style={[
|
|
28
30
|
styles.button,
|
|
29
31
|
styleButton,
|
|
32
|
+
styleButtonLeft,
|
|
30
33
|
useTwoButton && styles.buttonMarginRight,
|
|
31
34
|
]}
|
|
32
35
|
onPress={onLeftClick}
|
|
@@ -48,6 +51,7 @@ const ViewButtonBottom = ({
|
|
|
48
51
|
style={[
|
|
49
52
|
styles.button,
|
|
50
53
|
styleButton,
|
|
54
|
+
styleButtonRight,
|
|
51
55
|
useTwoButton && styles.buttonMarginLeft,
|
|
52
56
|
]}
|
|
53
57
|
onPress={onRightClick}
|
package/src/configs/API.js
CHANGED
|
@@ -33,6 +33,8 @@ const API = {
|
|
|
33
33
|
SCConfig.apiRoot + `/property_manager/units/${id}/device_control/`,
|
|
34
34
|
DEVICE_SENSOR: (id) =>
|
|
35
35
|
SCConfig.apiRoot + `/property_manager/units/${id}/device_sensor/`,
|
|
36
|
+
ADD_GATEWAY: (id) =>
|
|
37
|
+
SCConfig.apiRoot + `/property_manager/units/${id}/add_gateway/`,
|
|
36
38
|
},
|
|
37
39
|
SUB_UNIT: {
|
|
38
40
|
REMOVE_SUB_UNIT: (unitId, id) =>
|
package/src/configs/BLE.js
CHANGED
|
@@ -3,4 +3,7 @@ export default {
|
|
|
3
3
|
BLE_REMOTE_CHARACTERISTIC_UUID: 'b32f3620-2846-4d1c-88aa-5dd06c0ad15e',
|
|
4
4
|
BLE_REMOTE_CHARACTERISTIC_UUID_TX: 'fba737c2-9f19-4779-9ef2-9446c29d0bf5',
|
|
5
5
|
BLE_REMOTE_CHARACTERISTIC_UUID_RX: '54173c1f-3a6a-4812-90fb-9a222f445f0c',
|
|
6
|
+
BLE_RESPONSE_OK: 'OK',
|
|
7
|
+
BLE_RESPONSE_FAILED: 'FAILED',
|
|
8
|
+
BLE_LISTER_RESPONSE_CONTROL: 'LISTER_RESPONSE_CONTROL',
|
|
6
9
|
};
|
package/src/configs/Constants.js
CHANGED
|
@@ -610,6 +610,8 @@ export const NOTIFICATION_TYPES = {
|
|
|
610
610
|
PARKING_COMPLETED_DUE_TO_CAR_LEAVE: 'PARKING_COMPLETED_DUE_TO_CAR_LEAVE',
|
|
611
611
|
NOTIFY_INVITE_MEMBER: 'NOTIFY_INVITE_MEMBER',
|
|
612
612
|
REMINDER: 'REMINDER',
|
|
613
|
+
NOTIFY_REMOVE_UNIT: 'NOTIFY_REMOVE_UNIT',
|
|
614
|
+
NOTIFY_REMOVE_MEMBER: 'NOTIFY_REMOVE_MEMBER',
|
|
613
615
|
};
|
|
614
616
|
|
|
615
617
|
export const ACTIVITY_LOG_TYPES = {
|
package/src/configs/Images.js
CHANGED
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
file: require('../Images/Common/file.png'),
|
|
8
8
|
activeButton: require('../Images/Common/ActiveButton.png'),
|
|
9
9
|
logo: require('../Images/Common/logo.png'),
|
|
10
|
-
buttonPauseCurtain: require('../Images/Common/
|
|
10
|
+
buttonPauseCurtain: require('../Images/Common/buttonPauseCurtain.png'),
|
|
11
11
|
buttonLeftCurtain: require('../Images/Common/buttonLeftCurtain.png'),
|
|
12
12
|
buttonRightCurtain: require('../Images/Common/buttonRightCurtain.png'),
|
|
13
13
|
};
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from './actionType';
|
|
10
10
|
import { initialState, Action, ContextData, reducer } from './reducer';
|
|
11
11
|
import { setConfigGlobalState } from '../iot/states.js';
|
|
12
|
+
import { setAxiosDefaultLanguage } from '../utils/Utils';
|
|
12
13
|
|
|
13
14
|
type SCContextType = {
|
|
14
15
|
stateData: ContextData;
|
|
@@ -46,6 +47,7 @@ export const SCProvider = ({ children, initState = initialState }) => {
|
|
|
46
47
|
const setLocale = (language: Language) => {
|
|
47
48
|
setConfigGlobalState('lang', language);
|
|
48
49
|
setAction('UPDATE_LANGUAGE', language);
|
|
50
|
+
setAxiosDefaultLanguage(language);
|
|
49
51
|
};
|
|
50
52
|
|
|
51
53
|
const setAction = <T extends ActionType>(
|
|
@@ -87,7 +87,12 @@ const realScanBluetoothDevices = () => {
|
|
|
87
87
|
}, 15000);
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
-
export const sendCommandOverBluetooth = async (
|
|
90
|
+
export const sendCommandOverBluetooth = async (
|
|
91
|
+
sensor,
|
|
92
|
+
action,
|
|
93
|
+
data,
|
|
94
|
+
userID
|
|
95
|
+
) => {
|
|
91
96
|
const bluetooth = sensor.remote_control_options.bluetooth;
|
|
92
97
|
let device = null;
|
|
93
98
|
if (bluetooth) {
|
|
@@ -99,6 +104,7 @@ export const sendCommandOverBluetooth = async (sensor, action, data) => {
|
|
|
99
104
|
command: action.key,
|
|
100
105
|
password: bluetooth ? bluetooth.password : '',
|
|
101
106
|
data,
|
|
107
|
+
user: userID,
|
|
102
108
|
});
|
|
103
109
|
return result;
|
|
104
110
|
};
|
|
@@ -139,20 +145,39 @@ export const sendDataOverBluetooth = async (
|
|
|
139
145
|
|
|
140
146
|
let connectedDevice = null;
|
|
141
147
|
let fullDataDevice = null;
|
|
142
|
-
let result =
|
|
148
|
+
let result = true;
|
|
149
|
+
const responseTime = 2000;
|
|
143
150
|
try {
|
|
144
151
|
connectedDevice = await device.connect();
|
|
145
152
|
fullDataDevice =
|
|
146
153
|
await connectedDevice.discoverAllServicesAndCharacteristics();
|
|
154
|
+
await fullDataDevice.monitorCharacteristicForService(
|
|
155
|
+
BLE.BLE_REMOTE_SERVICE_UUID,
|
|
156
|
+
BLE.BLE_REMOTE_CHARACTERISTIC_UUID_TX,
|
|
157
|
+
(error, characteristic) => {
|
|
158
|
+
const notify = error ? '' : base64.decode(characteristic.value);
|
|
159
|
+
if (notify === BLE.BLE_RESPONSE_OK) {
|
|
160
|
+
ToastBottomHelper.success(
|
|
161
|
+
t('control_device_via_bluetooth_successfully')
|
|
162
|
+
);
|
|
163
|
+
if (!keepConnect) {
|
|
164
|
+
bleManager.cancelTransaction(BLE.BLE_LISTER_RESPONSE_CONTROL);
|
|
165
|
+
device.cancelConnection();
|
|
166
|
+
}
|
|
167
|
+
} else if (notify === BLE.BLE_RESPONSE_FAILED) {
|
|
168
|
+
ToastBottomHelper.error(t('control_device_via_bluetooth_failed'));
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
BLE.BLE_LISTER_RESPONSE_CONTROL
|
|
172
|
+
);
|
|
147
173
|
await fullDataDevice.writeCharacteristicWithResponseForService(
|
|
148
174
|
BLE.BLE_REMOTE_SERVICE_UUID,
|
|
149
175
|
BLE.BLE_REMOTE_CHARACTERISTIC_UUID,
|
|
150
176
|
base64.encode(JSON.stringify(data))
|
|
151
177
|
);
|
|
152
|
-
ToastBottomHelper.
|
|
153
|
-
result = true;
|
|
178
|
+
ToastBottomHelper.error(t('command_is_sent_to_device_via_bluetooth'));
|
|
154
179
|
} catch (e) {
|
|
155
|
-
ToastBottomHelper.error(t('
|
|
180
|
+
ToastBottomHelper.error(t('command_is_fail_to_send_via_bluetooth'));
|
|
156
181
|
throw SEND_COMMAND_OVER_BLUETOOTH_FAIL;
|
|
157
182
|
}
|
|
158
183
|
|
|
@@ -160,7 +185,10 @@ export const sendDataOverBluetooth = async (
|
|
|
160
185
|
return result;
|
|
161
186
|
}
|
|
162
187
|
|
|
163
|
-
|
|
188
|
+
// eslint-disable-next-line no-shadow
|
|
189
|
+
setTimeout(async (device) => {
|
|
190
|
+
await device.cancelConnection();
|
|
191
|
+
}, responseTime);
|
|
164
192
|
return result;
|
|
165
193
|
};
|
|
166
194
|
|
|
@@ -221,6 +221,7 @@ describe('Test IOT Bluetooth', () => {
|
|
|
221
221
|
connect: async () => ({
|
|
222
222
|
discoverAllServicesAndCharacteristics: async () => ({
|
|
223
223
|
writeCharacteristicWithResponseForService: async () => ({}),
|
|
224
|
+
monitorCharacteristicForService: async () => ({}),
|
|
224
225
|
}),
|
|
225
226
|
}),
|
|
226
227
|
};
|
|
@@ -8,7 +8,12 @@ import { ToastBottomHelper } from '../../utils/Utils';
|
|
|
8
8
|
import t from '../../hooks/Common/useTranslations';
|
|
9
9
|
import { sendCommandOverLGThinq } from './LG';
|
|
10
10
|
|
|
11
|
-
export const sendRemoteCommand = async (
|
|
11
|
+
export const sendRemoteCommand = async (
|
|
12
|
+
sensor,
|
|
13
|
+
action,
|
|
14
|
+
data,
|
|
15
|
+
userId = null
|
|
16
|
+
) => {
|
|
12
17
|
// No action, raise not authorized
|
|
13
18
|
let result = false;
|
|
14
19
|
if (!action) {
|
|
@@ -19,7 +24,7 @@ export const sendRemoteCommand = async (sensor, action, data) => {
|
|
|
19
24
|
}
|
|
20
25
|
if (action.command_prefer_over_bluetooth) {
|
|
21
26
|
try {
|
|
22
|
-
result = await sendCommandOverBluetooth(sensor, action, data);
|
|
27
|
+
result = await sendCommandOverBluetooth(sensor, action, data, userId);
|
|
23
28
|
} catch (err) {
|
|
24
29
|
if (err === SEND_COMMAND_OVER_BLUETOOTH_FAIL) {
|
|
25
30
|
result = await sendCommandOverInternet(
|
|
@@ -8,6 +8,7 @@ import ConnectDevices from '../screens/AddNewDevice/ConnectDevices';
|
|
|
8
8
|
import ConnectingDevices from '../screens/AddNewDevice/ConnectingDevices';
|
|
9
9
|
import ScanSensorQR from '../screens/ScanSensorQR';
|
|
10
10
|
import Route from '../utils/Route';
|
|
11
|
+
import { screenOptions } from './utils';
|
|
11
12
|
|
|
12
13
|
const Stack = createStackNavigator();
|
|
13
14
|
|
|
@@ -15,6 +16,7 @@ export const AddDeviceStack = memo(() => {
|
|
|
15
16
|
return (
|
|
16
17
|
<Stack.Navigator
|
|
17
18
|
screenOptions={{
|
|
19
|
+
...screenOptions,
|
|
18
20
|
headerShown: false,
|
|
19
21
|
}}
|
|
20
22
|
>
|
|
@@ -8,6 +8,10 @@ import ConnectedGateway from '../screens/AddNewGateway/ConnectedGateway';
|
|
|
8
8
|
import ConnectingGateway from '../screens/AddNewGateway/ConnectingGateway';
|
|
9
9
|
import SetupGatewayWifi from '../screens/AddNewGateway/SetupGatewayWifi';
|
|
10
10
|
import AddCommonSelectSubUnit from '../screens/AddCommon/SelectSubUnit';
|
|
11
|
+
import FirstWarning from '../screens/AddNewGateway/PlugAndPlay/FirstWarning';
|
|
12
|
+
import ConnectWifiWarning from '../screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning';
|
|
13
|
+
import GatewayWifiList from '../screens/AddNewGateway/PlugAndPlay/GatewayWifiList';
|
|
14
|
+
import { screenOptions } from './utils';
|
|
11
15
|
|
|
12
16
|
const Stack = createStackNavigator();
|
|
13
17
|
|
|
@@ -15,6 +19,7 @@ export const AddGatewayStack = memo(() => {
|
|
|
15
19
|
return (
|
|
16
20
|
<Stack.Navigator
|
|
17
21
|
screenOptions={{
|
|
22
|
+
...screenOptions,
|
|
18
23
|
headerShown: false,
|
|
19
24
|
}}
|
|
20
25
|
>
|
|
@@ -36,6 +41,12 @@ export const AddGatewayStack = memo(() => {
|
|
|
36
41
|
name={Route.ConnectedGateway}
|
|
37
42
|
component={ConnectedGateway}
|
|
38
43
|
/>
|
|
44
|
+
<Stack.Screen name={Route.FirstWarning} component={FirstWarning} />
|
|
45
|
+
<Stack.Screen
|
|
46
|
+
name={Route.ConnectWifiWarning}
|
|
47
|
+
component={ConnectWifiWarning}
|
|
48
|
+
/>
|
|
49
|
+
<Stack.Screen name={Route.GatewayWifiList} component={GatewayWifiList} />
|
|
39
50
|
</Stack.Navigator>
|
|
40
51
|
);
|
|
41
52
|
});
|
|
@@ -4,6 +4,7 @@ import React, { memo } from 'react';
|
|
|
4
4
|
import AddCommonSelectUnit from '../screens/AddCommon/SelectUnit';
|
|
5
5
|
import AddLGDevice from '../screens/SyncLGDevice/AddLGDevice';
|
|
6
6
|
import Routes from '../utils/Route';
|
|
7
|
+
import { screenOptions } from './utils';
|
|
7
8
|
|
|
8
9
|
const Stack = createStackNavigator();
|
|
9
10
|
|
|
@@ -11,6 +12,7 @@ export const AddLGDeviceStack = memo(() => {
|
|
|
11
12
|
return (
|
|
12
13
|
<Stack.Navigator
|
|
13
14
|
screenOptions={{
|
|
15
|
+
...screenOptions,
|
|
14
16
|
headerShown: false,
|
|
15
17
|
}}
|
|
16
18
|
>
|
|
@@ -5,6 +5,7 @@ import AddCommonSelectUnit from '../screens/AddCommon/SelectUnit';
|
|
|
5
5
|
import SharingSelectPermission from '../screens/Sharing/SelectPermission';
|
|
6
6
|
import SharingInviteMembers from '../screens/Sharing/SelectUser';
|
|
7
7
|
import Route from '../utils/Route';
|
|
8
|
+
import { screenOptions } from './utils';
|
|
8
9
|
|
|
9
10
|
const Stack = createStackNavigator();
|
|
10
11
|
|
|
@@ -12,6 +13,7 @@ export const AddMemberStack = memo(() => {
|
|
|
12
13
|
return (
|
|
13
14
|
<Stack.Navigator
|
|
14
15
|
screenOptions={{
|
|
16
|
+
...screenOptions,
|
|
15
17
|
headerShown: false,
|
|
16
18
|
}}
|
|
17
19
|
>
|
|
@@ -4,6 +4,7 @@ import React, { memo } from 'react';
|
|
|
4
4
|
import AddCommonSelectUnit from '../screens/AddCommon/SelectUnit';
|
|
5
5
|
import AddSubUnit from '../screens/SubUnit/AddSubUnit';
|
|
6
6
|
import Route from '../utils/Route';
|
|
7
|
+
import { screenOptions } from './utils';
|
|
7
8
|
|
|
8
9
|
const Stack = createStackNavigator();
|
|
9
10
|
|
|
@@ -11,6 +12,7 @@ export const AddSubUnitStack = memo(() => {
|
|
|
11
12
|
return (
|
|
12
13
|
<Stack.Navigator
|
|
13
14
|
screenOptions={{
|
|
15
|
+
...screenOptions,
|
|
14
16
|
headerShown: false,
|
|
15
17
|
}}
|
|
16
18
|
>
|
|
@@ -4,6 +4,7 @@ import React, { memo } from 'react';
|
|
|
4
4
|
import AddLocationMaps from '../screens/AddLocationMaps'; //containers/AddLocationMaps
|
|
5
5
|
import AddSubUnit from '../screens/SubUnit/AddSubUnit';
|
|
6
6
|
import Route from '../utils/Route'; // utils/Route
|
|
7
|
+
import { screenOptions } from './utils';
|
|
7
8
|
|
|
8
9
|
const Stack = createStackNavigator();
|
|
9
10
|
|
|
@@ -11,6 +12,7 @@ export const AddUnitStack = memo(() => {
|
|
|
11
12
|
return (
|
|
12
13
|
<Stack.Navigator
|
|
13
14
|
screenOptions={{
|
|
15
|
+
...screenOptions,
|
|
14
16
|
headerShown: false,
|
|
15
17
|
}}
|
|
16
18
|
>
|
|
@@ -8,6 +8,7 @@ import { EmergencyContactsAddNew } from '../screens/EmergencyContacts/EmergencyC
|
|
|
8
8
|
import { EmergencyContactsList } from '../screens/EmergencyContacts/EmergencyContactsList';
|
|
9
9
|
import { EmergencyContactsSelectContacts } from '../screens/EmergencyContacts/EmergencyContactsSelectContacts';
|
|
10
10
|
import Route from '../utils/Route';
|
|
11
|
+
import { screenOptions } from './utils';
|
|
11
12
|
|
|
12
13
|
const Stack = createStackNavigator();
|
|
13
14
|
|
|
@@ -15,6 +16,7 @@ export const EmergencyContactsStack = memo(() => {
|
|
|
15
16
|
return (
|
|
16
17
|
<Stack.Navigator
|
|
17
18
|
screenOptions={{
|
|
19
|
+
...screenOptions,
|
|
18
20
|
headerTitleAlign: 'center',
|
|
19
21
|
headerBackImage: () => (
|
|
20
22
|
<IconOutline
|
|
@@ -8,6 +8,7 @@ import { useTranslations } from '../hooks/Common/useTranslations';
|
|
|
8
8
|
import Shared from '../screens/SharedUnit';
|
|
9
9
|
import { Colors } from '../configs';
|
|
10
10
|
import Routes from '../utils/Route';
|
|
11
|
+
import { screenOptions } from './utils';
|
|
11
12
|
|
|
12
13
|
const Stack = createStackNavigator();
|
|
13
14
|
const SharedStack = memo(() => {
|
|
@@ -20,6 +21,7 @@ const SharedStack = memo(() => {
|
|
|
20
21
|
name={Routes.Shared}
|
|
21
22
|
component={Shared}
|
|
22
23
|
options={{
|
|
24
|
+
...screenOptions,
|
|
23
25
|
title: t('text_shared_with_me'),
|
|
24
26
|
headerLeft: () => (
|
|
25
27
|
<TouchableOpacity
|
|
@@ -9,6 +9,7 @@ import { useTranslations } from '../hooks/Common/useTranslations';
|
|
|
9
9
|
import { Colors, Device } from '../configs';
|
|
10
10
|
import Route from '../utils/Route';
|
|
11
11
|
import ActivityLogScreen from '../screens/ActivityLog';
|
|
12
|
+
import { screenOptions } from './utils';
|
|
12
13
|
|
|
13
14
|
import AQIGuide from '../screens/AQIGuide';
|
|
14
15
|
import DeviceDetail from '../screens/Device/detail';
|
|
@@ -52,6 +53,7 @@ export const UnitStack = memo((props) => {
|
|
|
52
53
|
return (
|
|
53
54
|
<Stack.Navigator
|
|
54
55
|
screenOptions={{
|
|
56
|
+
...screenOptions,
|
|
55
57
|
headerTitleAlign: 'center',
|
|
56
58
|
headerBackImage: () => (
|
|
57
59
|
<IconOutline
|
package/src/navigations/utils.js
CHANGED
|
@@ -17,8 +17,14 @@ const AddCommonSelectSubUnit = ({ route }) => {
|
|
|
17
17
|
const t = useTranslations();
|
|
18
18
|
const navigation = useNavigation();
|
|
19
19
|
const isFocused = useIsFocused();
|
|
20
|
-
const {
|
|
21
|
-
|
|
20
|
+
const {
|
|
21
|
+
addType,
|
|
22
|
+
unit_id,
|
|
23
|
+
sensor_data,
|
|
24
|
+
listSelectDevice,
|
|
25
|
+
smart_account_id,
|
|
26
|
+
smart_account_id_from_backend,
|
|
27
|
+
} = route.params;
|
|
22
28
|
const [selectedIndex, setSelectedIndex] = useState(-1);
|
|
23
29
|
const [unit, setUnit] = useState([]);
|
|
24
30
|
const [title, setTitle] = useState('');
|
|
@@ -78,6 +84,8 @@ const AddCommonSelectSubUnit = ({ route }) => {
|
|
|
78
84
|
sensor_data: sensor_data,
|
|
79
85
|
listSelectDevice: listSelectDevice,
|
|
80
86
|
smart_account_id: smart_account_id,
|
|
87
|
+
unit_id: unit_id,
|
|
88
|
+
smart_account_id_from_backend: smart_account_id_from_backend,
|
|
81
89
|
});
|
|
82
90
|
break;
|
|
83
91
|
case 'AddVconnexDevice':
|
|
@@ -105,6 +113,8 @@ const AddCommonSelectSubUnit = ({ route }) => {
|
|
|
105
113
|
sensor_data,
|
|
106
114
|
listSelectDevice,
|
|
107
115
|
smart_account_id,
|
|
116
|
+
unit_id,
|
|
117
|
+
smart_account_id_from_backend,
|
|
108
118
|
]);
|
|
109
119
|
|
|
110
120
|
const handleSelectIndex = (index) => {
|