@eohjsc/react-native-smart-city 0.2.96 → 0.2.99
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/README.md +35 -14
- package/package.json +16 -4
- package/src/commons/Action/ItemQuickAction.js +5 -2
- package/src/commons/ActionGroup/ColorPickerTemplate.js +1 -1
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +12 -4
- package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLock.js +7 -4
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/index.js +1 -0
- package/src/commons/ActionGroup/OnOffTemplate/OnOffSimpleTemplate.js +10 -10
- package/src/commons/ActionGroup/OnOffTemplate/index.js +18 -15
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +8 -2
- package/src/commons/ActionGroup/SliderRangeTemplate.js +1 -1
- package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +4 -1
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +14 -4
- package/src/commons/ActionGroup/TimerActionTemplate.js +9 -1
- package/src/commons/ActionGroup/TwoButtonTemplate/index.js +13 -9
- package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +14 -14
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +53 -78
- package/src/commons/ActionGroup/__test__/OneBigButtonTemplate.test.js +36 -20
- package/src/commons/Auth/AccountList.js +1 -1
- package/src/commons/{Connecting → Connecting}/__test__/Connecting.test.js +0 -0
- package/src/commons/{Connecting → Connecting}/index.js +0 -0
- package/src/commons/{Connecting → Connecting}/styles.js +0 -0
- package/src/commons/ConnectingProcess/index.js +1 -1
- package/src/commons/Device/HistoryChart.js +6 -2
- package/src/commons/Device/PMSensor/PMSensorIndicatior.js +16 -12
- package/src/commons/Device/PMSensor/PMSensorIndicatorStyles.js +3 -0
- package/src/commons/Device/WaterQualitySensor/ListQualityIndicator.js +1 -0
- package/src/commons/FieldTemplate/ChooseUserField/ChooseFieldStyles.js +25 -0
- package/src/commons/FieldTemplate/ChooseUserField/ChoosePopup.js +96 -0
- package/src/commons/FieldTemplate/ChooseUserField/ChoosePopupStyles.js +39 -0
- package/src/commons/FieldTemplate/ChooseUserField/__test__/index.test.js +113 -0
- package/src/commons/FieldTemplate/ChooseUserField/index.js +62 -0
- package/src/commons/FieldTemplate/PasscodeField/PasscodeFieldStyles.js +30 -0
- package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +93 -0
- package/src/commons/FieldTemplate/PasscodeField/index.js +43 -0
- package/src/commons/FieldTemplate/ScheduleField/ScheduleFieldStyles.js +13 -0
- package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +182 -0
- package/src/commons/FieldTemplate/ScheduleField/index.js +176 -0
- package/src/commons/FullLoading/index.js +2 -1
- package/src/commons/MenuActionAddnew/index.js +1 -0
- package/src/commons/MenuActionList/index.js +1 -0
- package/src/commons/MenuActionMore/index.js +1 -1
- package/src/commons/PreventAccess/__test__/PreventAccess.test.js +62 -0
- package/src/commons/PreventAccess/index.js +67 -0
- package/src/commons/PreventAccess/styles.js +33 -0
- package/src/commons/WheelDateTimePicker/index.js +2 -1
- package/src/configs/API.js +3 -0
- package/src/configs/Constants.js +16 -1
- package/src/iot/RemoteControl/GoogleHome.js +24 -11
- package/src/iot/RemoteControl/__test__/GoogleHome.test.js +32 -0
- package/src/navigations/UnitStack.js +8 -0
- package/src/screens/AQIGuide/index.js +1 -1
- package/src/screens/ActivityLog/FilterPopup.js +2 -0
- package/src/screens/AddCommon/SelectSubUnit.js +1 -0
- package/src/screens/AddCommon/SelectUnit.js +1 -0
- package/src/screens/AddLocationMaps/index.js +4 -1
- package/src/screens/AddNewAction/SelectSensorDevices.js +14 -3
- package/src/screens/AddNewAction/__test__/SelectSensorDevices.test.js +34 -92
- package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +3 -1
- package/src/screens/AddNewAutoSmart/index.js +5 -2
- package/src/screens/AddNewDevice/index.js +1 -0
- package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +1 -1
- package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +4 -1
- package/src/screens/AddNewGateway/SelectGateway.js +1 -0
- package/src/screens/AddNewGateway/SetupGatewayWifi.js +1 -0
- package/src/screens/AddNewGateway/index.js +1 -0
- package/src/screens/AddNewOneTap/__test__/AddNewOneTap.test.js +1 -1
- package/src/screens/AddNewOneTap/index.js +3 -2
- package/src/screens/Automate/index.js +2 -0
- package/src/screens/Device/__test__/detail.test.js +4 -4
- package/src/screens/Device/detail.js +44 -6
- package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +5 -2
- package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +14 -0
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +19 -1
- package/src/screens/EmergencySetting/index.js +4 -1
- package/src/screens/Explore/index.js +2 -0
- package/src/screens/GuestInfo/__test__/index.test.js +1 -1
- package/src/screens/GuestInfo/components/RecurringDetail.js +1 -0
- package/src/screens/GuestInfo/components/TemporaryDetail.js +2 -2
- package/src/screens/ManageAccess/index.js +1 -0
- package/src/screens/MoveToAnotherSubUnit/index.js +1 -1
- package/src/screens/ScanChipQR/components/QRScan/index.js +1 -0
- package/src/screens/ScriptDetail/index.js +3 -3
- package/src/screens/SelectUnit/__test__/index.test.js +1 -1
- package/src/screens/SelectUnit/index.js +5 -2
- package/src/screens/SetSchedule/index.js +6 -2
- package/src/screens/SharedUnit/index.js +2 -0
- package/src/screens/Sharing/MemberList.js +12 -11
- package/src/screens/Sharing/SelectPermission.js +1 -1
- package/src/screens/Sharing/hooks/index.js +3 -0
- package/src/screens/SideMenuDetail/SideMenuDetailStyles.js +28 -0
- package/src/screens/SideMenuDetail/__test__/index.test.js +165 -0
- package/src/screens/SideMenuDetail/index.js +149 -0
- package/src/screens/SmartIr/components/SelectBrand.js +1 -1
- package/src/screens/SubUnit/ManageSubUnit.js +1 -0
- package/src/screens/SyncLGDevice/AddLGDevice.js +1 -0
- package/src/screens/TDSGuide/index.js +4 -1
- package/src/screens/UVIndexGuide/index.js +1 -1
- package/src/screens/Unit/Detail.js +18 -5
- package/src/screens/Unit/SelectAddress.js +4 -1
- package/src/screens/Unit/Station/index.js +1 -0
- package/src/screens/Unit/Summaries.js +1 -1
- package/src/screens/Unit/__test__/Detail.test.js +25 -5
- package/src/screens/UnitSummary/__test__/index.test.js +32 -0
- package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +1 -1
- package/src/screens/WaterQualityGuide/index.js +1 -1
- package/src/utils/I18n/translations/en.json +5 -1
- package/src/utils/I18n/translations/vi.json +5 -1
- package/src/utils/Route/index.js +1 -0
|
@@ -13,7 +13,10 @@ const TDSGuide = memo(() => {
|
|
|
13
13
|
|
|
14
14
|
return (
|
|
15
15
|
<View style={styles.container}>
|
|
16
|
-
<ScrollView
|
|
16
|
+
<ScrollView
|
|
17
|
+
style={styles.paddingHorizontal16}
|
|
18
|
+
scrollIndicatorInsets={{ right: 1 }}
|
|
19
|
+
>
|
|
17
20
|
<Text
|
|
18
21
|
type="H3"
|
|
19
22
|
semibold
|
|
@@ -73,7 +73,7 @@ const UVIndexGuide = memo(() => {
|
|
|
73
73
|
const onPress = useCallback((item) => {}, []);
|
|
74
74
|
return (
|
|
75
75
|
<SafeAreaView style={styles.container}>
|
|
76
|
-
<ScrollView style={styles.container}>
|
|
76
|
+
<ScrollView style={styles.container} scrollIndicatorInsets={{ right: 1 }}>
|
|
77
77
|
{titles.map((item, index) => {
|
|
78
78
|
const { title, des } = item;
|
|
79
79
|
return (
|
|
@@ -47,6 +47,7 @@ import {
|
|
|
47
47
|
watchNotificationData,
|
|
48
48
|
unwatchNotificationData,
|
|
49
49
|
} from '../../utils/Monitor';
|
|
50
|
+
import PreventAccess from '../../commons/PreventAccess';
|
|
50
51
|
|
|
51
52
|
const UnitDetail = ({ route }) => {
|
|
52
53
|
const t = useTranslations();
|
|
@@ -63,14 +64,17 @@ const UnitDetail = ({ route }) => {
|
|
|
63
64
|
|
|
64
65
|
const isFocused = useIsFocused();
|
|
65
66
|
const { stateData, setAction } = useContext(SCContext);
|
|
66
|
-
const { navigate } = useNavigation();
|
|
67
|
+
const { navigate, goBack } = useNavigation();
|
|
67
68
|
const RouterHardware = useCallback(
|
|
68
69
|
(routeHardware) => () => {
|
|
69
70
|
navigate(routeHardware);
|
|
70
71
|
},
|
|
71
72
|
[navigate]
|
|
72
73
|
);
|
|
73
|
-
|
|
74
|
+
|
|
75
|
+
useBlockBackAndroid(
|
|
76
|
+
isSuccessfullyConnected ? RouterHardware(Routes.Dashboard) : goBack
|
|
77
|
+
);
|
|
74
78
|
const user = useSCContextSelector((state) => state?.auth?.account?.user);
|
|
75
79
|
const isLavidaSource = useSCContextSelector(
|
|
76
80
|
(state) => state.app.isLavidaSource
|
|
@@ -84,6 +88,8 @@ const UnitDetail = ({ route }) => {
|
|
|
84
88
|
const [station, setStation] = useState({});
|
|
85
89
|
const [indexStation, setIndexStation] = useState(0);
|
|
86
90
|
const [showAdd, setShowAdd, setHideAdd] = useBoolean();
|
|
91
|
+
const [showPreventAccess, setShowPreventAccess, setHidePreventAccess] =
|
|
92
|
+
useBoolean(false);
|
|
87
93
|
const [isFullScreen, setIsFullScreen] = useState(false);
|
|
88
94
|
const [dataFullScreen, setDataFullScreen] = useState();
|
|
89
95
|
const appState = useRef(AppState.currentState);
|
|
@@ -122,16 +128,18 @@ const UnitDetail = ({ route }) => {
|
|
|
122
128
|
|
|
123
129
|
const fetchDetails = useCallback(async () => {
|
|
124
130
|
getAutomates();
|
|
125
|
-
const { success, data } = await axiosGet(
|
|
131
|
+
const { success, data, resp_status } = await axiosGet(
|
|
126
132
|
API.UNIT.UNIT_DETAIL(unitId),
|
|
127
|
-
{},
|
|
133
|
+
{ headers: { 'Cache-Control': 'no-cache' } },
|
|
128
134
|
true
|
|
129
135
|
);
|
|
130
136
|
if (success) {
|
|
131
137
|
prepareData(data);
|
|
132
138
|
setUnit(data);
|
|
139
|
+
} else if (resp_status === 404) {
|
|
140
|
+
setShowPreventAccess();
|
|
133
141
|
}
|
|
134
|
-
}, [
|
|
142
|
+
}, [getAutomates, unitId, prepareData, setShowPreventAccess]);
|
|
135
143
|
|
|
136
144
|
const getAutomates = useCallback(async () => {
|
|
137
145
|
await fetchWithCache(
|
|
@@ -395,6 +403,11 @@ const UnitDetail = ({ route }) => {
|
|
|
395
403
|
modalStyles={styles.modal}
|
|
396
404
|
onClose={onClose}
|
|
397
405
|
/>
|
|
406
|
+
<PreventAccess
|
|
407
|
+
visible={showPreventAccess}
|
|
408
|
+
hidePreventAccess={setHidePreventAccess}
|
|
409
|
+
headerBodyText={'unit'}
|
|
410
|
+
/>
|
|
398
411
|
</WrapParallaxScrollView>
|
|
399
412
|
);
|
|
400
413
|
};
|
|
@@ -163,7 +163,10 @@ const SelectAddress = memo(({ route }) => {
|
|
|
163
163
|
<View style={styles.wrap}>
|
|
164
164
|
<View style={styles.searchLocation}>
|
|
165
165
|
<SearchBarLocation input={input} onTextInput={onTextInput} />
|
|
166
|
-
<ScrollView
|
|
166
|
+
<ScrollView
|
|
167
|
+
style={styles.searchData}
|
|
168
|
+
scrollIndicatorInsets={{ right: 1 }}
|
|
169
|
+
>
|
|
167
170
|
{searchData.map((item, index) => (
|
|
168
171
|
<RowLocation key={index} item={item} onPress={onPressRowLocation} />
|
|
169
172
|
))}
|
|
@@ -85,7 +85,7 @@ const Summaries = memo(({ unit }) => {
|
|
|
85
85
|
return (
|
|
86
86
|
<>
|
|
87
87
|
{!unitSummaries || !unitSummaries.length ? null : (
|
|
88
|
-
<ScrollView horizontal={true}>
|
|
88
|
+
<ScrollView horizontal={true} scrollIndicatorInsets={{ right: 1 }}>
|
|
89
89
|
{unitSummaries.map((item, index) => (
|
|
90
90
|
<SummaryItem key={index} item={item} goToSummary={goToSummary} />
|
|
91
91
|
))}
|
|
@@ -96,7 +96,11 @@ describe('Test UnitDetail', () => {
|
|
|
96
96
|
await renderer.create(wrapComponent(route));
|
|
97
97
|
});
|
|
98
98
|
|
|
99
|
-
expect(axios.get).toHaveBeenCalledWith(detailUnitApiUrl, {
|
|
99
|
+
expect(axios.get).toHaveBeenCalledWith(detailUnitApiUrl, {
|
|
100
|
+
headers: {
|
|
101
|
+
'Cache-Control': 'no-cache',
|
|
102
|
+
},
|
|
103
|
+
});
|
|
100
104
|
});
|
|
101
105
|
|
|
102
106
|
test('fetch unit detail no network then load from cache', async () => {
|
|
@@ -118,7 +122,11 @@ describe('Test UnitDetail', () => {
|
|
|
118
122
|
await renderer.create(wrapComponent(route, account));
|
|
119
123
|
});
|
|
120
124
|
|
|
121
|
-
expect(axios.get).toHaveBeenCalledWith(detailUnitApiUrl, {
|
|
125
|
+
expect(axios.get).toHaveBeenCalledWith(detailUnitApiUrl, {
|
|
126
|
+
headers: {
|
|
127
|
+
'Cache-Control': 'no-cache',
|
|
128
|
+
},
|
|
129
|
+
});
|
|
122
130
|
});
|
|
123
131
|
|
|
124
132
|
test('fetch unit detail no network and fail load from cache', async () => {
|
|
@@ -129,7 +137,11 @@ describe('Test UnitDetail', () => {
|
|
|
129
137
|
await renderer.create(wrapComponent(route, account));
|
|
130
138
|
});
|
|
131
139
|
|
|
132
|
-
expect(axios.get).toHaveBeenCalledWith(detailUnitApiUrl, {
|
|
140
|
+
expect(axios.get).toHaveBeenCalledWith(detailUnitApiUrl, {
|
|
141
|
+
headers: {
|
|
142
|
+
'Cache-Control': 'no-cache',
|
|
143
|
+
},
|
|
144
|
+
});
|
|
133
145
|
});
|
|
134
146
|
|
|
135
147
|
test('fetch unit summary empty', async () => {
|
|
@@ -193,7 +205,11 @@ describe('Test UnitDetail', () => {
|
|
|
193
205
|
await renderer.create(wrapComponent(route, account));
|
|
194
206
|
});
|
|
195
207
|
|
|
196
|
-
expect(axios.get).not.toHaveBeenCalledWith(summaryUnitApiUrl, {
|
|
208
|
+
expect(axios.get).not.toHaveBeenCalledWith(summaryUnitApiUrl, {
|
|
209
|
+
headers: {
|
|
210
|
+
'Cache-Control': 'no-cache',
|
|
211
|
+
},
|
|
212
|
+
});
|
|
197
213
|
});
|
|
198
214
|
|
|
199
215
|
test('fetch unit detail when refresh', async () => {
|
|
@@ -206,7 +222,11 @@ describe('Test UnitDetail', () => {
|
|
|
206
222
|
await act(async () => {
|
|
207
223
|
refreshControl.props.onRefresh();
|
|
208
224
|
});
|
|
209
|
-
expect(axios.get).toHaveBeenCalledWith(detailUnitApiUrl, {
|
|
225
|
+
expect(axios.get).toHaveBeenCalledWith(detailUnitApiUrl, {
|
|
226
|
+
headers: {
|
|
227
|
+
'Cache-Control': 'no-cache',
|
|
228
|
+
},
|
|
229
|
+
});
|
|
210
230
|
});
|
|
211
231
|
|
|
212
232
|
test('when unit has google home action then connect to google home', async () => {
|
|
@@ -43,6 +43,7 @@ describe('Test UnitSummary', () => {
|
|
|
43
43
|
Date.now = jest.fn(() => new Date('2021-01-24T12:00:00.000Z'));
|
|
44
44
|
route = {
|
|
45
45
|
params: {
|
|
46
|
+
unitId: 1,
|
|
46
47
|
unitData: {
|
|
47
48
|
id: 1,
|
|
48
49
|
},
|
|
@@ -114,6 +115,37 @@ describe('Test UnitSummary', () => {
|
|
|
114
115
|
);
|
|
115
116
|
});
|
|
116
117
|
|
|
118
|
+
test('render fetchUnitDetail success', async () => {
|
|
119
|
+
route = {
|
|
120
|
+
params: {
|
|
121
|
+
unitId: 1,
|
|
122
|
+
unitData: null,
|
|
123
|
+
summaryData: {
|
|
124
|
+
id: 1,
|
|
125
|
+
name: '',
|
|
126
|
+
screen: Routes.AirQuality,
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
jest.useFakeTimers();
|
|
131
|
+
const response = {
|
|
132
|
+
status: 200,
|
|
133
|
+
data: {
|
|
134
|
+
data: {},
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
axios.get.mockImplementation(async (url) => response);
|
|
138
|
+
|
|
139
|
+
act(() => {
|
|
140
|
+
tree = create(wrapComponent(route));
|
|
141
|
+
});
|
|
142
|
+
act(() => {
|
|
143
|
+
jest.runOnlyPendingTimers();
|
|
144
|
+
});
|
|
145
|
+
expect(axios.get).toHaveBeenCalled();
|
|
146
|
+
expect(axios.get).toHaveBeenCalledWith(API.UNIT.UNIT_DETAIL(1), {});
|
|
147
|
+
});
|
|
148
|
+
|
|
117
149
|
let list_value = [
|
|
118
150
|
Routes.AirQuality,
|
|
119
151
|
Routes.PowerConsumption,
|
|
@@ -207,7 +207,7 @@ const ThreePhasePowerConsumption = memo(({ summaryDetail }) => {
|
|
|
207
207
|
params.append('date_from', moment(startDate).format('YYYY-MM-DD'));
|
|
208
208
|
params.append('date_to', moment(endDate).format('YYYY-MM-DD'));
|
|
209
209
|
const { success, data } = await axiosGet(
|
|
210
|
-
API.VALUE_CONSUME.DISPLAY_HISTORY,
|
|
210
|
+
API.VALUE_CONSUME.DISPLAY_HISTORY(),
|
|
211
211
|
{
|
|
212
212
|
params,
|
|
213
213
|
}
|
|
@@ -270,7 +270,7 @@ const WaterQualityGuide = memo(({ route }) => {
|
|
|
270
270
|
|
|
271
271
|
return (
|
|
272
272
|
<SafeAreaView style={styles.container}>
|
|
273
|
-
<ScrollView style={styles.container}>
|
|
273
|
+
<ScrollView style={styles.container} scrollIndicatorInsets={{ right: 1 }}>
|
|
274
274
|
<View style={styles.wrapScroll}>
|
|
275
275
|
{titles.map((item, index) => {
|
|
276
276
|
const { title, des } = item;
|
|
@@ -982,5 +982,9 @@
|
|
|
982
982
|
"saving_contact_successful" : "Saving contact successful",
|
|
983
983
|
"maxmium_contacts": "Maxmium contacts",
|
|
984
984
|
"enter_password": "Enter Your Password",
|
|
985
|
-
"you_need_to_enter_password": "You need to enter password to perform this action"
|
|
985
|
+
"you_need_to_enter_password": "You need to enter password to perform this action",
|
|
986
|
+
"note": "Note",
|
|
987
|
+
"back": "Back",
|
|
988
|
+
"invaild_data": "Invaild data",
|
|
989
|
+
"This {name} was removed!" : "This {name} was removed!"
|
|
986
990
|
}
|
|
@@ -982,5 +982,9 @@
|
|
|
982
982
|
"search": "Tìm kiếm",
|
|
983
983
|
"connect_home_wifi" : "Kết nối Wifi của gia đình",
|
|
984
984
|
"saving_contact_successful" : "Lưu liên hệ thành công",
|
|
985
|
-
"maxmium_contacts": "Địa chỉ liên hệ tối đa"
|
|
985
|
+
"maxmium_contacts": "Địa chỉ liên hệ tối đa",
|
|
986
|
+
"note": "Lưu ý ",
|
|
987
|
+
"back": "Quay lại",
|
|
988
|
+
"invaild_data": "Dữ liệu không hợp lệ",
|
|
989
|
+
"This {name} was removed!" : "{Name} này đã bị xóa!"
|
|
986
990
|
}
|
package/src/utils/Route/index.js
CHANGED
|
@@ -136,6 +136,7 @@ const Routes = {
|
|
|
136
136
|
SmartAccount: 'SmartAccount',
|
|
137
137
|
SmartHomeDashboard: 'SmartHomeDashboard',
|
|
138
138
|
SetupGeneratePasscode: 'SetupGeneratePasscode',
|
|
139
|
+
SideMenuDetail: 'SideMenuDetail',
|
|
139
140
|
SelectDeviceType: 'SelectDeviceType',
|
|
140
141
|
SelectBrand: 'SelectBrand',
|
|
141
142
|
GroupButtonByType: 'GroupButtonByType',
|