@eohjsc/react-native-smart-city 0.2.71 → 0.2.75

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 (51) hide show
  1. package/package.json +1 -1
  2. package/src/Images/Common/disney.svg +20 -0
  3. package/src/Images/Common/home.svg +3 -0
  4. package/src/Images/Common/input.svg +3 -0
  5. package/src/Images/Common/keyboard_arrow_down.svg +3 -0
  6. package/src/Images/Common/keyboard_arrow_up.svg +3 -0
  7. package/src/Images/Common/keyboard_return.svg +3 -0
  8. package/src/Images/Common/netflix.svg +9 -0
  9. package/src/Images/Common/pause.svg +3 -0
  10. package/src/Images/Common/shadowButton.png +0 -0
  11. package/src/Images/Common/spotify.svg +5 -0
  12. package/src/Images/Common/volume_up.svg +3 -0
  13. package/src/Images/Common/youtube.svg +13 -0
  14. package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +214 -0
  15. package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplateStyles.js +69 -0
  16. package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/CircleButton.test.js +129 -0
  17. package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/ControlPlay.test.js +138 -0
  18. package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/RectangleButton.test.js +110 -0
  19. package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/SmartTiviActionTemplate.test.js +144 -0
  20. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButton.js +91 -0
  21. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButtonStyles.js +79 -0
  22. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlay.js +51 -0
  23. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlayStyles.js +28 -0
  24. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/Icon.js +25 -0
  25. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/RectangleButton.js +49 -0
  26. package/src/commons/ActionGroup/SmartTiviActionTemplate/component/RectangleButtonStyles.js +47 -0
  27. package/src/commons/ActionGroup/index.js +3 -0
  28. package/src/commons/Device/HistoryChart.js +11 -7
  29. package/src/commons/Device/HorizontalBarChart.js +2 -1
  30. package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +1 -1
  31. package/src/configs/API.js +3 -0
  32. package/src/configs/Constants.js +23 -0
  33. package/src/configs/Images.js +1 -0
  34. package/src/context/actionType.ts +2 -0
  35. package/src/context/reducer.ts +10 -0
  36. package/src/navigations/UnitStack.js +1 -3
  37. package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +37 -50
  38. package/src/screens/AddNewGateway/index.js +5 -1
  39. package/src/screens/ConfirmUnitDeletion/index.js +1 -1
  40. package/src/screens/Device/EditDevice/index.js +1 -1
  41. package/src/screens/Device/EditDevice/styles/EditDeviceStyles.js +2 -0
  42. package/src/screens/Notification/Monitor.js +12 -0
  43. package/src/screens/Notification/components/NotificationItem.js +11 -0
  44. package/src/screens/Notification/index.js +8 -0
  45. package/src/screens/Unit/Detail.js +8 -5
  46. package/src/screens/Unit/ManageUnit.js +9 -6
  47. package/src/screens/Unit/components/MyUnitDevice/index.js +4 -1
  48. package/src/utils/I18n/translations/en.json +3 -1
  49. package/src/utils/I18n/translations/vi.json +3 -1
  50. package/src/utils/Pusher/index.js +36 -0
  51. package/src/utils/Route/index.js +1 -0
@@ -0,0 +1,36 @@
1
+ import { API } from '../../configs';
2
+ import Pusher from 'pusher-js/react-native';
3
+ import { SCConfig } from '../../configs/SCConfig';
4
+ import { axiosPost } from '../../utils/Apis/axios';
5
+
6
+ Pusher.logToConsole = true;
7
+ let pusher = null;
8
+
9
+ export const getPusher = () => {
10
+ if (!pusher) {
11
+ pusher = new Pusher(SCConfig.pusherAppKey, {
12
+ cluster: SCConfig.pusherAppCluste,
13
+ authorizer: function (channel, option) {
14
+ return {
15
+ // eslint-disable-next-line promise/prefer-await-to-callbacks
16
+ authorize: async function (socketId, callback) {
17
+ const { success, data } = await axiosPost(API.PUSHER.AUTH(), {
18
+ channel_name: channel.name,
19
+ socket_id: socketId,
20
+ });
21
+ if (success) {
22
+ // eslint-disable-next-line promise/prefer-await-to-callbacks
23
+ callback(null, data);
24
+ }
25
+ },
26
+ };
27
+ },
28
+ });
29
+ }
30
+ return pusher;
31
+ };
32
+
33
+ export const destroyPusher = () => {
34
+ pusher.disconnect();
35
+ pusher = null;
36
+ };
@@ -126,6 +126,7 @@ const Routes = {
126
126
  GatewayWifiList: 'GatewayWifiList',
127
127
  ConfirmUnitDeletion: 'ConfirmUnitDeletion',
128
128
  SmartAccount: 'SmartAccount',
129
+ SmartHomeDashboard: 'SmartHomeDashboard',
129
130
  };
130
131
 
131
132
  export default Routes;