@eohjsc/react-native-smart-city 0.3.5 → 0.3.8

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 (290) hide show
  1. package/README.md +15 -36
  2. package/package.json +5 -9
  3. package/react-native-smart-city.podspec +0 -1
  4. package/src/commons/Action/ItemQuickAction.js +4 -16
  5. package/src/commons/Action/__test__/ItemQuickAction.test.js +6 -11
  6. package/src/commons/ActionGroup/ColorPickerTemplate.js +24 -37
  7. package/src/commons/ActionGroup/CurtainButtonTemplate.js +5 -10
  8. package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +11 -7
  9. package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/__test__/index.test.js +0 -4
  10. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/ItemPasscode.js +1 -1
  11. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/__test__/index.test.js +0 -14
  12. package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/index.js +0 -1
  13. package/src/commons/ActionGroup/OnOffTemplate/OnOffButtonTemplate.js +2 -8
  14. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +9 -7
  15. package/src/commons/ActionGroup/SliderRangeTemplate.js +2 -6
  16. package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +3 -7
  17. package/src/commons/ActionGroup/StatesGridActionTemplate.js +8 -22
  18. package/src/commons/ActionGroup/TimerActionTemplate.js +3 -11
  19. package/src/commons/ActionGroup/TwoButtonTemplate/index.js +5 -1
  20. package/src/commons/ActionGroup/__test__/CurtainButtonTemplate.test.js +4 -53
  21. package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +40 -0
  22. package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +14 -14
  23. package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +78 -53
  24. package/src/commons/ActionGroup/__test__/OneBigButtonTemplate.test.js +20 -36
  25. package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +57 -1
  26. package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +6 -58
  27. package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +1 -49
  28. package/src/commons/ActionGroup/__test__/index.test.js +0 -135
  29. package/src/commons/Auth/AccountList.js +1 -1
  30. package/src/commons/Automate/ItemAutomate.js +3 -1
  31. package/src/commons/Connecting/__test__/Connecting.test.js +2 -19
  32. package/src/commons/ConnectingProcess/DeviceItem/DeviceItem.js +3 -7
  33. package/src/commons/ConnectingProcess/DeviceItem/DeviceItemStyles.js +11 -8
  34. package/src/commons/ConnectingProcess/__test__/Connecting.test.js +3 -136
  35. package/src/commons/ConnectingProcess/__test__/DeviceItem.test.js +2 -3
  36. package/src/commons/ConnectingProcess/index.js +25 -75
  37. package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +13 -16
  38. package/src/commons/Dashboard/MyPinnedSharedUnit/index.js +1 -1
  39. package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +5 -0
  40. package/src/commons/Device/ConnectedViewHeader.js +1 -1
  41. package/src/commons/Device/HistoryChart.js +3 -7
  42. package/src/commons/Device/ItemDevice.js +12 -19
  43. package/src/commons/Device/LinearChart.js +0 -15
  44. package/src/commons/Device/PMSensor/PMSensorIndicatior.js +12 -16
  45. package/src/commons/Device/PMSensor/PMSensorIndicatorStyles.js +0 -3
  46. package/src/commons/Device/SonosSpeaker/index.js +1 -1
  47. package/src/commons/Device/WaterQualitySensor/ListQualityIndicator.js +0 -1
  48. package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +2 -7
  49. package/src/commons/Explore/__test__/CityItem.test.js +54 -33
  50. package/src/commons/Form/CurrencyInput.js +1 -15
  51. package/src/commons/Form/TextInputPassword.js +1 -1
  52. package/src/commons/FullLoading/index.js +1 -2
  53. package/src/commons/Header/HeaderCustom.js +1 -2
  54. package/src/commons/HeaderAni/index.js +1 -6
  55. package/src/commons/HorizontalPicker/index.js +2 -2
  56. package/src/commons/MediaPlayerDetail/Styles/MediaPlayerDetailStyles.js +6 -0
  57. package/src/commons/MediaPlayerDetail/index.js +47 -25
  58. package/src/commons/MenuActionAddnew/index.js +0 -1
  59. package/src/commons/MenuActionList/index.js +0 -1
  60. package/src/commons/MenuActionMore/index.js +1 -1
  61. package/src/commons/PreventAccess/index.js +1 -9
  62. package/src/commons/Sharing/MemberList.js +2 -10
  63. package/src/commons/Sharing/WrapHeaderScrollable.js +0 -2
  64. package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +1 -0
  65. package/src/commons/SubUnit/Favorites/index.js +3 -2
  66. package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +35 -8
  67. package/src/commons/SubUnit/OneTap/index.js +2 -1
  68. package/src/commons/SubUnit/ShortDetail.js +9 -25
  69. package/src/commons/SubUnit/__test__/Item.test.js +1 -0
  70. package/src/commons/SubUnit/__test__/ShortDetail.test.js +2 -9
  71. package/src/commons/Unit/SharedUnit.js +0 -1
  72. package/src/commons/Unit/__test__/SharedUnit.test.js +183 -38
  73. package/src/commons/UnitSummary/ConfigHistoryChart/index.js +13 -2
  74. package/src/commons/UnitSummary/ConfigHistoryChart.js +13 -22
  75. package/src/commons/WheelDateTimePicker/index.js +3 -4
  76. package/src/configs/API.js +143 -87
  77. package/src/configs/Constants.js +2 -57
  78. package/src/configs/SCConfig.js +0 -4
  79. package/src/context/actionType.ts +0 -8
  80. package/src/context/mockStore.ts +0 -10
  81. package/src/context/reducer.ts +2 -38
  82. package/src/hooks/Common/index.js +0 -2
  83. package/src/hooks/Common/useGetIdUser.js +5 -1
  84. package/src/hooks/Common/useSensorsStatus.js +4 -4
  85. package/src/hooks/useReceiveNotifications.js +5 -9
  86. package/src/iot/Monitor.js +2 -3
  87. package/src/iot/RemoteControl/Bluetooth.js +1 -1
  88. package/src/iot/RemoteControl/GoogleHome.js +49 -75
  89. package/src/iot/RemoteControl/Internet.js +1 -1
  90. package/src/iot/RemoteControl/__test__/GoogleHome.test.js +48 -95
  91. package/src/iot/RemoteControl/__test__/Internet.test.js +7 -18
  92. package/src/iot/RemoteControl/__test__/LgThinq.test.js +177 -36
  93. package/src/iot/RemoteControl/index.js +52 -52
  94. package/src/navigations/UnitStack.js +20 -11
  95. package/src/screens/AQIGuide/index.js +1 -1
  96. package/src/screens/ActivityLog/FilterPopup.js +0 -2
  97. package/src/screens/ActivityLog/__test__/index.test.js +23 -38
  98. package/src/screens/ActivityLog/hooks/__test__/index.test.js +90 -51
  99. package/src/screens/ActivityLog/hooks/index.js +1 -1
  100. package/src/screens/ActivityLog/index.js +2 -2
  101. package/src/screens/AddCommon/SelectSubUnit.js +0 -1
  102. package/src/screens/AddCommon/SelectUnit.js +0 -1
  103. package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +24 -13
  104. package/src/screens/AddCommon/__test__/SelectUnit.test.js +33 -9
  105. package/src/screens/AddLocationMaps/index.js +5 -9
  106. package/src/screens/AddNewAction/SelectAction.js +8 -8
  107. package/src/screens/AddNewAction/SelectSensorDevices.js +2 -8
  108. package/src/screens/AddNewAction/SetupSensor.js +7 -7
  109. package/src/screens/AddNewAction/__test__/SelectAction.test.js +91 -10
  110. package/src/screens/AddNewAction/__test__/SelectSensorDevices.test.js +26 -40
  111. package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +1 -3
  112. package/src/screens/AddNewAutoSmart/index.js +2 -5
  113. package/src/screens/AddNewDevice/ConnectingDevices.js +3 -3
  114. package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +34 -42
  115. package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +4 -0
  116. package/src/screens/AddNewDevice/__test__/ConnectingDevices.test.js +22 -22
  117. package/src/screens/AddNewDevice/hooks/ConnectDevices.js +1 -1
  118. package/src/screens/AddNewDevice/index.js +0 -1
  119. package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +17 -23
  120. package/src/screens/AddNewGateway/PlugAndPlay/GatewayWifiList.js +4 -7
  121. package/src/screens/AddNewGateway/SelectGateway.js +0 -1
  122. package/src/screens/AddNewGateway/SetupGatewayWifi.js +0 -2
  123. package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +6 -4
  124. package/src/screens/AddNewGateway/__test__/ConnectedGateway.test.js +4 -0
  125. package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +29 -5
  126. package/src/screens/AddNewGateway/__test__/SelectGateway.test.js +4 -0
  127. package/src/screens/AddNewGateway/__test__/SetupGateway.test.js +4 -0
  128. package/src/screens/AddNewGateway/index.js +0 -1
  129. package/src/screens/AddNewOneTap/__test__/AddNewOneTap.test.js +24 -10
  130. package/src/screens/AddNewOneTap/index.js +2 -3
  131. package/src/screens/AllCamera/index.js +4 -4
  132. package/src/screens/Automate/MultiUnits.js +8 -8
  133. package/src/screens/Automate/__test__/MultiUnits.test.js +9 -6
  134. package/src/screens/Automate/__test__/index.test.js +12 -7
  135. package/src/screens/Automate/index.js +3 -5
  136. package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +8 -36
  137. package/src/screens/ConfirmUnitDeletion/index.js +1 -7
  138. package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +22 -71
  139. package/src/screens/Device/EditDevice/index.js +15 -17
  140. package/src/screens/Device/__test__/detail.test.js +86 -33
  141. package/src/screens/Device/components/DetailHistoryChart.js +1 -1
  142. package/src/screens/Device/components/SensorConnectStatusViewHeader.js +0 -1
  143. package/src/screens/Device/components/SensorDisplayItem.js +2 -5
  144. package/src/screens/Device/detail.js +24 -80
  145. package/src/screens/Device/hooks/useDisconnectedDevice.js +4 -4
  146. package/src/screens/Device/hooks/useFavoriteDevice.js +9 -5
  147. package/src/screens/DeviceInfo/__test__/index.test.js +2 -0
  148. package/src/screens/EditActionsList/index.js +1 -1
  149. package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +3 -6
  150. package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +19 -7
  151. package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +2 -20
  152. package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +23 -40
  153. package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
  154. package/src/screens/EmergencySetting/index.js +1 -4
  155. package/src/screens/EnterPassword/__test__/EnterPassword.test.js +25 -41
  156. package/src/screens/Explore/index.js +0 -2
  157. package/src/screens/GuestInfo/__test__/index.test.js +41 -14
  158. package/src/screens/GuestInfo/components/RecurringDetail.js +0 -1
  159. package/src/screens/GuestInfo/components/TemporaryDetail.js +2 -2
  160. package/src/screens/HanetCamera/Detail.js +1 -1
  161. package/src/screens/HanetCamera/__test__/CaptureFaceID.test.js +12 -8
  162. package/src/screens/HanetCamera/__test__/Detail.test.js +42 -27
  163. package/src/screens/HanetCamera/__test__/ManageAccess.test.js +5 -8
  164. package/src/screens/HanetCamera/__test__/MemberInfo.test.js +32 -10
  165. package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +2 -3
  166. package/src/screens/HanetCamera/hooks/__test__/useHanetCheckinData.test.js +35 -43
  167. package/src/screens/HanetCamera/hooks/__test__/useHanetPlaceMembers.test.js +21 -10
  168. package/src/screens/HanetCamera/hooks/useHanetCheckinData.js +11 -11
  169. package/src/screens/HanetCamera/hooks/useHanetPlaceMembers.js +11 -11
  170. package/src/screens/ManageAccess/__test__/ManageAccess.test.js +22 -33
  171. package/src/screens/ManageAccess/hooks/__test__/useManageAccess.test.js +45 -44
  172. package/src/screens/ManageAccess/hooks/index.js +4 -7
  173. package/src/screens/ManageAccess/index.js +1 -2
  174. package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +12 -35
  175. package/src/screens/MoveToAnotherSubUnit/index.js +6 -6
  176. package/src/screens/Notification/__test__/Notification.test.js +25 -14
  177. package/src/screens/Notification/__test__/NotificationItem.test.js +7 -8
  178. package/src/screens/Notification/components/NotificationItem.js +20 -17
  179. package/src/screens/Notification/index.js +2 -9
  180. package/src/screens/PlayBackCamera/Timer.js +2 -2
  181. package/src/screens/PlayBackCamera/__test__/index.test.js +2 -87
  182. package/src/screens/PlayBackCamera/index.js +6 -22
  183. package/src/screens/ScanChipQR/__test__/ScanChipQR.test.js +20 -7
  184. package/src/screens/ScanChipQR/components/QRScan/index.js +0 -1
  185. package/src/screens/ScanChipQR/hooks/index.js +16 -15
  186. package/src/screens/ScanSensorQR/__test__/ScanSensorQR.test.js +24 -8
  187. package/src/screens/ScriptDetail/__test__/index.test.js +86 -17
  188. package/src/screens/ScriptDetail/index.js +14 -19
  189. package/src/screens/SelectUnit/__test__/index.test.js +55 -12
  190. package/src/screens/SelectUnit/index.js +4 -9
  191. package/src/screens/SetSchedule/index.js +11 -15
  192. package/src/screens/SharedUnit/__test__/TabHeader.test.js +2 -0
  193. package/src/screens/SharedUnit/index.js +0 -2
  194. package/src/screens/Sharing/Components/SensorItem.js +12 -10
  195. package/src/screens/Sharing/InfoMemberUnit.js +1 -1
  196. package/src/screens/Sharing/MemberList.js +11 -12
  197. package/src/screens/Sharing/SelectPermission.js +76 -121
  198. package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +29 -47
  199. package/src/screens/Sharing/__test__/MemberList.test.js +127 -13
  200. package/src/screens/Sharing/__test__/SelectPermission.test.js +38 -28
  201. package/src/screens/Sharing/__test__/SelectUser.test.js +38 -17
  202. package/src/screens/Sharing/hooks/index.js +0 -3
  203. package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +2 -3
  204. package/src/screens/SmartIr/components/SelectBrand.js +1 -1
  205. package/src/screens/SubUnit/AddSubUnit.js +17 -23
  206. package/src/screens/SubUnit/Detail.js +2 -1
  207. package/src/screens/SubUnit/EditSubUnit.js +13 -15
  208. package/src/screens/SubUnit/ManageSubUnit.js +7 -13
  209. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +89 -29
  210. package/src/screens/SubUnit/__test__/Detail.test.js +8 -31
  211. package/src/screens/SubUnit/__test__/EditSubUnit.test.js +89 -21
  212. package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +1 -27
  213. package/src/screens/SubUnit/hooks/__test__/useManageSubUnit.test.js +45 -48
  214. package/src/screens/SubUnit/hooks/useManageSubUnit.js +7 -7
  215. package/src/screens/SyncLGDevice/AddLGDevice.js +0 -1
  216. package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +91 -22
  217. package/src/screens/TDSGuide/index.js +1 -4
  218. package/src/screens/UVIndexGuide/index.js +1 -1
  219. package/src/screens/Unit/ChooseLocation.js +14 -7
  220. package/src/screens/Unit/Detail.js +75 -30
  221. package/src/screens/Unit/ManageUnit.js +0 -1
  222. package/src/screens/Unit/SelectAddress.js +23 -45
  223. package/src/screens/Unit/SmartAccount.js +4 -4
  224. package/src/screens/Unit/Station/index.js +0 -4
  225. package/src/screens/Unit/Summaries.js +2 -18
  226. package/src/screens/Unit/__test__/CheckSendEmail.test.js +29 -24
  227. package/src/screens/Unit/__test__/ChooseLocation.test.js +14 -27
  228. package/src/screens/Unit/__test__/Detail.test.js +200 -99
  229. package/src/screens/Unit/__test__/ManageUnit.test.js +42 -18
  230. package/src/screens/Unit/__test__/SelectAddress.test.js +49 -159
  231. package/src/screens/Unit/__test__/SmartAccount.test.js +9 -17
  232. package/src/screens/Unit/__test__/SmartAccountItem.test.js +1 -0
  233. package/src/screens/Unit/components/MyUnitDevice/index.js +4 -4
  234. package/src/screens/Unit/components/SharedUnit/index.js +0 -1
  235. package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +2 -2
  236. package/src/screens/Unit/components/__test__/SharedUnit.test.js +34 -31
  237. package/src/screens/Unit/styles.js +0 -4
  238. package/src/screens/UnitSummary/__test__/index.test.js +30 -91
  239. package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +2 -31
  240. package/src/screens/UnitSummary/components/PowerConsumeHistoryChart/__test__/index.test.js +4 -7
  241. package/src/screens/UnitSummary/components/PowerConsumeHistoryChart/index.js +13 -2
  242. package/src/screens/UnitSummary/components/PowerConsumption/__test__/ItemPower.test.js +1 -0
  243. package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +16 -14
  244. package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +2 -11
  245. package/src/screens/UnitSummary/components/RunningDevices/index.js +10 -7
  246. package/src/screens/UnitSummary/components/Temperature/index.js +4 -4
  247. package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +2 -10
  248. package/src/screens/UnitSummary/index.js +1 -15
  249. package/src/screens/WaterQualityGuide/index.js +1 -1
  250. package/src/utils/Apis/axios.js +31 -54
  251. package/src/utils/Converter/time.js +18 -0
  252. package/src/utils/I18n/translations/en.json +1 -7
  253. package/src/utils/I18n/translations/vi.json +1 -8
  254. package/src/utils/Route/index.js +0 -1
  255. package/src/utils/Utils.js +7 -11
  256. package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/ItemPasscode.test.js +0 -24
  257. package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +0 -77
  258. package/src/commons/Calendar/__test__/Calendar.test.js +0 -33
  259. package/src/commons/Device/Hanet/ItemHanetDevice.test.js +0 -58
  260. package/src/commons/FieldTemplate/ChooseUserField/ChooseFieldStyles.js +0 -25
  261. package/src/commons/FieldTemplate/ChooseUserField/ChoosePopup.js +0 -96
  262. package/src/commons/FieldTemplate/ChooseUserField/ChoosePopupStyles.js +0 -39
  263. package/src/commons/FieldTemplate/ChooseUserField/__test__/index.test.js +0 -118
  264. package/src/commons/FieldTemplate/ChooseUserField/index.js +0 -62
  265. package/src/commons/FieldTemplate/PasscodeField/PasscodeFieldStyles.js +0 -30
  266. package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +0 -90
  267. package/src/commons/FieldTemplate/PasscodeField/index.js +0 -43
  268. package/src/commons/FieldTemplate/ScheduleField/ScheduleFieldStyles.js +0 -13
  269. package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +0 -179
  270. package/src/commons/FieldTemplate/ScheduleField/index.js +0 -176
  271. package/src/commons/PreventAccess/__test__/PreventAccess.test.js +0 -62
  272. package/src/hooks/Common/useGGHomeDeviceConnected.js +0 -16
  273. package/src/hooks/IoT/__test__/useGGHomeConnection.test.js +0 -198
  274. package/src/hooks/IoT/__test__/useRemoteControl.test.js +0 -198
  275. package/src/hooks/IoT/index.js +0 -4
  276. package/src/hooks/IoT/useGGHomeConnection.js +0 -91
  277. package/src/hooks/IoT/useRemoteControl.js +0 -79
  278. package/src/hooks/index.js +0 -4
  279. package/src/navigations/UnitStackStyles.js +0 -21
  280. package/src/screens/Sharing/__test__/MemberList2.test.js +0 -80
  281. package/src/screens/SideMenuDetail/SideMenuDetailStyles.js +0 -28
  282. package/src/screens/SideMenuDetail/__test__/index.test.js +0 -154
  283. package/src/screens/SideMenuDetail/index.js +0 -148
  284. package/src/screens/Unit/__test__/Summaries.test.js +0 -100
  285. package/src/screens/Unit/components/MyAllUnit/__test__/MyAllUnit.test.js +0 -36
  286. package/src/screens/Unit/components/MyAllUnit/__test__/index.test.js +0 -54
  287. package/src/screens/Unit/hook/useUnitConnectRemoteDevices.js +0 -50
  288. package/src/utils/Permission/common.js +0 -67
  289. package/src/utils/Setting/Location.js +0 -30
  290. package/src/utils/__test__/Utils.test.js +0 -12
package/README.md CHANGED
@@ -1,26 +1,19 @@
1
1
  ## react-native-smart-city
2
2
 
3
3
  ## Getting started
4
-
5
4
  1. Install package dependencies:
6
-
7
- - Using [Yarn](https://yarnpkg.com/): `yarn add react-native-reanimated@^1.10.1`
5
+ - Using [Yarn](https://yarnpkg.com/): `yarn add react-native-reanimated@^1.10.1`
8
6
 
9
7
  2. Install:
10
-
11
- - Using [npm](https://www.npmjs.com/#getting-started): `npm install @eohjsc/react-native-smart-city --save`
12
- - Using [Yarn](https://yarnpkg.com/): `yarn add @eohjsc/react-native-smart-city`
8
+ - Using [npm](https://www.npmjs.com/#getting-started): `npm install @eohjsc/react-native-smart-city --save`
9
+ - Using [Yarn](https://yarnpkg.com/): `yarn add @eohjsc/react-native-smart-city`
13
10
 
14
11
  3. Compile application using react-native run-android
15
-
16
12
  ### Mostly automatic installation
17
-
18
13
  `$ react-native link @eohjsc/react-native-smart-city`
19
14
 
20
15
  ## Usage
21
-
22
16
  1. StackNavigator
23
-
24
17
  ```javascript
25
18
  import {
26
19
  UnitStack,
@@ -37,7 +30,7 @@ import {
37
30
  } from '@eohjsc/react-native-smart-city';
38
31
  import { createStackNavigator } from '@react-navigation/stack';
39
32
 
40
- // TODO: What to do with the module?
33
+ // TODO: What to do with the module?
41
34
  const Stack = createStackNavigator();
42
35
 
43
36
  const YourStack = () => {
@@ -91,9 +84,7 @@ const MainTab = () => {
91
84
  );
92
85
  };
93
86
  ```
94
-
95
87
  2. Use components
96
-
97
88
  ```javascript
98
89
  import React from 'react';
99
90
  import { View } from 'react-native';
@@ -102,15 +93,13 @@ import { MyPinnedSharedUnit, MyUnit } from '@eohjsc/react-native-smart-city';
102
93
  const MyScreen = () => {
103
94
  return (
104
95
  <View>
105
- <MyUnit />
106
- <MyPinnedSharedUnit />
96
+ <MyUnit />
97
+ <MyPinnedSharedUnit />
107
98
  </View>
108
99
  );
109
100
  };
110
101
  ```
111
-
112
102
  3. Trigger quick action
113
-
114
103
  ```javascript
115
104
  import React from 'react';
116
105
  import { View, Button } from 'react-native';
@@ -137,33 +126,23 @@ export const MyFunctionalComponent = () => {
137
126
  lg_actions: [],
138
127
  name: 'Garage Up',
139
128
  };
140
- const handleQuickAction = async () => {
129
+ const handleQuickAction = async() => {
141
130
  const result = await sendRemoteCommand(sensor, action); // Action Garage Up
142
- if (result) {
143
- console.log('Successful control');
144
- } else {
145
- console.log('Control failed');
131
+ if (result){
132
+ console.log('Successful control')
133
+ }else {
134
+ console.log('Control failed')
146
135
  }
147
136
  };
148
137
  return (
149
138
  <View>
150
- <Button
151
- onPress={handleQuickAction}
152
- title="Example trigger quick action control Garage Up"
153
- />
139
+ <Button onPress={handleQuickAction} title="Example trigger quick action control Garage Up" />
154
140
  </View>
155
141
  );
156
142
  };
157
143
  ```
158
-
159
- - sendRemoteCommand user needs to `have permission to control the device`, you pass in the `sensor and action` to it and it will run after calling render.
160
- - `sensor` is a device in your Unit and action is the `action` key of the device..
144
+ - sendRemoteCommand user needs to `have permission to control the device`, you pass in the `sensor and action` to it and it will run after calling render.
145
+ - `sensor` is a device in your Unit and action is the `action` key of the device..
161
146
  - You can take out the sensor and action from your Unit when calling the `API.UNIT.UNIT_DETAIL(unitId)` it will return all devices in 1 unit.
162
- - Or get sensor from `API.DEVICE.DISPLAY(sensor.id)` returns all actions of 1 device.
147
+ - Or get sensor from `API.SENSOR.DISPLAY(sensor.id)` returns all actions of 1 device.
163
148
  - Refer YourProjectPath /node_modules/@eohjsc/react-native-smart-city/src/screens/Unit/Detail.js
164
-
165
- ## Sync file to EoH source
166
-
167
- ```
168
- yarn install && yarn watch
169
- ```
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.3.05",
4
+ "version": "0.3.08",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -18,7 +18,7 @@
18
18
  "ios": "react-native run-ios",
19
19
  "start": "react-native start",
20
20
  "test": "yarn run lint && yarn run jest",
21
- "lint": "eslint . --ext js --ext ts --ext tsx --max-warnings 5",
21
+ "lint": "eslint . --ext js --ext ts --ext tsx",
22
22
  "lint-fix": "eslint . --fix",
23
23
  "type-check": "npx tsc",
24
24
  "pod": "cd ios && pod install",
@@ -74,7 +74,6 @@
74
74
  "@types/react": "^17.0.0",
75
75
  "@types/react-native": "^0.63.43",
76
76
  "@types/react-test-renderer": "^17.0.0",
77
- "axios-mock-adapter": "^1.21.1",
78
77
  "babel-jest": "^26.6.3",
79
78
  "detox": "^18.3.1",
80
79
  "eslint": "7.14.0",
@@ -100,7 +99,7 @@
100
99
  "@ant-design/icons-react-native": "^2.2.1",
101
100
  "@ant-design/react-native": "^4.0.5",
102
101
  "@babel/helper-environment-visitor": "^7.16.7",
103
- "@eohjsc/highcharts": "^1.0.9",
102
+ "@eohjsc/highcharts": "^1.0.8",
104
103
  "@eohjsc/react-native-keyboard-aware-scroll-view": "^0.9.5",
105
104
  "@formatjs/intl-getcanonicallocales": "^1.4.5",
106
105
  "@formatjs/intl-numberformat": "^5.6.2",
@@ -125,7 +124,6 @@
125
124
  "@react-navigation/stack": "^5.7.0",
126
125
  "@sentry/react-native": "^1.7.1",
127
126
  "@testing-library/react-hooks": "^6.0.0",
128
- "apisauce": "^2.1.5",
129
127
  "axios": "^0.19.2",
130
128
  "dotenv": "^8.2.0",
131
129
  "google-libphonenumber": "^3.2.10",
@@ -146,8 +144,6 @@
146
144
  "react-hooks-global-state": "^1.0.1",
147
145
  "react-i18next": "^11.8.12",
148
146
  "react-native-alert-async": "^1.0.5",
149
- "react-native-android-keyboard-adjust": "^1.2.0",
150
- "react-native-android-location-enabler": "^1.2.2",
151
147
  "react-native-android-wifi": "^0.0.41",
152
148
  "react-native-appearance": "^0.3.4",
153
149
  "react-native-base64": "^0.1.0",
@@ -178,7 +174,7 @@
178
174
  "react-native-pager-view": "^5.4.1",
179
175
  "react-native-parallax-scroll-view": "^0.21.3",
180
176
  "react-native-parsed-text": "^0.0.22",
181
- "react-native-permissions": "3.0.3",
177
+ "react-native-permissions": "^2.1.5",
182
178
  "react-native-popover-view": "^4.0.3",
183
179
  "react-native-progress": "^5.0.0",
184
180
  "react-native-reanimated": "1.10.1",
@@ -194,7 +190,7 @@
194
190
  "react-native-unimodules": "^0.11.0",
195
191
  "react-native-version-check": "^3.4.2",
196
192
  "react-native-vlc-media-player": "^1.0.39",
197
- "react-native-webview": "11.17.2",
193
+ "react-native-webview": "^10.9.3",
198
194
  "react-native-wheel-color-picker": "^1.2.0",
199
195
  "react-native-wheel-scrollview-picker": "^1.2.2",
200
196
  "react-native-wifi-reborn": "^4.5.0",
@@ -22,7 +22,6 @@ Pod::Spec.new do |s|
22
22
  s.requires_arc = true
23
23
 
24
24
  s.dependency "React"
25
- s.dependency "RNPermissions"
26
25
  # ...
27
26
  # s.dependency "..."
28
27
  end
@@ -3,7 +3,7 @@ import { TouchableOpacity, View } from 'react-native';
3
3
  import { TESTID } from '../../configs/Constants';
4
4
  import { useSCContextSelector } from '../../context';
5
5
  import { watchMultiConfigs } from '../../iot/Monitor';
6
- import { useRemoteControl } from '../../hooks/IoT';
6
+ import { sendRemoteCommand } from '../../iot/RemoteControl';
7
7
  import { useConfigGlobalState } from '../../iot/states';
8
8
  import IconComponent from '../IconComponent';
9
9
 
@@ -13,8 +13,6 @@ const ItemQuickAction = memo(({ sensor, wrapperStyle, setStatus, unit }) => {
13
13
  // eslint-disable-next-line no-unused-vars
14
14
  const [configValues, _] = useConfigGlobalState('configValues');
15
15
 
16
- const sendRemoteCommand = useRemoteControl();
17
-
18
16
  const revertActionUpdate = useCallback(
19
17
  (value, on_action, on_status, off_action, off_status) => {
20
18
  setIsSendingCommand(false);
@@ -45,9 +43,8 @@ const ItemQuickAction = memo(({ sensor, wrapperStyle, setStatus, unit }) => {
45
43
  useEffect(() => {
46
44
  sensor.quick_action &&
47
45
  sensor.quick_action.config_id &&
48
- sensor.device_type !== 'GOOGLE_HOME' &&
49
46
  watchMultiConfigs([sensor.quick_action.config_id]);
50
- }, [sensor.quick_action, sensor?.device_type]);
47
+ }, [sensor.quick_action]);
51
48
 
52
49
  useEffect(() => {
53
50
  if (!sensor.quick_action) {
@@ -62,9 +59,7 @@ const ItemQuickAction = memo(({ sensor, wrapperStyle, setStatus, unit }) => {
62
59
  const userId = useSCContextSelector((state) => state?.auth.account.user.id);
63
60
  const onActionPress = useCallback(() => {
64
61
  sendRemoteCommand(sensor, action, null, userId);
65
- sensor.quick_action &&
66
- sensor.device_type !== 'GOOGLE_HOME' &&
67
- watchMultiConfigs([sensor.quick_action.config_id]);
62
+ sensor.quick_action && watchMultiConfigs([sensor.quick_action.config_id]);
68
63
  setIsSendingCommand(true);
69
64
 
70
65
  if (!sensor.quick_action) {
@@ -83,14 +78,7 @@ const ItemQuickAction = memo(({ sensor, wrapperStyle, setStatus, unit }) => {
83
78
  statusCallback(action.id === sensor.quick_action.on_action.id);
84
79
  }, sensor.quick_action.interval);
85
80
  }
86
- }, [
87
- sensor,
88
- action,
89
- userId,
90
- revertActionUpdate,
91
- statusCallback,
92
- sendRemoteCommand,
93
- ]);
81
+ }, [sensor, action, userId, revertActionUpdate, statusCallback]);
94
82
 
95
83
  if (!action) {
96
84
  return <View />;
@@ -5,6 +5,7 @@ import ItemQuickAction from '../ItemQuickAction';
5
5
  import { Colors } from '../../../configs';
6
6
  import { TESTID } from '../../../configs/Constants';
7
7
  import { factory } from 'factory-girl';
8
+ import { sendRemoteCommand } from '../../../iot/RemoteControl';
8
9
 
9
10
  class Sensor {}
10
11
 
@@ -20,13 +21,7 @@ jest.mock('react', () => {
20
21
 
21
22
  useState.mockImplementation((init) => [init, mockSetState]);
22
23
 
23
- const mockSendRemoteControl = jest.fn();
24
- jest.mock('../../../hooks/IoT', () => {
25
- return {
26
- ...jest.requireActual('../../../hooks/IoT'),
27
- useRemoteControl: () => mockSendRemoteControl,
28
- };
29
- });
24
+ jest.mock('../../../iot/RemoteControl');
30
25
 
31
26
  jest.mock('../../../iot/states', () => ({
32
27
  useConfigGlobalState: () => [{}, null],
@@ -88,9 +83,9 @@ describe('Test ItemQuickAction', () => {
88
83
  };
89
84
 
90
85
  test('render with no action', async () => {
91
- const newSensor = await factory.build('Sensor');
86
+ const sensor = await factory.build('Sensor');
92
87
  act(() => {
93
- tree = create(<ItemQuickAction sensor={newSensor} />);
88
+ tree = create(<ItemQuickAction sensor={sensor} />);
94
89
  });
95
90
  const instance = tree.root;
96
91
  const buttonOnActionPress = instance.findAll(
@@ -126,7 +121,7 @@ describe('Test ItemQuickAction', () => {
126
121
  act(() => {
127
122
  buttonOnActionPress.props.onPress();
128
123
  });
129
- expect(mockSendRemoteControl).toBeCalled();
124
+ expect(sendRemoteCommand).toBeCalled();
130
125
  expect(mockSetState).toBeCalledTimes(1);
131
126
 
132
127
  jest.runAllTimers();
@@ -159,7 +154,7 @@ describe('Test ItemQuickAction', () => {
159
154
  act(() => {
160
155
  buttonOnActionPress.props.onPress();
161
156
  });
162
- expect(mockSendRemoteControl).toBeCalled();
157
+ expect(sendRemoteCommand).toBeCalled();
163
158
  expect(mockSetState).toBeCalledTimes(1);
164
159
 
165
160
  jest.runAllTimers();
@@ -1,67 +1,54 @@
1
- import React, { memo, useState, useEffect } from 'react';
1
+ import React, { memo, useCallback, useState, useEffect, useMemo } from 'react';
2
2
  import { View } from 'react-native';
3
3
  import styles from './ColorPickerTemplateStyles';
4
4
  import ColorPicker from 'react-native-wheel-color-picker';
5
5
  import { watchMultiConfigs } from '../../iot/Monitor';
6
6
  import { useConfigGlobalState } from '../../iot/states';
7
7
 
8
- let isFirstTime = true;
9
-
10
- const WheelColorPicker = ({ valueColor, onChangeColor }) => {
11
- return (
12
- <ColorPicker
13
- style={styles.colorPicker}
14
- sliderHidden={true}
15
- swatches={false}
16
- color={valueColor}
17
- onColorChangeComplete={onChangeColor}
18
- thumbSize={16}
19
- />
20
- );
21
- };
22
-
23
8
  const ColorPickerTemplate = memo(({ actionGroup, doAction, sensor }) => {
24
9
  const { configuration } = actionGroup;
25
10
  const [valueColorComplete, setValueColorComplete] = useState('');
11
+ const [isFirstColor, setIsFirstColor] = useState(false);
26
12
  const [configValues] = useConfigGlobalState('configValues');
27
13
 
28
- const onChangeColor = (color) => {
29
- const to = setTimeout(() => {
30
- isFirstTime = false;
31
- clearTimeout(to);
32
- }, 1000);
33
-
34
- !isFirstTime &&
14
+ const onChangeColor = useCallback(
15
+ (color) => {
16
+ if (!isFirstColor) {
17
+ setIsFirstColor(true);
18
+ return;
19
+ }
35
20
  doAction(
36
21
  configuration?.action_color_data,
37
22
  JSON.stringify({ value: color })
38
23
  );
39
- };
24
+ },
25
+ [configuration?.action_color_data, doAction, isFirstColor]
26
+ );
27
+ const valueColor = useMemo(() => {
28
+ return valueColorComplete || '';
29
+ }, [valueColorComplete]);
40
30
 
41
31
  useEffect(() => {
42
32
  const { config } = configuration;
43
33
  const configValue = configValues[config];
44
- if (configValue && isFirstTime) {
45
- setValueColorComplete(`#${configValue?.toString(16)}`);
46
- }
47
- // eslint-disable-next-line react-hooks/exhaustive-deps
48
- }, [configValues]);
34
+ setValueColorComplete(configValue);
35
+ }, [configuration.config, configValues, configuration]);
49
36
 
50
37
  useEffect(() => {
51
- if (sensor?.is_managed_by_backend && sensor.device_type !== 'GOOGLE_HOME') {
38
+ if (sensor?.is_managed_by_backend) {
52
39
  watchMultiConfigs([configuration.config]);
53
40
  }
54
41
  }, [sensor, configuration.config]);
55
42
 
56
- useEffect(() => {
57
- return () => (isFirstTime = true);
58
- }, []);
59
-
60
43
  return (
61
44
  <View style={styles.viewPickColor}>
62
- <WheelColorPicker
63
- valueColor={valueColorComplete}
64
- onChangeColor={onChangeColor}
45
+ <ColorPicker
46
+ style={styles.colorPicker}
47
+ sliderHidden={true}
48
+ swatches={false}
49
+ color={valueColor}
50
+ onColorChangeComplete={onChangeColor}
51
+ thumbSize={16}
65
52
  />
66
53
  </View>
67
54
  );
@@ -17,11 +17,6 @@ const CurtainButtonTemplate = memo(({ actionGroup, doAction, sensor }) => {
17
17
  close_action_data,
18
18
  action_off_data,
19
19
  action_on_data,
20
- is_display_lock,
21
- text1,
22
- text2,
23
- text3,
24
- text_door_lock,
25
20
  } = configuration || {};
26
21
  const [lock, setLock] = useState(false);
27
22
 
@@ -57,21 +52,21 @@ const CurtainButtonTemplate = memo(({ actionGroup, doAction, sensor }) => {
57
52
  {
58
53
  style: styles.buttonActionCurtain,
59
54
  icon: Images.buttonLeftCurtain,
60
- text: text1,
55
+ text: configuration.text1,
61
56
  onPress: onButtonOpenPress,
62
57
  testID: TESTID.BUTTON_TEMPLATE_1,
63
58
  },
64
59
  {
65
60
  style: styles.buttonActionCurtainCenter,
66
61
  icon: Images.buttonPauseCurtain,
67
- text: text2,
62
+ text: configuration.text2,
68
63
  onPress: onButtonStopPress,
69
64
  testID: TESTID.BUTTON_TEMPLATE_2,
70
65
  },
71
66
  {
72
67
  style: styles.buttonActionCurtain,
73
68
  icon: Images.buttonRightCurtain,
74
- text: text3,
69
+ text: configuration.text3,
75
70
  onPress: onButtonClosePress,
76
71
  testID: TESTID.BUTTON_TEMPLATE_3,
77
72
  },
@@ -101,7 +96,7 @@ const CurtainButtonTemplate = memo(({ actionGroup, doAction, sensor }) => {
101
96
  style={styles.textLockDoor}
102
97
  testID={TESTID.TEXT_DOOR_LOOK_ON_OFF}
103
98
  >
104
- {text_door_lock}{' '}
99
+ {configuration.text_door_lock}{' '}
105
100
  </Text>
106
101
  </View>
107
102
  <Switch
@@ -120,7 +115,7 @@ const CurtainButtonTemplate = memo(({ actionGroup, doAction, sensor }) => {
120
115
  <RenderThreeButtonActions />
121
116
  </View>
122
117
  <View style={styles.lockSwitch}>
123
- {is_display_lock &&
118
+ {configuration.is_display_lock &&
124
119
  itemLock(
125
120
  lock ? 'lock' : 'unlock',
126
121
  lock ? Colors.Primary : Colors.Gray6
@@ -32,7 +32,7 @@ const NumberUpDownActionTemplate = ({ actionGroup, doAction, sensor }) => {
32
32
  if (
33
33
  !!config &&
34
34
  sensor?.is_managed_by_backend &&
35
- sensor.device_type !== 'GOOGLE_HOME'
35
+ sensor.device_type !== DEVICE_TYPE.GOOGLE_HOME
36
36
  ) {
37
37
  watchMultiConfigs([config]);
38
38
  }
@@ -53,12 +53,16 @@ const NumberUpDownActionTemplate = ({ actionGroup, doAction, sensor }) => {
53
53
 
54
54
  const doActionAndWatchConfig = useCallback(
55
55
  async (actionData, actionValue, actionName) => {
56
- const data = { temperature: actionValue };
57
- if (allow_config_store_value && config) {
58
- data.config_id = config;
59
- data.value = actionValue;
56
+ let data = actionValue;
57
+ if (sensor.device_type !== DEVICE_TYPE.GOOGLE_HOME) {
58
+ data = { temperature: actionValue };
59
+ if (allow_config_store_value && config) {
60
+ data.config_id = config;
61
+ data.value = actionValue;
62
+ }
63
+ data = JSON.stringify(data);
60
64
  }
61
- await doAction(actionData, JSON.stringify(data), actionName);
65
+ await doAction(actionData, data, actionName);
62
66
  if (!sensor?.is_managed_by_backend) {
63
67
  return;
64
68
  }
@@ -67,7 +71,7 @@ const NumberUpDownActionTemplate = ({ actionGroup, doAction, sensor }) => {
67
71
  }
68
72
 
69
73
  config &&
70
- sensor.device_type !== 'GOOGLE_HOME' &&
74
+ sensor.device_type !== DEVICE_TYPE.GOOGLE_HOME &&
71
75
  watchMultiConfigs([config]);
72
76
  },
73
77
  [
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import { act, create } from 'react-test-renderer';
3
- import { Switch } from 'react-native';
4
3
 
5
4
  import AutoLock from '../index';
6
5
  import { mockSCStore } from '../../../../../context/mockStore';
@@ -39,9 +38,6 @@ describe('Test AutoLock', () => {
39
38
  });
40
39
 
41
40
  const instance = tree.root;
42
- const switchs = instance.findByType(Switch);
43
- await switchs.props.onValueChange();
44
-
45
41
  const { buttonEnable, buttonInstant, buttonRelockTiming } =
46
42
  getElement(instance);
47
43
 
@@ -19,7 +19,7 @@ const ButtonWrapper = ({ item, textHeadline }) => {
19
19
  };
20
20
 
21
21
  const ItemPasscode = memo(({ route }) => {
22
- const { item = {} } = route.params || {};
22
+ const { item } = route.params;
23
23
 
24
24
  return (
25
25
  <SafeAreaView style={styles.container}>
@@ -40,7 +40,6 @@ describe('Test SetupGeneratePasscode', () => {
40
40
  const changeDuration = instance.findAll(
41
41
  (item) => item.props.testID === TESTID.GENERATE_PASSCODE_SET_DURATION
42
42
  );
43
-
44
43
  return {
45
44
  changeName,
46
45
  changeTime,
@@ -59,18 +58,5 @@ describe('Test SetupGeneratePasscode', () => {
59
58
  expect(changeName[0]).toBeDefined();
60
59
  expect(changeTime[0]).toBeDefined();
61
60
  expect(changeDuration[0]).toBeDefined();
62
-
63
- await changeDuration[0].props.onPressSetMinute();
64
- await changeDuration[0].props.onPressSelectCircle();
65
- await changeTime[0].props.onPressSetTime();
66
-
67
- const wheelDateTimePicker = instance.findAll(
68
- (item) =>
69
- item.props.testID ===
70
- `${TESTID.WHEEL_DATE_TIME_PICKER_BUTTON}${TESTID.VIEW_BUTTON_BOTTOM_RIGHT_BUTTON}`
71
- );
72
- await wheelDateTimePicker[5].props.onClick();
73
- await wheelDateTimePicker[11].props.onClick();
74
- await wheelDateTimePicker[17].props.onClick();
75
61
  });
76
62
  });
@@ -180,7 +180,6 @@ const SetupGeneratePasscode = memo(() => {
180
180
  showsVerticalScrollIndicator={false}
181
181
  showsHorizontalScrollIndicator={false}
182
182
  style={styles.scrollview}
183
- scrollIndicatorInsets={{ right: 1 }}
184
183
  >
185
184
  <View style={styles.wrap}>
186
185
  <ButtonWrapper
@@ -5,20 +5,15 @@ import React, { memo } from 'react';
5
5
  import { TouchableOpacity, View } from 'react-native';
6
6
  import { Colors } from '../../../configs';
7
7
  import styles from './OnOffButtonTemplateStyle';
8
- import { TESTID } from '../../../configs/Constants';
9
8
 
10
9
  const OnOffButtonTemplate = memo(
11
10
  ({ isOn, triggerAction, actionGroup, isLight = false }) => {
12
- const { configuration, id } = actionGroup;
11
+ const { configuration } = actionGroup;
13
12
 
14
13
  return (
15
14
  <>
16
15
  <View style={styles.barrierControlContainer}>
17
- <TouchableOpacity
18
- style={styles.bigCircle}
19
- onPress={triggerAction}
20
- testID={`${TESTID.ON_OFF_BUTTON}-${id}`}
21
- >
16
+ <TouchableOpacity style={styles.bigCircle} onPress={triggerAction}>
22
17
  <View style={styles.smallCircle}>
23
18
  <Icon
24
19
  name={isOn ? configuration.icon_on : configuration.icon_off}
@@ -30,7 +25,6 @@ const OnOffButtonTemplate = memo(
30
25
  styles.textBig,
31
26
  { color: isOn ? Colors.Gray8 : Colors.Gray6 },
32
27
  ]}
33
- testID={`${TESTID.SENSOR_STATUS}-${id}`}
34
28
  >
35
29
  {isOn ? configuration.text_on : configuration.text_off}
36
30
  </Text>
@@ -9,7 +9,7 @@ import { useDropdownAction } from './hooks/useDropdownAction';
9
9
  import { useConfigGlobalState } from '../../iot/states';
10
10
  import styles from './OptionsDropdownActionTemplateStyle';
11
11
  import { watchMultiConfigs } from '../../iot/Monitor';
12
- import { TESTID } from '../../configs/Constants';
12
+ import { DEVICE_TYPE, TESTID } from '../../configs/Constants';
13
13
  import IconComponent from '../../commons/IconComponent';
14
14
  import { useTranslations } from '../../hooks/Common/useTranslations';
15
15
  import SvgDoorState from '../../../assets/images/Device/door-state.svg';
@@ -61,14 +61,16 @@ const OptionsDropdownActionTemplate = ({ actionGroup, doAction, sensor }) => {
61
61
  const value = getOptionValue(newOption);
62
62
  let actionName = `${sensor?.name} ${title?.toLowerCase()} ${value}`;
63
63
  actionName = actionName.replace(/\s+/g, ' ').trim();
64
- doAction(
65
- action_data,
66
- JSON.stringify({ level: value, key_code: newOption?.value_int }),
67
- actionName
68
- );
64
+
65
+ let data = JSON.stringify({ level: value, key_code: newOption?.value_int });
66
+ if (sensor.device_type === DEVICE_TYPE.GOOGLE_HOME) {
67
+ data = value;
68
+ }
69
+
70
+ doAction(action_data, data, actionName);
69
71
  if (sensor?.is_managed_by_backend) {
70
72
  configuration.config &&
71
- sensor.device_type !== 'GOOGLE_HOME' &&
73
+ sensor.device_type !== DEVICE_TYPE.GOOGLE_HOME &&
72
74
  watchMultiConfigs([configuration.config]);
73
75
  }
74
76
  hideAlertAction();
@@ -33,15 +33,11 @@ const SliderRangeTemplate = memo(({ actionGroup, doAction, sensor }) => {
33
33
  useEffect(() => {
34
34
  const { config } = configuration;
35
35
  const configValue = configValues[config];
36
- let valueTemp = configValue;
37
- if (configValue > 0) {
38
- valueTemp = Math.round((configValue / 254) * 100);
39
- }
40
- setValueBrightness(valueTemp);
36
+ setValueBrightness(configValue);
41
37
  }, [configuration.config, configValues, configuration]);
42
38
 
43
39
  useEffect(() => {
44
- if (sensor?.is_managed_by_backend && sensor.device_type !== 'GOOGLE_HOME') {
40
+ if (sensor?.is_managed_by_backend) {
45
41
  watchMultiConfigs([configuration.config]);
46
42
  }
47
43
  }, [sensor, configuration.config]);
@@ -1,5 +1,5 @@
1
1
  import React, { memo, useCallback } from 'react';
2
- import { View, ScrollView } from 'react-native';
2
+ import { View, ScrollView, Alert } from 'react-native';
3
3
 
4
4
  import styles from './SmartTiviActionTemplateStyles';
5
5
  import Text from '../../Text';
@@ -22,7 +22,6 @@ import {
22
22
  Youtube,
23
23
  Netflix,
24
24
  } from './component/Icon';
25
- import { notImplemented } from '../../../utils/Utils';
26
25
 
27
26
  const SmartTiviActionTemplate = memo(
28
27
  ({ actionGroup, doAction, scrollEnabled = true }) => {
@@ -69,7 +68,7 @@ const SmartTiviActionTemplate = memo(
69
68
  case SMART_TIVI_BUTTON.HOME_BUTTON:
70
69
  case SMART_TIVI_BUTTON.BACK_BUTTON:
71
70
  case SMART_TIVI_BUTTON.CHANNEL_BUTTON:
72
- return notImplemented(t);
71
+ return Alert.alert(t('feature_under_development'));
73
72
  default:
74
73
  return <></>;
75
74
  }
@@ -92,10 +91,7 @@ const SmartTiviActionTemplate = memo(
92
91
  }, []);
93
92
  return (
94
93
  <>
95
- <ScrollView
96
- scrollEnabled={scrollEnabled}
97
- scrollIndicatorInsets={{ right: 1 }}
98
- >
94
+ <ScrollView scrollEnabled={scrollEnabled}>
99
95
  <View style={styles.wrap}>
100
96
  <View style={styles.rowOnOff}>
101
97
  <CircleButton