@eohjsc/react-native-smart-city 0.3.90 → 0.3.91

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 +1 -1
  2. package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +1 -1
  3. package/src/commons/ActionTemplate/CurtainAction.js +2 -2
  4. package/src/commons/ActionTemplate/OnOffButtonAction.js +2 -2
  5. package/src/commons/ActionTemplate/OnOffSimpleAction.js +2 -2
  6. package/src/commons/ActionTemplate/OnOffSmartLockAction.js +2 -2
  7. package/src/commons/ActionTemplate/OneButtonAction.js +2 -2
  8. package/src/commons/ActionTemplate/ThreeButtonAction.js +2 -2
  9. package/src/commons/ActionTemplate/__test__/CurtainAction.test.js +1 -1
  10. package/src/commons/ActionTemplate/__test__/OnOffButtonAction.test.js +1 -1
  11. package/src/commons/ActionTemplate/__test__/OnOffSimpleAction.test.js +1 -1
  12. package/src/commons/ActionTemplate/__test__/OnOffSmartLockAction.test.js +1 -1
  13. package/src/commons/ActionTemplate/__test__/OneButtonAction.test.js +1 -1
  14. package/src/commons/ActionTemplate/__test__/ThreeButtonAction.test.js +1 -1
  15. package/src/commons/ActionTemplate/__test__/index.test.js +21 -70
  16. package/src/commons/ActionTemplate/index.js +19 -55
  17. package/src/commons/Alert/__test__/Alert.test.js +1 -1
  18. package/src/commons/Auth/__test__/OtpInputList.test.js +4 -2
  19. package/src/commons/Auth/__test__/SocialButton.test.js +4 -2
  20. package/src/commons/BackDefault/__test__/BackDefault.test.js +1 -1
  21. package/src/commons/Button/__test__/Button.test.js +1 -1
  22. package/src/commons/ButtonPopup/__test__/ButtonPopup.test.js +1 -1
  23. package/src/commons/Calendar/__test__/Calendar.test.js +1 -1
  24. package/src/commons/ChartLoading/__test__/ChartLoading.test.js +1 -1
  25. package/src/commons/CircleButton/__test__/CircleButton.test.js +1 -1
  26. package/src/commons/CircleView/__test__/CircleView.test.js +1 -1
  27. package/src/commons/DateTimeRangeChange/__test__/DateTimeButton.test.js +4 -2
  28. package/src/commons/DateTimeRangeChange/index.js +31 -48
  29. package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +2 -2
  30. package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +1 -1
  31. package/src/commons/Device/FlatListItems.js +1 -1
  32. package/src/commons/Device/Hanet/ItemHanetDevice.test.js +2 -2
  33. package/src/commons/Device/HistoryChart.js +6 -49
  34. package/src/commons/Device/LinearChart/LinearChart.test.js +1 -1
  35. package/src/commons/Device/ProgressBar/__test__/ProgressBar.test.js +1 -1
  36. package/src/commons/Device/RainningSensor/__test__/CurrentRainSensor.test.js +5 -5
  37. package/src/commons/Device/SonosSpeaker/__test__/SonosSpeaker.test.js +3 -3
  38. package/src/commons/Device/WindDirection/Compass/Compass.test.js +2 -2
  39. package/src/commons/Device/WindSpeed/LinearChart/index.js +1 -1
  40. package/src/commons/Device/__test__/DeviceAlertStatus.test.js +3 -3
  41. package/src/commons/Device/__test__/DisconnectedView.test.js +2 -2
  42. package/src/commons/Device/__test__/FlatListItems.test.js +1 -1
  43. package/src/commons/Device/__test__/SensorConnectedStatus.test.js +1 -1
  44. package/src/commons/DisplayChecking/__test__/DisplayChecking.test.js +1 -1
  45. package/src/commons/Form/__test__/CurrencyInput.test.js +2 -2
  46. package/src/commons/Form/__test__/TextInput.test.js +2 -2
  47. package/src/commons/Form/__test__/TextInputPassword.test.js +2 -2
  48. package/src/commons/FullLoading/__test__/index.test.js +2 -2
  49. package/src/commons/ImageButton/__test__/ImageButton.test.js +1 -1
  50. package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +2 -2
  51. package/src/commons/OneTapTemplate/OptionsDropdownActionTemplate.js +4 -4
  52. package/src/commons/OneTapTemplate/StatesGridActionTemplate.js +4 -4
  53. package/src/commons/OneTapTemplate/__test__/NumberUpDownActionTemplate.test.js +2 -2
  54. package/src/commons/OneTapTemplate/__test__/OptionsDropdownActionTemplate.test.js +1 -1
  55. package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +2 -2
  56. package/src/commons/RowItem/__test__/RowItem.test.js +1 -1
  57. package/src/commons/RowUser/__test__/RowUser.test.js +1 -1
  58. package/src/commons/Section/Section.test.js +2 -2
  59. package/src/commons/SelectSubUnit/__test__/SelectSubUnit.test.js +1 -1
  60. package/src/commons/SelectUnit/__test__/SelectUnit.test.js +3 -3
  61. package/src/commons/Sharing/__test__/ButtonRemoveMember.test.js +1 -1
  62. package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +1 -1
  63. package/src/commons/Sharing/__test__/MemberList.test.js +6 -4
  64. package/src/commons/Sharing/__test__/RowMember.test.js +2 -2
  65. package/src/commons/Sharing/__test__/StationDevicePermission.test.js +3 -3
  66. package/src/commons/Sharing/__test__/WrapHeaderScrollable.test.js +4 -2
  67. package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +2 -10
  68. package/src/commons/SubUnit/OneTap/index.js +3 -1
  69. package/src/commons/TextButton/__test__/TextButton.test.js +2 -2
  70. package/src/commons/Today/__test__/Today.test.js +1 -1
  71. package/src/commons/TouchableScale/__test__/TouchableScale.test.js +1 -1
  72. package/src/commons/UnitSummary/AirQuality/index.js +2 -2
  73. package/src/commons/UnitSummary/ConfigHistoryChart/index.js +0 -6
  74. package/src/commons/UnitSummary/__test__/TotalPowerBox.test.js +1 -1
  75. package/src/commons/UnitSummary/__test__/TotalPowerConsumption.test.js +1 -1
  76. package/src/commons/ViewButtonBottom/__test__/ViewButtonBottom.test.js +1 -1
  77. package/src/configs/API.js +9 -32
  78. package/src/configs/Constants.js +2 -30
  79. package/src/context/reducer.ts +3 -1
  80. package/src/hoc/__test__/withRemoteControl.test.js +1 -1
  81. package/src/navigations/UnitStack.js +23 -13
  82. package/src/screens/ActivityLog/FilterPopup.js +4 -4
  83. package/src/screens/ActivityLog/__test__/FilterPopup.test.js +2 -2
  84. package/src/screens/ActivityLog/__test__/index.test.js +2 -2
  85. package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +3 -3
  86. package/src/screens/AddCommon/__test__/SelectUnit.test.js +5 -5
  87. package/src/screens/AddNewAction/ChooseAction.js +180 -0
  88. package/src/screens/AddNewAction/ChooseConfig.js +207 -0
  89. package/src/screens/AddNewAction/Components/SelectDevices.js +75 -0
  90. package/src/screens/AddNewAction/Device/__test__/index.test.js +1 -1
  91. package/src/screens/AddNewAction/NewActionWrapper.js +55 -0
  92. package/src/screens/AddNewAction/SelectControlDevices.js +107 -0
  93. package/src/screens/AddNewAction/SelectMonitorDevices.js +142 -0
  94. package/src/screens/AddNewAction/SetupConfigCondition.js +245 -0
  95. package/src/screens/AddNewAction/Styles/SetupSensorStyles.js +1 -1
  96. package/src/screens/AddNewAction/__test__/{SelectAction.test.js → ChooseAction.test.js} +94 -114
  97. package/src/screens/AddNewAction/__test__/ChooseConfig.test.js +211 -0
  98. package/src/screens/AddNewAction/__test__/{SelectSensorDevices.test.js → SelectControlDevices.test.js} +32 -83
  99. package/src/screens/AddNewAction/__test__/SelectMonitorDevices.test.js +92 -0
  100. package/src/screens/AddNewAction/__test__/SetupSensor.test.js +9 -22
  101. package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +2 -3
  102. package/src/screens/AddNewAutoSmart/index.js +13 -33
  103. package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectRouterGuide.test.js +1 -1
  104. package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +1 -1
  105. package/src/screens/AddNewGateway/PlugAndPlay/__test__/ZigbeeDeviceConnectGuide.test.js +1 -1
  106. package/src/screens/AddNewGateway/__test__/ConnectingWifiGuide.test.js +1 -1
  107. package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +2 -2
  108. package/src/screens/AddNewGateway/__test__/ScanModbusQR.test.js +3 -3
  109. package/src/screens/AddNewGateway/__test__/ScanWifiDeviceQR.test.js +2 -2
  110. package/src/screens/AddNewGateway/__test__/SelectDeviceSubUnit.test.js +3 -3
  111. package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +1 -1
  112. package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +1 -1
  113. package/src/screens/AddNewOneTap/index.js +16 -7
  114. package/src/screens/AllCamera/__test__/index.test.js +18 -57
  115. package/src/screens/AllCamera/index.js +98 -30
  116. package/src/screens/Automate/MultiUnits.js +2 -2
  117. package/src/screens/Automate/__test__/MultiUnits.test.js +2 -2
  118. package/src/screens/Automate/__test__/index.test.js +19 -38
  119. package/src/screens/Automate/index.js +8 -3
  120. package/src/screens/Device/__test__/DetailHistoryChart.test.js +2 -2
  121. package/src/screens/Device/__test__/EmergencyCountdown.test.js +4 -2
  122. package/src/screens/Device/__test__/sensorDisplayItem.test.js +10 -10
  123. package/src/screens/Device/components/ChartWrapper.js +3 -3
  124. package/src/screens/Device/components/VisualChart.js +1 -1
  125. package/src/screens/Device/components/__test__/VisualChart.test.js +1 -1
  126. package/src/screens/Device/hooks/useEvaluateValue.js +8 -0
  127. package/src/screens/DeviceInfo/__test__/index.test.js +16 -18
  128. package/src/screens/DeviceInfo/index.js +6 -5
  129. package/src/screens/EditActionsList/__tests__/index.test.js +14 -6
  130. package/src/screens/Notification/__test__/Notification.test.js +65 -74
  131. package/src/screens/Notification/index.js +14 -14
  132. package/src/screens/ScriptDetail/__test__/index.test.js +2 -8
  133. package/src/screens/ScriptDetail/index.js +9 -88
  134. package/src/screens/ScriptDetail/utils.js +112 -0
  135. package/src/screens/SelectUnit/__test__/index.test.js +0 -5
  136. package/src/screens/SelectUnit/index.js +1 -2
  137. package/src/screens/Sharing/Components/TitleCheckBox.js +2 -2
  138. package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +3 -3
  139. package/src/screens/SmartAccount/__test__/Connecting.test.js +1 -1
  140. package/src/screens/SmartAccount/__test__/SmartAccount.test.js +3 -3
  141. package/src/screens/SmartIr/__test__/ButtonsBottom.test.js +1 -1
  142. package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +5 -5
  143. package/src/screens/SmartIr/__test__/SelectBrand.test.js +2 -2
  144. package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +2 -2
  145. package/src/screens/SmartIr/__test__/SmartIr.test.js +2 -2
  146. package/src/screens/Template/__test__/detail.test.js +10 -2
  147. package/src/screens/Unit/__test__/Detail.test.js +7 -13
  148. package/src/screens/Unit/components/__test__/Header.test.js +4 -4
  149. package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +1 -1
  150. package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +14 -6
  151. package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +1 -1
  152. package/src/screens/UnitSummary/components/Temperature/index.js +2 -2
  153. package/src/screens/UnitSummary/components/UvIndex/index.js +2 -2
  154. package/src/screens/UnitSummary/components/WaterQuality/index.js +2 -2
  155. package/src/screens/UnitSummary/components/__test__/TotalPowerBox.test.js +1 -1
  156. package/src/screens/UnitSummary/components/__test__/TotalPowerConsumption.test.js +1 -1
  157. package/src/screens/UnitSummary/components/__test__/index.test.js +2 -2
  158. package/src/utils/Apis/axios.js +3 -0
  159. package/src/utils/I18n/translations/en.json +1 -0
  160. package/src/utils/I18n/translations/vi.json +1 -0
  161. package/src/utils/Route/index.js +6 -3
  162. package/src/screens/AddNewAction/SelectAction.js +0 -570
  163. package/src/screens/AddNewAction/SelectSensorDevices.js +0 -236
  164. package/src/screens/AddNewAction/SetupSensor.js +0 -263
@@ -44,13 +44,13 @@ const ActionItem = ({
44
44
  );
45
45
  };
46
46
 
47
- const StatesGridActionTemplate = ({ device, data, onSelectAction }) => {
47
+ const StatesGridActionTemplate = ({ device, item, onSelectAction }) => {
48
48
  const t = useTranslations();
49
49
  const [visible, setVisible] = useState(false);
50
50
  const [actionName, setActionName] = useState(null);
51
51
  const onClose = useCallback(() => setVisible(false), []);
52
52
  const onPress = useCallback(() => setVisible(true), []);
53
- const { title, configuration, template } = data;
53
+ const { title, configuration, template } = item;
54
54
  const { options } = configuration;
55
55
 
56
56
  return (
@@ -68,9 +68,9 @@ const StatesGridActionTemplate = ({ device, data, onSelectAction }) => {
68
68
  >
69
69
  <View style={styles.popoverStyle}>
70
70
  <View style={styles.modalContent}>
71
- {options.map((item, index) => (
71
+ {options.map((option, index) => (
72
72
  <ActionItem
73
- item={item}
73
+ item={option}
74
74
  key={index}
75
75
  setActionName={setActionName}
76
76
  onSelectAction={onSelectAction}
@@ -11,10 +11,10 @@ import SelectActionCard from '../../SelectActionCard';
11
11
 
12
12
  const mockOnSelectAction = jest.fn();
13
13
 
14
- const wrapComponent = (data) => (
14
+ const wrapComponent = (item) => (
15
15
  <SCProvider initState={mockSCStore({})}>
16
16
  <NumberUpDownActionTemplate
17
- data={data}
17
+ item={item}
18
18
  onSelectAction={mockOnSelectAction}
19
19
  />
20
20
  </SCProvider>
@@ -14,7 +14,7 @@ const mockOnSelectAction = jest.fn();
14
14
  const wrapComponent = (data) => (
15
15
  <SCProvider initState={mockSCStore({})}>
16
16
  <OptionsDropdownActionTemplate
17
- data={data}
17
+ item={data}
18
18
  onSelectAction={mockOnSelectAction}
19
19
  />
20
20
  </SCProvider>
@@ -10,9 +10,9 @@ import SelectActionCard from '../../SelectActionCard';
10
10
 
11
11
  const mockOnSelectAction = jest.fn();
12
12
 
13
- const wrapComponent = (data) => (
13
+ const wrapComponent = (item) => (
14
14
  <SCProvider initState={mockSCStore({})}>
15
- <StatesGridActionTemplate data={data} onSelectAction={mockOnSelectAction} />
15
+ <StatesGridActionTemplate item={item} onSelectAction={mockOnSelectAction} />
16
16
  </SCProvider>
17
17
  );
18
18
 
@@ -7,7 +7,7 @@ describe('Test RowUser', () => {
7
7
  let tree;
8
8
  it('create RowUser', async () => {
9
9
  await act(async () => {
10
- tree = renderer.create(<RowItem text="Text" type="primary" />);
10
+ tree = await renderer.create(<RowItem text="Text" type="primary" />);
11
11
  });
12
12
  const instance = tree.root;
13
13
  const buttons = instance.findAllByType(TouchableOpacity);
@@ -7,7 +7,7 @@ describe('Test RowUser', () => {
7
7
  let tree;
8
8
  it('create RowUser', async () => {
9
9
  await act(async () => {
10
- tree = renderer.create(<RowUser text="Text" type="disable" />);
10
+ tree = await renderer.create(<RowUser text="Text" type="disable" />);
11
11
  });
12
12
  const instance = tree.root;
13
13
  const buttons = instance.findAllByType(TouchableWithoutFeedback);
@@ -14,7 +14,7 @@ describe('Section', () => {
14
14
  </Section>
15
15
  );
16
16
  await act(async () => {
17
- tree = renderer.create(component);
17
+ tree = await renderer.create(component);
18
18
  });
19
19
  const instance = tree.root;
20
20
  const Views = instance.findAllByType(View);
@@ -29,7 +29,7 @@ describe('Section', () => {
29
29
  </Section>
30
30
  );
31
31
  await act(async () => {
32
- tree = renderer.create(component);
32
+ tree = await renderer.create(component);
33
33
  });
34
34
  const instance = tree.root;
35
35
  const Views = instance.findAllByType(View);
@@ -94,7 +94,7 @@ describe('Test SelectSubUnit', () => {
94
94
  it('test ViewButtonBottom leftClick', async () => {
95
95
  const route = { params: { addType: 'AddNewGateway' } };
96
96
  await act(async () => {
97
- tree = renderer.create(wrapComponent(route));
97
+ tree = await renderer.create(wrapComponent(route));
98
98
  });
99
99
  const instance = tree.root;
100
100
  const viewButtonBottom = instance.findByType(ViewButtonBottom);
@@ -46,7 +46,7 @@ describe('test single SelectUnit', () => {
46
46
  };
47
47
  mock.onGet(API.SHARE.UNITS()).reply(200, response.data);
48
48
  await act(async () => {
49
- tree = renderer.create(wrapComponent());
49
+ tree = await renderer.create(wrapComponent());
50
50
  });
51
51
  const instance = tree.root;
52
52
  const unitName = instance.findAll(
@@ -80,7 +80,7 @@ describe('test single SelectUnit', () => {
80
80
  Platform.OS = 'ios';
81
81
  mock.onGet(500);
82
82
  await act(async () => {
83
- tree = renderer.create(wrapComponent());
83
+ tree = await renderer.create(wrapComponent());
84
84
  });
85
85
 
86
86
  const instance = tree.root;
@@ -102,7 +102,7 @@ describe('test single SelectUnit', () => {
102
102
 
103
103
  it('click goBack', async () => {
104
104
  await act(async () => {
105
- tree = renderer.create(wrapComponent());
105
+ tree = await renderer.create(wrapComponent());
106
106
  });
107
107
 
108
108
  const instance = tree.root;
@@ -9,7 +9,7 @@ describe('BtnRemoveMember', () => {
9
9
  it('BtnRemoveMember snapshot', async () => {
10
10
  const component = <BtnRemoveMember />;
11
11
  await act(async () => {
12
- tree = renderer.create(component);
12
+ tree = await renderer.create(component);
13
13
  });
14
14
  const instance = tree.root;
15
15
  const TouchableOpacities = instance.findAllByType(TouchableOpacity);
@@ -26,7 +26,7 @@ describe('Test DevicePermissionsCheckbox', () => {
26
26
  const mockFunction = jest.fn();
27
27
  it('test create DevicePermissionsCheckbox', async () => {
28
28
  await act(async () => {
29
- tree = renderer.create(wrapComponent(sensor, mockFunction));
29
+ tree = await renderer.create(wrapComponent(sensor, mockFunction));
30
30
  });
31
31
  const instance = tree.root;
32
32
  const dropdownButtons = instance.findAllByType(TouchableOpacity);
@@ -25,7 +25,7 @@ describe('MemberList', () => {
25
25
  it('MemberList snapshot id dataMember === ownerId', async () => {
26
26
  const dataMember = [{ id: 1, name: 'CEO' }];
27
27
  await act(async () => {
28
- tree = renderer.create(wrapComponent(dataMember, 1, 2, mockFunc));
28
+ tree = await renderer.create(wrapComponent(dataMember, 1, 2, mockFunc));
29
29
  });
30
30
  const instance = tree.root;
31
31
  const rowMember = instance.findByType(RowMember);
@@ -38,7 +38,9 @@ describe('MemberList', () => {
38
38
  it('MemberList snapshot id dataMember !== ownerId', async () => {
39
39
  const dataMember = [{ id: 1, name: 'CEO' }];
40
40
  await act(async () => {
41
- tree = renderer.create(wrapComponent(dataMember, 2, null, mockFunc));
41
+ tree = await renderer.create(
42
+ wrapComponent(dataMember, 2, null, mockFunc)
43
+ );
42
44
  });
43
45
  const instance = tree.root;
44
46
  const rowMember = instance.findByType(RowMember);
@@ -51,7 +53,7 @@ describe('MemberList', () => {
51
53
  it('MemberList snapshot id dataMember === currentUserId', async () => {
52
54
  const dataMember = [{ id: 1, name: 'CEO' }];
53
55
  await act(async () => {
54
- tree = renderer.create(wrapComponent(dataMember, 2, 1, mockFunc));
56
+ tree = await renderer.create(wrapComponent(dataMember, 2, 1, mockFunc));
55
57
  });
56
58
  const instance = tree.root;
57
59
  const rowMembers = instance.findAllByType(RowMember);
@@ -61,7 +63,7 @@ describe('MemberList', () => {
61
63
  it('MemberList dataMember null', async () => {
62
64
  const dataMember = [];
63
65
  await act(async () => {
64
- tree = renderer.create(wrapComponent(dataMember));
66
+ tree = await renderer.create(wrapComponent(dataMember));
65
67
  });
66
68
  const instance = tree.root;
67
69
  const textInputs = instance.findAllByType(RowMember);
@@ -22,7 +22,7 @@ describe('RowMember', () => {
22
22
  it('RowMember owner have name', async () => {
23
23
  const dataMember = { id: 1, name: 'CEO' };
24
24
  await act(async () => {
25
- tree = renderer.create(wrapComponent(dataMember, 1, 1, mockFunc));
25
+ tree = await renderer.create(wrapComponent(dataMember, 1, 1, mockFunc));
26
26
  });
27
27
  const instance = tree.root;
28
28
  const textInputs = instance.findAllByType(Text);
@@ -31,7 +31,7 @@ describe('RowMember', () => {
31
31
  it('RowMember owner dont have name show start of email ', async () => {
32
32
  const dataMember = { id: 1, name: '', email: 'abc@gmail.com' };
33
33
  await act(async () => {
34
- tree = renderer.create(wrapComponent(dataMember, 1, 1, mockFunc));
34
+ tree = await renderer.create(wrapComponent(dataMember, 1, 1, mockFunc));
35
35
  });
36
36
  const instance = tree.root;
37
37
  const textInputs = instance.findAllByType(Text);
@@ -28,7 +28,7 @@ describe('StationDevicePermission', () => {
28
28
  ],
29
29
  };
30
30
  await act(async () => {
31
- tree = renderer.create(wrapComponent(dataStation));
31
+ tree = await renderer.create(wrapComponent(dataStation));
32
32
  });
33
33
  const instance = tree.root;
34
34
  const textInputs = instance.findAllByType(TouchableOpacity);
@@ -56,7 +56,7 @@ describe('StationDevicePermission', () => {
56
56
  ],
57
57
  };
58
58
  await act(async () => {
59
- tree = renderer.create(wrapComponent(dataStation));
59
+ tree = await renderer.create(wrapComponent(dataStation));
60
60
  });
61
61
  const instance = tree.root;
62
62
  const textInputs = instance.findAllByType(TouchableOpacity);
@@ -75,7 +75,7 @@ describe('StationDevicePermission', () => {
75
75
  ],
76
76
  };
77
77
  await act(async () => {
78
- tree = renderer.create(wrapComponent(dataStation));
78
+ tree = await renderer.create(wrapComponent(dataStation));
79
79
  });
80
80
 
81
81
  const instance = tree.root;
@@ -9,7 +9,9 @@ describe('WrapHeaderScrollable', () => {
9
9
  it('WrapHeaderScrollable scroll to end', async () => {
10
10
  const loadMore = jest.fn();
11
11
  await act(async () => {
12
- tree = renderer.create(<WrapHeaderScrollable onLoadMore={loadMore} />);
12
+ tree = await renderer.create(
13
+ <WrapHeaderScrollable onLoadMore={loadMore} />
14
+ );
13
15
  });
14
16
  const root = tree.root;
15
17
  const scrollView = root.findByType(Animated.ScrollView);
@@ -22,7 +24,7 @@ describe('WrapHeaderScrollable', () => {
22
24
  it('WrapHeaderScrollable loadMore null', async () => {
23
25
  const loadMore = jest.fn();
24
26
  await act(async () => {
25
- tree = renderer.create(<WrapHeaderScrollable />);
27
+ tree = await renderer.create(<WrapHeaderScrollable />);
26
28
  });
27
29
  const root = tree.root;
28
30
  const scrollView = root.findByType(Animated.ScrollView);
@@ -14,6 +14,7 @@ import { mockSCStore } from '../../../../context/mockStore';
14
14
  import Routes from '../../../../utils/Route';
15
15
  import api from '../../../../utils/Apis/axios';
16
16
  import { API } from '../../../../configs';
17
+ import { useNavigation } from '@react-navigation/native';
17
18
 
18
19
  const mock = new MockAdapter(api.axiosInstance);
19
20
 
@@ -30,16 +31,6 @@ jest.mock('react-redux', () => {
30
31
  };
31
32
  });
32
33
 
33
- const mockedNavigate = jest.fn();
34
- jest.mock('@react-navigation/native', () => {
35
- return {
36
- ...jest.requireActual('@react-navigation/native'),
37
- useNavigation: () => ({
38
- navigate: mockedNavigate,
39
- }),
40
- };
41
- });
42
-
43
34
  let tree;
44
35
  let data = {
45
36
  isOwner: true,
@@ -65,6 +56,7 @@ let data = {
65
56
  };
66
57
 
67
58
  describe('test Item', () => {
59
+ const mockedNavigate = useNavigation().navigate;
68
60
  beforeEach(() => {
69
61
  mockedNavigate.mockClear();
70
62
  });
@@ -5,7 +5,7 @@ import { Section } from '../..';
5
5
  import ItemAddNew from '../../Device/ItemAddNew';
6
6
  import ItemOneTap from './ItemOneTap';
7
7
  import { useTranslations } from '../../../hooks/Common/useTranslations';
8
- import { useNavigation } from '@react-navigation/native';
8
+ import { useNavigation, useRoute } from '@react-navigation/native';
9
9
  import Routes from '../../../utils/Route/index.js';
10
10
  import { AUTOMATE_TYPE, AccessibilityLabel } from '../../../configs/Constants';
11
11
  import Text from '../../Text/index.js';
@@ -17,6 +17,7 @@ const SubUnitAutomate = ({ isOwner, listAutomate, unit, wrapItemStyle }) => {
17
17
  const { navigate } = useNavigation();
18
18
  const [automates, setAutomates] = useState(listAutomate[0]);
19
19
  const [indexAutomate, setIndexAutomate] = useState(0);
20
+ const { name: currentScreen } = useRoute();
20
21
  const handleOnAddNew = () => {
21
22
  switch (automates.type) {
22
23
  case AUTOMATE_TYPE.ONE_TAP:
@@ -26,6 +27,7 @@ const SubUnitAutomate = ({ isOwner, listAutomate, unit, wrapItemStyle }) => {
26
27
  navigate(Routes.AddNewAutoSmart, {
27
28
  type: AUTOMATE_TYPE.VALUE_CHANGE,
28
29
  unit,
30
+ closeScreen: currentScreen,
29
31
  });
30
32
  break;
31
33
  }
@@ -8,7 +8,7 @@ describe('create TextButton component', () => {
8
8
  it('create button auth', async () => {
9
9
  const mockFunc = jest.fn();
10
10
  await act(async () => {
11
- tree = renderer.create(
11
+ tree = await renderer.create(
12
12
  <TextButton
13
13
  key={'item_1'}
14
14
  primary={'primary'}
@@ -28,7 +28,7 @@ describe('create TextButton component', () => {
28
28
  it('create button ActivityIndicator', async () => {
29
29
  const mockFunc = jest.fn();
30
30
  await act(async () => {
31
- tree = renderer.create(
31
+ tree = await renderer.create(
32
32
  <TextButton
33
33
  loading={true}
34
34
  showIndicator={true}
@@ -16,7 +16,7 @@ describe('Test Today', () => {
16
16
  it('create Today', async () => {
17
17
  Date.now = jest.fn(() => new Date('2021-01-24T12:00:00.000Z'));
18
18
  await act(async () => {
19
- tree = renderer.create(wrapComponent());
19
+ tree = await renderer.create(wrapComponent());
20
20
  });
21
21
  const instance = tree.root;
22
22
  const texts = instance.findAllByType(Text);
@@ -8,7 +8,7 @@ describe('Test TouchableScale', () => {
8
8
  const mockFunc = jest.fn();
9
9
  it('create TouchableScale onPress', async () => {
10
10
  await act(async () => {
11
- tree = renderer.create(<TouchableScale onPress={mockFunc} />);
11
+ tree = await renderer.create(<TouchableScale onPress={mockFunc} />);
12
12
  });
13
13
  const instance = tree.root;
14
14
  const textInputs = instance.findAllByType(TouchableOpacity);
@@ -6,7 +6,7 @@ import { useTranslations } from '../../../hooks/Common/useTranslations';
6
6
  import { Colors } from '../../../configs';
7
7
  import { Section } from '../../../commons/index';
8
8
  import Text from '../../../commons/Text';
9
- import ConfigHistoryChart from '../ConfigHistoryChart';
9
+ import VisualChart from '../../../screens/Device/components/VisualChart';
10
10
 
11
11
  import SegmentedRoundDisplay from './SegmentedRoundDisplay';
12
12
  import { AccessibilityLabel } from '../../../configs/Constants';
@@ -166,7 +166,7 @@ const AirQuality = memo(({ summaryDetail }) => {
166
166
  )}
167
167
  {showBoxHistory && (
168
168
  <Section type={'border'}>
169
- <ConfigHistoryChart configs={configs} />
169
+ <VisualChart item={{ configuration: { configs } }} />
170
170
  </Section>
171
171
  )}
172
172
  </View>
@@ -6,12 +6,6 @@ import HistoryChart from '../../../commons/Device/HistoryChart';
6
6
  import { axiosGet } from '../../../utils/Apis/axios';
7
7
  import { getPusher } from '../../../utils/Pusher';
8
8
 
9
- export const dateTimeType = {
10
- date: 'date',
11
- time: 'time',
12
- dateTime: 'datetime',
13
- };
14
-
15
9
  const fetchDataS3 = async (url) => {
16
10
  const { data } = await axiosGet(url, {
17
11
  // todo Bang try not to use axiosGet
@@ -8,7 +8,7 @@ describe('Test Total Power Box', () => {
8
8
 
9
9
  it('render Total Power Box', async () => {
10
10
  await act(async () => {
11
- tree = renderer.create(<TotalPowerBox title={'titleTest'} />);
11
+ tree = await renderer.create(<TotalPowerBox title={'titleTest'} />);
12
12
  });
13
13
  const instance = tree.root;
14
14
  const item = instance.find(
@@ -20,7 +20,7 @@ describe('Test Total Power Consumption', () => {
20
20
 
21
21
  it('render Total Power Consumption', async () => {
22
22
  await act(async () => {
23
- tree = renderer.create(wrapComponent());
23
+ tree = await renderer.create(wrapComponent());
24
24
  });
25
25
  const instance = tree.root;
26
26
  const item = instance.find(
@@ -8,7 +8,7 @@ describe('Test TouchableScale', () => {
8
8
  const mockFunc = jest.fn();
9
9
  it('create TouchableScale onPress', async () => {
10
10
  await act(async () => {
11
- tree = renderer.create(
11
+ tree = await renderer.create(
12
12
  <ViewButtonBottom
13
13
  leftTitle={'leftTitle'}
14
14
  onLeftClick={mockFunc}
@@ -6,7 +6,6 @@ const API = {
6
6
  SHARED_UNITS: () => '/property_manager/shared_units/',
7
7
  CREATE_UNIT: () => '/property_manager/iot_dashboard/dev_mode/units/',
8
8
  UNIT_DETAIL: (id) => `/property_manager/units/${id}/`,
9
- UNITS_PUBLIC: () => '/property_manager/units/public/',
10
9
  UNIT_SUMMARY: (id) => `/property_manager/units/${id}/summary/`,
11
10
  UNIT_SUMMARY_DETAIL: (id, id2) =>
12
11
  `/property_manager/units/${id}/summary_detail/${id2}/`,
@@ -52,35 +51,25 @@ const API = {
52
51
  },
53
52
  },
54
53
  DEVICE: {
55
- SENSOR_DETAIL: (id) => `/property_manager/sensors/${id}/`,
54
+ SENSOR_DETAIL: (id) => `/property_manager/devices/${id}/`,
56
55
  DISPLAY: (id) => `/property_manager/devices/${id}/display/`,
57
56
  SIDE_MENU_DETAIL: (id, side_menu_id) =>
58
57
  `/property_manager/devices/${id}/display/side_menu/${side_menu_id}/`,
59
58
  DISPLAY_VALUES_V2: (id) =>
60
- `/property_manager/sensors/${id}/display_values_v2/`,
61
- DISPLAY_HISTORY: (id, hId) =>
62
- `/property_manager/sensors/${id}/display_history/`,
59
+ `/property_manager/devices/${id}/display_values_v2/`,
60
+ DISPLAY_HISTORY: (id) => `/property_manager/devices/${id}/display_history/`,
63
61
  REMOTE_CONTROL_OPTIONS: (id) =>
64
- `/property_manager/sensors/${id}/remote_control_options/`,
65
- TRIGGER_ACTION: (id) => `/property_manager/sensors/${id}/quick_action/`,
62
+ `/property_manager/devices/${id}/remote_control_options/`,
63
+ TRIGGER_ACTION: (id) => `/property_manager/devices/${id}/quick_action/`,
66
64
  SETUP: (id) => `/property_manager/devices/${id}/setup/`,
67
- CHECK_CONNECTION: (id) =>
68
- `/property_manager/sensors/${id}/check_connection/`,
69
- UPDATE_SENSOR: (unit_id, station_id, id) =>
70
- `/property_manager/${unit_id}/sub_units/${station_id}/devices/${id}/`,
71
- ACTIVITY_LOG: () => SCConfig.apiRoot + '/chip_manager/action_log',
72
- DISPLAY_ACTIONS: (id) =>
73
- SCConfig.apiRoot + `/property_manager/sensors/${id}/display_actions/`,
74
- DISPLAY_EVENTS: (id) =>
75
- SCConfig.apiRoot + `/property_manager/sensors/${id}/display_events/`,
65
+ ACTIVITY_LOG: () => '/chip_manager/action_log',
66
+ DISPLAY_ACTIONS: (id) => `/property_manager/devices/${id}/display_actions/`,
76
67
  CHANGE_SUB_UNIT: (unit_id, station_id, id) =>
77
68
  `/property_manager/${unit_id}/sub_units/${station_id}/devices/${id}/change_sub_unit/`,
78
69
  ADD_TO_FAVOURITES: (id) =>
79
- SCConfig.apiRoot + `/property_manager/devices/${id}/add_to_favourites/`,
70
+ `/property_manager/devices/${id}/add_to_favourites/`,
80
71
  REMOVE_FROM_FAVOURITES: (id) =>
81
- SCConfig.apiRoot +
82
72
  `/property_manager/devices/${id}/remove_from_favourites/`,
83
- END_DEVICE_DETAIL: (id) => `/property_manager/devices/${id}/`,
84
73
  },
85
74
  SHARED_SENSOR: {
86
75
  ACCESS: (id) => `/property_manager/shared_sensors/${id}/access/`,
@@ -104,8 +93,7 @@ const API = {
104
93
  UNSTAR_SCRIPT: (id) => `/property_manager/automate/${id}/unstar_script/`,
105
94
  GET_SMART: () => '/property_manager/automate/smart/',
106
95
  GET_ALL_UNITS: () => '/property_manager/units/all_unit/',
107
- GET_SENSOR_CONFIG: (id) =>
108
- `/property_manager/sensors/${id}/display_configs/`,
96
+ DISPLAY_CONFIGS: (id) => `/property_manager/devices/${id}/display_configs/`,
109
97
  GET_MULTI_UNITS: () => '/property_manager/automate/multi_unit/',
110
98
  ACTIVITY_LOG: (id) => `/property_manager/automate/${id}/logs/`,
111
99
  STARRED_SCRIPTS: () => '/property_manager/automate/starred_scripts/',
@@ -229,19 +217,10 @@ const API = {
229
217
  `/iot/modules/arduino/gateways/${gatewayId}/devices/${deviceId}/`,
230
218
  CONFIG_PINS: (gatewayId, deviceId) =>
231
219
  `/iot/modules/arduino/gateways/${gatewayId}/devices/${deviceId}/pins/`,
232
- CONFIG_PIN_DETAIL: (gatewayId, deviceId, configPinId) =>
233
- `/iot/modules/arduino/gateways/${gatewayId}/devices/${deviceId}/pins/${configPinId}/`,
234
220
  ACTION: (gatewayId, deviceId) =>
235
221
  `/iot/modules/arduino/gateways/${gatewayId}/devices/${deviceId}/actions/`,
236
- ACTION_DETAIL: (gatewayId, deviceId, actionId) =>
237
- `/iot/modules/arduino/gateways/${gatewayId}/devices/${deviceId}/actions/${actionId}/`,
238
222
  },
239
223
  ZIGBEE: {
240
- DETAIL: (id) => `/iot/modules/zigbee/gateways/${id}/`,
241
- SEARCH_DEVICE: (id) => `/iot/modules/zigbee/chips/${id}/search_device/`,
242
- DEVICE_CONFIGURATION: (id, deviceId) =>
243
- `/iot/modules/zigbee/chips/${id}/sensors/${deviceId}/configuration/`,
244
- CONFIGURATION: (id) => `/iot/modules/zigbee/chips/${id}/configuration/`,
245
224
  DEVICE: (gatewayId) =>
246
225
  `/iot/modules/zigbee/gateways/${gatewayId}/devices/`,
247
226
  DEVICE_DETAIL: (gatewayId, deviceId) =>
@@ -261,8 +240,6 @@ const API = {
261
240
  `/iot/modules/modbus/gateways/${gatewayId}/devices/${deviceId}/registers/`,
262
241
  ACTION: (gatewayId, deviceId) =>
263
242
  `/iot/modules/modbus/gateways/${gatewayId}/devices/${deviceId}/actions/`,
264
- ACTION_DETAIL: (gatewayId, deviceId, actionId) =>
265
- `/iot/modules/modbus/gateways/${gatewayId}/devices/${deviceId}/actions/${actionId}/`,
266
243
  },
267
244
  },
268
245
  };
@@ -149,36 +149,6 @@ export const SMART_TIVI_BUTTON = {
149
149
  CHANNEL_BUTTON: 'Channel',
150
150
  };
151
151
 
152
- export const AUTOMATE_SELECT = {
153
- SELECT_DEVICE: 'select_device',
154
- SELECT_SENSOR: 'select_sensor',
155
- };
156
-
157
- export const CONDITION_TYPES = {
158
- IS: 'IS',
159
- IS_BELOW: 'IS_BELOW',
160
- IS_ABOVE: 'IS_ABOVE',
161
- };
162
-
163
- export const STATE_VALUE_SENSOR_TYPES = [
164
- {
165
- type: 'smoke',
166
- stateValue: ['not_detected', 'detected'],
167
- },
168
- {
169
- type: 'fire',
170
- stateValue: ['not_detected', 'detected'],
171
- },
172
- {
173
- type: 'sos',
174
- stateValue: ['not_activated', 'activated'],
175
- },
176
- {
177
- type: 'door',
178
- stateValue: ['close', 'open'],
179
- },
180
- ];
181
-
182
152
  export const AUTOMATES = {
183
153
  one_tap: {
184
154
  value: AUTOMATE_TYPE.ONE_TAP,
@@ -301,4 +271,6 @@ export const PROBLEM_CODE = {
301
271
 
302
272
  export const DATE_TIME_FORMAT = {
303
273
  YMD: 'YYYY-MM-DD',
274
+ DMY: 'DD-MM-YYYY',
275
+ DMY_HM: 'DD-MM-YYYY HH:mm',
304
276
  };
@@ -411,7 +411,9 @@ export const reducer = (currentState: ContextData, action: Action) => {
411
411
  valueEvaluations: _.reduce(
412
412
  data,
413
413
  (dict, item) => {
414
- dict[item.config] = item;
414
+ item.configs.map((configId) => {
415
+ dict[configId] = item;
416
+ });
415
417
  return dict;
416
418
  },
417
419
  currentState.valueEvaluations
@@ -11,7 +11,7 @@ describe('Test withRemoteControl', () => {
11
11
  const Component = () => <></>;
12
12
  const WrappedComponent = withRemoteControl(Component);
13
13
  await act(async () => {
14
- tree = renderer.create(
14
+ tree = await renderer.create(
15
15
  <SCProvider initState={mockSCStore({})}>
16
16
  <WrappedComponent />
17
17
  </SCProvider>