mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
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:
commit
d6125d0d0c
@ -118,16 +118,17 @@ ipcMain.on('loudNotification', function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let powerSaveBlockerId;
|
let powerSaveBlockerId = null;
|
||||||
ipcMain.on('app_onAction', function(ev, payload) {
|
ipcMain.on('app_onAction', function(ev, payload) {
|
||||||
switch (payload.action) {
|
switch (payload.action) {
|
||||||
case 'call_state':
|
case 'call_state':
|
||||||
if (powerSaveBlockerId && powerSaveBlocker.isStarted(powerSaveBlockerId)) {
|
if (powerSaveBlockerId !== null && powerSaveBlocker.isStarted(powerSaveBlockerId)) {
|
||||||
if (payload.state === 'ended') {
|
if (payload.state === 'ended') {
|
||||||
powerSaveBlocker.stop(powerSaveBlockerId);
|
powerSaveBlocker.stop(powerSaveBlockerId);
|
||||||
|
powerSaveBlockerId = null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (payload.state === 'connected') {
|
if (powerSaveBlockerId === null && payload.state === 'connected') {
|
||||||
powerSaveBlockerId = powerSaveBlocker.start('prevent-display-sleep');
|
powerSaveBlockerId = powerSaveBlocker.start('prevent-display-sleep');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user