mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2025-03-15 20:51:39 +03:00
Several changes
- `Patch/Stream`'s `patchFinish()` callback now have `result: boolean` argument which indicates whether the patch was successfully applied - `Patch/Stream` now also logs patch script output - if the patch wasn't successfully applied - then `ApplyPatch` script will show user a notification about it - also was fixed notification icon in telemetry checking
This commit is contained in:
parent
a0e38c825b
commit
3fa259ec64
4 changed files with 30 additions and 9 deletions
BIN
public/images/baal64-transparent.png
Normal file
BIN
public/images/baal64-transparent.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
|
@ -16,9 +16,10 @@ declare const Neutralino;
|
|||
class Stream extends AbstractInstaller
|
||||
{
|
||||
protected userUnpackFinishCallback?: () => void;
|
||||
protected onPatchFinish?: () => void;
|
||||
protected onPatchFinish?: (result: boolean) => void;
|
||||
|
||||
protected patchFinished: boolean = false;
|
||||
protected patchResult: boolean = false;
|
||||
|
||||
public constructor(uri: string, version: string|null = null)
|
||||
{
|
||||
|
@ -84,11 +85,21 @@ class Stream extends AbstractInstaller
|
|||
});
|
||||
|
||||
// When all the things above are done
|
||||
pipeline.then(() => {
|
||||
pipeline.then((outputs) => {
|
||||
this.patchFinished = true;
|
||||
|
||||
Debug.log({
|
||||
function: 'Patch/Stream',
|
||||
message: [
|
||||
'Patch script output:',
|
||||
...outputs[5].stdOut.split(/\r\n|\r|\n/)
|
||||
]
|
||||
});
|
||||
|
||||
this.patchResult = outputs[5].stdOut.includes('==> Patch applied! Enjoy the game');
|
||||
|
||||
if (this.onPatchFinish)
|
||||
this.onPatchFinish();
|
||||
this.onPatchFinish(this.patchResult);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@ -104,12 +115,12 @@ class Stream extends AbstractInstaller
|
|||
/**
|
||||
* Specify event that will be called when the patch will be applied
|
||||
*/
|
||||
public patchFinish(callback: () => void)
|
||||
public patchFinish(callback: (result: boolean) => void)
|
||||
{
|
||||
this.onPatchFinish = callback;
|
||||
|
||||
if (this.patchFinished)
|
||||
callback();
|
||||
callback(this.patchResult);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import type Launcher from '../../Launcher';
|
||||
|
||||
import Patch from '../../Patch';
|
||||
import Notifications from '../../core/Notifications';
|
||||
import constants from '../../Constants';
|
||||
|
||||
export default (launcher: Launcher): Promise<void> => {
|
||||
return new Promise(async (resolve) => {
|
||||
|
@ -56,9 +58,19 @@ export default (launcher: Launcher): Promise<void> => {
|
|||
});
|
||||
});
|
||||
|
||||
stream.patchFinish(() => {
|
||||
stream.patchFinish((result) => {
|
||||
launcher.progressBar?.hide();
|
||||
|
||||
// If for some reasons patch wasn't applied successfully
|
||||
if (!result)
|
||||
{
|
||||
Notifications.show({
|
||||
title: 'An Anime Game Launcher',
|
||||
body: 'Patch wasn\'t applied successfully. Please, check your log file to find a reason of it, or ask someone in our discord server',
|
||||
icon: `${constants.paths.appDir}/public/images/baal64-transparent.png`
|
||||
});
|
||||
}
|
||||
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -9,8 +9,6 @@ import Game from '../../Game';
|
|||
import Process from '../../neutralino/Process';
|
||||
import Window from '../../neutralino/Window';
|
||||
|
||||
import Baal from '../../../assets/images/baal64-transparent.png';
|
||||
|
||||
declare const Neutralino;
|
||||
|
||||
export default (launcher: Launcher): Promise<void> => {
|
||||
|
@ -25,7 +23,7 @@ export default (launcher: Launcher): Promise<void> => {
|
|||
Notifications.show({
|
||||
title: 'An Anime Game Launcher',
|
||||
body: 'Telemetry servers are not disabled',
|
||||
icon: Baal,
|
||||
icon: `${constants.paths.appDir}/public/images/baal64-transparent.png`,
|
||||
importance: 'critical'
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue