@eohjsc/react-native-smart-city 0.2.58 → 0.2.62

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 (133) hide show
  1. package/README.md +115 -68
  2. package/assets/images/Map/MarkerGeolocation.svg +4 -0
  3. package/package.json +2 -2
  4. package/src/Images/Common/buttonLeftCurtain.png +0 -0
  5. package/src/Images/Common/buttonPause-center-curtain.png +0 -0
  6. package/src/Images/Common/buttonRightCurtain.png +0 -0
  7. package/src/commons/ActionGroup/CurtainButtonTemplate.js +147 -0
  8. package/src/commons/ActionGroup/CurtainButtonTemplateStyle.js +58 -0
  9. package/src/commons/ActionGroup/__test__/CurtainButtonTemplate.test.js +72 -0
  10. package/src/commons/ActionGroup/__test__/MenuActionAddSchedule.test.js +71 -0
  11. package/src/commons/ActionGroup/hooks/AccessScheduleDetailStyles.js +41 -0
  12. package/src/commons/ActionGroup/hooks/MenuActionAddSchedule.js +110 -0
  13. package/src/commons/ActionGroup/hooks/MenuActionAddScheduleStyle.js +69 -0
  14. package/src/commons/ActionGroup/hooks/RecurringDetail.js +97 -0
  15. package/src/commons/ActionGroup/index.js +3 -0
  16. package/src/commons/DateTimeRangeChange/DateTimeButton.js +7 -2
  17. package/src/commons/Device/HistoryChart.js +80 -81
  18. package/src/commons/Device/HorizontalBarChart.js +48 -31
  19. package/src/commons/Device/LinearChart.js +28 -1
  20. package/src/commons/Form/CurrencyInput.js +8 -1
  21. package/src/commons/FourButtonFilterHistory/__test__/FourButtonFilterHistory.test.js +48 -0
  22. package/src/commons/FourButtonFilterHistory/index.js +72 -0
  23. package/src/commons/FourButtonFilterHistory/styles.js +22 -0
  24. package/src/commons/ImagePicker/index.js +27 -33
  25. package/src/commons/MediaPlayerDetail/Styles/MediaPlayerDetailStyles.js +14 -0
  26. package/src/commons/MediaPlayerDetail/index.js +84 -41
  27. package/src/commons/SearchLocation/index.js +0 -1
  28. package/src/commons/SubUnit/OneTap/OneTapStyles.js +20 -1
  29. package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +151 -40
  30. package/src/commons/SubUnit/OneTap/index.js +64 -12
  31. package/src/commons/SubUnit/ShortDetail.js +1 -1
  32. package/src/commons/UnitSummary/AirQuality/index.js +9 -7
  33. package/src/commons/UnitSummary/ConfigHistoryChart.js +2 -1
  34. package/src/configs/API.js +8 -3
  35. package/src/configs/Constants.js +20 -1
  36. package/src/configs/Images.js +3 -0
  37. package/src/context/actionType.ts +5 -0
  38. package/src/context/mockStore.ts +3 -0
  39. package/src/context/reducer.ts +14 -0
  40. package/src/iot/RemoteControl/Bluetooth.js +6 -3
  41. package/src/iot/RemoteControl/GoogleHome.js +6 -3
  42. package/src/iot/RemoteControl/Internet.js +1 -0
  43. package/src/iot/RemoteControl/LG.js +2 -1
  44. package/src/iot/RemoteControl/index.js +13 -6
  45. package/src/navigations/SharedStack.js +11 -9
  46. package/src/navigations/UnitStack.js +52 -6
  47. package/src/screens/ActivityLog/FilterPopup.js +1 -1
  48. package/src/screens/ActivityLog/ItemLog.js +3 -3
  49. package/src/screens/ActivityLog/__test__/ItemLog.test.js +5 -2
  50. package/src/screens/ActivityLog/hooks/index.js +2 -1
  51. package/src/screens/ActivityLog/index.js +0 -1
  52. package/src/screens/AddLocationMaps/index.js +139 -44
  53. package/src/screens/AddLocationMaps/indexStyle.js +14 -12
  54. package/src/screens/AddNewAction/SelectAction.js +1 -0
  55. package/src/screens/AddNewAction/SelectSensorDevices.js +18 -11
  56. package/src/screens/AddNewAction/Styles/SelectSensorDevicesStyles.js +5 -1
  57. package/src/screens/AddNewAction/__test__/SelectSensorDevices.test.js +6 -1
  58. package/src/screens/Automate/MultiUnits.js +12 -9
  59. package/src/screens/Automate/__test__/MultiUnits.test.js +1 -1
  60. package/src/screens/Automate/__test__/index.test.js +14 -0
  61. package/src/screens/Automate/index.js +4 -2
  62. package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +61 -0
  63. package/src/screens/ConfirmUnitDeletion/index.js +64 -0
  64. package/src/screens/ConfirmUnitDeletion/styles.js +37 -0
  65. package/src/screens/Device/__test__/detail.test.js +3 -2
  66. package/src/screens/Device/detail.js +50 -14
  67. package/src/screens/Device/hooks/useDisconnectedDevice.js +2 -1
  68. package/src/screens/Device/styles.js +3 -3
  69. package/src/screens/EmergencySetting/__test__/DropDownItem.test.js +59 -0
  70. package/src/screens/EmergencySetting/__test__/index.test.js +27 -0
  71. package/src/screens/EmergencySetting/components/DropDownItem.js +54 -0
  72. package/src/screens/EmergencySetting/index.js +92 -0
  73. package/src/screens/EmergencySetting/styles/DropDownItem.js +38 -0
  74. package/src/screens/EmergencySetting/styles.js +25 -0
  75. package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +126 -0
  76. package/src/screens/MoveToAnotherSubUnit/index.js +88 -0
  77. package/src/screens/MoveToAnotherSubUnit/styles/MoveToAnotherSubUnitStyles.js +50 -0
  78. package/src/screens/Notification/__test__/Notification.test.js +3 -3
  79. package/src/screens/Notification/components/NotificationItem.js +3 -6
  80. package/src/screens/Notification/index.js +2 -2
  81. package/src/screens/ScriptDetail/Styles/indexStyles.js +0 -1
  82. package/src/screens/ScriptDetail/__test__/index.test.js +13 -0
  83. package/src/screens/ScriptDetail/index.js +21 -17
  84. package/src/screens/SelectUnit/index.js +2 -0
  85. package/src/screens/SubUnit/AddSubUnit.js +7 -6
  86. package/src/screens/SubUnit/AddSubUnitStyles.js +0 -2
  87. package/src/screens/SubUnit/EditSubUnit.js +16 -7
  88. package/src/screens/SubUnit/EditSubUnitStyles.js +2 -3
  89. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +4 -3
  90. package/src/screens/SubUnit/__test__/EditSubUnit.test.js +2 -2
  91. package/src/screens/TDSGuide/index.js +1 -1
  92. package/src/screens/Unit/ChooseLocation.js +96 -0
  93. package/src/screens/Unit/ChooseLocationStyles.js +26 -0
  94. package/src/screens/Unit/Detail.js +24 -8
  95. package/src/screens/Unit/ManageUnit.js +21 -27
  96. package/src/screens/Unit/SelectAddress.js +240 -0
  97. package/src/screens/Unit/SelectAddressStyles.js +48 -0
  98. package/src/screens/Unit/SmartAccount.js +25 -41
  99. package/src/screens/Unit/SmartAccountItem.js +2 -1
  100. package/src/screens/Unit/SmartAccountStyles.js +0 -1
  101. package/src/screens/Unit/__test__/ChooseLocation.test.js +112 -0
  102. package/src/screens/Unit/__test__/ManageUnit.test.js +0 -6
  103. package/src/screens/Unit/__test__/SelectAddress.test.js +216 -0
  104. package/src/screens/Unit/__test__/SmartAccount.test.js +24 -0
  105. package/src/screens/Unit/__test__/SmartAccountItem.test.js +72 -0
  106. package/src/screens/Unit/components/MyUnitDevice/index.js +21 -5
  107. package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +58 -59
  108. package/src/screens/UnitSummary/components/PowerConsumption/index.js +26 -22
  109. package/src/screens/UnitSummary/components/Temperature/ItemTemperature/index.js +2 -2
  110. package/src/screens/UnitSummary/components/Temperature/index.js +15 -14
  111. package/src/screens/UnitSummary/components/UvIndex/index.js +6 -5
  112. package/src/screens/UnitSummary/components/WaterQuality/index.js +9 -7
  113. package/src/screens/UnitSummary/index.js +11 -7
  114. package/src/screens/WaterQualityGuide/index.js +1 -0
  115. package/src/utils/Apis/axios.js +4 -4
  116. package/src/utils/I18n/translations/en.json +25 -3
  117. package/src/utils/I18n/translations/vi.json +28 -5
  118. package/src/utils/Route/index.js +5 -1
  119. package/src/utils/Utils.js +4 -0
  120. package/assets/images/AddLocationMaps/PinLocation.svg +0 -3
  121. package/assets/images/AddLocationMaps/Point.svg +0 -3
  122. package/src/commons/ThreeButtonHistory/CalendarHeader.js +0 -35
  123. package/src/commons/ThreeButtonHistory/CalendarHeaderStyles.js +0 -17
  124. package/src/commons/ThreeButtonHistory/SelectMonth.js +0 -53
  125. package/src/commons/ThreeButtonHistory/SelectMonthStyles.js +0 -29
  126. package/src/commons/ThreeButtonHistory/__test__/SelectMonth.test.js +0 -37
  127. package/src/commons/ThreeButtonHistory/__test__/ThreeButtonHistory.test.js +0 -240
  128. package/src/commons/ThreeButtonHistory/index.js +0 -310
  129. package/src/commons/ThreeButtonHistory/styles.js +0 -65
  130. package/src/screens/Unit/ManageUnit/index.js +0 -286
  131. package/src/screens/Unit/ManageUnit/index.test.js +0 -34
  132. package/src/screens/Unit/SelectLocation.js +0 -161
  133. package/src/screens/Unit/SelectLocationStyles.js +0 -114
@@ -1,161 +0,0 @@
1
- /* eslint-disable react-hooks/exhaustive-deps */
2
- import React, { memo, useCallback, useRef, useState } from 'react';
3
- import { View } from 'react-native';
4
-
5
- import MapView, { Marker, PROVIDER_GOOGLE } from 'react-native-maps';
6
- import BottomButtonView from '../../commons/BottomButtonView';
7
-
8
- import { useTranslations } from '../../hooks/Common/useTranslations';
9
- import { API } from '../../configs';
10
- import styles from './SelectLocationStyles';
11
- import SearchBarLocation from '../../commons/SearchLocation';
12
- import RowLocation from '../../commons/SearchLocation/RowLocation';
13
- import { axiosGet } from '../../utils/Apis/axios';
14
- import { ScrollView } from 'react-native';
15
- import { useNavigation } from '@react-navigation/native';
16
- import { SCConfig } from '../../configs';
17
- import Point from '../../../assets/images/AddLocationMaps/Point.svg';
18
-
19
- const initialRegion = {
20
- latitudeDelta: 0.0922,
21
- longitudeDelta: 0.0421,
22
- };
23
-
24
- const DEFAULT_LATITUDE = 10.7974046; // EoH center
25
- const DEFAULT_LONGITUDE = 106.7035663;
26
-
27
- const SelectLocation = memo(({ route }) => {
28
- const t = useTranslations();
29
- const { updateLocation } = route.params;
30
- const { goBack } = useNavigation();
31
- const [input, setInput] = useState('');
32
- const [searchData, setSearchData] = useState([]);
33
- const [searchedLocation, setSearchedLocation] = useState(null);
34
- const mapRef = useRef(null);
35
-
36
- const onTextInput = useCallback(async (input) => {
37
- setInput(input);
38
- if (!input) {
39
- setSearchData([]);
40
- setSearchedLocation(null);
41
- return;
42
- }
43
- try {
44
- const config = {
45
- params: {
46
- input: input,
47
- key: SCConfig.GOOGLE_MAP_API_KEY,
48
- sessiontoken: 123456324,
49
- strictBounds: false,
50
- types: ['establishment'],
51
- },
52
- };
53
-
54
- const { success, data } = await axiosGet(
55
- API.EXTERNAL.GOOGLE_MAP.AUTO_COMPLETE,
56
- config
57
- );
58
- if (success) {
59
- setSearchData(data.predictions);
60
- }
61
- } catch (error) {}
62
- }, []);
63
-
64
- const animateToRegion = useCallback((lat, lng) => {
65
- if (!mapRef || !mapRef.current) {
66
- return;
67
- }
68
-
69
- mapRef.current.animateToRegion(
70
- {
71
- latitude: lat,
72
- longitude: lng,
73
- ...initialRegion,
74
- },
75
- 600
76
- );
77
- }, []);
78
-
79
- const onPressRowLocation = useCallback(async (item) => {
80
- setInput(item.description);
81
- setSearchData([]);
82
- const body = {
83
- params: {
84
- place_id: item.place_id,
85
- key: SCConfig.GOOGLE_MAP_API_KEY,
86
- },
87
- };
88
-
89
- const { success, data } = await axiosGet(
90
- API.EXTERNAL.GOOGLE_MAP.GET_LAT_LNG_BY_PLACE_ID,
91
- body
92
- );
93
- if (success) {
94
- const { location } = data.result.geometry;
95
- animateToRegion(location.lat, location.lng);
96
- setSearchedLocation({
97
- description: item.description,
98
- latitude: location.lat,
99
- longitude: location.lng,
100
- });
101
- }
102
- }, []);
103
-
104
- const onDone = useCallback(() => {
105
- if (!searchedLocation) {
106
- return;
107
- }
108
-
109
- updateLocation(searchedLocation.description);
110
- goBack();
111
- }, [goBack, updateLocation, searchedLocation]);
112
- return (
113
- <View style={styles.wrap}>
114
- <View style={styles.searchLocation}>
115
- <SearchBarLocation input={input} onTextInput={onTextInput} />
116
- <ScrollView style={styles.searchData}>
117
- {searchData.map((item) => (
118
- <RowLocation item={item} onPress={onPressRowLocation} />
119
- ))}
120
- </ScrollView>
121
- </View>
122
- <MapView
123
- ref={mapRef}
124
- provider={PROVIDER_GOOGLE}
125
- style={styles.mapView}
126
- initialRegion={{
127
- ...initialRegion,
128
- latitude: DEFAULT_LATITUDE,
129
- longitude: DEFAULT_LONGITUDE,
130
- }}
131
- followUserLocation={true}
132
- >
133
- {searchedLocation && (
134
- <Marker
135
- coordinate={{
136
- latitude: searchedLocation.latitude,
137
- longitude: searchedLocation.longitude,
138
- }}
139
- tracksViewChanges={false}
140
- >
141
- <View style={styles.pointCircle}>
142
- <Point />
143
- </View>
144
- </Marker>
145
- )}
146
- </MapView>
147
- <BottomButtonView
148
- rowButton
149
- style={styles.bottomButton}
150
- mainTitle={t('done')}
151
- onPressMain={onDone}
152
- secondaryTitle={t('cancel')}
153
- onPressSecondary={goBack}
154
- typeMain="primaryText"
155
- typeSecondary="primaryText"
156
- />
157
- </View>
158
- );
159
- });
160
-
161
- export default SelectLocation;
@@ -1,114 +0,0 @@
1
- import { StyleSheet } from 'react-native';
2
- import { Colors } from '../../configs';
3
-
4
- export default StyleSheet.create({
5
- wrap: {
6
- flex: 1,
7
- },
8
- mapView: {
9
- position: 'absolute',
10
- top: 0,
11
- left: 0,
12
- right: 0,
13
- bottom: 0,
14
- },
15
- bottomButton: {
16
- backgroundColor: Colors.White,
17
- },
18
- pointCircle: {
19
- flex: 1,
20
- alignItems: 'center',
21
- justifyContent: 'center',
22
- width: 109,
23
- height: 109,
24
- borderRadius: 50,
25
- backgroundColor: Colors.BlueTransparent5,
26
- borderWidth: 1,
27
- borderColor: Colors.Blue10,
28
- },
29
- searchLocation: {
30
- paddingVertical: 8,
31
- position: 'absolute',
32
- zIndex: 1,
33
- minHeight: 48,
34
- top: 0,
35
- left: 0,
36
- right: 0,
37
- flex: 1,
38
- backgroundColor: Colors.White,
39
- },
40
- searchData: {
41
- paddingHorizontal: 16,
42
- position: 'relative',
43
- width: '100%',
44
- maxHeight: 100,
45
- },
46
- buttonShadow: {
47
- shadowColor: Colors.Gray11,
48
- shadowOffset: {
49
- width: 0,
50
- height: 8,
51
- },
52
- shadowOpacity: 1,
53
- shadowRadius: 12,
54
- elevation: 5,
55
- marginBottom: 16,
56
- marginRight: 16,
57
- },
58
- center: {
59
- justifyContent: 'center',
60
- alignItems: 'center',
61
- },
62
- fullWidth: {
63
- width: '100%',
64
- },
65
- button: {
66
- paddingHorizontal: 30,
67
- paddingVertical: 9,
68
- backgroundColor: Colors.White,
69
- borderColor: Colors.Gray4,
70
- borderWidth: 1,
71
- borderRadius: 30,
72
- },
73
- activeSessionView: {
74
- marginHorizontal: 16,
75
- },
76
- popupIcon: {
77
- marginLeft: '44%',
78
- marginBottom: 15,
79
- },
80
- popupTitle: {
81
- alignSelf: 'center',
82
- marginBottom: 15,
83
- },
84
- popupDes: {
85
- alignSelf: 'center',
86
- textAlign: 'center',
87
- width: '95%',
88
- },
89
- buttonAgree: {
90
- flex: 1,
91
- flexDirection: 'row',
92
- paddingHorizontal: 16,
93
- paddingTop: 16,
94
- alignItems: 'center',
95
- justifyContent: 'center',
96
- },
97
- titleContainer: {
98
- justifyContent: 'center',
99
- flexDirection: 'row',
100
- alignItems: 'center',
101
- flex: 1,
102
- marginTop: 30,
103
- },
104
- childrenStyle: {
105
- padding: 16,
106
- },
107
- scrollViewTerm: {
108
- height: 300,
109
- borderBottomWidth: 1,
110
- borderTopWidth: 1,
111
- borderTopColor: Colors.WrapGray,
112
- borderBottomColor: Colors.WrapGray,
113
- },
114
- });