Skip to content

Commit

Permalink
fix: Show loading window during game bootup (in case the app hasn't b…
Browse files Browse the repository at this point in the history
…een started before)
  • Loading branch information
itssimple committed Mar 15, 2022
1 parent 128bfed commit 33904bf
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 43 deletions.
17 changes: 4 additions & 13 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,8 @@
"file": "resources/compiled/windows/loading-window.html",
"show_in_taskbar": true,
"is_background_page": false,
"grab_focus_on_desktop": true,
"desktop_only": true,
"native_window": true,
"disable_hardware_acceleration": true,
"disable_auto_dpi_sizing": true,
"desktop_only": false,
"transparent": true,
"resizable": false,
"min_size": {
"width": 450,
Expand Down Expand Up @@ -78,16 +75,10 @@
"show_in_taskbar": true,
"is_background_page": false,
"block_top_window_navigation": true,
"grab_focus_on_desktop": true,
"desktop_only": true,
"transparent": false,
"native_window": true,
"show_minimize": true,
"show_maximize": false,
"desktop_only": false,
"transparent": true,
"resizable": false,
"keep_window_location": true,
"disable_hardware_acceleration": true,
"disable_auto_dpi_sizing": true,
"min_size": {
"width": 1366,
"height": 750
Expand Down
17 changes: 4 additions & 13 deletions src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,8 @@
"file": "resources/compiled/windows/loading-window.html",
"show_in_taskbar": true,
"is_background_page": false,
"grab_focus_on_desktop": true,
"desktop_only": true,
"native_window": true,
"disable_hardware_acceleration": true,
"disable_auto_dpi_sizing": true,
"desktop_only": false,
"transparent": true,
"resizable": false,
"min_size": {
"width": 450,
Expand Down Expand Up @@ -78,16 +75,10 @@
"show_in_taskbar": true,
"is_background_page": false,
"block_top_window_navigation": true,
"grab_focus_on_desktop": true,
"desktop_only": true,
"transparent": false,
"native_window": true,
"show_minimize": true,
"show_maximize": false,
"desktop_only": false,
"transparent": true,
"resizable": false,
"keep_window_location": true,
"disable_hardware_acceleration": true,
"disable_auto_dpi_sizing": true,
"min_size": {
"width": 1366,
"height": 750
Expand Down
37 changes: 20 additions & 17 deletions src/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,14 +340,11 @@ if (firstLaunch) {
}
);

window.eventEmitter.addEventListener(
'manifests-loaded',
async function () {
closeLoadingWindow();
localStorage.removeItem("mainWindow_opened");
openWindow(null, null);
}
);
window.eventEmitter.addEventListener("manifests-loaded", async function () {
closeLoadingWindow();
localStorage.removeItem("mainWindow_opened");
openWindow(null, null);
});

function checkExtensionUpdate() {
overwolf.extensions.checkForExtensionUpdate((updateState) => {
Expand Down Expand Up @@ -415,12 +412,17 @@ if (firstLaunch) {

await destinyApiClient.checkManifestVersion();

let missingDefinitions = await destinyApiClient.checkStoredDefinitions(false);
let missingDefinitions =
await destinyApiClient.checkStoredDefinitions(false);

let showLoadingWindow = true;

if(missingDefinitions.length > 0) {
log("DATABASE", "Missing definitions, downloading them", missingDefinitions);
if (missingDefinitions.length > 0) {
log(
"DATABASE",
"Missing definitions, downloading them",
missingDefinitions
);
showLoadingWindow = true;
}

Expand All @@ -438,7 +440,7 @@ if (firstLaunch) {
locSearch.indexOf("source=tray") > -1 ||
(wasPreviouslyOpened != null && wasPreviouslyOpened == "true")
) {
if(showLoadingWindow) {
if (showLoadingWindow) {
log("DATABASE", "Opening loading window");
openLoadingWindow();
} else {
Expand All @@ -447,11 +449,12 @@ if (firstLaunch) {
}
} else if (locSearch.indexOf("source=gamelaunchevent") > -1) {
log("GAME:LAUNCH", "Application was started by game");
overwolf.games.getRunningGameInfo(async function (data) {
if (showLoadingWindow) {
log("DATABASE", "Opening loading window");
openLoadingWindow();
}
overwolf.games.getRunningGameInfo(function (data) {
if (data) {
if(showLoadingWindow) {
await destinyApiClient.checkStoredDefinitions(true);
}
gameLaunched(data);
}
});
Expand All @@ -461,7 +464,7 @@ if (firstLaunch) {
locSearch.replace("?source=urlscheme&", "")
);

if(showLoadingWindow) {
if (showLoadingWindow) {
log("DATABASE", "Opening loading window");
openLoadingWindow();
}
Expand Down

0 comments on commit 33904bf

Please sign in to comment.