Merge pull request #11264 from vector-im/dbkr/fix_wakelock_bug

Fix bug preventing display from sleeping after a call
This commit is contained in:
David Baker 2019-10-30 13:19:01 +00:00 committed by GitHub
commit d6125d0d0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -118,16 +118,17 @@ ipcMain.on('loudNotification', function() {
}
});
let powerSaveBlockerId;
let powerSaveBlockerId = null;
ipcMain.on('app_onAction', function(ev, payload) {
switch (payload.action) {
case 'call_state':
if (powerSaveBlockerId && powerSaveBlocker.isStarted(powerSaveBlockerId)) {
if (powerSaveBlockerId !== null && powerSaveBlocker.isStarted(powerSaveBlockerId)) {
if (payload.state === 'ended') {
powerSaveBlocker.stop(powerSaveBlockerId);
powerSaveBlockerId = null;
}
} else {
if (payload.state === 'connected') {
if (powerSaveBlockerId === null && payload.state === 'connected') {
powerSaveBlockerId = powerSaveBlocker.start('prevent-display-sleep');
}
}