In prerelease, enable background throttling when not on a call

This commit is contained in:
Evan Hahn 2021-09-28 14:00:22 -05:00 committed by GitHub
parent 2f7226e200
commit 942ce16610
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 59 additions and 2 deletions

28
main.js
View file

@ -403,7 +403,10 @@ async function createWindow() {
),
nativeWindowOpen: true,
spellcheck: await getSpellCheckSetting(),
backgroundThrottling: false,
// We are evaluating background throttling in prerelease versions. If we decide to
// move forward, we can remove this line (as `backgroundThrottling` is true by
// default).
backgroundThrottling: !isProduction(app.getVersion()),
enablePreferredSizeMode: true,
},
icon: windowIcon,
@ -664,6 +667,29 @@ ipc.on('title-bar-double-click', () => {
}
});
ipc.on('set-is-call-active', (_event, isCallActive) => {
if (!mainWindow) {
return;
}
// We are evaluating background throttling in prerelease versions. If we decide to move
// forward, we can remove this check.
if (isProduction(app.getVersion())) {
return;
}
let backgroundThrottling;
if (isCallActive) {
console.log('Background throttling disabled because a call is active');
backgroundThrottling = false;
} else {
console.log('Background throttling enabled because no call is active');
backgroundThrottling = true;
}
mainWindow.webContents.setBackgroundThrottling(backgroundThrottling);
});
ipc.on('convert-image', async (event, uuid, data) => {
const { error, response } = await heicConverter(uuid, data);
event.reply(`convert-image:${uuid}`, { error, response });