@eohjsc/react-native-smart-city 0.2.55 → 0.2.59

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 (101) hide show
  1. package/assets/images/SonosSpeaker/buttonpause-active.svg +3 -0
  2. package/assets/images/SonosSpeaker/buttonpause-notactive.svg +3 -0
  3. package/assets/images/SonosSpeaker/picture-main-notactive.svg +5 -0
  4. package/assets/images/SonosSpeaker/picture-main.svg +6 -0
  5. package/assets/images/SonosSpeaker/picture-volume.svg +3 -0
  6. package/package.json +4 -22
  7. package/src/Images/Common/buttonLeftCurtain.png +0 -0
  8. package/src/Images/Common/buttonPause-center-curtain.png +0 -0
  9. package/src/Images/Common/buttonRightCurtain.png +0 -0
  10. package/src/commons/ActionGroup/CurtainButtonTemplate.js +139 -0
  11. package/src/commons/ActionGroup/CurtainButtonTemplateStyle.js +58 -0
  12. package/src/commons/ActionGroup/__test__/CurtainButtonTemplate.test.js +72 -0
  13. package/src/commons/ActionGroup/index.js +3 -0
  14. package/src/commons/AlertAction/index.js +3 -3
  15. package/src/commons/Auth/__test__/AccountList.test.js +33 -0
  16. package/src/commons/CameraDevice/index.js +2 -0
  17. package/src/commons/CardShadow/index.js +1 -1
  18. package/src/commons/CardShadow/styles.js +1 -3
  19. package/src/commons/DateTimeRangeChange/index.js +2 -2
  20. package/src/commons/Device/HistoryChart.js +9 -39
  21. package/src/commons/Device/HorizontalBarChart.js +1 -1
  22. package/src/commons/Device/LinearChart.js +0 -34
  23. package/src/commons/Device/PMSensor/PMSensorIndicatior.js +1 -1
  24. package/src/commons/Device/PMSensor/PMSensorIndicatorStyles.js +2 -1
  25. package/src/commons/Device/SonosSpeaker/__test__/SonosSpeaker.test.js +57 -0
  26. package/src/commons/Device/SonosSpeaker/index.js +88 -0
  27. package/src/commons/Device/SonosSpeaker/styles.js +57 -0
  28. package/src/commons/Form/CurrencyInput.js +169 -0
  29. package/src/commons/Form/__test__/CurrencyInput.test.js +65 -0
  30. package/src/commons/MediaPlayerDetail/Styles/MediaPlayerDetailStyles.js +4 -0
  31. package/src/commons/MediaPlayerDetail/index.js +195 -161
  32. package/src/commons/SearchLocation/index.js +0 -1
  33. package/src/commons/Sharing/RowMember.js +7 -2
  34. package/src/commons/Sharing/__test__/RowMember.test.js +42 -0
  35. package/src/commons/SubUnit/ShortDetail.js +12 -6
  36. package/src/commons/ThreeButtonHistory/__test__/ThreeButtonHistory.test.js +17 -8
  37. package/src/commons/ThreeButtonHistory/index.js +52 -23
  38. package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +1 -1
  39. package/src/configs/API.js +10 -3
  40. package/src/configs/Constants.js +8 -4
  41. package/src/configs/Images.js +3 -0
  42. package/src/configs/SCConfig.js +8 -0
  43. package/src/context/actionType.ts +5 -0
  44. package/src/context/mockStore.ts +3 -0
  45. package/src/context/reducer.ts +14 -0
  46. package/src/iot/RemoteControl/Bluetooth.js +14 -0
  47. package/src/iot/RemoteControl/index.js +0 -1
  48. package/src/navigations/UnitStack.js +26 -4
  49. package/src/screens/ActivityLog/FilterPopup.js +1 -1
  50. package/src/screens/ActivityLog/ItemLog.js +9 -0
  51. package/src/screens/ActivityLog/__test__/ItemLog.test.js +43 -0
  52. package/src/screens/AddCommon/SelectSubUnit.js +24 -2
  53. package/src/screens/AddCommon/SelectUnit.js +12 -0
  54. package/src/screens/AddLocationMaps/index.js +137 -44
  55. package/src/screens/AddLocationMaps/indexStyle.js +14 -12
  56. package/src/screens/AddNewAction/SelectAction.js +1 -0
  57. package/src/screens/Automate/MultiUnits.js +8 -8
  58. package/src/screens/Automate/__test__/MultiUnits.test.js +2 -2
  59. package/src/screens/Automate/__test__/index.test.js +2 -0
  60. package/src/screens/Automate/index.js +4 -2
  61. package/src/screens/Device/__test__/detail.test.js +0 -5
  62. package/src/screens/Device/components/SensorDisplayItem.js +10 -10
  63. package/src/screens/Device/detail.js +21 -4
  64. package/src/screens/Device/hooks/useDisconnectedDevice.js +31 -26
  65. package/src/screens/Notification/__test__/Notification.test.js +3 -3
  66. package/src/screens/Notification/components/NotificationItem.js +3 -6
  67. package/src/screens/Notification/index.js +2 -2
  68. package/src/screens/ScriptDetail/__test__/index.test.js +13 -0
  69. package/src/screens/ScriptDetail/index.js +20 -17
  70. package/src/screens/SelectUnit/index.js +2 -0
  71. package/src/screens/Sharing/MemberList.js +2 -9
  72. package/src/screens/SubUnit/AddSubUnit.js +79 -59
  73. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +4 -3
  74. package/src/screens/TDSGuide/index.js +6 -4
  75. package/src/screens/Unit/ChooseLocation.js +100 -0
  76. package/src/screens/Unit/ChooseLocationStyles.js +29 -0
  77. package/src/screens/Unit/Detail.js +14 -2
  78. package/src/screens/Unit/ManageUnit.js +4 -5
  79. package/src/screens/Unit/SelectAddress.js +240 -0
  80. package/src/screens/Unit/SelectAddressStyles.js +48 -0
  81. package/src/screens/Unit/SmartAccount.js +2 -3
  82. package/src/screens/Unit/SmartAccountItem.js +1 -1
  83. package/src/screens/Unit/Summaries.js +5 -1
  84. package/src/screens/Unit/__test__/ChooseLocation.test.js +112 -0
  85. package/src/screens/Unit/__test__/SelectAddress.test.js +216 -0
  86. package/src/screens/Unit/components/MyUnitDevice/index.js +21 -5
  87. package/src/screens/Unit/hook/useStateAlertRemove.js +3 -1
  88. package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +1 -1
  89. package/src/screens/UnitSummary/components/PowerConsumption/index.js +1 -1
  90. package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +1 -3
  91. package/src/screens/UnitSummary/index.js +3 -2
  92. package/src/utils/Apis/axios.js +17 -5
  93. package/src/utils/I18n/translations/en.json +13 -4
  94. package/src/utils/I18n/translations/vi.json +16 -7
  95. package/src/utils/Route/index.js +2 -1
  96. package/src/utils/Utils.js +22 -2
  97. package/assets/images/AddLocationMaps/PinLocation.svg +0 -3
  98. package/assets/images/AddLocationMaps/Point.svg +0 -3
  99. package/src/screens/Unit/ManageUnit/index.js +0 -286
  100. package/src/screens/Unit/SelectLocation.js +0 -161
  101. 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
- });