@eohjsc/react-native-smart-city 0.4.41 → 0.4.42

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 (85) hide show
  1. package/android/build.gradle +24 -19
  2. package/package.json +12 -14
  3. package/src/commons/Action/ItemQuickAction.js +0 -1
  4. package/src/commons/ActionGroup/ColorPickerTemplate.js +4 -3
  5. package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +3 -3
  6. package/src/commons/ActionGroup/OnOffSmartLock/OnOffSmartLock.js +2 -2
  7. package/src/commons/ActionGroup/OnOffTemplate/OnOffButtonTemplate.js +5 -4
  8. package/src/commons/ActionGroup/OnOffTemplate/SwitchButtonTemplate.js +4 -4
  9. package/src/commons/ActionGroup/OnOffTemplate/index.js +5 -6
  10. package/src/commons/ActionGroup/OneBigButtonTemplate.js +4 -4
  11. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +17 -6
  12. package/src/commons/ActionGroup/SliderRangeTemplate.js +3 -5
  13. package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +7 -7
  14. package/src/commons/ActionGroup/StatesGridActionTemplate.js +20 -6
  15. package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonTemplate.test.js +6 -6
  16. package/src/commons/ActionGroup/ThreeButtonTemplate/index.js +2 -2
  17. package/src/commons/ActionGroup/TimerActionTemplate.js +2 -3
  18. package/src/commons/ActionGroup/TwoButtonTemplate/index.js +135 -133
  19. package/src/commons/ActionGroup/__test__/ColorPickerTemplate.test.js +14 -37
  20. package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +31 -71
  21. package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +11 -11
  22. package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +17 -13
  23. package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +48 -44
  24. package/src/commons/ActionGroup/__test__/OneBigButtonTemplate.test.js +22 -56
  25. package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +21 -123
  26. package/src/commons/ActionGroup/__test__/SliderRangeTemplate.test.js +16 -12
  27. package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +38 -73
  28. package/src/commons/ActionGroup/__test__/SwitchButtonTemplate.test.js +15 -11
  29. package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +15 -11
  30. package/src/commons/ActionGroup/__test__/TimerActionTemplateWithutConfigValue.test.js +9 -9
  31. package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +31 -21
  32. package/src/commons/ActionGroup/__test__/index.test.js +21 -36
  33. package/src/commons/ActionGroup/index.js +7 -4
  34. package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +5 -0
  35. package/src/commons/Dashboard/MyUnit/index.js +2 -2
  36. package/src/commons/DateTimeRangeChange/index.js +3 -3
  37. package/src/commons/Device/HistoryChart.js +1 -1
  38. package/src/commons/Device/HorizontalBarChart.js +4 -3
  39. package/src/commons/Device/LinearChart.js +5 -3
  40. package/src/commons/FlatListDnD/__test__/index.test.js +25 -27
  41. package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +22 -1
  42. package/src/commons/HeaderAni/index.js +2 -12
  43. package/src/commons/MediaPlayerDetail/__test__/MediaPlayerFull.test.js +23 -1
  44. package/src/commons/OneTapTemplate/__test__/NumberUpDownActionTemplate.test.js +3 -5
  45. package/src/commons/Processing/index.js +0 -1
  46. package/src/commons/Processing/styles.js +0 -3
  47. package/src/commons/SubUnit/OneTap/ItemOneTap.js +0 -1
  48. package/src/commons/Unit/HeaderUnit/index.js +8 -15
  49. package/src/commons/UnitSummary/ConfigHistoryChart/__test__/ConfigHistoryChart.test.js +289 -0
  50. package/src/commons/UnitSummary/ConfigHistoryChart/index.js +59 -1
  51. package/src/configs/AccessibilityLabel.js +0 -1
  52. package/src/hooks/IoT/__test__/useRemoteControl.test.js +51 -52
  53. package/src/hooks/IoT/__test__/useWatchConfigs.test.js +2 -3
  54. package/src/hooks/useMqtt.js +2 -5
  55. package/src/iot/mqtt.js +0 -2
  56. package/src/navigations/UnitStack.js +2 -2
  57. package/src/screens/AddNewGateway/ConnectingDevice.js +2 -2
  58. package/src/screens/AddNewGateway/ShareWifiPassword.js +2 -2
  59. package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +32 -31
  60. package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +2 -19
  61. package/src/screens/Automate/AddNewAction/__test__/{SetupConfigCondition.test.js → SetupSensor.test.js} +0 -97
  62. package/src/screens/Automate/EditActionsList/__tests__/index.test.js +68 -69
  63. package/src/screens/ChangePosition/__test__/index.test.js +32 -34
  64. package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +11 -1
  65. package/src/screens/Device/__test__/detail.test.js +45 -40
  66. package/src/screens/Device/__test__/sensorDisplayItem.test.js +2 -14
  67. package/src/screens/Device/components/ChartWrapper.js +12 -14
  68. package/src/screens/Device/components/SensorDisplayItem.js +2 -18
  69. package/src/screens/Device/components/VisualChart.js +3 -17
  70. package/src/screens/Device/components/__test__/VisualChart.test.js +15 -12
  71. package/src/screens/Device/detail.js +15 -34
  72. package/src/screens/Device/hooks/__test__/useEvaluateValue.test.js +18 -20
  73. package/src/screens/Device/styles.js +0 -3
  74. package/src/screens/Sharing/MemberList.js +3 -16
  75. package/src/screens/Sharing/__test__/SelectPermission.test.js +137 -96
  76. package/src/screens/Template/__test__/EditTemplate.test.js +45 -48
  77. package/src/screens/Unit/SelectAddToFavorites.js +0 -1
  78. package/src/screens/Unit/__test__/SelectAddress.test.js +11 -4
  79. package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +11 -1
  80. package/src/utils/Apis/axios.js +0 -1
  81. package/src/utils/I18n/translations/en.js +0 -2
  82. package/src/utils/I18n/translations/vi.js +0 -2
  83. package/src/utils/Monitor.js +2 -2
  84. package/src/commons/Highcharts/index.js +0 -111
  85. package/src/commons/icon/index.js +0 -57
@@ -10,17 +10,17 @@
10
10
  // original location:
11
11
  // - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle
12
12
 
13
- def DEFAULT_COMPILE_SDK_VERSION = 33
14
- def DEFAULT_BUILD_TOOLS_VERSION = '33.0.0'
15
- def DEFAULT_MIN_SDK_VERSION = 24
16
- def DEFAULT_TARGET_SDK_VERSION = 33
13
+ def DEFAULT_COMPILE_SDK_VERSION = 28
14
+ def DEFAULT_BUILD_TOOLS_VERSION = '28.0.3'
15
+ def DEFAULT_MIN_SDK_VERSION = 16
16
+ def DEFAULT_TARGET_SDK_VERSION = 28
17
17
 
18
18
  def safeExtGet(prop, fallback) {
19
19
  rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
20
20
  }
21
21
 
22
22
  apply plugin: 'com.android.library'
23
- apply plugin: 'maven-publish'
23
+ apply plugin: 'maven'
24
24
 
25
25
  buildscript {
26
26
  // The Android Gradle plugin is only required when opening the android folder stand-alone.
@@ -38,6 +38,9 @@ buildscript {
38
38
  }
39
39
  }
40
40
 
41
+ apply plugin: 'com.android.library'
42
+ apply plugin: 'maven'
43
+
41
44
  android {
42
45
  compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
43
46
  buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
@@ -103,17 +106,17 @@ def configureReactNativePom(def pom) {
103
106
  afterEvaluate { project ->
104
107
  // some Gradle build hooks ref:
105
108
  // https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html
106
- // task androidJavadoc(type: Javadoc) {
107
- // source = android.sourceSets.main.java.srcDirs
108
- // classpath += files(android.bootClasspath)
109
- // classpath += files(project.getConfigurations().getByName('compile').asList())
110
- // include '**/*.java'
111
- // }
112
-
113
- // task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
114
- // classifier = 'javadoc'
115
- // from androidJavadoc.destinationDir
116
- // }
109
+ task androidJavadoc(type: Javadoc) {
110
+ source = android.sourceSets.main.java.srcDirs
111
+ classpath += files(android.bootClasspath)
112
+ classpath += files(project.getConfigurations().getByName('compile').asList())
113
+ include '**/*.java'
114
+ }
115
+
116
+ task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
117
+ classifier = 'javadoc'
118
+ from androidJavadoc.destinationDir
119
+ }
117
120
 
118
121
  task androidSourcesJar(type: Jar) {
119
122
  classifier = 'sources'
@@ -132,13 +135,15 @@ afterEvaluate { project ->
132
135
 
133
136
  artifacts {
134
137
  archives androidSourcesJar
135
- // archives androidJavadocJar
138
+ archives androidJavadocJar
136
139
  }
137
140
 
138
141
  task installArchives(type: Upload) {
139
142
  configuration = configurations.archives
140
- repositories.maven {
141
- url = uri("file://${projectDir}/../android/maven")
143
+ repositories.mavenDeployer {
144
+ // Deploy to react-native-event-bridge/maven, ready to publish to npm
145
+ repository url: "file://${projectDir}/../android/maven"
146
+ configureReactNativePom pom
142
147
  }
143
148
  }
144
149
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eohjsc/react-native-smart-city",
3
3
  "title": "React Native Smart Home",
4
- "version": "0.4.41",
4
+ "version": "0.4.42",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -65,9 +65,7 @@
65
65
  "peerDependencies": {
66
66
  "@react-native-community/clipboard": "*",
67
67
  "react": "*",
68
- "react-native": "*",
69
- "react-native-modal": "*",
70
- "react-native-modal-datetime-picker": "*"
68
+ "react-native": "*"
71
69
  },
72
70
  "devDependencies": {
73
71
  "@babel/core": "^7.12.9",
@@ -102,8 +100,8 @@
102
100
  "dependencies": {
103
101
  "@ant-design/icons-react-native": "^2.2.1",
104
102
  "@ant-design/react-native": "^4.0.5",
105
- "@react-native-picker/picker": "^1.16.7",
106
103
  "@babel/helper-environment-visitor": "^7.16.7",
104
+ "@eohjsc/highcharts": "^1.0.9",
107
105
  "@eohjsc/react-native-keyboard-aware-scroll-view": "^0.9.5",
108
106
  "@formatjs/intl-getcanonicallocales": "^1.4.5",
109
107
  "@formatjs/intl-numberformat": "^5.6.2",
@@ -113,14 +111,16 @@
113
111
  "@miblanchard/react-native-slider": "^2.2.0",
114
112
  "@react-native-clipboard/clipboard": "^1.11.1",
115
113
  "@react-native-community/async-storage": "^1.12.1",
116
- "@react-native-community/cameraroll": "4.1.2",
114
+ "@react-native-community/cameraroll": "^4.0.0",
117
115
  "@react-native-community/checkbox": "^0.5.5",
118
- "@react-native-community/datetimepicker": "^7.0.1",
116
+ "@react-native-community/datetimepicker": "https://github.com/hinh-eoh/datepicker",
119
117
  "@react-native-community/geolocation": "^2.0.2",
120
118
  "@react-native-community/masked-view": "^0.1.10",
121
119
  "@react-native-community/netinfo": "^9.3.4",
122
120
  "@react-native-community/segmented-control": "^2.1.1",
123
121
  "@react-native-community/slider": "^3.0.3",
122
+ "@react-native-community/toolbar-android": "^0.1.0-rc.2",
123
+ "@react-native-picker/picker": "^1.16.7",
124
124
  "@react-navigation/bottom-tabs": "^5.8.0",
125
125
  "@react-navigation/drawer": "^5.9.0",
126
126
  "@react-navigation/native": "^5.7.0",
@@ -130,7 +130,6 @@
130
130
  "apisauce": "^2.1.5",
131
131
  "axios": "^0.19.2",
132
132
  "base-64": "^1.0.0",
133
- "buffer": "^6.0.3",
134
133
  "deprecated-react-native-prop-types": "^2.3.0",
135
134
  "dotenv": "^8.2.0",
136
135
  "google-libphonenumber": "^3.2.10",
@@ -138,8 +137,7 @@
138
137
  "i18n-js": "^3.7.1",
139
138
  "i18next": "^20.1.0",
140
139
  "lodash": "^4.17.19",
141
- "lottie-ios": "3.4.1",
142
- "lottie-react-native": "5.1.4",
140
+ "lottie-react-native": "4.0.3",
143
141
  "moment": "^2.27.0",
144
142
  "moment-timezone": "^0.5.32",
145
143
  "numeral": "^2.0.6",
@@ -173,7 +171,7 @@
173
171
  "react-native-draggable-flatlist": "^2.6.2",
174
172
  "react-native-fast-image": "^8.3.2",
175
173
  "react-native-geocoder": "^0.5.0",
176
- "react-native-gesture-handler": "^2.10.0",
174
+ "react-native-gesture-handler": "^1.7.0",
177
175
  "react-native-get-location": "^2.0.0",
178
176
  "react-native-image-crop-picker": "^0.37.2",
179
177
  "react-native-image-resizer": "^1.4.5",
@@ -183,8 +181,8 @@
183
181
  "react-native-localize": "^1.4.1",
184
182
  "react-native-maps": "0.27.1",
185
183
  "react-native-maps-directions": "^1.8.0",
186
- "react-native-modal": "^13.0.1",
187
- "react-native-modal-datetime-picker": "15.0.0",
184
+ "react-native-modal": "^11.5.6",
185
+ "react-native-modal-datetime-picker": "^8.9.3",
188
186
  "react-native-new-snap-carousel": "^3.9.3",
189
187
  "react-native-onesignal": "^4.3.1",
190
188
  "react-native-pager-view": "^5.4.1",
@@ -203,7 +201,7 @@
203
201
  "react-native-udp": "^4.1.3",
204
202
  "react-native-version-check": "^3.4.2",
205
203
  "react-native-vlc-media-player": "^1.0.41",
206
- "react-native-webview": "^12.0.2",
204
+ "react-native-webview": "11.17.2",
207
205
  "react-native-wheel-color-picker": "^1.2.0",
208
206
  "react-native-wheel-scrollview-picker": "^1.2.2",
209
207
  "react-native-wifi-reborn": "^4.5.0",
@@ -42,7 +42,6 @@ const ItemQuickAction = memo(
42
42
  const userId = useSCContextSelector((state) => state?.auth.account.user.id);
43
43
  const onActionPress = useCallback(async () => {
44
44
  if (processing) {
45
- /* istanbul ignore next */
46
45
  return;
47
46
  }
48
47
  setProcessing(true);
@@ -43,8 +43,8 @@ export const WheelColorPicker = ({ color, onChangeColorComplete, onStart }) => {
43
43
  };
44
44
 
45
45
  let hexColorTemp = '#fff';
46
- const ColorPickerTemplate = memo(({ item = {}, doAction, sensor }) => {
47
- const { configuration = {} } = item;
46
+ const ColorPickerTemplate = memo(({ actionGroup = {}, doAction, sensor }) => {
47
+ const { configuration = {} } = actionGroup;
48
48
  const { config = undefined } = configuration;
49
49
  const [configValues] = useConfigGlobalState('configValues');
50
50
 
@@ -76,7 +76,8 @@ const ColorPickerTemplate = memo(({ item = {}, doAction, sensor }) => {
76
76
  setIsChangeColor(false);
77
77
  }
78
78
  },
79
- [configuration?.action_color_data, doAction, isChangeColor, setAction]
79
+ // eslint-disable-next-line react-hooks/exhaustive-deps
80
+ [configuration?.action_color_data, doAction, isChangeColor]
80
81
  );
81
82
 
82
83
  useEffect(() => {
@@ -11,12 +11,12 @@ import { watchMultiConfigs } from '../../iot/Monitor';
11
11
  import { DEVICE_TYPE, AccessibilityLabel } from '../../configs/Constants';
12
12
 
13
13
  const NumberUpDownActionTemplate = ({
14
- item = {},
14
+ actionGroup = {},
15
15
  doAction,
16
16
  sensor = {},
17
17
  isWidgetOrder,
18
18
  }) => {
19
- const { configuration = {}, title } = item;
19
+ const { configuration = {}, title } = actionGroup;
20
20
  const {
21
21
  action_data,
22
22
  max_value,
@@ -122,7 +122,7 @@ const NumberUpDownActionTemplate = ({
122
122
  <IconOutline name="down" size={32} color={Colors.Primary} />
123
123
  </TouchableOpacity>
124
124
 
125
- <Text accessibilityLabel={'text_format'} type="H2">
125
+ <Text accessibilityLabel={'abcd'} type="H2">
126
126
  {value !== undefined ? (
127
127
  text_format.replace('{number}', value)
128
128
  ) : (
@@ -10,9 +10,9 @@ import { useUnwatchLGDeviceConfigControl } from '../../../hooks/IoT';
10
10
  import { watchMultiConfigs } from '../../../iot/Monitor';
11
11
  import { DEVICE_TYPE, AccessibilityLabel } from '../../../configs/Constants';
12
12
 
13
- const OnOffSmartLock = memo(({ item = {}, doAction, sensor = {} }) => {
13
+ const OnOffSmartLock = memo(({ actionGroup = {}, doAction, sensor = {} }) => {
14
14
  const t = useTranslations();
15
- const { configuration = {} } = item;
15
+ const { configuration = {} } = actionGroup;
16
16
  const { action_on_data, action_off_data, config, is_on_value } =
17
17
  configuration;
18
18
  const { is_managed_by_backend, device_type } = sensor;
@@ -8,7 +8,8 @@ import { AccessibilityLabel } from '../../../configs/Constants';
8
8
  import IconComponent from '../../IconComponent';
9
9
 
10
10
  const OnOffButtonTemplate = memo(
11
- ({ isOn, triggerAction, actionGroup = {}, isLight = false, item }) => {
11
+ ({ isOn, triggerAction, actionGroup = {}, isLight = false }) => {
12
+ const { configuration = {}, id } = actionGroup;
12
13
  const {
13
14
  icon_on,
14
15
  icon_off,
@@ -16,7 +17,7 @@ const OnOffButtonTemplate = memo(
16
17
  icon_kit_off_data,
17
18
  text_on,
18
19
  text_off,
19
- } = actionGroup;
20
+ } = configuration;
20
21
  const icon = useMemo(() => {
21
22
  if (isOn) {
22
23
  return icon_kit_on_data?.icon || icon_on;
@@ -30,7 +31,7 @@ const OnOffButtonTemplate = memo(
30
31
  <TouchableOpacity
31
32
  style={styles.bigCircle}
32
33
  onPress={triggerAction}
33
- accessibilityLabel={`${AccessibilityLabel.ON_OFF_BUTTON}-${item?.id}`}
34
+ accessibilityLabel={`${AccessibilityLabel.ON_OFF_BUTTON}-${id}`}
34
35
  >
35
36
  <View style={styles.smallCircle}>
36
37
  <IconComponent
@@ -45,7 +46,7 @@ const OnOffButtonTemplate = memo(
45
46
  styles.textBig,
46
47
  { color: isOn ? Colors.Gray8 : Colors.Gray6 },
47
48
  ]}
48
- accessibilityLabel={`${AccessibilityLabel.SENSOR_STATUS}-${item?.id}`}
49
+ accessibilityLabel={`${AccessibilityLabel.SENSOR_STATUS}-${id}`}
49
50
  >
50
51
  {isOn ? text_on : text_off}
51
52
  </Text>
@@ -8,8 +8,8 @@ import AccessibilityLabel from '../../../configs/AccessibilityLabel';
8
8
  import { useConfigGlobalState } from '../../../iot/states';
9
9
 
10
10
  const SwitchButtonTemplate = memo(
11
- ({ item = {}, isLight = false, doAction }) => {
12
- const { configuration = {}, id } = item;
11
+ ({ actionGroup = {}, isLight = false, doAction }) => {
12
+ const { configuration = {}, id } = actionGroup;
13
13
  const {
14
14
  action_off_data,
15
15
  action_on_data,
@@ -58,9 +58,9 @@ const SwitchButtonTemplate = memo(
58
58
  </Text>
59
59
  </View>
60
60
 
61
- {!!item.title && !isLight && (
61
+ {!!actionGroup.title && !isLight && (
62
62
  <Text type="H3" semibold center>
63
- {item.title}
63
+ {actionGroup.title}
64
64
  </Text>
65
65
  )}
66
66
  </>
@@ -22,8 +22,8 @@ const getComponent = (template) => {
22
22
  }
23
23
  };
24
24
 
25
- const OnOffTemplate = memo(({ item = {}, doAction, sensor = {} }) => {
26
- const { configuration = {} } = item;
25
+ const OnOffTemplate = memo(({ actionGroup = {}, doAction, sensor = {} }) => {
26
+ const { configuration = {} } = actionGroup;
27
27
  const {
28
28
  action_on_data,
29
29
  action_off_data,
@@ -119,17 +119,16 @@ const OnOffTemplate = memo(({ item = {}, doAction, sensor = {} }) => {
119
119
  }, [getIsOnValue, device_type]);
120
120
 
121
121
  const Component = useMemo(() => {
122
- return getComponent(item.template);
123
- }, [item.template]);
122
+ return getComponent(actionGroup.template);
123
+ }, [actionGroup]);
124
124
 
125
125
  return (
126
126
  <View style={styles.wrap}>
127
127
  <Component
128
128
  isOn={tempIsOn}
129
129
  triggerAction={triggerAction}
130
- actionGroup={configuration}
130
+ actionGroup={actionGroup}
131
131
  disabled={!action_on_data && !action_off_data}
132
- item={item}
133
132
  />
134
133
  </View>
135
134
  );
@@ -6,8 +6,8 @@ import { Colors } from '../../configs';
6
6
  import styles from './OneBigButtonTemplateStyle';
7
7
  import IconComponent from '../IconComponent';
8
8
 
9
- const OneBigButtonTemplate = memo(({ item = {}, doAction, sensor }) => {
10
- const { configuration = {} } = item;
9
+ const OneBigButtonTemplate = memo(({ actionGroup = {}, doAction, sensor }) => {
10
+ const { configuration = {} } = actionGroup;
11
11
  const { text, action_data, icon } = configuration;
12
12
 
13
13
  const onPressDoAction = useCallback(() => {
@@ -29,9 +29,9 @@ const OneBigButtonTemplate = memo(({ item = {}, doAction, sensor }) => {
29
29
  </View>
30
30
  </TouchableOpacity>
31
31
  </View>
32
- {!!item.title && (
32
+ {!!actionGroup.title && (
33
33
  <Text type="H3" semibold center>
34
- {item.title}
34
+ {actionGroup.title}
35
35
  </Text>
36
36
  )}
37
37
  </>
@@ -12,7 +12,9 @@ import styles from './OptionsDropdownActionTemplateStyle';
12
12
  import { AccessibilityLabel, DEVICE_TYPE } from '../../configs/Constants';
13
13
  import IconComponent from '../../commons/IconComponent';
14
14
  import { useTranslations } from '../../hooks/Common/useTranslations';
15
- import { getIcon } from '../icon';
15
+ import SvgDoorState from '../../../assets/images/Device/door-state.svg';
16
+ import SvgCurrentState from '../../../assets/images/Device/current-state.svg';
17
+ import SvgWindStrength from '../../../assets/images/Device/wind-strength.svg';
16
18
 
17
19
  function getOptionValue(option, allow_config_store_value) {
18
20
  if (option?.value_text && !allow_config_store_value) {
@@ -22,13 +24,13 @@ function getOptionValue(option, allow_config_store_value) {
22
24
  }
23
25
 
24
26
  const OptionsDropdownActionTemplate = ({
25
- item = {},
27
+ actionGroup = {},
26
28
  doAction,
27
29
  sensor = {},
28
30
  isWidgetOrder,
29
31
  }) => {
30
32
  const t = useTranslations();
31
- const { configuration = {}, title = '' } = item;
33
+ const { configuration = {}, title = '' } = actionGroup;
32
34
  const {
33
35
  action_data,
34
36
  options = [],
@@ -108,7 +110,16 @@ const OptionsDropdownActionTemplate = ({
108
110
  }, [config, selectedOption?.text, t]);
109
111
 
110
112
  const iconSvg = useMemo(() => {
111
- return getIcon(icon);
113
+ switch (icon) {
114
+ case 'door-state-1':
115
+ return <SvgDoorState width={24} height={24} />;
116
+ case 'curent-state-1':
117
+ return <SvgCurrentState width={24} height={24} />;
118
+ case 'wind-strength-1':
119
+ return <SvgWindStrength width={24} height={24} />;
120
+ default:
121
+ return () => <></>;
122
+ }
112
123
  }, [icon]);
113
124
 
114
125
  return (
@@ -168,7 +179,7 @@ const OptionsDropdownActionTemplate = ({
168
179
  {t('write_not_available')}
169
180
  </Text>
170
181
  )}
171
- {options.map((option, index) => (
182
+ {options.map((item, index) => (
172
183
  <View key={index} style={styles.rowContainer}>
173
184
  <RadioCircle active={selectedIndex === index} />
174
185
  <TouchableOpacity
@@ -180,7 +191,7 @@ const OptionsDropdownActionTemplate = ({
180
191
  setSelectedIndex(index);
181
192
  }}
182
193
  >
183
- <Text style={styles.text}>{option?.text}</Text>
194
+ <Text style={styles.text}>{item?.text}</Text>
184
195
  </TouchableOpacity>
185
196
  </View>
186
197
  ))}
@@ -18,9 +18,9 @@ import { DEVICE_TYPE } from '../../configs/Constants';
18
18
  import _TextInput from '../Form/TextInput';
19
19
 
20
20
  const SliderRangeTemplate = memo(
21
- ({ item = {}, doAction, sensor, isWidgetOrder }) => {
21
+ ({ actionGroup = {}, doAction, sensor, item, isWidgetOrder }) => {
22
22
  const t = useTranslations();
23
- const { configuration = {} } = item;
23
+ const { configuration = {} } = actionGroup;
24
24
  const [configValues] = useConfigGlobalState('configValues');
25
25
  const {
26
26
  config = undefined,
@@ -56,7 +56,6 @@ const SliderRangeTemplate = memo(
56
56
 
57
57
  const getTextInputValue = useMemo(() => {
58
58
  if ([null, undefined, NaN].includes(valueBrightness)) {
59
- /* istanbul ignore next */
60
59
  return 0;
61
60
  }
62
61
 
@@ -71,7 +70,6 @@ const SliderRangeTemplate = memo(
71
70
  }
72
71
  setValueBrightness(value);
73
72
  if (timeout.current) {
74
- /* istanbul ignore next */
75
73
  clearTimeout(timeout.current);
76
74
  }
77
75
  if (value !== '') {
@@ -92,7 +90,7 @@ const SliderRangeTemplate = memo(
92
90
  style={(isWidgetOrder && styles.wrapOrderItem) || styles.viewBrightness}
93
91
  >
94
92
  <Text type="H4" style={styles.LeftTextBrightness}>
95
- {item?.title || item?.label || t('brightness')}
93
+ {actionGroup?.title || item?.label || t('brightness')}
96
94
  </Text>
97
95
 
98
96
  <View style={styles.wrap}>
@@ -25,7 +25,7 @@ import {
25
25
  import { notImplemented } from '../../../utils/Utils';
26
26
 
27
27
  const SmartTiviActionTemplate = memo(
28
- ({ item, doAction, scrollEnabled = true }) => {
28
+ ({ actionGroup, doAction, scrollEnabled = true }) => {
29
29
  const t = useTranslations();
30
30
  const FakeDataChannel = [
31
31
  {
@@ -50,7 +50,7 @@ const SmartTiviActionTemplate = memo(
50
50
  },
51
51
  ];
52
52
  const onPressButton = useCallback(
53
- (button) => () => {
53
+ (button, item) => () => {
54
54
  switch (button) {
55
55
  case SMART_TIVI_BUTTON.ONOFF_BUTTON:
56
56
  case SMART_TIVI_BUTTON.EXIT_BUTTON:
@@ -74,8 +74,8 @@ const SmartTiviActionTemplate = memo(
74
74
  },
75
75
  [t]
76
76
  );
77
- const iconChannels = useCallback((iconChannel) => {
78
- switch (iconChannel.icon) {
77
+ const iconChannels = useCallback((item) => {
78
+ switch (item.icon) {
79
79
  case 'disney':
80
80
  return <Disney style={styles.iconChannel} />;
81
81
  case 'youtube':
@@ -186,16 +186,16 @@ const SmartTiviActionTemplate = memo(
186
186
  </View>
187
187
  <View style={styles.channelTV}>
188
188
  {!!FakeDataChannel &&
189
- FakeDataChannel.map((fakeChannel, index) => {
189
+ FakeDataChannel.map((item, index) => {
190
190
  return (
191
191
  <RectangleButton
192
192
  key={index}
193
193
  type="row"
194
194
  onPress={onPressButton(
195
195
  SMART_TIVI_BUTTON.CHANNEL_BUTTON,
196
- fakeChannel
196
+ item
197
197
  )}
198
- icon={iconChannels(fakeChannel)}
198
+ icon={iconChannels(item)}
199
199
  wrapStyle={styles.buttonChannel}
200
200
  index={index}
201
201
  />
@@ -9,7 +9,10 @@ import { watchMultiConfigs } from '../../iot/Monitor';
9
9
  import IconComponent from '../IconComponent';
10
10
  import styles from './StatesGridActionTemplateStyle';
11
11
  import { DEVICE_TYPE, AccessibilityLabel } from '../../configs/Constants';
12
- import { getIcon } from '../icon';
12
+ import SvgClean from '../../../assets/images/Device/clean.svg';
13
+ import SvgCirculator from '../../../assets/images/Device/circulator.svg';
14
+ import SvgAuo from '../../../assets/images/Device/auto.svg';
15
+ import SvgAirDry from '../../../assets/images/Device/air-dry.svg';
13
16
 
14
17
  const buttonStyle = {
15
18
  OFF: {
@@ -64,7 +67,18 @@ const GridItem = ({ item, doAction, sensor }) => {
64
67
  const iconKit = !!icon_kit_data && icon_kit_data.icon;
65
68
 
66
69
  const iconSvg = useMemo(() => {
67
- return getIcon(icon);
70
+ switch (icon) {
71
+ case 'clean-1':
72
+ return <SvgClean width={24} height={24} />;
73
+ case 'circulator-1':
74
+ return <SvgCirculator width={24} height={24} />;
75
+ case 'auto-1':
76
+ return <SvgAuo width={24} height={24} />;
77
+ case 'air-dry-1':
78
+ return <SvgAirDry width={24} height={24} />;
79
+ default:
80
+ return null;
81
+ }
68
82
  }, [icon]);
69
83
 
70
84
  return (
@@ -94,12 +108,12 @@ const GridItem = ({ item, doAction, sensor }) => {
94
108
  };
95
109
 
96
110
  const StatesGridActionTemplate = ({
97
- item = {},
111
+ actionGroup = {},
98
112
  doAction,
99
113
  sensor = {},
100
114
  isWidgetOrder,
101
115
  }) => {
102
- const { configuration = {}, title } = item;
116
+ const { configuration = {}, title } = actionGroup;
103
117
 
104
118
  // eslint-disable-next-line no-unused-vars
105
119
  const [configValues, setConfigValues] = useConfigGlobalState('configValues');
@@ -129,10 +143,10 @@ const StatesGridActionTemplate = ({
129
143
  options?.length < 4 && styles.justifyContentAround,
130
144
  ]}
131
145
  >
132
- {options.map((option, index) => (
146
+ {options.map((item, index) => (
133
147
  <GridItem
134
148
  key={index}
135
- item={option}
149
+ item={item}
136
150
  index={index}
137
151
  doAction={doAction}
138
152
  sensor={sensor}
@@ -7,14 +7,14 @@ import { mockSCStore } from '../../../../context/mockStore';
7
7
  import ThreeButtonDefault from '../components/ThreeButtonDefault';
8
8
  import ThreeButtonCircle from '../components/ThreeButtonCircle';
9
9
 
10
- const wrapComponent = (item) => (
10
+ const wrapComponent = (actionGroup) => (
11
11
  <SCProvider initState={mockSCStore({})}>
12
- <ThreeButtonTemplate item={item} doAction={jest.fn()} />
12
+ <ThreeButtonTemplate actionGroup={actionGroup} doAction={jest.fn()} />
13
13
  </SCProvider>
14
14
  );
15
15
 
16
16
  describe('Test ThreeButtonTemplate', () => {
17
- let displayItem = {
17
+ let actionGroup = {
18
18
  configuration: {
19
19
  action1: '2b949045-8e03-4c07-a855-7794ade2e69c',
20
20
  action1_data: {
@@ -64,7 +64,7 @@ describe('Test ThreeButtonTemplate', () => {
64
64
 
65
65
  it('render ThreeButtonDefault', async () => {
66
66
  await act(async () => {
67
- wrapper = renderer.create(wrapComponent(displayItem));
67
+ wrapper = renderer.create(wrapComponent(actionGroup));
68
68
  });
69
69
  const instance = wrapper.root;
70
70
  const ThreeButtonDefaults = instance.findAllByType(ThreeButtonDefault);
@@ -72,8 +72,8 @@ describe('Test ThreeButtonTemplate', () => {
72
72
  });
73
73
  it('render ThreeButtonCircle', async () => {
74
74
  const actionGroupCT = {
75
- ...displayItem,
76
- configuration: { ...displayItem?.configuration, layout: 'circle' },
75
+ ...actionGroup,
76
+ configuration: { ...actionGroup?.configuration, layout: 'circle' },
77
77
  };
78
78
  await act(async () => {
79
79
  wrapper = renderer.create(wrapComponent(actionGroupCT));
@@ -8,8 +8,8 @@ import IconComponent from '../../IconComponent';
8
8
  import ThreeButtonCircle from './components/ThreeButtonCircle';
9
9
  import ThreeButtonDefault from './components/ThreeButtonDefault';
10
10
 
11
- const ThreeButtonTemplate = memo(({ item, doAction, isWidgetOrder }) => {
12
- const { configuration } = item;
11
+ const ThreeButtonTemplate = memo(({ actionGroup, doAction, isWidgetOrder }) => {
12
+ const { configuration } = actionGroup;
13
13
  const {
14
14
  text1,
15
15
  action1_data,
@@ -16,9 +16,9 @@ import { useUnwatchLGDeviceConfigControl } from '../../hooks/IoT';
16
16
  import BottomScrollPicker from '../BottomScrollPicker';
17
17
  import { DEVICE_TYPE } from '../../configs/Constants';
18
18
 
19
- const TimerActionTemplate = ({ item = {}, doAction, sensor = {} }) => {
19
+ const TimerActionTemplate = ({ actionGroup = {}, doAction, sensor = {} }) => {
20
20
  const t = useTranslations();
21
- const { configuration = {}, title } = item;
21
+ const { configuration = {}, title } = actionGroup;
22
22
  const [showTime, setShowTime] = useState(false);
23
23
  const [showHour, setShowHour] = useState(false);
24
24
 
@@ -156,7 +156,6 @@ const TimerActionTemplate = ({ item = {}, doAction, sensor = {} }) => {
156
156
 
157
157
  const onSwitchOff = useCallback(() => {
158
158
  if (!isTimerOn) {
159
- /* istanbul ignore next */
160
159
  return;
161
160
  }
162
161
  const { reset_value } = configuration;