@eohjsc/react-native-smart-city 0.3.71 → 0.3.73

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 (177) hide show
  1. package/index.js +0 -2
  2. package/package.json +4 -5
  3. package/src/Images/ThreeButton/buttonCircleBig.png +0 -0
  4. package/src/Images/ThreeButton/buttonCircleSmall.png +0 -0
  5. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/index.js +1 -1
  6. package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLock.js +2 -2
  7. package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLockStyle.js +1 -1
  8. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +12 -11
  9. package/src/commons/ActionGroup/SliderRangeTemplate.js +2 -3
  10. package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +1 -0
  11. package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonCircle.test.js +52 -0
  12. package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonDefault.test.js +52 -0
  13. package/src/commons/ActionGroup/{__test__ → ThreeButtonTemplate/__test__}/ThreeButtonTemplate.test.js +21 -8
  14. package/src/commons/ActionGroup/ThreeButtonTemplate/components/ThreeButtonCircle.js +103 -0
  15. package/src/commons/ActionGroup/ThreeButtonTemplate/components/ThreeButtonCircleStyles.js +31 -0
  16. package/src/commons/ActionGroup/ThreeButtonTemplate/components/ThreeButtonDefault.js +96 -0
  17. package/src/commons/ActionGroup/{ThreeButtonTemplateStyle.js → ThreeButtonTemplate/components/ThreeButtonDefaultStyles.js} +11 -34
  18. package/src/commons/ActionGroup/{ThreeButtonTemplate.js → ThreeButtonTemplate/index.js} +48 -51
  19. package/src/commons/ActionGroup/ThreeButtonTemplate/styles.js +27 -0
  20. package/src/commons/ActionGroup/TwoButtonTemplate/index.js +1 -0
  21. package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +39 -34
  22. package/src/commons/ActionGroup/__test__/SliderRangeTemplate.test.js +1 -1
  23. package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +19 -10
  24. package/src/commons/ActionGroup/__test__/TimerActionTemplateWithutConfigValue.test.js +0 -1
  25. package/src/commons/ActionGroup/__test__/index.test.js +24 -16
  26. package/src/commons/ActionTemplate/__test__/index.test.js +5 -1
  27. package/src/commons/AlertAction/__test__/AlertAction.test.js +2 -2
  28. package/src/commons/Automate/__test__/ItemAutomate.test.js +1 -1
  29. package/src/commons/Calendar/__test__/Calendar.test.js +3 -5
  30. package/src/commons/CameraDevice/index.js +37 -22
  31. package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +3 -3
  32. package/src/commons/Dashboard/MyUnit/index.js +1 -1
  33. package/src/commons/Device/ConnectedViewHeader.js +2 -1
  34. package/src/commons/Device/DeviceAlertStatus.js +1 -1
  35. package/src/commons/Device/DisconnectedView.js +10 -14
  36. package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +1 -1
  37. package/src/commons/Device/HorizontalBarChart.js +1 -1
  38. package/src/commons/Device/LinearChart/LinearChart.test.js +10 -4
  39. package/src/commons/Device/LinearChart.js +5 -1
  40. package/src/commons/Device/SonosSpeaker/__test__/SonosSpeaker.test.js +1 -1
  41. package/src/commons/Device/SonosSpeaker/index.js +1 -1
  42. package/src/commons/Device/WindDirection/Compass/Compass.test.js +12 -27
  43. package/src/commons/Device/WindDirection/Compass/index.js +15 -23
  44. package/src/commons/Device/WindSpeed/__test__/Anemometer.test.js +4 -4
  45. package/src/commons/Device/WindSpeed/__test__/ChartInfo.test.js +2 -2
  46. package/src/commons/Device/__test__/ConnectedViewHeader.test.js +11 -8
  47. package/src/commons/Device/__test__/DisconnectedView.test.js +8 -45
  48. package/src/commons/DisplayChecking/__test__/DisplayChecking.test.js +1 -1
  49. package/src/commons/DisplayChecking/index.js +4 -3
  50. package/src/commons/DisplayChecking/styles.js +2 -2
  51. package/src/commons/MediaPlayer/index.js +2 -1
  52. package/src/commons/MediaPlayerDetail/MediaPlayerFull.js +1 -1
  53. package/src/commons/MediaPlayerDetail/__test__/MediaPlayerDetail.test.js +0 -1
  54. package/src/commons/MediaPlayerDetail/index.js +2 -3
  55. package/src/commons/MenuActionAddnew/__test__/MenuActionAddNew.test.js +2 -1
  56. package/src/commons/MenuActionList/__test__/MenuActionList.test.js +1 -1
  57. package/src/commons/MenuActionList/index.js +8 -70
  58. package/src/commons/MenuActionList/styles.js +68 -0
  59. package/src/commons/Modal/__test__/ModalBottom.test.js +1 -10
  60. package/src/commons/OneTapTemplate/StatesGridActionTemplate.js +45 -31
  61. package/src/commons/OneTapTemplate/__test__/NumberUpDownActionTemplate.test.js +15 -13
  62. package/src/commons/OneTapTemplate/__test__/OptionsDropdownActionTemplate.test.js +12 -9
  63. package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +19 -13
  64. package/src/commons/PreventAccess/__test__/PreventAccess.test.js +5 -5
  65. package/src/commons/PreventAccess/index.js +3 -3
  66. package/src/commons/Sharing/__test__/MemberList.test.js +17 -6
  67. package/src/commons/Sharing/__test__/RowMember.test.js +0 -2
  68. package/src/commons/SubUnit/OneTap/index.js +6 -1
  69. package/src/commons/Today/__test__/Today.test.js +3 -3
  70. package/src/commons/UnitSummary/ConfigHistoryChart/__test__/ConfigHistoryChart.test.js +1 -1
  71. package/src/configs/IOPinConstants.js +285 -0
  72. package/src/configs/SCConfig.js +3 -0
  73. package/src/hooks/IoT/useBluetoothConnection.js +2 -1
  74. package/src/libs/react-native-parallax-scroll-view/index.js +2 -1
  75. package/src/navigations/AllGatewayStack.js +3 -3
  76. package/src/navigations/UnitStack.js +0 -6
  77. package/src/screens/ActivityLog/__test__/index.test.js +16 -22
  78. package/src/screens/ActivityLog/index.js +2 -3
  79. package/src/screens/AddLocationMaps/index.js +1 -1
  80. package/src/screens/AddNewAction/SelectAction.js +3 -0
  81. package/src/screens/AddNewAction/SetupSensor.js +3 -3
  82. package/src/screens/AddNewAction/__test__/SelectAction.test.js +12 -0
  83. package/src/screens/AddNewAction/__test__/SetupSensor.test.js +11 -24
  84. package/src/screens/AddNewGateway/ConnectingWifiGuide.js +4 -1
  85. package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectRouterGuide.test.js +0 -1
  86. package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +0 -1
  87. package/src/screens/AddNewGateway/PlugAndPlay/__test__/ZigbeeDeviceConnectGuide.test.js +0 -1
  88. package/src/screens/AddNewGateway/SetupGatewayWifiStyles.js +2 -2
  89. package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +22 -7
  90. package/src/screens/AllCamera/__test__/index.test.js +1 -1
  91. package/src/screens/AllCamera/index.js +1 -1
  92. package/src/screens/AllGateway/DetailConfigActionInternal/__test__/index.test.js +82 -0
  93. package/src/screens/AllGateway/DetailConfigActionInternal/index.js +84 -5
  94. package/src/screens/AllGateway/DetailConfigActionModbus/index.js +6 -4
  95. package/src/screens/AllGateway/DeviceInternalDetail/__test__/index.test.js +63 -57
  96. package/src/screens/AllGateway/DeviceInternalDetail/index.js +32 -32
  97. package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +40 -79
  98. package/src/screens/AllGateway/DeviceZigbeeDetail/__test__/index.test.js +36 -42
  99. package/src/screens/AllGateway/DeviceZigbeeDetail/index.js +4 -4
  100. package/src/screens/AllGateway/GatewayConnectionMethods/__test__/index.test.js +4 -1
  101. package/src/screens/AllGateway/GatewayConnectionMethods/index.js +4 -2
  102. package/src/screens/AllGateway/GatewayDetail/__test__/index.test.js +49 -61
  103. package/src/screens/AllGateway/GatewayDetail/index.js +2 -1
  104. package/src/screens/AllGateway/GatewayInfo/__test__/index.test.js +2 -1
  105. package/src/screens/AllGateway/components/Information/__test__/index.test.js +2 -1
  106. package/src/screens/AllGateway/components/Information/index.js +4 -2
  107. package/src/screens/AllGateway/components/TabPaneCT/__test__/index.test.js +1 -1
  108. package/src/screens/AllGateway/components/TabPaneCT/index.js +1 -1
  109. package/src/screens/AllGateway/hooks/useGateway.js +1 -0
  110. package/src/screens/AllGateway/test-utils.js +20 -0
  111. package/src/screens/Device/__test__/detail.test.js +8 -3
  112. package/src/screens/Device/components/SensorDisplayItem.js +1 -5
  113. package/src/screens/EmergencyContacts/EmergencyContactsList.js +1 -4
  114. package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +32 -4
  115. package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +7 -5
  116. package/src/screens/EmergencyContacts/__test__/hooks.test.js +1 -1
  117. package/src/screens/GuestInfo/__test__/index.test.js +26 -14
  118. package/src/screens/GuestInfo/index.js +2 -2
  119. package/src/screens/HanetCamera/CaptureFaceID.js +1 -1
  120. package/src/screens/HanetCamera/__test__/MemberInfo.test.js +1 -5
  121. package/src/screens/HanetCamera/styles/captureFaceIDStyles.js +1 -1
  122. package/src/screens/PlayBackCamera/Timer.js +2 -3
  123. package/src/screens/PlayBackCamera/__test__/index.test.js +69 -48
  124. package/src/screens/ScanChipQR/components/QRScan/index.js +8 -8
  125. package/src/screens/SharedUnit/__test__/ShareUnit.test.js +20 -10
  126. package/src/screens/SharedUnit/index.js +19 -17
  127. package/src/screens/Sharing/InfoMemberUnit.js +2 -2
  128. package/src/screens/SmartAccount/Connecting/index.js +2 -2
  129. package/src/screens/SmartAccount/ListDevice/__test__/DeviceItem.test.js +4 -2
  130. package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +17 -8
  131. package/src/screens/SmartAccount/ListDevice/index.js +1 -1
  132. package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +9 -6
  133. package/src/screens/SmartAccount/SuccessfullyConnected/index.js +1 -0
  134. package/src/screens/SmartAccount/__test__/Connecting.test.js +2 -1
  135. package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +17 -6
  136. package/src/screens/SubUnit/EditSubUnit.js +6 -6
  137. package/src/screens/SubUnit/EditSubUnitStyles.js +2 -2
  138. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +5 -6
  139. package/src/screens/SubUnit/__test__/Detail.test.js +2 -3
  140. package/src/screens/SubUnit/__test__/EditSubUnit.test.js +25 -10
  141. package/src/screens/Template/EditTemplate.js +13 -3
  142. package/src/screens/Template/__test__/EditTemplate.test.js +21 -15
  143. package/src/screens/Unit/Detail.js +157 -121
  144. package/src/screens/Unit/ManageUnit.js +3 -3
  145. package/src/screens/Unit/ManageUnitStyles.js +1 -1
  146. package/src/screens/Unit/SelectAddress.js +1 -1
  147. package/src/screens/Unit/__test__/Detail.test.js +40 -20
  148. package/src/screens/Unit/__test__/ManageUnit.test.js +18 -15
  149. package/src/screens/Unit/components/AutomateScript/index.js +9 -8
  150. package/src/screens/Unit/components/Header/index.js +1 -14
  151. package/src/screens/Unit/components/__test__/AutomateScript.test.js +10 -36
  152. package/src/screens/Unit/components/__test__/Header.test.js +14 -9
  153. package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +4 -5
  154. package/src/utils/I18n/translations/en.json +13 -12
  155. package/src/utils/I18n/translations/vi.json +12 -11
  156. package/src/utils/Route/index.js +1 -2
  157. package/src/utils/Utils.js +62 -2
  158. package/src/commons/Explore/ActivityIndicator/index.js +0 -49
  159. package/src/commons/Explore/CityItem/index.js +0 -116
  160. package/src/commons/Explore/HeaderExplore/index.js +0 -44
  161. package/src/commons/Explore/HeaderLabel/index.js +0 -46
  162. package/src/commons/Explore/LocationItem/index.js +0 -71
  163. package/src/commons/Explore/SearchBox/__test__/SearchBox.test.js +0 -58
  164. package/src/commons/Explore/SearchBox/index.js +0 -59
  165. package/src/commons/Explore/__test__/CityItem.test.js +0 -156
  166. package/src/commons/Explore/__test__/HeaderExplore.test.js +0 -25
  167. package/src/commons/Explore/__test__/HeaderLabel.test.js +0 -33
  168. package/src/commons/Explore/__test__/LocationItem.test.js +0 -31
  169. package/src/screens/Explore/__test__/Explore.test.js +0 -43
  170. package/src/screens/Explore/index.js +0 -201
  171. package/src/screens/Unit/MyAllUnit/index.js +0 -44
  172. package/src/screens/Unit/__test__/MyAllUnit.test.js +0 -87
  173. package/src/screens/Unit/components/ListMyAllUnit/index.js +0 -162
  174. package/src/screens/Unit/components/MyAllUnit/__test__/Header.test.js +0 -117
  175. package/src/screens/Unit/components/MyAllUnit/__test__/MyAllUnit.test.js +0 -36
  176. package/src/screens/Unit/components/MyAllUnit/__test__/index.test.js +0 -54
  177. package/src/screens/Unit/components/MyAllUnit/index.js +0 -44
@@ -1,117 +0,0 @@
1
- import React from 'react';
2
- import { TouchableOpacity } from 'react-native';
3
- import { act, create } from 'react-test-renderer';
4
- import { Colors } from '../../../../../configs';
5
- import { AccessibilityLabel } from '../../../../../configs/Constants';
6
- import HeaderUnit from '../../../../../commons/Unit/HeaderUnit';
7
- const mockGoBack = jest.fn();
8
-
9
- jest.mock('@react-navigation/native', () => {
10
- return {
11
- ...jest.requireActual('@react-navigation/native'),
12
- useNavigation: () => ({
13
- goBack: mockGoBack,
14
- }),
15
- };
16
- });
17
-
18
- describe('Test HeaderUnit', () => {
19
- let data;
20
- const mockOnBack = jest.fn();
21
- const mockOnAdd = jest.fn();
22
- const mockOnMore = jest.fn();
23
-
24
- beforeEach(() => {
25
- data = {
26
- transparent: false,
27
- onBack: mockOnBack,
28
- title: '',
29
- onAdd: mockOnAdd,
30
- onMore: mockOnMore,
31
- hideRight: false,
32
- hideRightPlus: false,
33
- styleBoxTitle: {},
34
- bottomBorder: {},
35
- };
36
- });
37
- let tree;
38
-
39
- it('onBack', async () => {
40
- await act(async () => {
41
- tree = await create(<HeaderUnit {...data} />);
42
- });
43
- const instance = tree.root;
44
- const button = instance.find(
45
- (el) =>
46
- el.props.accessibilityLabel ===
47
- AccessibilityLabel.HEADER_UNIT_BUTTON_BACK &&
48
- el.type === TouchableOpacity
49
- );
50
- await act(async () => {
51
- button.props.onPress();
52
- });
53
- expect(mockOnBack).toHaveBeenCalledTimes(1);
54
- });
55
-
56
- it('goBack', async () => {
57
- data.onBack = undefined;
58
- await act(async () => {
59
- tree = await create(<HeaderUnit {...data} />);
60
- });
61
- const instance = tree.root;
62
- const button = instance.find(
63
- (el) =>
64
- el.props.accessibilityLabel ===
65
- AccessibilityLabel.HEADER_UNIT_BUTTON_BACK &&
66
- el.type === TouchableOpacity
67
- );
68
- await act(async () => {
69
- button.props.onPress();
70
- });
71
- expect(mockGoBack).toHaveBeenCalledTimes(1);
72
- });
73
-
74
- it('onAdd', async () => {
75
- await act(async () => {
76
- tree = await create(<HeaderUnit {...data} />);
77
- });
78
- const instance = tree.root;
79
- const button = instance.find(
80
- (el) =>
81
- el.props.accessibilityLabel ===
82
- AccessibilityLabel.HEADER_UNIT_BUTTON_ADD &&
83
- el.type === TouchableOpacity
84
- );
85
- await act(async () => {
86
- button.props.onPress();
87
- });
88
- expect(mockOnAdd).toHaveBeenCalledTimes(1);
89
- });
90
-
91
- it('onMore', async () => {
92
- await act(async () => {
93
- tree = await create(<HeaderUnit {...data} />);
94
- });
95
- const instance = tree.root;
96
- const button = instance.find(
97
- (el) =>
98
- el.props.accessibilityLabel ===
99
- AccessibilityLabel.HEADER_UNIT_BUTTON_MORE &&
100
- el.type === TouchableOpacity
101
- );
102
- await act(async () => {
103
- button.props.onPress();
104
- });
105
- expect(mockOnMore).toHaveBeenCalledTimes(1);
106
- });
107
-
108
- it('transparent', async () => {
109
- data.transparent = true;
110
- await act(async () => {
111
- tree = await create(<HeaderUnit {...data} />);
112
- });
113
- const instance = tree.root;
114
- const iconPlus = instance.findByProps({ name: 'plus' });
115
- expect(iconPlus.props.color).toEqual(Colors.White);
116
- });
117
- });
@@ -1,36 +0,0 @@
1
- import React from 'react';
2
- import { View } from 'react-native';
3
- import { act, create } from 'react-test-renderer';
4
- import MyAllUnit from '../index';
5
- import { SCProvider } from '../../../../../context';
6
- import { mockSCStore } from '../../../../../context/mockStore';
7
-
8
- const wrapComponent = (route) => (
9
- <SCProvider initState={mockSCStore({})}>
10
- <MyAllUnit route={route} />
11
- </SCProvider>
12
- );
13
- describe('Test MyAllUnit', () => {
14
- let tree;
15
- it('render MyAllUnit', async () => {
16
- const route = {
17
- params: {
18
- myUnits: [
19
- {
20
- background: '',
21
- name: '',
22
- stations: [
23
- { id: 1, name: 'station', sensors: [{ id: 1, name: 'sensor' }] },
24
- ],
25
- },
26
- ],
27
- },
28
- };
29
- await act(async () => {
30
- tree = await create(wrapComponent(route));
31
- });
32
- const instance = tree.root;
33
- const views = instance.findAllByType(View);
34
- expect(views).toHaveLength(37);
35
- });
36
- });
@@ -1,54 +0,0 @@
1
- import React from 'react';
2
- import { act, create } from 'react-test-renderer';
3
- import MyAllUnit from '../index';
4
- import Header from '../../Header';
5
- import { SCProvider } from '../../../../../context';
6
- import { mockSCStore } from '../../../../../context/mockStore';
7
-
8
- const wrapComponent = (props) => (
9
- <SCProvider initState={mockSCStore({})}>
10
- <MyAllUnit {...props} />
11
- </SCProvider>
12
- );
13
-
14
- it('test MyAllUnit', async () => {
15
- let tree, props;
16
- let mockGoBack = jest.fn();
17
-
18
- props = {
19
- route: {
20
- params: {
21
- myUnits: [
22
- {
23
- background: '',
24
- name: 'name',
25
- stations: [
26
- {
27
- name: 'station',
28
- sensors: [
29
- {
30
- name: 'sensor',
31
- },
32
- ],
33
- },
34
- ],
35
- },
36
- ],
37
- },
38
- },
39
- navigation: {
40
- goBack: mockGoBack,
41
- },
42
- };
43
-
44
- await act(async () => {
45
- tree = await create(wrapComponent(props));
46
- });
47
-
48
- const instance = tree.root;
49
- const header = instance.findByType(Header);
50
- await act(async () => {
51
- header.props.goBack();
52
- });
53
- expect(mockGoBack).toBeCalled();
54
- });
@@ -1,44 +0,0 @@
1
- import React, { useRef } from 'react';
2
- import { StyleSheet, View, Animated, ScrollView } from 'react-native';
3
- import { getStatusBarHeight } from 'react-native-iphone-x-helper';
4
-
5
- import Header from '../Header';
6
- import ListMyAllUnit from '../ListMyAllUnit';
7
- import { Colors } from '../../../../configs';
8
-
9
- const AnimatedScrollView = Animated.createAnimatedComponent(ScrollView);
10
-
11
- const MyAllUnit = ({ route, navigation }) => {
12
- const animatedScrollYValue = useRef(new Animated.Value(0)).current;
13
- const unitItems = route?.params?.myUnits;
14
-
15
- return (
16
- <View style={[styles.wrap, styles.backgroundWhite]}>
17
- <Header dark goBack={() => navigation.goBack()} />
18
- <AnimatedScrollView
19
- scrollEventThrottle={1}
20
- onScroll={Animated.event(
21
- [{ nativeEvent: { contentOffset: { y: animatedScrollYValue } } }],
22
- {
23
- useNativeDriver: true,
24
- }
25
- )}
26
- contentContainerStyle={styles.wrap}
27
- >
28
- <ListMyAllUnit unitItems={unitItems} />
29
- </AnimatedScrollView>
30
- </View>
31
- );
32
- };
33
-
34
- const styles = StyleSheet.create({
35
- wrap: {
36
- flex: 1,
37
- paddingTop: getStatusBarHeight() + 10,
38
- },
39
- backgroundWhite: {
40
- backgroundColor: Colors.White,
41
- },
42
- });
43
-
44
- export default MyAllUnit;