Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #24 from antonk777/master
Browse files Browse the repository at this point in the history
Handle onAppLaunchTriggered correctly
  • Loading branch information
eransharv authored Jun 3, 2021
2 parents 66c2615 + 19a79e7 commit 75d2d36
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions native/windows/background/background-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ define([
);

overwolf.extensions.onAppLaunchTriggered.addListener(e => {
if (e && e.source !== 'gamelaunchevent')
BackgroundController._restoreLaunchWindow();
if (e && e.source !== 'gamelaunchevent') {
BackgroundController._restoreAppWindow();
}
});

// Listen to changes in windows
Expand Down Expand Up @@ -102,6 +103,20 @@ define([
}
}

/**
* Open the relevant window on user request
* @private
*/
static async _restoreAppWindow() {
const isGameRunning = await runningGameService.isGameRunning();

if (isGameRunning) {
WindowsService.restore(WindowNames.IN_GAME);
} else {
WindowsService.restore(WindowNames.DESKTOP);
}
}

/**
* app was launched with game launch
* @private
Expand Down

0 comments on commit 75d2d36

Please sign in to comment.