Adds using power monitor and detecting computer suspend. (#174)

* Adds using power monitor and detecting computer suspend.

* Simplify api listener functions.

* Fixes comments.
This commit is contained in:
Дамян Минков 2019-07-11 14:49:15 +01:00 committed by GitHub
parent d8bef4a784
commit 26053fc478
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 6 deletions

View file

@ -12,7 +12,8 @@ import {
setupScreenSharingForWindow,
setupAlwaysOnTopRender,
initPopupsConfigurationRender,
setupWiFiStats
setupWiFiStats,
setupPowerMonitorRender
} from 'jitsi-meet-electron-utils';
import config from '../../config';
@ -112,6 +113,7 @@ class Conference extends Component<Props, State> {
this._ref = React.createRef();
this._onIframeLoad = this._onIframeLoad.bind(this);
this._onVideoConferenceEnded = this._onVideoConferenceEnded.bind(this);
}
/**
@ -265,11 +267,10 @@ class Conference extends Component<Props, State> {
new RemoteControl(iframe); // eslint-disable-line no-new
setupAlwaysOnTopRender(this._api);
setupWiFiStats(iframe);
setupPowerMonitorRender(this._api);
this._api.on('readyToClose', (event: Event) => {
this.props.dispatch(conferenceEnded(this._conference));
this._navigateToHome(event);
});
this._api.on('suspendDetected', this._onVideoConferenceEnded);
this._api.on('readyToClose', this._onVideoConferenceEnded);
this._api.on('videoConferenceJoined',
(conferenceInfo: Object) => {
this.props.dispatch(conferenceJoined(this._conference));
@ -278,6 +279,20 @@ class Conference extends Component<Props, State> {
);
}
_onVideoConferenceEnded: (*) => void;
/**
* Dispatches conference ended and navigates to home screen.
*
* @param {Event} event - Event by which the function is called.
* @returns {void}
* @private
*/
_onVideoConferenceEnded(event: Event) {
this.props.dispatch(conferenceEnded(this._conference));
this._navigateToHome(event);
}
/**
* Updates redux state's user name from conference.
*

View file

@ -12,7 +12,8 @@ const windowStateKeeper = require('electron-window-state');
const {
initPopupsConfigurationMain,
getPopupTarget,
setupAlwaysOnTopMain
setupAlwaysOnTopMain,
setupPowerMonitorMain
} = require('jitsi-meet-electron-utils');
const path = require('path');
const URL = require('url');
@ -143,6 +144,7 @@ function createJitsiMeetWindow() {
initPopupsConfigurationMain(mainWindow);
setupAlwaysOnTopMain(mainWindow);
setupPowerMonitorMain(mainWindow);
mainWindow.webContents.on('new-window', (event, url, frameName) => {
const target = getPopupTarget(url, frameName);