@eohjsc/react-native-smart-city 0.2.91 → 0.2.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/images/Device/air-dry.svg +3 -0
- package/assets/images/Device/auto.svg +3 -0
- package/assets/images/Device/circulator.svg +4 -0
- package/assets/images/Device/clean.svg +5 -0
- package/assets/images/Device/current-state.svg +3 -0
- package/assets/images/Device/door-state.svg +3 -0
- package/assets/images/Device/wind-strength.svg +12 -0
- package/package.json +1 -1
- package/src/commons/Action/ItemQuickAction.js +1 -0
- package/src/commons/Action/__test__/ItemQuickAction.test.js +49 -2
- package/src/commons/ActionGroup/ColorPickerTemplate.js +30 -24
- package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLock.js +60 -12
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +47 -0
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +2 -0
- package/src/commons/ActionGroup/OnOffTemplate/OnOffSimpleTemplateStyle.js +2 -1
- package/src/commons/ActionGroup/OnOffTemplate/index.js +48 -28
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +31 -11
- package/src/commons/ActionGroup/OptionsDropdownActionTemplateStyle.js +5 -2
- package/src/commons/ActionGroup/SliderRangeTemplate.js +19 -5
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +42 -36
- package/src/commons/ActionGroup/StatesGridActionTemplateStyle.js +5 -10
- package/src/commons/ActionGroup/TimerActionTemplate.js +14 -10
- package/src/commons/ActionGroup/TimerActionTemplateStyles.js +12 -0
- package/src/commons/ActionGroup/TwoButtonTemplate/TwoButtonTemplateStyles.js +55 -0
- package/src/commons/ActionGroup/TwoButtonTemplate/index.js +170 -0
- package/src/commons/ActionGroup/__test__/ColorPickerTemplate.test.js +74 -0
- package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +107 -0
- package/src/commons/ActionGroup/__test__/SliderRangeTemplate.test.js +71 -0
- package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +1 -1
- package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +112 -0
- package/src/commons/ActionGroup/index.js +4 -1
- package/src/commons/Calendar/index.js +5 -1
- package/src/commons/CameraDevice/index.js +6 -1
- package/src/commons/ConnectingProcess/__test__/Connecting.test.js +4 -1
- package/src/commons/Device/HistoryChart.js +2 -2
- package/src/commons/Device/HorizontalBarChart.js +6 -2
- package/src/commons/Device/ItemDevice.js +3 -13
- package/src/commons/Explore/SearchBox/__test__/SearchBox.test.js +19 -0
- package/src/commons/Explore/SearchBox/index.js +2 -0
- package/src/commons/IconComponent/index.js +32 -26
- package/src/commons/MediaPlayerDetail/index.js +16 -4
- package/src/commons/MenuActionMore/index.js +14 -1
- package/src/commons/Modal/ModalCustom.js +9 -1
- package/src/commons/SubUnit/Favorites/index.js +11 -41
- package/src/commons/SubUnit/ShortDetail.js +7 -41
- package/src/commons/SubUnit/__test__/Favorites.test.js +33 -35
- package/src/configs/API.js +4 -0
- package/src/configs/Colors.js +1 -0
- package/src/configs/Constants.js +29 -0
- package/src/context/actionType.ts +17 -0
- package/src/context/mockStore.ts +18 -0
- package/src/context/reducer.ts +102 -0
- package/src/hooks/Common/index.js +2 -0
- package/src/hooks/Common/useSensorsStatus.js +52 -0
- package/src/iot/RemoteControl/Bluetooth.js +2 -0
- package/src/iot/RemoteControl/GoogleHome.js +1 -0
- package/src/navigations/AutomateStack.js +16 -1
- package/src/navigations/UnitStack.js +27 -0
- package/src/screens/AddCommon/SelectSubUnit.js +1 -0
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +2 -0
- package/src/screens/AddNewAction/Device/__test__/index.test.js +1 -1
- package/src/screens/AddNewAction/SelectAction.js +13 -15
- package/src/screens/AddNewAction/__test__/SelectAction.test.js +0 -7
- package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +2 -0
- package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +2 -0
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectWifiWarning.test.js +10 -0
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/GatewayWifiList.test.js +15 -0
- package/src/screens/AddNewGateway/SetupGatewayWifi.js +6 -1
- package/src/screens/AddNewGateway/__test__/SelectGateway.test.js +61 -0
- package/src/screens/AddNewGateway/__test__/SetupGateway.test.js +34 -0
- package/src/screens/AllCamera/index.js +1 -0
- package/src/screens/Automate/MultiUnits.js +9 -9
- package/src/screens/Automate/index.js +21 -20
- package/src/screens/Device/__test__/DetailHistoryChart.test.js +40 -0
- package/src/screens/Device/__test__/detail.test.js +119 -86
- package/src/screens/Device/detail.js +38 -51
- package/src/screens/Device/hooks/useFavoriteDevice.js +38 -0
- package/src/screens/EmergencyContacts/EmergencyContactsList.js +1 -1
- package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +41 -44
- package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +1 -0
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +18 -19
- package/src/screens/HanetCamera/Detail.js +20 -13
- package/src/screens/HanetCamera/ManageAccess.js +10 -52
- package/src/screens/HanetCamera/MemberInfo.js +59 -13
- package/src/screens/HanetCamera/__test__/ManageAccess.test.js +19 -0
- package/src/screens/HanetCamera/__test__/MemberInfo.test.js +57 -10
- package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +90 -0
- package/src/screens/HanetCamera/hooks/__test__/useHanetCheckinData.test.js +9 -12
- package/src/screens/HanetCamera/hooks/useHanetCheckinData.js +10 -7
- package/src/screens/HanetCamera/styles/manageAccessStyles.js +0 -14
- package/src/screens/MoveToAnotherSubUnit/index.js +3 -1
- package/src/screens/Notification/__test__/NotificationItem.test.js +64 -53
- package/src/screens/Notification/components/NotificationItem.js +13 -4
- package/src/screens/ScriptDetail/__test__/index.test.js +15 -4
- package/src/screens/ScriptDetail/hooks/useStarredScript.js +32 -0
- package/src/screens/ScriptDetail/index.js +11 -20
- package/src/screens/SharedUnit/__test__/TabHeader.test.js +5 -0
- package/src/screens/Sharing/SelectUser.js +3 -23
- package/src/screens/Sharing/__test__/SelectUser.test.js +12 -80
- package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +33 -0
- package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +2 -0
- package/src/screens/Unit/ChooseLocation.js +5 -0
- package/src/screens/Unit/Detail.js +34 -44
- package/src/screens/Unit/ManageUnit.js +21 -20
- package/src/screens/Unit/ManageUnitStyles.js +1 -0
- package/src/screens/Unit/SelectAddress.js +8 -2
- package/src/screens/Unit/Summaries.js +12 -15
- package/src/screens/Unit/__test__/Detail.test.js +25 -0
- package/src/screens/Unit/components/MyUnitDevice/index.js +13 -10
- package/src/screens/Unit/components/__test__/Header.test.js +32 -0
- package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +2 -2
- package/src/screens/Unit/hook/useFavorites.js +28 -0
- package/src/utils/Apis/axios.js +7 -2
- package/src/utils/I18n/translations/en.json +3 -5
- package/src/utils/I18n/translations/vi.json +2 -4
|
@@ -43,7 +43,7 @@ describe('Test MyUnitDevice', () => {
|
|
|
43
43
|
});
|
|
44
44
|
const instance = tree.root;
|
|
45
45
|
const Views = instance.findAllByType(View);
|
|
46
|
-
expect(Views).toHaveLength(
|
|
46
|
+
expect(Views).toHaveLength(11);
|
|
47
47
|
|
|
48
48
|
const touches = instance.findAllByType(TouchableOpacity);
|
|
49
49
|
expect(touches).toHaveLength(1);
|
|
@@ -60,6 +60,6 @@ describe('Test MyUnitDevice', () => {
|
|
|
60
60
|
});
|
|
61
61
|
const instance = tree.root;
|
|
62
62
|
const Views = instance.findAllByType(View);
|
|
63
|
-
expect(Views).toHaveLength(
|
|
63
|
+
expect(Views).toHaveLength(11);
|
|
64
64
|
});
|
|
65
65
|
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { useSCContextSelector } from '../../../context';
|
|
3
|
+
|
|
4
|
+
export const useFavorites = (stations, automatesData) => {
|
|
5
|
+
const favoriteDeviceIds = useSCContextSelector(
|
|
6
|
+
(state) => state.unit.favoriteDeviceIds
|
|
7
|
+
);
|
|
8
|
+
const starredScriptIds = useSCContextSelector(
|
|
9
|
+
(state) => state.automate.starredScriptIds
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
const favoriteDevices = useMemo(() => {
|
|
13
|
+
return []
|
|
14
|
+
.concat(...stations.map((station) => station.sensors || []))
|
|
15
|
+
.filter((device) => favoriteDeviceIds.includes(device.id));
|
|
16
|
+
}, [stations, favoriteDeviceIds]);
|
|
17
|
+
|
|
18
|
+
const favoriteAutomates = useMemo(() => {
|
|
19
|
+
return []
|
|
20
|
+
.concat(...automatesData.map((automateData) => automateData.data || []))
|
|
21
|
+
.filter((automate) => starredScriptIds.includes(automate?.script?.id));
|
|
22
|
+
}, [automatesData, starredScriptIds]);
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
favoriteDevices,
|
|
26
|
+
favoriteAutomates,
|
|
27
|
+
};
|
|
28
|
+
};
|
package/src/utils/Apis/axios.js
CHANGED
|
@@ -50,10 +50,11 @@ const parseErrorResponse = async (error) => {
|
|
|
50
50
|
error,
|
|
51
51
|
message,
|
|
52
52
|
data,
|
|
53
|
+
resp_status: error?.response?.status,
|
|
53
54
|
};
|
|
54
55
|
};
|
|
55
56
|
|
|
56
|
-
export async function axiosCache(URL) {
|
|
57
|
+
export async function axiosCache(URL, resp_status) {
|
|
57
58
|
const cacheKey = `@CACHE_REQUEST_${URL}`;
|
|
58
59
|
const cachedData = await getData(cacheKey);
|
|
59
60
|
if (!cachedData) {
|
|
@@ -64,6 +65,7 @@ export async function axiosCache(URL) {
|
|
|
64
65
|
success: true,
|
|
65
66
|
data: JSON.parse(cachedData),
|
|
66
67
|
cache: true,
|
|
68
|
+
resp_status,
|
|
67
69
|
};
|
|
68
70
|
}
|
|
69
71
|
|
|
@@ -89,7 +91,10 @@ export async function axiosGet(URL, config = {}, cache = false) {
|
|
|
89
91
|
if (cache) {
|
|
90
92
|
// only network error or server error
|
|
91
93
|
if (!error.response || error.response.status >= 500) {
|
|
92
|
-
return (
|
|
94
|
+
return (
|
|
95
|
+
(await axiosCache(URL, error.response.status)) ||
|
|
96
|
+
(await parseErrorResponse(error))
|
|
97
|
+
);
|
|
93
98
|
} else {
|
|
94
99
|
await deleteData(cacheKey);
|
|
95
100
|
}
|
|
@@ -646,7 +646,7 @@
|
|
|
646
646
|
"last_updated": "Last updated",
|
|
647
647
|
"emergency_contacts": "Emergency contacts",
|
|
648
648
|
"emergency_contacts_hint": "Set up Emergency contacts for this unit in order to call urgently when you’re in an emergency situation.",
|
|
649
|
-
"emergency_max_contacts": "Maximum
|
|
649
|
+
"emergency_max_contacts": "Maximum {number} contacts",
|
|
650
650
|
"parking_completed": "Parking Completed",
|
|
651
651
|
"please_move_your_car_and_drive_back_safely": "Please move your car and drive back safely. Thank you for using our service.",
|
|
652
652
|
"text_add_new_credit_card": "+ Add new credit card",
|
|
@@ -692,7 +692,7 @@
|
|
|
692
692
|
"text_notification_content_replace_water_filter": "Filter **%{number_coil}** of **%{device_name}** in **%{unit_name}**: **%{sub_unit_name}** has less than 10h remaining. Check and replace now.",
|
|
693
693
|
"text_notification_content_remove_unit_to_owner": "Unit **%{unit_name}** has been removed successfully.",
|
|
694
694
|
"text_notification_content_remove_unit_to_member": "Unit **%{unit_name}** has been removed by **%{unit_owner_name}**. You cannot access to this unit anymore.",
|
|
695
|
-
"text_notification_content_remove_member": "You were
|
|
695
|
+
"text_notification_content_remove_member": "You were removed from **%{unit_name}** by **%{unit_owner_name}**. You cannot access to this unit anymore.",
|
|
696
696
|
"text_notification_content_member_leave_unit": "**%{member_name}** has left **%{unit_name}**.",
|
|
697
697
|
"text_notification_content_rename_unit": "Unit **%{old_unit_name}** has been renamed to **%{new_unit_name}** by **%{owner_name}**.",
|
|
698
698
|
"text_notification_content_divice_disconnect": "**%{device_name}** at **%{unit_name}**: **%{sub_unit_name}** has been disconnected. Please check and reconnect.",
|
|
@@ -932,12 +932,10 @@
|
|
|
932
932
|
"deny": "DENY",
|
|
933
933
|
"allow": "ALLOW",
|
|
934
934
|
"avatar" : "Avatar",
|
|
935
|
-
"error_share_permission": "{text} {data} does not exist!",
|
|
936
|
-
"text_phone_share_permission": "The phone",
|
|
937
|
-
"text_email_share_permission": "Email",
|
|
938
935
|
"mask_off": "Mask off",
|
|
939
936
|
"mask_on": "Mask on",
|
|
940
937
|
"stranger": "Stranger",
|
|
938
|
+
"image_from_camera": "Image from camera",
|
|
941
939
|
"icon_unit": "Icon unit",
|
|
942
940
|
"lock": "LOCK",
|
|
943
941
|
"unlock": "UNLOCK",
|
|
@@ -664,7 +664,7 @@
|
|
|
664
664
|
"last_updated": "Đã cập nhật ",
|
|
665
665
|
"emergency_contacts": "Danh sách liên hệ khẩn cấp",
|
|
666
666
|
"emergency_contacts_hint": "Thiết lập danh bạ khẩn cấp cho địa điểm này để có thể liên lạc nhanh khi có tình huống khẩn cấp xảy ra.",
|
|
667
|
-
"emergency_max_contacts": "Tối đa
|
|
667
|
+
"emergency_max_contacts": "Tối đa {number} liên hệ",
|
|
668
668
|
"parking_completed": "Đỗ xe hoàn tất!",
|
|
669
669
|
"please_move_your_car_and_drive_back_safely": "Vui lòng dời xe của bạn khỏi vị trí đỗ.\nCảm ơn đã sử dụng dịch vụ đỗ xe SmartParking.",
|
|
670
670
|
"text_add_new_credit_card": "+ Thêm thẻ tín dụng",
|
|
@@ -934,12 +934,10 @@
|
|
|
934
934
|
"deny": "Từ chối",
|
|
935
935
|
"allow": "Cho phép",
|
|
936
936
|
"avatar" : "Ảnh đại diện",
|
|
937
|
-
"error_share_permission": "{text} {data} không tồn tại!",
|
|
938
|
-
"text_phone_share_permission": "Số điện thoại",
|
|
939
|
-
"text_email_share_permission": "Email",
|
|
940
937
|
"mask_off": "Không có khẩu trang",
|
|
941
938
|
"mask_on": "Có khẩu trang",
|
|
942
939
|
"stranger": "Người lạ",
|
|
940
|
+
"image_from_camera": "Ảnh chụp",
|
|
943
941
|
"icon_unit": "Ảnh đại diện địa điểm",
|
|
944
942
|
"lock": "KHÓA",
|
|
945
943
|
"unlock": "MỞ KHÓA",
|