Remove some unused electron code

Verified that steam exits the game even when a link has been opened, no need for utils.openExternal or tracking app_playerOpenedExternalLink.
Also removed some unneeded eslint override comments
This commit is contained in:
omuretsu 2023-02-26 19:18:54 -05:00
parent b9b5a62105
commit 93939431e9
3 changed files with 0 additions and 30 deletions

@ -72,23 +72,6 @@ function setStopProcessHandler(app, window) {
log.error(error);
}
// This may no longer be needed due to the return of action: deny in gameWindow.js setWindowOpenHandler.
// Nothing currently sets the app_playerOpenedExternalLink flag. See utils.js openExternal comment for more info.
// -------
// Because of a steam limitation, if the player has launched an external browser,
// steam will keep displaying the game as "Running" in their UI as long as the browser is up.
// So we'll alert the player to close their browser.
if (global.app_playerOpenedExternalLink) {
await dialog.showMessageBox({
title: "Bitburner",
message: "You may have to close your browser to properly exit the game.",
detail:
'Steam will keep tracking Bitburner as "Running" if any process started within the game is still running.' +
" This includes launching an external link, which opens up your browser.",
type: "warning",
buttons: ["OK"],
});
}
// We'll try to execute javascript on the page to see if we're stuck
let canRunJS = false;
window.webContents.executeJavaScript("window.stop(); document.close()", true).then(() => (canRunJS = true));

@ -58,12 +58,10 @@ async function prepareFolders(...folders) {
for (const folder of folders) {
try {
// Making sure the folder exists
// eslint-disable-next-line no-await-in-loop
await fs.stat(folder);
} catch (error) {
if (error.code === "ENOENT") {
log.warn(`'${folder}' not found, creating it...`);
// eslint-disable-next-line no-await-in-loop
await fs.mkdir(folder);
} else {
log.error(error);
@ -250,13 +248,11 @@ async function saveGameToDisk(window, saveData) {
const fileToRemove = oldestFiles.shift();
log.debug(`Over Quota -> Removing "${fileToRemove}"`);
try {
// eslint-disable-next-line no-await-in-loop
await fs.unlink(fileToRemove);
} catch (error) {
log.error(error);
}
// eslint-disable-next-line no-await-in-loop
saveFolderSizeBytes = await getFolderSizeInBytes(currentFolder);
log.debug(`Save Folder: ${saveFolderSizeBytes} bytes`);
log.debug(

@ -87,14 +87,6 @@ async function writeToast(window, message, type = "info", duration = 2000) {
await window.webContents.executeJavaScript(`window.appNotifier.toast("${message}", "${type}", ${duration});`, true);
}
// This may no longer be needed due to the return of { action: "deny" } in gameWindow.js setWindowOpenHandler.
// Currently this is unused so that this can be tested. If the issue no longer exists, this util will be removed.
// Otherwise, its use will be reimplemented.
function openExternal(url) {
shell.openExternal(url);
global.app_playerOpenedExternalLink = true;
}
function getZoomFactor() {
const configZoom = config.get("zoom", 1);
return configZoom;
@ -115,7 +107,6 @@ module.exports = {
exportSave,
attachUnresponsiveAppHandler,
detachUnresponsiveAppHandler,
openExternal,
writeTerminal,
writeToast,
getZoomFactor,