@eohjsc/react-native-smart-city 0.4.82 → 0.4.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commons/Dashboard/MyUnit/index.js +2 -2
- package/src/commons/UnitSummary/ConfigHistoryChart/index.js +4 -1
- package/src/commons/WrapParallaxScrollView/index.js +2 -2
- package/src/configs/SCConfig.js +8 -0
- package/src/hooks/IoT/useBluetoothDeviceConnected.js +2 -4
- package/src/iot/RemoteControl/Bluetooth.js +15 -9
- package/src/screens/Device/components/SensorConnectStatusViewHeader.js +3 -3
- package/src/screens/Device/components/VisualChart.js +12 -11
- package/src/screens/Device/detail.js +12 -5
- package/src/screens/Drawer/index.js +9 -9
- package/src/screens/Notification/components/NotificationItem.js +40 -26
- package/src/screens/Unit/ManageUnit.js +13 -13
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from '@react-navigation/native';
|
|
16
16
|
import NetInfo from '@react-native-community/netinfo';
|
|
17
17
|
import { BleManager } from 'react-native-ble-plx';
|
|
18
|
-
import { API, Colors, Images } from '../../../configs';
|
|
18
|
+
import { API, Colors, Images, SCConfig } from '../../../configs';
|
|
19
19
|
import Text from '../../Text';
|
|
20
20
|
import { axiosGet, fetchWithCache } from '../../../utils/Apis/axios';
|
|
21
21
|
|
|
@@ -160,7 +160,7 @@ const MyUnit = ({ refreshing }) => {
|
|
|
160
160
|
source={
|
|
161
161
|
item?.background
|
|
162
162
|
? { uri: item.background }
|
|
163
|
-
:
|
|
163
|
+
: SCConfig.appUnitDefaultBackground
|
|
164
164
|
}
|
|
165
165
|
defaultSource={Images.BgUnit}
|
|
166
166
|
resizeMode="cover"
|
|
@@ -36,7 +36,10 @@ export const useFetchConfigHistory = (configs, setChartData) => {
|
|
|
36
36
|
'date_from',
|
|
37
37
|
startDate.subtract(7, 'hours').format('YYYY-MM-DDTHH:mm:ss')
|
|
38
38
|
);
|
|
39
|
-
params.append(
|
|
39
|
+
params.append(
|
|
40
|
+
'date_to',
|
|
41
|
+
endDate.subtract(7, 'hours').format('YYYY-MM-DDTHH:mm:ss')
|
|
42
|
+
);
|
|
40
43
|
|
|
41
44
|
const { success, data } = await axiosGet(
|
|
42
45
|
API.CONFIG.DISPLAY_HISTORY_V3(),
|
|
@@ -2,7 +2,7 @@ import React, { useCallback } from 'react';
|
|
|
2
2
|
import { StatusBar, View, StyleSheet } from 'react-native';
|
|
3
3
|
import LinearGradient from 'react-native-linear-gradient';
|
|
4
4
|
|
|
5
|
-
import { Colors, Device, Images } from '../../configs';
|
|
5
|
+
import { Colors, Device, Images, SCConfig } from '../../configs';
|
|
6
6
|
import Text from '../Text';
|
|
7
7
|
import HeaderUnit from '../Unit/HeaderUnit';
|
|
8
8
|
import { AccessibilityLabel } from '../../configs/Constants';
|
|
@@ -65,7 +65,7 @@ const WrapParallaxScrollView = ({
|
|
|
65
65
|
<View style={styles.image}>
|
|
66
66
|
<FImage
|
|
67
67
|
style={styles.image}
|
|
68
|
-
source={uriImg ? { uri: uriImg } :
|
|
68
|
+
source={uriImg ? { uri: uriImg } : SCConfig.appUnitDefaultBackground}
|
|
69
69
|
defaultSource={Images.BgUnit}
|
|
70
70
|
resizeMode="cover"
|
|
71
71
|
/>
|
package/src/configs/SCConfig.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* istanbul ignore file */
|
|
2
2
|
import { LocaleConfig } from 'react-native-calendars';
|
|
3
3
|
import api from '../utils/Apis/axios';
|
|
4
|
+
import Images from './Images';
|
|
4
5
|
|
|
5
6
|
LocaleConfig.locales.vi = {
|
|
6
7
|
monthNames: [
|
|
@@ -100,6 +101,8 @@ const SCDefaultConfig = {
|
|
|
100
101
|
intervalWatchConfigTime: 30000,
|
|
101
102
|
setCurrentSensorDisplay: () => {},
|
|
102
103
|
appName: 'E-Ra',
|
|
104
|
+
appLogo: Images.logo,
|
|
105
|
+
appUnitDefaultBackground: Images.unitDefaultBackground,
|
|
103
106
|
};
|
|
104
107
|
|
|
105
108
|
export class SCConfig {
|
|
@@ -117,6 +120,8 @@ export class SCConfig {
|
|
|
117
120
|
static intervalWatchConfigTime = SCDefaultConfig.intervalWatchConfigTime;
|
|
118
121
|
static setCurrentSensorDisplay = SCDefaultConfig.setCurrentSensorDisplay;
|
|
119
122
|
static appName = SCDefaultConfig.appName;
|
|
123
|
+
static appLogo = SCDefaultConfig.appLogo;
|
|
124
|
+
static appUnitDefaultBackground = SCDefaultConfig.appUnitDefaultBackground;
|
|
120
125
|
}
|
|
121
126
|
|
|
122
127
|
export const initSCConfig = (config) => {
|
|
@@ -148,4 +153,7 @@ export const initSCConfig = (config) => {
|
|
|
148
153
|
SCConfig.setCurrentSensorDisplay =
|
|
149
154
|
config.setCurrentSensorDisplay ?? SCDefaultConfig.setCurrentSensorDisplay;
|
|
150
155
|
SCConfig.appName = config.appName ?? SCDefaultConfig.appName;
|
|
156
|
+
SCConfig.appLogo = config.appLogo ?? SCDefaultConfig.appLogo;
|
|
157
|
+
SCConfig.appUnitDefaultBackground =
|
|
158
|
+
config.appUnitDefaultBackground ?? SCDefaultConfig.appUnitDefaultBackground;
|
|
151
159
|
};
|
|
@@ -7,10 +7,8 @@ const useBluetoothDeviceConnected = (device) => {
|
|
|
7
7
|
const isBluetoothEnabled = useSCContextSelector((state) => {
|
|
8
8
|
return state.bluetooth.isEnabled;
|
|
9
9
|
});
|
|
10
|
-
|
|
11
|
-
const isConnected =
|
|
12
|
-
isBluetoothEnabled &&
|
|
13
|
-
!!connectedDevices[device?.remote_control_options?.bluetooth?.address];
|
|
10
|
+
const address = device?.remote_control_options?.bluetooth?.address;
|
|
11
|
+
const isConnected = isBluetoothEnabled && !!connectedDevices[address];
|
|
14
12
|
|
|
15
13
|
return { isConnected };
|
|
16
14
|
};
|
|
@@ -30,7 +30,7 @@ export const clearFoundDevices = () => {
|
|
|
30
30
|
|
|
31
31
|
export const scanBluetoothDevices = async (names, onDeviceFound) => {
|
|
32
32
|
names.map((name) => {
|
|
33
|
-
if (
|
|
33
|
+
if (needToScanDevices.includes(name)) {
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
needToScanDevices.push(name);
|
|
@@ -163,20 +163,26 @@ export const sendDataOverBluetooth = async (
|
|
|
163
163
|
let fullDataDevice = null;
|
|
164
164
|
let result = true;
|
|
165
165
|
let hasResponse = false;
|
|
166
|
-
|
|
167
166
|
try {
|
|
168
|
-
connectedDevice = await device.connect();
|
|
167
|
+
connectedDevice = await device.connect({ timeout: 5000 });
|
|
169
168
|
} catch (e) {
|
|
170
169
|
const BLE_ERROR = {
|
|
171
170
|
DEVICE_IS_NOT_ALREADY_CONNECTED: 201,
|
|
172
171
|
DEVICE_WAS_DISCONNECTED: 203,
|
|
172
|
+
DEVICE_CONNECTION_TIMEOUT: 3,
|
|
173
|
+
PHONE_HAS_BLUETOOTH_TURNED_OFF: 102,
|
|
173
174
|
};
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
BLE_ERROR.DEVICE_WAS_DISCONNECTED
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
175
|
+
switch (e?.errorCode) {
|
|
176
|
+
case BLE_ERROR.DEVICE_IS_NOT_ALREADY_CONNECTED:
|
|
177
|
+
case BLE_ERROR.DEVICE_WAS_DISCONNECTED:
|
|
178
|
+
await bleManager.cancelDeviceConnection(device.id);
|
|
179
|
+
return BLUETOOOH_DEVICE_UNSTABLE;
|
|
180
|
+
case BLE_ERROR.DEVICE_CONNECTION_TIMEOUT:
|
|
181
|
+
case BLE_ERROR.PHONE_HAS_BLUETOOTH_TURNED_OFF:
|
|
182
|
+
delete bluetoothDevices[device.address];
|
|
183
|
+
return SEND_COMMAND_OVER_BLUETOOTH_FAIL;
|
|
184
|
+
default:
|
|
185
|
+
return SEND_COMMAND_OVER_BLUETOOTH_FAIL;
|
|
180
186
|
}
|
|
181
187
|
}
|
|
182
188
|
try {
|
|
@@ -39,22 +39,22 @@ export const SensorConnectStatusViewHeader = ({
|
|
|
39
39
|
</>
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
|
-
if (
|
|
42
|
+
if (connectedViaBle) {
|
|
43
43
|
return (
|
|
44
44
|
<>
|
|
45
45
|
<ConnectedViewHeader
|
|
46
46
|
lastUpdated={lastUpdated}
|
|
47
|
+
type={'Bluetooth'}
|
|
47
48
|
isDisplayTime={isDisplayTime}
|
|
48
49
|
showWindDirection={showWindDirection}
|
|
49
50
|
/>
|
|
50
51
|
</>
|
|
51
52
|
);
|
|
52
|
-
} else if (
|
|
53
|
+
} else if (connectedViaNetwork) {
|
|
53
54
|
return (
|
|
54
55
|
<>
|
|
55
56
|
<ConnectedViewHeader
|
|
56
57
|
lastUpdated={lastUpdated}
|
|
57
|
-
type={'Bluetooth'}
|
|
58
58
|
isDisplayTime={isDisplayTime}
|
|
59
59
|
showWindDirection={showWindDirection}
|
|
60
60
|
/>
|
|
@@ -107,10 +107,16 @@ const styles = StyleSheet.create({
|
|
|
107
107
|
},
|
|
108
108
|
titleHistory: {
|
|
109
109
|
flexDirection: 'row',
|
|
110
|
-
alignItems: 'center',
|
|
111
110
|
justifyContent: 'space-between',
|
|
112
111
|
paddingHorizontal: 16,
|
|
113
112
|
},
|
|
113
|
+
aggregationView: {
|
|
114
|
+
flexDirection: 'row',
|
|
115
|
+
justifyContent: 'space-between',
|
|
116
|
+
paddingHorizontal: 16,
|
|
117
|
+
paddingTop: 8,
|
|
118
|
+
alignSelf: 'flex-end',
|
|
119
|
+
},
|
|
114
120
|
webviewStyle: {
|
|
115
121
|
flex: 1,
|
|
116
122
|
minHeight: 200,
|
|
@@ -123,11 +129,6 @@ const styles = StyleSheet.create({
|
|
|
123
129
|
width: 300,
|
|
124
130
|
height: 250,
|
|
125
131
|
},
|
|
126
|
-
titleView: {
|
|
127
|
-
flexDirection: 'row',
|
|
128
|
-
flex: 1,
|
|
129
|
-
lineHeight: 24,
|
|
130
|
-
},
|
|
131
132
|
});
|
|
132
133
|
|
|
133
134
|
const chartOptions = {
|
|
@@ -291,11 +292,11 @@ const VisualChart = ({ item, isDemo = false, isWidgetOrder }) => {
|
|
|
291
292
|
return (
|
|
292
293
|
<View style={styles.container}>
|
|
293
294
|
<View style={styles.titleHistory}>
|
|
294
|
-
<
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
295
|
+
<Text type="H3" semibold color={Colors.Gray9}>
|
|
296
|
+
{item.label}
|
|
297
|
+
</Text>
|
|
298
|
+
</View>
|
|
299
|
+
<View style={styles.aggregationView}>
|
|
299
300
|
{canChooseGroup && (
|
|
300
301
|
<ChartAggregationOption
|
|
301
302
|
groupBy={groupBy}
|
|
@@ -190,6 +190,13 @@ const DeviceDetail = ({ route }) => {
|
|
|
190
190
|
}
|
|
191
191
|
}, [unitId]);
|
|
192
192
|
|
|
193
|
+
const checkScanDevicesBLE = useCallback(async () => {
|
|
194
|
+
const bluetooth = controlOptions?.bluetooth;
|
|
195
|
+
if (isBluetoothEnabled && bluetooth) {
|
|
196
|
+
bluetoothScanDevices([bluetooth.address]);
|
|
197
|
+
}
|
|
198
|
+
}, [bluetoothScanDevices, controlOptions?.bluetooth, isBluetoothEnabled]);
|
|
199
|
+
|
|
193
200
|
useEffect(() => {
|
|
194
201
|
if (unitId && !unitData) {
|
|
195
202
|
fetchUnitDetail();
|
|
@@ -222,10 +229,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
222
229
|
}, [unit, isNetworkConnected]);
|
|
223
230
|
|
|
224
231
|
useEffect(() => {
|
|
225
|
-
|
|
226
|
-
const bluetooth = controlOptions.bluetooth;
|
|
227
|
-
bluetoothScanDevices([bluetooth.address]);
|
|
228
|
-
}
|
|
232
|
+
checkScanDevicesBLE();
|
|
229
233
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
230
234
|
}, [isBluetoothEnabled, bluetoothPermGranted, controlOptions, unit]);
|
|
231
235
|
|
|
@@ -296,7 +300,9 @@ const DeviceDetail = ({ route }) => {
|
|
|
296
300
|
|
|
297
301
|
success &&
|
|
298
302
|
data.items.length &&
|
|
299
|
-
data.items.some(
|
|
303
|
+
data.items.some(
|
|
304
|
+
(item) => item.template.toLowerCase().search('action') !== -1
|
|
305
|
+
) &&
|
|
300
306
|
(await fetchRemoteControlOptions());
|
|
301
307
|
}, [token, sensor, setDeviceId, fetchRemoteControlOptions]);
|
|
302
308
|
|
|
@@ -489,6 +495,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
489
495
|
await connectHomeAssistant(unit.remote_control_options.googlehome);
|
|
490
496
|
})();
|
|
491
497
|
}
|
|
498
|
+
checkScanDevicesBLE();
|
|
492
499
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
493
500
|
}, [sensor, unit, isNetworkConnected, fetchDataDeviceDetail]);
|
|
494
501
|
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
+
import { IconOutline } from '@ant-design/icons-react-native';
|
|
2
|
+
import { Icon } from '@ant-design/react-native';
|
|
1
3
|
import React, { useCallback, useContext } from 'react';
|
|
2
4
|
import {
|
|
3
|
-
View,
|
|
4
5
|
Image,
|
|
5
|
-
TouchableOpacity,
|
|
6
6
|
ScrollView,
|
|
7
7
|
StyleSheet,
|
|
8
|
+
TouchableOpacity,
|
|
9
|
+
View,
|
|
8
10
|
} from 'react-native';
|
|
9
|
-
import { IconOutline } from '@ant-design/icons-react-native';
|
|
10
|
-
import { Icon } from '@ant-design/react-native';
|
|
11
11
|
import { getStatusBarHeight } from 'react-native-iphone-x-helper';
|
|
12
12
|
|
|
13
|
-
import
|
|
14
|
-
import { Images, Colors } from '../../configs';
|
|
13
|
+
import { CommonActions, useNavigation } from '@react-navigation/native';
|
|
15
14
|
import Text from '../../commons/Text';
|
|
16
|
-
import
|
|
15
|
+
import { Colors, SCConfig } from '../../configs';
|
|
17
16
|
import { AccessibilityLabel } from '../../configs/Constants';
|
|
18
17
|
import { SCContext, useSCContextSelector } from '../../context';
|
|
19
|
-
import { CommonActions, useNavigation } from '@react-navigation/native';
|
|
20
18
|
import { Action } from '../../context/actionType';
|
|
19
|
+
import t from '../../hooks/Common/useTranslations';
|
|
20
|
+
import Routes from '../../utils/Route';
|
|
21
21
|
|
|
22
22
|
const DrawerContainer = () => {
|
|
23
23
|
const user = useSCContextSelector((state) => state.auth.account.user);
|
|
@@ -43,7 +43,7 @@ const DrawerContainer = () => {
|
|
|
43
43
|
<ScrollView contentContainerStyle={styles.scrollView}>
|
|
44
44
|
<View style={[styles.row, styles.logoWrap]}>
|
|
45
45
|
<Image
|
|
46
|
-
source={
|
|
46
|
+
source={SCConfig.appLogo}
|
|
47
47
|
style={styles.logo}
|
|
48
48
|
accessibilityLabel={AccessibilityLabel.SIDE_MENU_LOGO}
|
|
49
49
|
/>
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import React, { memo, useCallback, useState } from 'react';
|
|
2
|
-
import { View, TouchableOpacity, Image } from 'react-native';
|
|
3
|
-
import moment from 'moment';
|
|
4
1
|
import { useNavigation } from '@react-navigation/native';
|
|
2
|
+
import moment from 'moment';
|
|
3
|
+
import React, { memo, useCallback, useState } from 'react';
|
|
4
|
+
import { Image, TouchableOpacity, View } from 'react-native';
|
|
5
5
|
|
|
6
|
-
import styles from '../styles/NotificationItemStyles';
|
|
7
|
-
import Text from '../../../commons/Text';
|
|
8
|
-
import { Colors, API, Images } from '../../../configs';
|
|
9
6
|
import IconComponent from '../../../commons/IconComponent';
|
|
10
|
-
import
|
|
7
|
+
import Text from '../../../commons/Text';
|
|
8
|
+
import { API, Colors, SCConfig } from '../../../configs';
|
|
9
|
+
import {
|
|
10
|
+
AccessibilityLabel,
|
|
11
|
+
EMERGENCY_TYPE,
|
|
12
|
+
NOTIFICATION_TYPES,
|
|
13
|
+
} from '../../../configs/Constants';
|
|
14
|
+
import { useSCContextSelector } from '../../../context';
|
|
11
15
|
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
12
16
|
import { axiosPost } from '../../../utils/Apis/axios';
|
|
13
17
|
import Routes from '../../../utils/Route';
|
|
14
|
-
import
|
|
15
|
-
import { useSCContextSelector } from '../../../context';
|
|
18
|
+
import styles from '../styles/NotificationItemStyles';
|
|
16
19
|
|
|
17
20
|
const NotificationItem = memo(({ item }) => {
|
|
18
21
|
const t = useTranslations();
|
|
@@ -38,6 +41,8 @@ const NotificationItem = memo(({ item }) => {
|
|
|
38
41
|
[params]
|
|
39
42
|
);
|
|
40
43
|
|
|
44
|
+
const logo = SCConfig.appLogo;
|
|
45
|
+
|
|
41
46
|
const renderItem = useCallback(() => {
|
|
42
47
|
const unitId = params?.unit_id;
|
|
43
48
|
const sensorId = params?.sensor_id;
|
|
@@ -76,7 +81,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
76
81
|
unitId,
|
|
77
82
|
},
|
|
78
83
|
}),
|
|
79
|
-
iconContent: <Image source={
|
|
84
|
+
iconContent: <Image source={logo} style={styles.logo} />,
|
|
80
85
|
};
|
|
81
86
|
case NOTIFICATION_TYPES.TURBIDITY:
|
|
82
87
|
return {
|
|
@@ -91,7 +96,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
91
96
|
unitId,
|
|
92
97
|
},
|
|
93
98
|
}),
|
|
94
|
-
iconContent: <Image source={
|
|
99
|
+
iconContent: <Image source={logo} style={styles.logo} />,
|
|
95
100
|
};
|
|
96
101
|
case NOTIFICATION_TYPES.PH:
|
|
97
102
|
return {
|
|
@@ -106,7 +111,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
106
111
|
unitId,
|
|
107
112
|
},
|
|
108
113
|
}),
|
|
109
|
-
iconContent: <Image source={
|
|
114
|
+
iconContent: <Image source={logo} style={styles.logo} />,
|
|
110
115
|
};
|
|
111
116
|
case NOTIFICATION_TYPES.CLO:
|
|
112
117
|
return {
|
|
@@ -119,7 +124,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
119
124
|
unitId,
|
|
120
125
|
},
|
|
121
126
|
}),
|
|
122
|
-
iconContent: <Image source={
|
|
127
|
+
iconContent: <Image source={logo} style={styles.logo} />,
|
|
123
128
|
};
|
|
124
129
|
case NOTIFICATION_TYPES.UV:
|
|
125
130
|
return {
|
|
@@ -134,7 +139,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
134
139
|
unitId,
|
|
135
140
|
},
|
|
136
141
|
}),
|
|
137
|
-
iconContent: <Image source={
|
|
142
|
+
iconContent: <Image source={logo} style={styles.logo} />,
|
|
138
143
|
};
|
|
139
144
|
case NOTIFICATION_TYPES.SMOKE:
|
|
140
145
|
return {
|
|
@@ -147,7 +152,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
147
152
|
sensorId,
|
|
148
153
|
},
|
|
149
154
|
}),
|
|
150
|
-
iconContent: <Image source={
|
|
155
|
+
iconContent: <Image source={logo} style={styles.logo} />,
|
|
151
156
|
};
|
|
152
157
|
case NOTIFICATION_TYPES.FIRE:
|
|
153
158
|
return {
|
|
@@ -160,7 +165,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
160
165
|
sensorId,
|
|
161
166
|
},
|
|
162
167
|
}),
|
|
163
|
-
iconContent: <Image source={
|
|
168
|
+
iconContent: <Image source={logo} style={styles.logo} />,
|
|
164
169
|
};
|
|
165
170
|
case NOTIFICATION_TYPES.SOS:
|
|
166
171
|
return {
|
|
@@ -173,7 +178,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
173
178
|
sensorId,
|
|
174
179
|
},
|
|
175
180
|
}),
|
|
176
|
-
iconContent: <Image source={
|
|
181
|
+
iconContent: <Image source={logo} style={styles.logo} />,
|
|
177
182
|
};
|
|
178
183
|
case NOTIFICATION_TYPES.FILTER_WATER:
|
|
179
184
|
return {
|
|
@@ -188,7 +193,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
188
193
|
sensorId,
|
|
189
194
|
},
|
|
190
195
|
}),
|
|
191
|
-
iconContent: <Image source={
|
|
196
|
+
iconContent: <Image source={logo} style={styles.logo} />,
|
|
192
197
|
};
|
|
193
198
|
case NOTIFICATION_TYPES.LOW_BATTERY:
|
|
194
199
|
return {
|
|
@@ -345,7 +350,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
345
350
|
sensorId,
|
|
346
351
|
},
|
|
347
352
|
}),
|
|
348
|
-
iconContent: <Image source={
|
|
353
|
+
iconContent: <Image source={logo} style={styles.logo} />,
|
|
349
354
|
};
|
|
350
355
|
case EMERGENCY_TYPE.RESOLVE:
|
|
351
356
|
return {
|
|
@@ -360,7 +365,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
360
365
|
sensorId,
|
|
361
366
|
},
|
|
362
367
|
}),
|
|
363
|
-
iconContent: <Image source={
|
|
368
|
+
iconContent: <Image source={logo} style={styles.logo} />,
|
|
364
369
|
};
|
|
365
370
|
default:
|
|
366
371
|
return null;
|
|
@@ -371,7 +376,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
371
376
|
t('text_notification_content_change_unit_for_old_owner')
|
|
372
377
|
),
|
|
373
378
|
redirect: () => null,
|
|
374
|
-
iconContent: <Image source={
|
|
379
|
+
iconContent: <Image source={logo} style={styles.logo} />,
|
|
375
380
|
};
|
|
376
381
|
case NOTIFICATION_TYPES.NOTIFY_CHANGE_UNIT_NEW_OWNER:
|
|
377
382
|
return {
|
|
@@ -386,7 +391,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
386
391
|
},
|
|
387
392
|
});
|
|
388
393
|
},
|
|
389
|
-
iconContent: <Image source={
|
|
394
|
+
iconContent: <Image source={logo} style={styles.logo} />,
|
|
390
395
|
};
|
|
391
396
|
case NOTIFICATION_TYPES.TRIAL_WILL_END: // to do Canh remove later
|
|
392
397
|
return {
|
|
@@ -394,7 +399,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
394
399
|
t('text_notification_content_when_trial_will_end')
|
|
395
400
|
),
|
|
396
401
|
redirect: () => null,
|
|
397
|
-
iconContent: <Image source={
|
|
402
|
+
iconContent: <Image source={logo} style={styles.logo} />,
|
|
398
403
|
};
|
|
399
404
|
case NOTIFICATION_TYPES.FREE_TRIAL_SUBSCRIPTION:
|
|
400
405
|
return {
|
|
@@ -406,7 +411,7 @@ const NotificationItem = memo(({ item }) => {
|
|
|
406
411
|
return {
|
|
407
412
|
content: params?.message[language],
|
|
408
413
|
redirect: () => null,
|
|
409
|
-
iconContent: <Image source={
|
|
414
|
+
iconContent: <Image source={logo} style={styles.logo} />,
|
|
410
415
|
};
|
|
411
416
|
case NOTIFICATION_TYPES.SUBSCRIBE_SUCCESS:
|
|
412
417
|
return {
|
|
@@ -414,12 +419,21 @@ const NotificationItem = memo(({ item }) => {
|
|
|
414
419
|
t('text_notification_content_subscribe_success')
|
|
415
420
|
),
|
|
416
421
|
redirect: () => null,
|
|
417
|
-
iconContent: <Image source={
|
|
422
|
+
iconContent: <Image source={logo} style={styles.logo} />,
|
|
418
423
|
};
|
|
419
424
|
default:
|
|
420
425
|
return null;
|
|
421
426
|
}
|
|
422
|
-
}, [
|
|
427
|
+
}, [
|
|
428
|
+
content_code,
|
|
429
|
+
customColorText,
|
|
430
|
+
icon,
|
|
431
|
+
navigation,
|
|
432
|
+
params,
|
|
433
|
+
t,
|
|
434
|
+
language,
|
|
435
|
+
logo,
|
|
436
|
+
]);
|
|
423
437
|
|
|
424
438
|
const { content, redirect, iconContent } = renderItem() || {};
|
|
425
439
|
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { Image, TouchableOpacity, View } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import { Colors, API, Images } from '../../configs';
|
|
6
|
-
import Routes from '../../utils/Route';
|
|
7
|
-
import { ToastBottomHelper } from '../../utils/Utils';
|
|
8
|
-
import { createFormData, axiosPatch } from '../../utils/Apis/axios';
|
|
9
|
-
import useBoolean from '../../hooks/Common/useBoolean';
|
|
10
|
-
import useKeyboardAnimated from '../../hooks/Explore/useKeyboardAnimated';
|
|
4
|
+
import { useNavigation } from '@react-navigation/native';
|
|
11
5
|
import { AlertAction, ImagePicker } from '../../commons';
|
|
12
|
-
import Text from '../../commons/Text';
|
|
13
6
|
import _TextInput from '../../commons/Form/TextInput';
|
|
14
7
|
import WrapHeaderScrollable from '../../commons/Sharing/WrapHeaderScrollable';
|
|
15
|
-
import
|
|
8
|
+
import Text from '../../commons/Text';
|
|
9
|
+
import { API, Colors, Images, SCConfig } from '../../configs';
|
|
16
10
|
import { AccessibilityLabel } from '../../configs/Constants';
|
|
11
|
+
import { useIsOwnerOfUnit } from '../../hooks/Common';
|
|
12
|
+
import useBoolean from '../../hooks/Common/useBoolean';
|
|
13
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
14
|
+
import useKeyboardAnimated from '../../hooks/Explore/useKeyboardAnimated';
|
|
15
|
+
import { axiosPatch, createFormData } from '../../utils/Apis/axios';
|
|
16
|
+
import Routes from '../../utils/Route';
|
|
17
|
+
import { ToastBottomHelper } from '../../utils/Utils';
|
|
17
18
|
import styles from './ManageUnitStyles';
|
|
18
|
-
import { useNavigation } from '@react-navigation/native';
|
|
19
19
|
import ButtonWrapper from './components/ButtonWrapper';
|
|
20
20
|
|
|
21
21
|
const ManageUnit = ({ route }) => {
|
|
@@ -212,7 +212,7 @@ const ManageUnit = ({ route }) => {
|
|
|
212
212
|
? {
|
|
213
213
|
uri: unitData.background,
|
|
214
214
|
}
|
|
215
|
-
:
|
|
215
|
+
: SCConfig.appUnitDefaultBackground
|
|
216
216
|
}
|
|
217
217
|
borderRadius={10}
|
|
218
218
|
style={styles.image}
|