@eohjsc/react-native-smart-city 0.2.56 → 0.2.60

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.
Files changed (126) hide show
  1. package/assets/images/Map/MarkerGeolocation.svg +4 -0
  2. package/assets/images/SonosSpeaker/buttonpause-active.svg +3 -0
  3. package/assets/images/SonosSpeaker/buttonpause-notactive.svg +3 -0
  4. package/assets/images/SonosSpeaker/picture-main-notactive.svg +5 -0
  5. package/assets/images/SonosSpeaker/picture-main.svg +6 -0
  6. package/assets/images/SonosSpeaker/picture-volume.svg +3 -0
  7. package/package.json +4 -22
  8. package/src/Images/Common/buttonLeftCurtain.png +0 -0
  9. package/src/Images/Common/buttonPause-center-curtain.png +0 -0
  10. package/src/Images/Common/buttonRightCurtain.png +0 -0
  11. package/src/commons/ActionGroup/CurtainButtonTemplate.js +139 -0
  12. package/src/commons/ActionGroup/CurtainButtonTemplateStyle.js +58 -0
  13. package/src/commons/ActionGroup/__test__/CurtainButtonTemplate.test.js +72 -0
  14. package/src/commons/ActionGroup/index.js +3 -0
  15. package/src/commons/Auth/__test__/AccountList.test.js +33 -0
  16. package/src/commons/CameraDevice/index.js +2 -0
  17. package/src/commons/CardShadow/index.js +1 -1
  18. package/src/commons/CardShadow/styles.js +1 -3
  19. package/src/commons/DateTimeRangeChange/DateTimeButton.js +1 -1
  20. package/src/commons/DateTimeRangeChange/index.js +2 -2
  21. package/src/commons/Device/HistoryChart.js +21 -55
  22. package/src/commons/Device/HorizontalBarChart.js +46 -30
  23. package/src/commons/Device/LinearChart.js +0 -34
  24. package/src/commons/Device/PMSensor/PMSensorIndicatior.js +1 -1
  25. package/src/commons/Device/PMSensor/PMSensorIndicatorStyles.js +2 -1
  26. package/src/commons/Device/SonosSpeaker/__test__/SonosSpeaker.test.js +57 -0
  27. package/src/commons/Device/SonosSpeaker/index.js +88 -0
  28. package/src/commons/Device/SonosSpeaker/styles.js +57 -0
  29. package/src/commons/Form/CurrencyInput.js +169 -0
  30. package/src/commons/Form/__test__/CurrencyInput.test.js +65 -0
  31. package/src/commons/FourButtonFilterHistory/__test__/FourButtonFilterHistory.test.js +48 -0
  32. package/src/commons/FourButtonFilterHistory/index.js +72 -0
  33. package/src/commons/FourButtonFilterHistory/styles.js +22 -0
  34. package/src/commons/MediaPlayerDetail/Styles/MediaPlayerDetailStyles.js +14 -0
  35. package/src/commons/MediaPlayerDetail/index.js +204 -161
  36. package/src/commons/SearchLocation/index.js +0 -1
  37. package/src/commons/Sharing/RowMember.js +7 -2
  38. package/src/commons/Sharing/__test__/RowMember.test.js +42 -0
  39. package/src/commons/SubUnit/ShortDetail.js +12 -6
  40. package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +1 -1
  41. package/src/commons/UnitSummary/ConfigHistoryChart.js +2 -1
  42. package/src/configs/API.js +13 -3
  43. package/src/configs/Constants.js +14 -4
  44. package/src/configs/Images.js +3 -0
  45. package/src/configs/SCConfig.js +8 -0
  46. package/src/context/actionType.ts +5 -0
  47. package/src/context/mockStore.ts +3 -0
  48. package/src/context/reducer.ts +14 -0
  49. package/src/iot/RemoteControl/Bluetooth.js +14 -0
  50. package/src/iot/RemoteControl/index.js +0 -1
  51. package/src/navigations/UnitStack.js +42 -4
  52. package/src/screens/ActivityLog/FilterPopup.js +1 -1
  53. package/src/screens/ActivityLog/ItemLog.js +11 -2
  54. package/src/screens/ActivityLog/__test__/ItemLog.test.js +46 -0
  55. package/src/screens/ActivityLog/hooks/index.js +1 -0
  56. package/src/screens/ActivityLog/index.js +0 -1
  57. package/src/screens/AddCommon/SelectSubUnit.js +24 -2
  58. package/src/screens/AddCommon/SelectUnit.js +12 -0
  59. package/src/screens/AddLocationMaps/index.js +139 -44
  60. package/src/screens/AddLocationMaps/indexStyle.js +14 -12
  61. package/src/screens/AddNewAction/SelectAction.js +1 -0
  62. package/src/screens/Automate/MultiUnits.js +8 -8
  63. package/src/screens/Automate/__test__/MultiUnits.test.js +2 -2
  64. package/src/screens/Automate/__test__/index.test.js +2 -0
  65. package/src/screens/Automate/index.js +4 -2
  66. package/src/screens/Device/__test__/detail.test.js +3 -7
  67. package/src/screens/Device/components/SensorDisplayItem.js +10 -10
  68. package/src/screens/Device/detail.js +65 -15
  69. package/src/screens/Device/hooks/useDisconnectedDevice.js +32 -26
  70. package/src/screens/Device/styles.js +3 -3
  71. package/src/screens/EmergencySetting/__test__/DropDownItem.test.js +59 -0
  72. package/src/screens/EmergencySetting/__test__/index.test.js +27 -0
  73. package/src/screens/EmergencySetting/components/DropDownItem.js +54 -0
  74. package/src/screens/EmergencySetting/index.js +90 -0
  75. package/src/screens/EmergencySetting/styles/DropDownItem.js +38 -0
  76. package/src/screens/EmergencySetting/styles.js +19 -0
  77. package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +126 -0
  78. package/src/screens/MoveToAnotherSubUnit/index.js +88 -0
  79. package/src/screens/MoveToAnotherSubUnit/styles/MoveToAnotherSubUnitStyles.js +50 -0
  80. package/src/screens/Notification/__test__/Notification.test.js +3 -3
  81. package/src/screens/Notification/components/NotificationItem.js +3 -6
  82. package/src/screens/Notification/index.js +2 -2
  83. package/src/screens/ScriptDetail/Styles/indexStyles.js +0 -1
  84. package/src/screens/ScriptDetail/__test__/index.test.js +13 -0
  85. package/src/screens/ScriptDetail/index.js +20 -17
  86. package/src/screens/SelectUnit/index.js +2 -0
  87. package/src/screens/Sharing/MemberList.js +2 -9
  88. package/src/screens/SubUnit/AddSubUnit.js +79 -59
  89. package/src/screens/SubUnit/AddSubUnitStyles.js +0 -2
  90. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +4 -3
  91. package/src/screens/TDSGuide/index.js +6 -4
  92. package/src/screens/Unit/ChooseLocation.js +96 -0
  93. package/src/screens/Unit/ChooseLocationStyles.js +26 -0
  94. package/src/screens/Unit/Detail.js +14 -2
  95. package/src/screens/Unit/ManageUnit.js +4 -5
  96. package/src/screens/Unit/SelectAddress.js +240 -0
  97. package/src/screens/Unit/SelectAddressStyles.js +48 -0
  98. package/src/screens/Unit/SmartAccountItem.js +1 -1
  99. package/src/screens/Unit/Summaries.js +5 -1
  100. package/src/screens/Unit/__test__/ChooseLocation.test.js +112 -0
  101. package/src/screens/Unit/__test__/SelectAddress.test.js +216 -0
  102. package/src/screens/Unit/components/MyUnitDevice/index.js +21 -5
  103. package/src/screens/Unit/hook/useStateAlertRemove.js +3 -1
  104. package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +2 -2
  105. package/src/screens/UnitSummary/components/PowerConsumption/index.js +3 -2
  106. package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +1 -3
  107. package/src/screens/UnitSummary/index.js +3 -2
  108. package/src/screens/WaterQualityGuide/index.js +1 -0
  109. package/src/utils/Apis/axios.js +17 -5
  110. package/src/utils/I18n/translations/en.json +19 -4
  111. package/src/utils/I18n/translations/vi.json +22 -7
  112. package/src/utils/Route/index.js +4 -1
  113. package/src/utils/Utils.js +22 -2
  114. package/assets/images/AddLocationMaps/PinLocation.svg +0 -3
  115. package/assets/images/AddLocationMaps/Point.svg +0 -3
  116. package/src/commons/ThreeButtonHistory/CalendarHeader.js +0 -35
  117. package/src/commons/ThreeButtonHistory/CalendarHeaderStyles.js +0 -17
  118. package/src/commons/ThreeButtonHistory/SelectMonth.js +0 -53
  119. package/src/commons/ThreeButtonHistory/SelectMonthStyles.js +0 -29
  120. package/src/commons/ThreeButtonHistory/__test__/SelectMonth.test.js +0 -37
  121. package/src/commons/ThreeButtonHistory/__test__/ThreeButtonHistory.test.js +0 -231
  122. package/src/commons/ThreeButtonHistory/index.js +0 -281
  123. package/src/commons/ThreeButtonHistory/styles.js +0 -65
  124. package/src/screens/Unit/ManageUnit/index.js +0 -286
  125. package/src/screens/Unit/SelectLocation.js +0 -161
  126. package/src/screens/Unit/SelectLocationStyles.js +0 -114
@@ -82,6 +82,9 @@ const API = {
82
82
  SCConfig.apiRoot + `/property_manager/sensors/${id}/`,
83
83
  REMOVE_SENSOR: (id) =>
84
84
  SCConfig.apiRoot + `/property_manager/sensors/${id}/`,
85
+ CHANGE_SUB_UNIT: (unit_id, station_id, id) =>
86
+ SCConfig.apiRoot +
87
+ `/property_manager/${unit_id}/sub_units/${station_id}/devices/${id}/change_sub_unit/`,
85
88
  },
86
89
  SHARED_SENSOR: {
87
90
  ACCESS: (id) =>
@@ -172,11 +175,16 @@ const API = {
172
175
  SCConfig.apiRoot +
173
176
  `/connection_manager/lg_thinq/device_status/${sensorId}/`,
174
177
  },
178
+ VCONNEX: {
179
+ AUTHORIZE: (client_id, redirect_uri, user_id, station_id) =>
180
+ // eslint-disable-next-line max-len
181
+ `https://partner-api-stg.vconnex.vn/oauth/authorize?client_id=${client_id}&redirect_uri=${redirect_uri}&response_type=code&scope=SYNCH&scope=CONTROL&scope=QUERY&state=${user_id}@${station_id}`,
182
+ },
175
183
  },
176
184
  NOTIFICATION: {
177
- LIST_ALL_NOTIFICATIONS: (page, type) =>
178
- SCConfig.apiRoot + `/notifications/root/?page=${page}&type=${type}`,
179
- SET_READ: (id) => SCConfig.apiRoot + `/notifications/root/${id}/set_read/`,
185
+ LIST_EOH_NOTIFICATIONS: (page, type) =>
186
+ SCConfig.apiRoot + `/notifications/eoh/?page=${page}&type=${type}`,
187
+ SET_READ: (id) => SCConfig.apiRoot + `/notifications/eoh/${id}/set_read/`,
180
188
  },
181
189
  EXTERNAL: {
182
190
  GOOGLE_MAP: {
@@ -184,6 +192,8 @@ const API = {
184
192
  'https://maps.googleapis.com/maps/api/place/autocomplete/json',
185
193
  GET_LAT_LNG_BY_PLACE_ID:
186
194
  'https://maps.googleapis.com/maps/api/place/details/json',
195
+ GET_LOCATION_FROM_LAT_LNG:
196
+ 'https://maps.googleapis.com/maps/api/geocode/json',
187
197
  },
188
198
  },
189
199
  SMART_ACCOUNT: {
@@ -1,6 +1,6 @@
1
1
  import { Platform, Dimensions, StatusBar } from 'react-native';
2
2
  import { RFValue } from 'react-native-responsive-fontsize';
3
- import OneTap from '../../assets/images/OneTap@1x.svg';
3
+ import OneTap from '../../assets/images/OneTap.svg';
4
4
  import ValueChange from '../../assets/images/ValueChange.svg';
5
5
  import Schedule from '../../assets/images/Schedule.svg';
6
6
 
@@ -84,7 +84,7 @@ export const SCANNING_STATUS = {
84
84
  };
85
85
 
86
86
  export const SubUnitName = {
87
- scenario: 'Kịch Bản',
87
+ smart: 'Kịch Bản',
88
88
  };
89
89
 
90
90
  export const AUTOMATE_TYPE = {
@@ -116,13 +116,13 @@ export const AUTOMATES = {
116
116
  value_change: {
117
117
  value: AUTOMATE_TYPE.VALUE_CHANGE,
118
118
  title: 'value_change',
119
- explanation: 'short_explanation',
119
+ explanation: 'setup_the_conditions',
120
120
  icon: ValueChange,
121
121
  },
122
122
  schedule: {
123
123
  value: AUTOMATE_TYPE.SCHEDULE,
124
124
  title: 'schedule',
125
- explanation: 'short_explanation',
125
+ explanation: 'setup_the_schedule',
126
126
  icon: Schedule,
127
127
  },
128
128
  };
@@ -572,6 +572,16 @@ export const TESTID = {
572
572
  // ThreeButtonHistory
573
573
  HISTORY_BUTTON: 'HISTORY_BUTTON',
574
574
  HISTORY_CALENDAR: 'HISTORY_CALENDAR',
575
+
576
+ // DropDownPicker
577
+ DROP_DOWN_PICKER_ITEM: 'DROP_DOWN_PICKER_ITEM',
578
+
579
+ // SelectAddress
580
+ BUTTON_YOUR_LOCATION: 'BUTTON_YOUR_LOCATION',
581
+ BUTTON_CHOOSE_ON_MAP: 'BUTTON_CHOOSE_ON_MAP',
582
+
583
+ // MoveToAnotherSubUnit
584
+ ROW_SUB_UNIT: 'ROW_SUB_UNIT',
575
585
  };
576
586
 
577
587
  export const NOTIFICATION_TYPES = {
@@ -7,4 +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/buttonPause-center-curtain.png'),
11
+ buttonLeftCurtain: require('../Images/Common/buttonLeftCurtain.png'),
12
+ buttonRightCurtain: require('../Images/Common/buttonRightCurtain.png'),
10
13
  };
@@ -90,6 +90,8 @@ const SCDefaultConfig = {
90
90
  LG_CLIENT_ID: '2b85aee334f046848341547894bb7c4e',
91
91
  LG_REDIRECT_URI_APP: 'app://eoh/sync-lg-device',
92
92
  LG_URL: 'https://qt-vn.m.lgaccount.com/emp/v2',
93
+ VCONNEX_CLIENT_ID: '',
94
+ VCONNEX_REDIRECT_URI_APP: '',
93
95
  pusherAppKey: '9a591ae4a764acc08714',
94
96
  pusherAppCluster: 'ap1',
95
97
  };
@@ -100,6 +102,8 @@ export class SCConfig {
100
102
  static LG_CLIENT_ID = SCDefaultConfig.LG_CLIENT_ID;
101
103
  static LG_REDIRECT_URI_APP = SCDefaultConfig.LG_REDIRECT_URI_APP;
102
104
  static LG_URL = SCDefaultConfig.LG_URL;
105
+ static VCONNEX_CLIENT_ID = SCDefaultConfig.VCONNEX_CLIENT_ID;
106
+ static VCONNEX_REDIRECT_URI_APP = SCDefaultConfig.VCONNEX_REDIRECT_URI_APP;
103
107
  static pusherAppKey = SCDefaultConfig.pusherAppKey;
104
108
  static pusherAppCluste = SCDefaultConfig.pusherAppCluster;
105
109
  }
@@ -113,6 +117,10 @@ export const initSCConfig = (config) => {
113
117
  SCConfig.LG_REDIRECT_URI_APP =
114
118
  config.LG_REDIRECT_URI_APP ?? SCDefaultConfig.LG_REDIRECT_URI_APP;
115
119
  SCConfig.LG_URL = config.LG_URL ?? SCDefaultConfig.LG_URL;
120
+ SCConfig.VCONNEX_CLIENT_ID =
121
+ config.VCONNEX_CLIENT_ID ?? SCDefaultConfig.VCONNEX_CLIENT_ID;
122
+ SCConfig.VCONNEX_REDIRECT_URI_APP =
123
+ config.VCONNEX_REDIRECT_URI_APP ?? SCDefaultConfig.VCONNEX_REDIRECT_URI_APP;
116
124
  SCConfig.pusherAppKey = config.pusherAppKey ?? SCDefaultConfig.pusherAppKey;
117
125
  SCConfig.pusherAppCluster =
118
126
  config.pusherAppCluster ?? SCDefaultConfig.pusherAppCluster;
@@ -4,6 +4,7 @@ export const Action = {
4
4
  STORE_STATUS_BAR: 'STORE_STATUS_BAR',
5
5
  LIST_DEVICE_TYPES: 'LIST_DEVICE_TYPES',
6
6
  LIST_ACTION: 'LIST_ACTION',
7
+ IS_FIRST_OPEN_CAMERA: 'IS_FIRST_OPEN_CAMERA',
7
8
  };
8
9
 
9
10
  export type AuthData = {
@@ -44,3 +45,7 @@ export type ActionDataMap = {
44
45
  LIST_DEVICE_TYPES: ListDevice;
45
46
  LIST_ACTION: ListAction;
46
47
  };
48
+
49
+ export type AppType = {
50
+ isFirstOpenCamera: boolean;
51
+ };
@@ -47,5 +47,8 @@ export const mockSCStore = (data: ContextData): ContextData => {
47
47
  barStyle: data?.statusBar?.barStyle || mockDataStore?.statusBar?.barStyle,
48
48
  },
49
49
  listAction: [...mockDataStore.listAction, ...(data?.listAction || [])],
50
+ app: {
51
+ isFirstOpenCamera: true,
52
+ },
50
53
  };
51
54
  };
@@ -7,6 +7,7 @@ import {
7
7
  Action,
8
8
  ListDevice,
9
9
  ListAction,
10
+ AppType,
10
11
  } from './actionType';
11
12
 
12
13
  export type ContextData = {
@@ -15,6 +16,7 @@ export type ContextData = {
15
16
  listDevice: ListDevice;
16
17
  listAction: ListAction;
17
18
  statusBar: StatusBar;
19
+ app: AppType;
18
20
  };
19
21
 
20
22
  export type Action = {
@@ -35,6 +37,9 @@ export const initialState = {
35
37
  statusBar: {} as StatusBar,
36
38
  listDevice: {} as ListDevice,
37
39
  listAction: [] as ListAction,
40
+ app: {
41
+ isFirstOpenCamera: true,
42
+ },
38
43
  };
39
44
 
40
45
  export const reducer = (currentState: ContextData, action: Action) => {
@@ -83,6 +88,15 @@ export const reducer = (currentState: ContextData, action: Action) => {
83
88
  }
84
89
 
85
90
  return { ...currentState, listAction: newListAction };
91
+
92
+ case Action.IS_FIRST_OPEN_CAMERA:
93
+ return {
94
+ ...currentState,
95
+ app: {
96
+ ...currentState.app,
97
+ isFirstOpenCamera: payload,
98
+ },
99
+ };
86
100
  default:
87
101
  return currentState;
88
102
  }
@@ -5,6 +5,7 @@ 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';
8
9
 
9
10
  const bluetoothDevices = {};
10
11
  const needToScanDevices = [];
@@ -165,6 +166,19 @@ export const isBluetoothEnabled = async () => {
165
166
  return state === 'PoweredOn';
166
167
  };
167
168
 
169
+ export const useIsBluetoothEnabled = () => {
170
+ const [isEnabled, setIsEnabled] = useState(null);
171
+
172
+ useEffect(() => {
173
+ const subscription = bleManager.onStateChange((state) => {
174
+ setIsEnabled(state === 'PoweredOn');
175
+ }, true);
176
+
177
+ return () => subscription.remove();
178
+ }, []);
179
+ return isEnabled;
180
+ };
181
+
168
182
  export const enableBluetoothForAndroid = async () => {
169
183
  await bleManager.enable();
170
184
  };
@@ -16,7 +16,6 @@ export const sendRemoteCommand = async (sensor, action, data) => {
16
16
  );
17
17
  return;
18
18
  }
19
-
20
19
  if (action.command_prefer_over_bluetooth) {
21
20
  try {
22
21
  await sendCommandOverBluetooth(sensor, action, data);
@@ -1,9 +1,10 @@
1
1
  import React, { memo } from 'react';
2
- import { StyleSheet, Platform } from 'react-native';
2
+ import { View, StyleSheet, Platform } from 'react-native';
3
3
  import { IconOutline } from '@ant-design/icons-react-native';
4
4
  import { createStackNavigator } from '@react-navigation/stack';
5
5
  import { get } from 'lodash';
6
6
 
7
+ import Text from '../commons/Text';
7
8
  import { useTranslations } from '../hooks/Common/useTranslations';
8
9
  import { Colors, Device } from '../configs';
9
10
  import Route from '../utils/Route';
@@ -13,7 +14,8 @@ import AQIGuide from '../screens/AQIGuide';
13
14
  import DeviceDetail from '../screens/Device/detail';
14
15
  import SharingMemberList from '../screens/Sharing/MemberList';
15
16
  import ManageSubUnit from '../screens/SubUnit/ManageSubUnit';
16
- import SelectLocation from '../screens/Unit/SelectLocation';
17
+ import SelectAddress from '../screens/Unit/SelectAddress';
18
+ import ChooseLocation from '../screens/Unit/ChooseLocation';
17
19
  import ManageUnit from '../screens/Unit/ManageUnit';
18
20
  import ListSmartAccount from '../screens/Unit/SmartAccount';
19
21
  import MyAllUnit from '../screens/Unit/MyAllUnit';
@@ -29,6 +31,7 @@ import AddNewAutoSmart from '../screens/AddNewAutoSmart';
29
31
  import PlaybackCamera from '../screens/PlayBackCamera';
30
32
  import AllCamera from '../screens/AllCamera';
31
33
  import ManageAccessScreen from '../screens/ManageAccess';
34
+ import MoveToAnotherSubUnit from '../screens/MoveToAnotherSubUnit';
32
35
  import GuestInfo from '../screens/GuestInfo';
33
36
  import ScriptDetail from '../screens/ScriptDetail';
34
37
  import EditActionsList from '../screens/EditActionsList';
@@ -39,6 +42,7 @@ import SelectAction from '../screens/AddNewAction/SelectAction';
39
42
  import EditSubUnit from '../screens/SubUnit/EditSubUnit';
40
43
  import SetUpSensor from '../screens/AddNewAction/SetupSensor';
41
44
  import EditDevice from '../screens/Device/EditDevice/index';
45
+ import EmergencySetting from '../screens/EmergencySetting';
42
46
 
43
47
  const Stack = createStackNavigator();
44
48
 
@@ -98,13 +102,30 @@ export const UnitStack = memo((props) => {
98
102
  }}
99
103
  />
100
104
  <Stack.Screen
101
- name={Route.SelectLocation}
102
- component={SelectLocation}
105
+ name={Route.SelectAddress}
106
+ component={SelectAddress}
103
107
  options={{
104
108
  headerShown: true,
105
109
  headerTitle: t('select_address'),
106
110
  }}
107
111
  />
112
+ <Stack.Screen
113
+ name={Route.ChooseLocation}
114
+ component={ChooseLocation}
115
+ options={{
116
+ headerShown: true,
117
+ headerTitle: () => (
118
+ <View style={styles.alignCenter}>
119
+ <Text type="H3" color={Colors.Gray9} bold>
120
+ {t('choose_on_map')}
121
+ </Text>
122
+ <Text type="H4" color={Colors.Gray8}>
123
+ {t('plan_and_zoom_to_adjust')}
124
+ </Text>
125
+ </View>
126
+ ),
127
+ }}
128
+ />
108
129
  <Stack.Screen
109
130
  name={Route.UnitSummary}
110
131
  component={UnitSummary}
@@ -210,6 +231,13 @@ export const UnitStack = memo((props) => {
210
231
  headerShown: false,
211
232
  }}
212
233
  />
234
+ <Stack.Screen
235
+ name={Route.MoveToAnotherSubUnit}
236
+ component={MoveToAnotherSubUnit}
237
+ options={{
238
+ headerShown: false,
239
+ }}
240
+ />
213
241
  <Stack.Screen
214
242
  name={Route.GuestInfo}
215
243
  component={GuestInfo}
@@ -272,6 +300,13 @@ export const UnitStack = memo((props) => {
272
300
  headerShown: false,
273
301
  }}
274
302
  />
303
+ <Stack.Screen
304
+ name={Route.EmergencySetting}
305
+ component={EmergencySetting}
306
+ options={{
307
+ headerShown: false,
308
+ }}
309
+ />
275
310
  </Stack.Navigator>
276
311
  );
277
312
  });
@@ -280,4 +315,7 @@ const styles = StyleSheet.create({
280
315
  icLeft: {
281
316
  marginLeft: Device.isIOS ? 8 : 0,
282
317
  },
318
+ alignCenter: {
319
+ alignItems: 'center',
320
+ },
283
321
  });
@@ -211,7 +211,7 @@ const FilterPopup = ({
211
211
  onStart={onPickStartDate}
212
212
  onEnd={onPickEndDate}
213
213
  formatType="date"
214
- inline={false}
214
+ inline={true}
215
215
  />
216
216
  {userFilterEnabled && (
217
217
  <>
@@ -29,14 +29,23 @@ const DetailLog = ({ item }) => {
29
29
  {item.action_name
30
30
  ? `${item.action_name} ${t('by')} `
31
31
  : `${t('activated_by')} `}
32
- <Text style={styles.name}>{item.name || item.params?.username}</Text>
32
+ <Text style={styles.name}>{item.name || item.username}</Text>
33
33
  </Text>
34
34
  );
35
35
  case ACTIVITY_LOG_TYPES.SCRIPT_UPDATED_BY:
36
36
  return (
37
37
  <Text style={styles.text}>
38
38
  {`${t('script_updated_by')} `}
39
- <Text style={styles.name}>{item.name || item.params?.username}</Text>
39
+ <Text style={styles.name}>{item.name || item.username}</Text>
40
+ </Text>
41
+ );
42
+ default:
43
+ return (
44
+ <Text style={styles.text}>
45
+ {item.action_name
46
+ ? `${item.action_name} ${t('by')} `
47
+ : `${t('activated_by')} `}
48
+ <Text style={styles.name}>{item.name || item.username}</Text>
40
49
  </Text>
41
50
  );
42
51
  }
@@ -46,6 +46,7 @@ test('test ItemLog one tap', () => {
46
46
  params: {
47
47
  username: 'username',
48
48
  },
49
+ username: 'username',
49
50
  created_at: '2021-07-02T15:48:24.917932Z',
50
51
  },
51
52
  type: `automate.${AUTOMATE_TYPE.ONE_TAP}`,
@@ -60,6 +61,51 @@ test('test ItemLog one tap', () => {
60
61
  expect(texts[2].props.children).toBe(props.item.params.username);
61
62
  });
62
63
 
64
+ test('test ItemLog script update', () => {
65
+ let tree;
66
+ let props = {
67
+ item: {
68
+ content_code: 'SCRIPT_UPDATED_BY',
69
+ params: {
70
+ username: 'username',
71
+ },
72
+ username: 'username',
73
+ created_at: '2021-07-02T15:48:24.917932Z',
74
+ },
75
+ type: 'automate',
76
+ length: 2,
77
+ index: 1,
78
+ };
79
+ act(() => {
80
+ tree = create(wrapComponent(props));
81
+ });
82
+ const instance = tree.root;
83
+ const texts = instance.findAllByType(Text);
84
+ expect(texts[2].props.children).toBe(props.item.username);
85
+ });
86
+
87
+ test('test ItemLog no content_code', () => {
88
+ let tree;
89
+ let props = {
90
+ item: {
91
+ params: {
92
+ username: 'username',
93
+ },
94
+ created_at: '2021-07-02T15:48:24.917932Z',
95
+ },
96
+ username: 'username',
97
+ type: 'action',
98
+ length: 2,
99
+ index: 1,
100
+ };
101
+ act(() => {
102
+ tree = create(wrapComponent(props));
103
+ });
104
+ const instance = tree.root;
105
+ const texts = instance.findAllByType(Text);
106
+ expect(texts[2].props.children).toBe(props.item.username);
107
+ });
108
+
63
109
  describe('test ItemLog emergency event', () => {
64
110
  let tree;
65
111
  let props;
@@ -12,6 +12,7 @@ const apiMaps = {
12
12
  url: () => API.SENSOR.ACTIVITY_LOG(),
13
13
  params: (id) => ({ id: id }),
14
14
  standardizeData: getDataForList,
15
+ memberUrl: (id) => API.SHARE.UNITS_MEMBERS(id),
15
16
  },
16
17
  ['emergency_event']: {
17
18
  url: () => API.EMERGENCY_BUTTON.ACTIVITY_LOG(),
@@ -66,7 +66,6 @@ const ActivityLogScreen = ({ route }) => {
66
66
  {getTitleFromTime(data[0].created_at, new Date())}
67
67
  </Text>
68
68
  );
69
-
70
69
  useEffect(() => {
71
70
  onRefresh();
72
71
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -11,6 +11,7 @@ import Routes from '../../utils/Route';
11
11
  import { TESTID } from '../../configs/Constants';
12
12
  import styles from './SelectSubUnitStyles';
13
13
  import Button from '../../commons/Button';
14
+ import { SCConfig } from '../../configs/SCConfig';
14
15
 
15
16
  const AddCommonSelectSubUnit = ({ route }) => {
16
17
  const t = useTranslations();
@@ -31,6 +32,9 @@ const AddCommonSelectSubUnit = ({ route }) => {
31
32
  case 'AddHassiDevice':
32
33
  setTitle(t('select_a_sub_unit'));
33
34
  break;
35
+ case 'AddVconnexDevice':
36
+ setTitle(t('select_a_sub_unit'));
37
+ break;
34
38
  default:
35
39
  setTitle(t('add_new_gateway'));
36
40
  setSubTitle(t('select_a_sub_unit'));
@@ -70,10 +74,28 @@ const AddCommonSelectSubUnit = ({ route }) => {
70
74
  station: subUnits[selectedIndex]?.id,
71
75
  });
72
76
  break;
77
+ case 'AddVconnexDevice':
78
+ navigation.navigate(Routes.Browser, {
79
+ link: API.IOT.VCONNEX.AUTHORIZE(
80
+ SCConfig.VCONNEX_CLIENT_ID,
81
+ SCConfig.VCONNEX_REDIRECT_URI_APP,
82
+ unit.user_id,
83
+ subUnits[selectedIndex]?.id
84
+ ),
85
+ });
86
+ break;
73
87
  default:
74
88
  break;
75
89
  }
76
- }, [addType, navigation, subUnits, selectedIndex, unit.name, route.params]);
90
+ }, [
91
+ addType,
92
+ navigation,
93
+ subUnits,
94
+ selectedIndex,
95
+ unit?.name,
96
+ unit.user_id,
97
+ route.params,
98
+ ]);
77
99
 
78
100
  const handleSelectIndex = (index) => {
79
101
  if (index !== selectedIndex) {
@@ -86,7 +108,7 @@ const AddCommonSelectSubUnit = ({ route }) => {
86
108
  const addSubUnit = useCallback(() => {
87
109
  navigation.navigate(Routes.AddSubUnitStack, {
88
110
  screen: Routes.AddSubUnit,
89
- params: { unit, ...route.params },
111
+ params: { unit, ...route.params, addType: 'AddHassiDevice' },
90
112
  });
91
113
  }, [navigation, unit, route.params]);
92
114
 
@@ -48,6 +48,9 @@ const AddCommonSelectUnit = ({ route }) => {
48
48
  case 'AddHassioDevice':
49
49
  setTitle(t('text_select_a_unit'));
50
50
  break;
51
+ case 'AddVconnexDevice':
52
+ setTitle(t('text_select_a_unit'));
53
+ break;
51
54
  default:
52
55
  setTitle(t('add_new_sub_unit'));
53
56
  setSubTitle(t('add_new_subunit_select_unit'));
@@ -102,6 +105,15 @@ const AddCommonSelectUnit = ({ route }) => {
102
105
  unit_id: units[selectedIndex].id,
103
106
  });
104
107
  break;
108
+ case 'AddVconnexDevice':
109
+ navigation.navigate(Routes.AddDeviceStack, {
110
+ screen: Routes.AddCommonSelectSubUnit,
111
+ params: {
112
+ unit_id: units[selectedIndex].id,
113
+ addType: 'AddVconnexDevice',
114
+ },
115
+ });
116
+ break;
105
117
  default:
106
118
  break;
107
119
  }