@eohjsc/react-native-smart-city 0.3.47 → 0.3.49

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 (164) hide show
  1. package/package.json +3 -2
  2. package/src/Images/DevMode/file_copy.svg +3 -0
  3. package/src/Images/DevMode/inforCode.png +0 -0
  4. package/src/Images/DevMode/inforCode@2x.png +0 -0
  5. package/src/Images/DevMode/inforCode@3x.png +0 -0
  6. package/src/commons/Action/__test__/ItemQuickAction.test.js +0 -7
  7. package/src/commons/ActionGroup/__test__/ColorPickerTemplate.test.js +1 -8
  8. package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +1 -1
  9. package/src/commons/ActionGroup/__test__/SliderRangeTemplate.test.js +1 -8
  10. package/src/commons/ActionTemplate/__test__/index.test.js +0 -7
  11. package/src/commons/Dashboard/MyPinnedSharedUnit/index.js +3 -3
  12. package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +1 -1
  13. package/src/commons/Dashboard/MyUnit/index.js +30 -4
  14. package/src/commons/DevMode/Styles/ItemStyles.js +1 -1
  15. package/src/commons/Device/PMSensor/PMSensorIndicatior.js +2 -1
  16. package/src/commons/FourButtonFilterHistory/__test__/FourButtonFilterHistory.test.js +0 -7
  17. package/src/commons/Header/HeaderCustom.js +13 -6
  18. package/src/commons/MediaPlayer/__test__/index.test.js +0 -7
  19. package/src/commons/MediaPlayerDetail/__test__/MediaPlayerFull.test.js +0 -1
  20. package/src/commons/MenuActionMore/index.js +4 -1
  21. package/src/commons/NavBar/index.js +1 -1
  22. package/src/commons/OneTapTemplate/OptionsDropdownActionTemplate.js +1 -1
  23. package/src/commons/OneTapTemplate/__test__/NumberUpDownActionTemplate.test.js +0 -7
  24. package/src/commons/OneTapTemplate/__test__/OptionsDropdownActionTemplate.test.js +0 -7
  25. package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +0 -7
  26. package/src/commons/RowItem/index.js +6 -1
  27. package/src/commons/SelectUnit/index.js +4 -1
  28. package/src/commons/StatusBox/styles.js +8 -3
  29. package/src/commons/SubUnit/__test__/Favorites.test.js +0 -7
  30. package/src/commons/SubUnit/__test__/ShortDetail.test.js +0 -7
  31. package/src/commons/Tabbar/__test__/index.test.js +0 -7
  32. package/src/commons/Unit/__test__/HeaderUnit.test.js +0 -5
  33. package/src/commons/UnitSummary/ConfigHistoryChart/__test__/ConfigHistoryChart.test.js +0 -7
  34. package/src/configs/API.js +28 -0
  35. package/src/configs/AccessibilityLabel.js +13 -0
  36. package/src/configs/Colors.js +4 -0
  37. package/src/configs/Constants.js +6 -0
  38. package/src/configs/Images.js +1 -0
  39. package/src/context/actionType.ts +8 -1
  40. package/src/context/mockStore.ts +8 -2
  41. package/src/context/reducer.ts +27 -4
  42. package/src/hooks/IoT/__test__/useWatchConfigs.test.js +46 -0
  43. package/src/hooks/IoT/useBluetoothConnection.js +78 -4
  44. package/src/hooks/IoT/useBluetoothDeviceConnected.js +1 -1
  45. package/src/iot/RemoteControl/Bluetooth.js +0 -16
  46. package/src/iot/RemoteControl/__test__/Bluetooth.test.js +0 -25
  47. package/src/navigations/Main.js +39 -0
  48. package/src/navigations/UnitStack.js +18 -5
  49. package/src/screens/ActivityLog/__test__/FilterPopup.test.js +0 -7
  50. package/src/screens/ActivityLog/__test__/ItemLog.test.js +0 -7
  51. package/src/screens/ActivityLog/__test__/index.test.js +0 -7
  52. package/src/screens/AddLocationMaps/__test__/index.test.js +0 -7
  53. package/src/screens/AddNewAction/SelectAction.js +22 -18
  54. package/src/screens/AddNewAction/__test__/SelectAction.test.js +35 -16
  55. package/src/screens/AddNewAction/__test__/SelectSensorDevices.test.js +0 -7
  56. package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +0 -4
  57. package/src/screens/AddNewGateway/ConnectingZigbeeDevice.js +17 -4
  58. package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +0 -4
  59. package/src/screens/AddNewGateway/__test__/ConnectingModbusDevice.test.js +0 -4
  60. package/src/screens/AddNewGateway/__test__/ConnectingWifiDevice.test.js +0 -4
  61. package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +4 -7
  62. package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +0 -7
  63. package/src/screens/AddNewGateway/__test__/SelectDeviceType.test.js +0 -4
  64. package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +0 -4
  65. package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +0 -4
  66. package/src/screens/AddNewOneTap/__test__/AddNewOneTap.test.js +0 -7
  67. package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +0 -1
  68. package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +0 -7
  69. package/src/screens/Device/__test__/detail.test.js +1 -1
  70. package/src/screens/Device/detail.js +11 -3
  71. package/src/screens/Device/hooks/useDisconnectedDevice.js +26 -7
  72. package/src/screens/EmergencyContacts/__test__/hooks.test.js +79 -0
  73. package/src/screens/Gateway/DetailConfigActionModbus/__test__/index.test.js +138 -0
  74. package/src/screens/Gateway/DetailConfigActionModbus/index.js +180 -0
  75. package/src/screens/Gateway/DetailConfigActionModbus/styles.js +9 -0
  76. package/src/screens/Gateway/DetailConfigActionZigbee/__test__/index.test.js +73 -0
  77. package/src/screens/Gateway/DetailConfigActionZigbee/index.js +62 -0
  78. package/src/screens/Gateway/DetailConfigActionZigbee/styles.js +9 -0
  79. package/src/screens/Gateway/DeviceGatewayInfo/__test__/index.test.js +73 -0
  80. package/src/screens/Gateway/DeviceGatewayInfo/index.js +96 -0
  81. package/src/screens/Gateway/DeviceGatewayInfo/styles.js +9 -0
  82. package/src/screens/Gateway/DeviceModbusDetail/__test__/index.test.js +393 -0
  83. package/src/screens/Gateway/DeviceModbusDetail/index.js +176 -0
  84. package/src/screens/Gateway/DeviceModbusDetail/styles.js +12 -0
  85. package/src/screens/Gateway/DeviceZigbeeDetail/__test__/index.test.js +265 -0
  86. package/src/screens/Gateway/DeviceZigbeeDetail/index.js +148 -0
  87. package/src/screens/Gateway/DeviceZigbeeDetail/styles.js +12 -0
  88. package/src/screens/Gateway/GatewayConnectionMethods/__test__/index.test.js +37 -0
  89. package/src/screens/Gateway/GatewayConnectionMethods/index.js +73 -0
  90. package/src/screens/Gateway/GatewayConnectionMethods/styles.js +45 -0
  91. package/src/screens/Gateway/GatewayDetail/__test__/index.test.js +298 -0
  92. package/src/screens/Gateway/GatewayDetail/index.js +148 -0
  93. package/src/screens/Gateway/GatewayDetail/styles.js +12 -0
  94. package/src/screens/Gateway/GatewayInfo/__test__/index.test.js +137 -0
  95. package/src/screens/Gateway/GatewayInfo/index.js +115 -0
  96. package/src/screens/Gateway/GatewayInfo/styles.js +9 -0
  97. package/src/screens/Gateway/__test__/index.test.js +58 -0
  98. package/src/screens/Gateway/components/Detail/__test__/index.test.js +46 -0
  99. package/src/screens/Gateway/components/Detail/index.js +62 -0
  100. package/src/screens/Gateway/components/Detail/styles.js +27 -0
  101. package/src/screens/Gateway/components/DetailActionModbus/__test__/index.test.js +49 -0
  102. package/src/screens/Gateway/components/DetailActionModbus/index.js +52 -0
  103. package/src/screens/Gateway/components/DetailActionModbus/styles.js +32 -0
  104. package/src/screens/Gateway/components/DetailConfigAction/__test__/index.test.js +59 -0
  105. package/src/screens/Gateway/components/DetailConfigAction/index.js +69 -0
  106. package/src/screens/Gateway/components/DetailConfigAction/styles.js +21 -0
  107. package/src/screens/Gateway/components/GatewayItem/__test__/index.test.js +1 -1
  108. package/src/screens/Gateway/components/GatewayItem/styles.js +4 -33
  109. package/src/screens/Gateway/components/Information/__test__/index.test.js +70 -0
  110. package/src/screens/Gateway/components/Information/index.js +116 -0
  111. package/src/screens/Gateway/components/Information/styles.js +59 -0
  112. package/src/screens/Gateway/components/RowItem/__test__/index.test.js +67 -0
  113. package/src/screens/Gateway/components/RowItem/index.js +65 -0
  114. package/src/screens/Gateway/components/RowItem/styles.js +25 -0
  115. package/src/screens/Gateway/components/TabPaneCT/__test__/index.test.js +98 -0
  116. package/src/screens/Gateway/components/TabPaneCT/index.js +134 -0
  117. package/src/screens/Gateway/components/TabPaneCT/styles.js +58 -0
  118. package/src/screens/Gateway/hooks/__test__/index.test.js +93 -0
  119. package/src/screens/Gateway/hooks/useGateway.js +110 -16
  120. package/src/screens/Gateway/index.js +19 -3
  121. package/src/screens/Gateway/styles.js +6 -8
  122. package/src/screens/Gateway/utils/index.js +16 -0
  123. package/src/screens/GuestInfo/__test__/index.test.js +0 -7
  124. package/src/screens/HanetCamera/__test__/CaptureFaceID.test.js +0 -7
  125. package/src/screens/HanetCamera/__test__/Detail.test.js +0 -7
  126. package/src/screens/HanetCamera/__test__/ManageAccess.test.js +0 -7
  127. package/src/screens/HanetCamera/__test__/MemberInfo.test.js +0 -7
  128. package/src/screens/ManageAccess/__test__/ManageAccess.test.js +0 -6
  129. package/src/screens/ManageAccess/hooks/__test__/useManageAccess.test.js +0 -7
  130. package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +0 -7
  131. package/src/screens/Notification/__test__/Notification.test.js +0 -7
  132. package/src/screens/PlayBackCamera/__test__/index.test.js +0 -1
  133. package/src/screens/ScriptDetail/__test__/index.test.js +0 -7
  134. package/src/screens/SelectUnit/__test__/index.test.js +0 -1
  135. package/src/screens/SetSchedule/__test__/index.test.js +0 -7
  136. package/src/screens/Sharing/Components/__test__/DeviceItem.test.js +0 -7
  137. package/src/screens/Sharing/Components/__test__/ItemChangeRole.test.js +0 -7
  138. package/src/screens/Sharing/Components/__test__/TitleCheckBox.test.js +0 -7
  139. package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +0 -6
  140. package/src/screens/Sharing/hooks/__test__/index.test.js +80 -0
  141. package/src/screens/SmartAccount/ListDevice/__test__/DeviceItem.test.js +0 -7
  142. package/src/screens/SmartIr/__test__/ButtonsBottom.test.js +0 -6
  143. package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +1 -6
  144. package/src/screens/SmartIr/__test__/SelectBrand.test.js +1 -6
  145. package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +1 -6
  146. package/src/screens/SubUnit/AddSubUnit.js +1 -0
  147. package/src/screens/SubUnit/ManageSubUnit.js +4 -1
  148. package/src/screens/SubUnit/hooks/__test__/useEmergencyContacts.test.js +34 -0
  149. package/src/screens/SubUnit/hooks/__test__/useManageSubUnit.test.js +0 -7
  150. package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +0 -7
  151. package/src/screens/Unit/__test__/AddMenu.test.js +0 -7
  152. package/src/screens/Unit/__test__/CheckSendEmail.test.js +1 -1
  153. package/src/screens/Unit/__test__/ChooseLocation.test.js +0 -7
  154. package/src/screens/Unit/__test__/Detail.test.js +1 -8
  155. package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +0 -7
  156. package/src/screens/Unit/__test__/SelectAddress.test.js +0 -7
  157. package/src/screens/Unit/__test__/SmartAccount.test.js +0 -7
  158. package/src/screens/Unit/__test__/SmartAccountItem.test.js +0 -7
  159. package/src/screens/Unit/__test__/Summaries.test.js +0 -7
  160. package/src/screens/Unit/hook/useUnitConnectRemoteDevices.js +4 -3
  161. package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +2 -2
  162. package/src/utils/I18n/translations/en.json +28 -0
  163. package/src/utils/I18n/translations/vi.json +28 -0
  164. package/src/utils/Route/index.js +8 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eohjsc/react-native-smart-city",
3
3
  "title": "React Native Smart Home",
4
- "version": "0.3.47",
4
+ "version": "0.3.49",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -109,6 +109,7 @@
109
109
  "@formatjs/intl-pluralrules": "^3.4.7",
110
110
  "@invertase/react-native-apple-authentication": "^1.1.2",
111
111
  "@messageformat/core": "^3.0.0",
112
+ "@react-native-clipboard/clipboard": "^1.11.1",
112
113
  "@react-native-community/async-storage": "^1.12.1",
113
114
  "@react-native-community/cameraroll": "^4.0.0",
114
115
  "@react-native-community/checkbox": "^0.5.5",
@@ -182,7 +183,7 @@
182
183
  "react-native-pager-view": "^5.4.1",
183
184
  "react-native-parallax-scroll-view": "^0.21.3",
184
185
  "react-native-parsed-text": "^0.0.22",
185
- "react-native-permissions": "3.0.3",
186
+ "react-native-permissions": "3.4.0",
186
187
  "react-native-popover-view": "^4.0.3",
187
188
  "react-native-progress": "^5.0.0",
188
189
  "react-native-reanimated": "1.10.1",
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="25" viewBox="0 0 24 25" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M16 1.59863H4C2.9 1.59863 2 2.49863 2 3.59863V17.5986H4V3.59863H16V1.59863ZM15 5.59863H8C6.9 5.59863 6.01 6.49863 6.01 7.59863L6 21.5986C6 22.6986 6.89 23.5986 7.99 23.5986H19C20.1 23.5986 21 22.6986 21 21.5986V11.5986L15 5.59863ZM8 21.5986V7.59863H14V12.5986H19V21.5986H8Z" fill="#808080"/>
3
+ </svg>
Binary file
@@ -12,13 +12,6 @@ class Sensor {}
12
12
 
13
13
  factory.define('Sensor', Sensor, {});
14
14
 
15
- jest.mock('react', () => {
16
- return {
17
- ...jest.requireActual('react'),
18
- memo: (x) => x,
19
- };
20
- });
21
-
22
15
  const mockSendRemoteControl = jest.fn();
23
16
  jest.mock('../../../hooks/IoT', () => {
24
17
  return {
@@ -12,14 +12,7 @@ const mockDoAction = jest.fn();
12
12
  jest.mock('../../../iot/states', () => ({
13
13
  useConfigGlobalState: jest.fn(),
14
14
  }));
15
- const mockSetState = jest.fn();
16
- jest.mock('react', () => {
17
- return {
18
- ...jest.requireActual('react'),
19
- useState: jest.fn((init) => [init, mockSetState]),
20
- memo: (x) => x,
21
- };
22
- });
15
+
23
16
  const wrapComponent = (actionGroup, doAction, sensor) => (
24
17
  <SCProvider initState={mockSCStore({})}>
25
18
  <ColorPickerTemplate
@@ -118,7 +118,7 @@ describe('Test OnOffTemplate', () => {
118
118
  });
119
119
  const instance = tree.root;
120
120
  const template = instance.findAllByType(OnOffButtonTemplate);
121
- expect(template).toHaveLength(0);
121
+ expect(template).toHaveLength(1);
122
122
  });
123
123
 
124
124
  it('render with wrong template', async () => {
@@ -12,14 +12,7 @@ const mockDoAction = jest.fn();
12
12
  jest.mock('../../../iot/states', () => ({
13
13
  useConfigGlobalState: jest.fn(),
14
14
  }));
15
- const mockSetState = jest.fn();
16
- jest.mock('react', () => {
17
- return {
18
- ...jest.requireActual('react'),
19
- useState: jest.fn((init) => [init, mockSetState]),
20
- memo: (x) => x,
21
- };
22
- });
15
+
23
16
  const wrapComponent = (actionGroup, doAction, sensor) => (
24
17
  <SCProvider initState={mockSCStore({})}>
25
18
  <SliderRangeTemplate
@@ -8,13 +8,6 @@ import SelectActionCard from '../../SelectActionCard';
8
8
  import Modal from 'react-native-modal';
9
9
  import ThreeButtonAction from '../ThreeButtonAction';
10
10
 
11
- jest.mock('react', () => {
12
- return {
13
- ...jest.requireActual('react'),
14
- memo: (x) => x,
15
- };
16
- });
17
-
18
11
  const mockOnSelectAction = jest.fn();
19
12
 
20
13
  const wrapComponent = (data) => (
@@ -12,7 +12,7 @@ import { useTranslations } from '../../../hooks/Common/useTranslations';
12
12
  import SharedUnit from '../../Unit/SharedUnit';
13
13
  import { fetchWithCache } from '../../../utils/Apis/axios';
14
14
 
15
- const MyPinnedSharedUnit = () => {
15
+ const MyPinnedSharedUnit = ({ refreshing }) => {
16
16
  const t = useTranslations();
17
17
  const isFocused = useIsFocused();
18
18
  const navigation = useNavigation();
@@ -35,10 +35,10 @@ const MyPinnedSharedUnit = () => {
35
35
  }, [setSharedUnits]);
36
36
 
37
37
  useEffect(() => {
38
- if (isFocused) {
38
+ if (isFocused || refreshing) {
39
39
  fetchSharedUnitDashboard();
40
40
  }
41
- }, [fetchSharedUnitDashboard, isFocused]);
41
+ }, [fetchSharedUnitDashboard, isFocused, refreshing]);
42
42
 
43
43
  return (
44
44
  <>
@@ -32,7 +32,7 @@ jest.mock('react-redux', () => ({
32
32
 
33
33
  const wrapComponent = () => (
34
34
  <SCProvider initState={mockSCStore({})}>
35
- <MyUnit />
35
+ <MyUnit refreshing={true} />
36
36
  </SCProvider>
37
37
  );
38
38
 
@@ -13,6 +13,7 @@ import {
13
13
  useFocusEffect,
14
14
  } from '@react-navigation/native';
15
15
  import NetInfo from '@react-native-community/netinfo';
16
+ import { BleManager } from 'react-native-ble-plx';
16
17
  import { API, Colors, Images } from '../../../configs';
17
18
  import Text from '../../Text';
18
19
  import { fetchWithCache } from '../../../utils/Apis/axios';
@@ -21,7 +22,7 @@ import styles from './styles';
21
22
  import { Section } from '../../Section';
22
23
  import { useTranslations } from '../../../hooks/Common/useTranslations';
23
24
  import { useUnitConnectRemoteDevices } from '../../../screens/Unit/hook/useUnitConnectRemoteDevices';
24
- import { useWatchConfigs } from '../../../hooks/IoT';
25
+ import { useWatchConfigs, useBluetoothConnection } from '../../../hooks/IoT';
25
26
  import { SCContext } from '../../../context';
26
27
  import { Action } from '../../../context/actionType';
27
28
 
@@ -31,7 +32,10 @@ import Routes from '../../../utils/Route';
31
32
  import MyUnitDevice from '../../../screens/Unit/components/MyUnitDevice';
32
33
 
33
34
  let screenWidth = Dimensions.get('window').width;
34
- const MyUnit = () => {
35
+
36
+ const bleManager = new BleManager();
37
+
38
+ const MyUnit = ({ refreshing }) => {
35
39
  const t = useTranslations();
36
40
  const isFocused = useIsFocused();
37
41
  const navigation = useNavigation();
@@ -39,6 +43,15 @@ const MyUnit = () => {
39
43
  const [slideIndex, setSlideIndex] = useState(0);
40
44
  const { setAction } = useContext(SCContext);
41
45
 
46
+ const {
47
+ permissionsRequested: bluetoothPermRequested,
48
+ requestPerm: requestBluetoothPerm,
49
+ } = useBluetoothConnection();
50
+
51
+ useEffect(() => {
52
+ !bluetoothPermRequested && requestBluetoothPerm();
53
+ }, [bluetoothPermRequested, requestBluetoothPerm]);
54
+
42
55
  const fetchMyUnitDashboard = useCallback(async () => {
43
56
  await fetchWithCache(API.UNIT.MY_UNITS(), {}, (response) => {
44
57
  const { success, data } = response;
@@ -47,8 +60,10 @@ const MyUnit = () => {
47
60
  }, [setMyUnits]);
48
61
 
49
62
  useEffect(() => {
50
- isFocused && fetchMyUnitDashboard();
51
- }, [fetchMyUnitDashboard, isFocused]);
63
+ if (isFocused || refreshing) {
64
+ fetchMyUnitDashboard();
65
+ }
66
+ }, [fetchMyUnitDashboard, isFocused, refreshing]);
52
67
 
53
68
  useFocusEffect(
54
69
  useCallback(() => {
@@ -60,6 +75,17 @@ const MyUnit = () => {
60
75
  }, [])
61
76
  );
62
77
 
78
+ useFocusEffect(
79
+ useCallback(() => {
80
+ const subscription = bleManager.onStateChange((state) => {
81
+ const connected = state === 'PoweredOn';
82
+ setAction(Action.SET_BLUETOOTH_STATE, connected);
83
+ }, true);
84
+ return () => subscription.remove();
85
+ // eslint-disable-next-line react-hooks/exhaustive-deps
86
+ }, [])
87
+ );
88
+
63
89
  useUnitConnectRemoteDevices(myUnits[slideIndex]);
64
90
 
65
91
  const configsNeedWatching = useMemo(() => {
@@ -21,7 +21,7 @@ export default StyleSheet.create({
21
21
  },
22
22
  countItem: {
23
23
  fontSize: 12,
24
- fontWeight: 400,
24
+ fontWeight: '400',
25
25
  color: Colors.Neutral.Neutral5,
26
26
  },
27
27
  });
@@ -9,12 +9,13 @@ const keyExtractor = (item) => item.id.toString();
9
9
  const PMSensorIndicatior = memo(({ data = [], style }) => {
10
10
  const renderItem = useCallback(
11
11
  ({ item }) => {
12
+ const getValue = item?.value >= 0 ? item?.value : '--';
12
13
  return (
13
14
  <QualityIndicatorItem
14
15
  key={item.id.toString()}
15
16
  color={item.color}
16
17
  standard={item.standard}
17
- value={item.value || '--'}
18
+ value={getValue}
18
19
  evaluate={item.evaluate}
19
20
  measure={item.measure}
20
21
  style={style}
@@ -11,13 +11,6 @@ const wrapComponent = (props) => (
11
11
  </SCProvider>
12
12
  );
13
13
 
14
- jest.mock('react', () => {
15
- return {
16
- ...jest.requireActual('react'),
17
- memo: (x) => x,
18
- };
19
- });
20
-
21
14
  it('test', async () => {
22
15
  const mockSetGroupBy = jest.fn();
23
16
  let tree;
@@ -7,6 +7,7 @@ import { useNavigation } from '@react-navigation/native';
7
7
  import styles from './Styles/HeaderCustomStyles';
8
8
  import { useTranslations } from '../../hooks/Common/useTranslations';
9
9
  import { notImplemented } from '../../utils/Utils';
10
+ import { AccessibilityLabel } from '../../configs/Constants';
10
11
 
11
12
  const HeaderCustom = ({
12
13
  title = '',
@@ -25,6 +26,7 @@ const HeaderCustom = ({
25
26
  wrapTitleStyle,
26
27
  iconBackStyle,
27
28
  isCanBack = true,
29
+ customTitle = false,
28
30
  }) => {
29
31
  const t = useTranslations();
30
32
  const { goBack } = useNavigation();
@@ -53,12 +55,16 @@ const HeaderCustom = ({
53
55
  </TouchableOpacity>
54
56
  )}
55
57
  <View style={[styles.wrapTitle, wrapTitleStyle]}>
56
- <Text
57
- style={[styles.title, titleStyles, !isShowRight && styles.title2]}
58
- numberOfLines={1}
59
- >
60
- {title}
61
- </Text>
58
+ {!customTitle ? (
59
+ <Text
60
+ style={[styles.title, titleStyles, !isShowRight && styles.title2]}
61
+ numberOfLines={1}
62
+ >
63
+ {title}
64
+ </Text>
65
+ ) : (
66
+ customTitle
67
+ )}
62
68
  </View>
63
69
 
64
70
  <View style={styles.viewRight}>
@@ -77,6 +83,7 @@ const HeaderCustom = ({
77
83
  style={styles.buttonBack}
78
84
  onPress={handleShowMenuAction}
79
85
  ref={refMenuAction}
86
+ accessibilityLabel={AccessibilityLabel.MENU_POPPER_MORE}
80
87
  >
81
88
  <Icon name={'more'} size={27} color={Colors.Black} />
82
89
  </TouchableOpacity>
@@ -5,13 +5,6 @@ import { mockSCStore } from '../../../context/mockStore';
5
5
  import { TouchableOpacity } from 'react-native';
6
6
  import MediaPlay from '../index';
7
7
 
8
- jest.mock('react', () => {
9
- return {
10
- ...jest.requireActual('react'),
11
- memo: (x) => x,
12
- };
13
- });
14
-
15
8
  const wrapComponent = (props) => (
16
9
  <SCProvider initState={mockSCStore({})}>
17
10
  <MediaPlay {...props} />
@@ -9,7 +9,6 @@ const mockSetState = jest.fn();
9
9
  jest.mock('react', () => {
10
10
  return {
11
11
  ...jest.requireActual('react'),
12
- memo: (x) => x,
13
12
  useState: jest.fn((init) => [init, mockSetState]),
14
13
  };
15
14
  });
@@ -70,7 +70,10 @@ const MenuActionMore = memo(
70
70
  }`}
71
71
  disabled={isDisable}
72
72
  >
73
- <Text style={[styles.modalHeaderText, item?.textStyle]}>
73
+ <Text
74
+ accessibilityLabel={AccessibilityLabel.TEXT_SUB_UNIT}
75
+ style={[styles.modalHeaderText, item?.textStyle]}
76
+ >
74
77
  {item?.text}
75
78
  </Text>
76
79
  </TouchableOpacity>
@@ -51,7 +51,7 @@ const NavBar = memo(
51
51
  childRef={childRef}
52
52
  onItemClick={onSnapToItem}
53
53
  isTextCenter={false}
54
- accessibilityLabel={AccessibilityLabel.NAVBAR_MENU_ACTION_MORE}
54
+ idLabelPopover={AccessibilityLabel.NAVBAR_MENU_ACTION_MORE}
55
55
  wrapStyle={styles.wrapStyle}
56
56
  idLabelScrollView={idLabelScrollView}
57
57
  idLabelItem={idLabelItem}
@@ -120,7 +120,7 @@ const OptionsDropdownActionTemplate = ({ device, data, onSelectAction }) => {
120
120
  <Text
121
121
  type="H4"
122
122
  bold
123
- color={activeAction >= 0 ? Colors.Primary : Colors.Disabled}
123
+ color={activeAction >= 0 ? Colors.Primary : Colors.TextGray}
124
124
  style={styles.textButton}
125
125
  >
126
126
  {t('done')}
@@ -8,13 +8,6 @@ import { TouchableOpacity } from 'react-native';
8
8
  import Text from '../../Text';
9
9
  import { AccessibilityLabel } from '../../../configs/Constants';
10
10
 
11
- jest.mock('react', () => {
12
- return {
13
- ...jest.requireActual('react'),
14
- memo: (x) => x,
15
- };
16
- });
17
-
18
11
  const mockOnSelectAction = jest.fn();
19
12
 
20
13
  const wrapComponent = (data) => (
@@ -8,13 +8,6 @@ import { RadioCircle } from '../..';
8
8
  import { TouchableOpacity } from 'react-native';
9
9
  import { AccessibilityLabel } from '../../../configs/Constants';
10
10
 
11
- jest.mock('react', () => {
12
- return {
13
- ...jest.requireActual('react'),
14
- memo: (x) => x,
15
- };
16
- });
17
-
18
11
  const mockOnSelectAction = jest.fn();
19
12
 
20
13
  const wrapComponent = (data) => (
@@ -7,13 +7,6 @@ import StatesGridActionTemplate from '../StatesGridActionTemplate';
7
7
  import { TouchableOpacity } from 'react-native';
8
8
  import { AccessibilityLabel } from '../../../configs/Constants';
9
9
 
10
- jest.mock('react', () => {
11
- return {
12
- ...jest.requireActual('react'),
13
- memo: (x) => x,
14
- };
15
- });
16
-
17
10
  const mockOnSelectAction = jest.fn();
18
11
 
19
12
  const wrapComponent = (data) => (
@@ -5,6 +5,7 @@ import { Colors } from '../../configs';
5
5
  import Text from '../Text';
6
6
  import styles from './styles';
7
7
  import { CircleView } from '../CircleView';
8
+ import AccessibilityLabel from '../../configs/AccessibilityLabel';
8
9
 
9
10
  const arrColor = [
10
11
  Colors.GeekBlue3,
@@ -49,7 +50,11 @@ export const RowItem = memo(
49
50
  </View>
50
51
  )}
51
52
  <View style={styles.columeFlex}>
52
- <Text numberOfLines={1} style={styles.titleName}>
53
+ <Text
54
+ numberOfLines={1}
55
+ style={styles.titleName}
56
+ accessibilityLabel={AccessibilityLabel.TEXT_SUB_UNIT}
57
+ >
53
58
  {text}
54
59
  </Text>
55
60
  {!!isShowSubText && (
@@ -67,7 +67,10 @@ const SelectUnit = ({ title, subTitle, onPressNext }) => {
67
67
  })();
68
68
  }, []);
69
69
  return (
70
- <View style={styles.container}>
70
+ <View
71
+ style={styles.container}
72
+ accessibilityLabel={AccessibilityLabel.SELECT_UNIT}
73
+ >
71
74
  <HeaderCustom title={title} isShowSeparator />
72
75
  <Text style={styles.subtitle}>{subTitle}</Text>
73
76
  <View style={styles.contentContainer}>
@@ -3,7 +3,7 @@ import { Colors } from '../../configs';
3
3
 
4
4
  export default StyleSheet.create({
5
5
  viewStatus: {
6
- width: 65,
6
+ width: 70,
7
7
  paddingHorizontal: 8,
8
8
  paddingVertical: 4,
9
9
  borderRadius: 54,
@@ -13,7 +13,7 @@ export default StyleSheet.create({
13
13
  },
14
14
  textStatus: {
15
15
  fontStyle: 'normal',
16
- fontWeight: 600,
16
+ fontWeight: 'bold',
17
17
  letterSpacing: 0.04,
18
18
  fontSize: 12,
19
19
  lineHeight: 16,
@@ -21,7 +21,12 @@ export default StyleSheet.create({
21
21
  textAlign: 'center',
22
22
  },
23
23
  textOnline: {
24
- fontStyle: 'bold',
24
+ letterSpacing: 0.04,
25
+ fontSize: 12,
26
+ lineHeight: 16,
27
+ fontStyle: 'normal',
28
+ fontWeight: 'bold',
29
+ color: Colors.Green11,
25
30
  },
26
31
  viewOnline: {
27
32
  backgroundColor: Colors.LightGreen,
@@ -13,13 +13,6 @@ const wrapComponent = (props) => (
13
13
  </SCProvider>
14
14
  );
15
15
 
16
- jest.mock('react', () => {
17
- return {
18
- ...jest.requireActual('react'),
19
- memo: (x) => x,
20
- };
21
- });
22
-
23
16
  const mockNavigate = jest.fn();
24
17
  jest.mock('@react-navigation/native', () => {
25
18
  return {
@@ -16,13 +16,6 @@ const wrapComponent = (props) => (
16
16
  </SCProvider>
17
17
  );
18
18
 
19
- jest.mock('react', () => {
20
- return {
21
- ...jest.requireActual('react'),
22
- memo: (x) => x,
23
- };
24
- });
25
-
26
19
  jest.mock('react-native-permissions', () => {
27
20
  return mock;
28
21
  });
@@ -23,13 +23,6 @@ jest.mock('@react-navigation/native', () => {
23
23
  };
24
24
  });
25
25
 
26
- jest.mock('react', () => {
27
- return {
28
- ...jest.requireActual('react'),
29
- memo: (x) => x,
30
- };
31
- });
32
-
33
26
  describe('Test HanetCameraDetail', () => {
34
27
  Date.now = jest.fn(() => new Date('2021-09-09T10:00:00.000Z'));
35
28
  let tree, props;
@@ -14,11 +14,6 @@ jest.mock('@react-navigation/native', () => {
14
14
  };
15
15
  });
16
16
 
17
- jest.mock('react', () => ({
18
- ...jest.requireActual('react'),
19
- memo: (x) => x,
20
- }));
21
-
22
17
  describe('Test HeaderUnit', () => {
23
18
  afterEach(() => {
24
19
  mockedGoBack.mockClear();
@@ -10,13 +10,6 @@ import { SCProvider } from '../../../../context';
10
10
  import API from '../../../../configs/API';
11
11
  import { getPusher } from '../../../../utils/Pusher';
12
12
 
13
- jest.mock('react', () => {
14
- return {
15
- ...jest.requireActual('react'),
16
- memo: (x) => x,
17
- };
18
- });
19
-
20
13
  const mock = new MockAdapter(api.axiosInstance);
21
14
 
22
15
  const wrapComponent = (configs = []) => (
@@ -215,6 +215,34 @@ const API = {
215
215
  LIST: () => '/chip_manager/developer_mode_chips/',
216
216
  DETAIL: (id) => `/chip_manager/developer_mode_chips/${id}/`,
217
217
  },
218
+ ZIGBEE: {
219
+ SEARCH_DEVICE: (id) => `/iot/modules/zigbee/chips/${id}/search_device/`,
220
+ DEVICE_CONFIGURATION: (id, deviceId) =>
221
+ `/iot/modules/zigbee/chips/${id}/sensors/${deviceId}/configuration/`,
222
+ CONFIGURATION: (id) => `/iot/modules/zigbee/chips/${id}/configuration/`,
223
+ DEVICE: (gatewayId) =>
224
+ `/iot/modules/zigbee/gateways/${gatewayId}/devices/`,
225
+ DEVICE_DETAIL: (gatewayId, deviceId) =>
226
+ `/iot/modules/zigbee/gateways/${gatewayId}/devices/${deviceId}/`,
227
+ CONFIG_MAP: (gatewayId, deviceId) =>
228
+ `/iot/modules/zigbee/gateways/${gatewayId}/devices/${deviceId}/config_maps/`,
229
+ ACTION: (gatewayId, deviceId) =>
230
+ `/iot/modules/zigbee/gateways/${gatewayId}/devices/${deviceId}/zigbee_actions/`,
231
+ },
232
+ MODBUS: {
233
+ DEVICE: (gatewayId) =>
234
+ `/iot/modules/modbus/gateways/${gatewayId}/devices/`,
235
+ DEVICE_DETAIL: (gatewayId, deviceId) =>
236
+ `/iot/modules/modbus/gateways/${gatewayId}/devices/${deviceId}/`,
237
+ REGISTER: (gatewayId, deviceId) =>
238
+ `/iot/modules/modbus/gateways/${gatewayId}/devices/${deviceId}/registers/`,
239
+ ACTION: (gatewayId, deviceId) =>
240
+ `/iot/modules/modbus/gateways/${gatewayId}/devices/${deviceId}/actions/`,
241
+ ACTION_DETAIL: (gatewayId, deviceId, actionId) =>
242
+ `/iot/modules/modbus/gateways/${gatewayId}/devices/${deviceId}/actions/${actionId}/`,
243
+ ACTION_ITEM_DETAIL: (actionId, actionItemId) =>
244
+ `/iot/modules/modbus/actions/${actionId}/items/${actionItemId}/`,
245
+ },
218
246
  },
219
247
  };
220
248
 
@@ -262,6 +262,7 @@ export default {
262
262
  ADD_SUB_UNIT_NAME_FIELD: 'ADD_SUB_UNIT_NAME_FIELD',
263
263
  ADD_SUB_UNIT_BUTTON_CHOOSE_PHOTO: 'ADD_SUB_UNIT_BUTTON_CHOOSE_PHOTO',
264
264
  ADD_SUB_UNIT_BUTTON_CHOOSE_LOCATION: 'ADD_SUB_UNIT_BUTTON_CHOOSE_LOCATION',
265
+ TITLE_SUB_UNIT: 'TITLE_SUB_UNIT',
265
266
 
266
267
  SCANNING_RESPONSE_TITLE: 'SCANNING_RESPONSE_TITLE',
267
268
  SCANNING_RESPONSE_DESCRIPTION: 'SCANNING_RESPONSE_DESCRIPTION',
@@ -342,6 +343,7 @@ export default {
342
343
  MANAGE_SUB_UNIT_NAME: 'MANAGE_SUB_UNIT_NAME',
343
344
  MANAGE_SUB_UNIT_REMOVE_BUTTON: 'MANAGE_SUB_UNIT_REMOVE_BUTTON',
344
345
  MANAGE_SUB_UNIT_SELECT_FILE_BUTTON: 'MANAGE_SUB_UNIT_SELECT_FILE_BUTTON',
346
+ MANAGE_SUB_UNIT: 'MANAGE_SUB_UNIT',
345
347
 
346
348
  BUTTON_POPUP_RESOLVED: 'BUTTON_POPUP_RESOLVED',
347
349
  BUTTON_POPUP_RESOLVED_TITLE: 'BUTTON_POPUP_RESOLVED_TITLE',
@@ -415,11 +417,13 @@ export default {
415
417
  SELECT_SUBUNIT_NAME: 'SELECT_SUBUNIT_NAME',
416
418
  SELECT_SUBUNIT_RADIO_BUTTON: 'SELECT_SUBUNIT_RADIO_BUTTON',
417
419
  SELECT_SUBUNIT_SELECT: 'SELECT_SUBUNIT_SELECT',
420
+ TEXT_SUB_UNIT: 'TEXT_SUB_UNIT',
418
421
 
419
422
  // Select unit
420
423
  SELECT_UNIT_NAME: 'SELECT_UNIT_NAME',
421
424
  SELECT_UNIT_RADIO_BUTTON: 'SELECT_UNIT_RADIO_BUTTON',
422
425
  SELECT_UNIT_SELECT: 'SELECT_UNIT_SELECT',
426
+ SELECT_UNIT: 'SELECT_UNIT',
423
427
  SELECT_MEMBER_UNIT: 'SELECT_MEMBER_UNIT',
424
428
 
425
429
  // select wifi
@@ -649,8 +653,17 @@ export default {
649
653
  BUTTON_REMOVE_EDIT_ACTION_LIST: 'BUTTON_REMOVE_EDIT_ACTION_LIST',
650
654
  // GATEWAY
651
655
  LIST_GATEWAY: 'LIST_GATEWAY',
656
+ GATEWAY_INFO_ALERT: 'GATEWAY_INFO_ALERT',
657
+ GATEWAY_INFO_BUTTON_GOTO_CONNECTION_METHODS:
658
+ 'GATEWAY_INFO_BUTTON_GOTO_CONNECTION_METHODS',
659
+ GATEWAY_INFO_BUTTON_DELETE_GATEWAY: 'GATEWAY_INFO_BUTTON_DELETE_GATEWAY',
660
+ MENU_POPPER_MORE: 'MENU_POPPER_MORE',
661
+ GATEWAY_CONNECTION_METHODS_TEXT: 'GATEWAY_CONNECTION_METHODS_TEXT',
652
662
  //Notification
653
663
  CUSTOM_TEXT: 'CUSTOM_TEXT',
654
664
  //ButtonWrapper
655
665
  BUTTON_WRAPPER: 'BUTTON_WRAPPER',
666
+ //devmod
667
+ TAB_PANE_CT_FLATLIST: 'TAB_PANE_CT_FLATLIST',
668
+ ROW_ITEM_DEVMOD: 'ROW_ITEM_DEVMOD',
656
669
  };
@@ -61,6 +61,7 @@ export const Colors = {
61
61
  Gray18: '#9B9A9B',
62
62
  Gray19: '#E5E5E5',
63
63
  Gray20: '#808080',
64
+ Gray21: '#F2F2F2',
64
65
 
65
66
  // Range Green
66
67
  Green1: '#F6FFED',
@@ -70,6 +71,7 @@ export const Colors = {
70
71
  Green8: '#D9F7BE',
71
72
  Green9: '#389E0D',
72
73
  Green10: '#237804',
74
+ Green11: '#008040',
73
75
 
74
76
  //Yellow
75
77
  Yellow6: '#FADB14',
@@ -112,6 +114,8 @@ export const Colors = {
112
114
  Blue11: '#096DD9',
113
115
  Blue12: '#0050B3',
114
116
  Blue13: '#E2F0F8',
117
+ Blue14: '#D9ECFF',
118
+ Blue15: '#99CCFF',
115
119
 
116
120
  //Range Volcano:
117
121
  Volcano3: '#FFBB96',