From 62aaab0d74701af465a3c5352db8a07f472849f0 Mon Sep 17 00:00:00 2001 From: Geoffrey Coulaud Date: Sat, 29 Jan 2022 10:20:06 +0000 Subject: [PATCH] Ping command check before telemetry check --- public/locales/en-us.yaml | 5 +++++ src/ts/launcher/states/Launch.ts | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/public/locales/en-us.yaml b/public/locales/en-us.yaml index b46faf9..01773c6 100644 --- a/public/locales/en-us.yaml +++ b/public/locales/en-us.yaml @@ -231,6 +231,11 @@ notifications: title: 'Launcher update available: {from} -> {to}' body: You can download a new version of the launcher from the project's repository at {repository} + # Before telemetry check when iputils is not downloaded + iputils_package_required: + title: An Anime Game Launcher + body: You must have iputils installed for telemetry checking + # When telemetry servers are not disabled telemetry_not_disabled: title: An Anime Game Launcher diff --git a/src/ts/launcher/states/Launch.ts b/src/ts/launcher/states/Launch.ts index 0dc8195..6ad22e0 100644 --- a/src/ts/launcher/states/Launch.ts +++ b/src/ts/launcher/states/Launch.ts @@ -13,6 +13,20 @@ export default (launcher: Launcher): Promise => { return new Promise(async (resolve) => { const debugThread = new DebugThread('State/Launch', 'Starting the game'); + // Show an error notification if ping is not available + if (!await Launcher.isPackageAvailable('ping')) + { + Notification.show({ + ...(Locales.translate('notifications.iputils_package_required') as { title: string, body: string }), + icon: `${constants.paths.appDir}/public/images/baal64-transparent.png`, + importance: 'critical' + }); + + debugThread.log('iputils package is not installed!'); + + resolve(); + } + const telemetry = await Game.isTelemetryDisabled(); // If telemetry servers are not disabled