@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.
- package/package.json +1 -1
- package/src/Images/Common/disney.svg +20 -0
- package/src/Images/Common/home.svg +3 -0
- package/src/Images/Common/input.svg +3 -0
- package/src/Images/Common/keyboard_arrow_down.svg +3 -0
- package/src/Images/Common/keyboard_arrow_up.svg +3 -0
- package/src/Images/Common/keyboard_return.svg +3 -0
- package/src/Images/Common/netflix.svg +9 -0
- package/src/Images/Common/pause.svg +3 -0
- package/src/Images/Common/shadowButton.png +0 -0
- package/src/Images/Common/spotify.svg +5 -0
- package/src/Images/Common/volume_up.svg +3 -0
- package/src/Images/Common/youtube.svg +13 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +214 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplateStyles.js +69 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/CircleButton.test.js +129 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/ControlPlay.test.js +138 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/RectangleButton.test.js +110 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/SmartTiviActionTemplate.test.js +144 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButton.js +91 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButtonStyles.js +79 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlay.js +51 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlayStyles.js +28 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/Icon.js +25 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/RectangleButton.js +49 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/RectangleButtonStyles.js +47 -0
- package/src/commons/ActionGroup/index.js +3 -0
- package/src/commons/Device/HistoryChart.js +11 -7
- package/src/commons/Device/HorizontalBarChart.js +2 -1
- package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +1 -1
- package/src/configs/API.js +3 -0
- package/src/configs/Constants.js +23 -0
- package/src/configs/Images.js +1 -0
- package/src/context/actionType.ts +2 -0
- package/src/context/reducer.ts +10 -0
- package/src/navigations/UnitStack.js +1 -3
- package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +37 -50
- package/src/screens/AddNewGateway/index.js +5 -1
- package/src/screens/ConfirmUnitDeletion/index.js +1 -1
- package/src/screens/Device/EditDevice/index.js +1 -1
- package/src/screens/Device/EditDevice/styles/EditDeviceStyles.js +2 -0
- package/src/screens/Notification/Monitor.js +12 -0
- package/src/screens/Notification/components/NotificationItem.js +11 -0
- package/src/screens/Notification/index.js +8 -0
- package/src/screens/Unit/Detail.js +8 -5
- package/src/screens/Unit/ManageUnit.js +9 -6
- package/src/screens/Unit/components/MyUnitDevice/index.js +4 -1
- package/src/utils/I18n/translations/en.json +3 -1
- package/src/utils/I18n/translations/vi.json +3 -1
- package/src/utils/Pusher/index.js +36 -0
- 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
|
+
};
|
package/src/utils/Route/index.js
CHANGED