diff --git a/fbw-a32nx/src/systems/extras-host/index.ts b/fbw-a32nx/src/systems/extras-host/index.ts index 56e7a30ad4b7..2acc3bc385e1 100644 --- a/fbw-a32nx/src/systems/extras-host/index.ts +++ b/fbw-a32nx/src/systems/extras-host/index.ts @@ -63,9 +63,9 @@ class ExtrasHost extends BaseInstrument { this.notificationManager = new NotificationManager(); this.pushbuttonCheck = new PushbuttonCheck(this.bus, this.notificationManager); - this.versionCheck = new VersionCheck(this.bus); this.keyInterceptor = new KeyInterceptor(this.bus, this.notificationManager); - this.aircraftSync = new AircraftSync(this.bus); + this.versionCheck = new VersionCheck(process.env.AIRCRAFT_PROJECT_PREFIX, this.bus); + this.aircraftSync = new AircraftSync(process.env.AIRCRAFT_PROJECT_PREFIX, this.bus); console.log('A32NX_EXTRASHOST: Created'); } diff --git a/fbw-a32nx/src/systems/extras-host/modules/aircraft_sync/AircraftSync.ts b/fbw-a32nx/src/systems/extras-host/modules/aircraft_sync/AircraftSync.ts index cf7ca38191eb..a208795fc3e0 100644 --- a/fbw-a32nx/src/systems/extras-host/modules/aircraft_sync/AircraftSync.ts +++ b/fbw-a32nx/src/systems/extras-host/modules/aircraft_sync/AircraftSync.ts @@ -10,7 +10,7 @@ import { EventBus } from '@microsoft/msfs-sdk'; export class AircraftSync { public xmlConfig: Document - constructor(private readonly bus: EventBus) { + constructor(private readonly aircraftProjectPrefix: string, private readonly bus: EventBus) { console.log('AircraftSync: Created'); } @@ -22,6 +22,8 @@ export class AircraftSync { this.xmlConfig = xmlConfig; } + // TODO: Remove this sync when VFS config is done. + // Replace with new function for commbus implementation to sync VFS markup config to WASM public startPublish(): void { console.log('AicraftSync: startPublish()'); @@ -33,10 +35,8 @@ export class AircraftSync { aircraftType = AircraftType.A380_842; break; case 'A320_251N': - aircraftType = AircraftType.A320_251N; - break; default: - aircraftType = AircraftType.Unknown; + aircraftType = AircraftType.A320_251N; break; } diff --git a/fbw-a32nx/src/systems/extras-host/modules/version_check/VersionCheck.ts b/fbw-a32nx/src/systems/extras-host/modules/version_check/VersionCheck.ts index baa68ffe25f4..1450c0abed10 100644 --- a/fbw-a32nx/src/systems/extras-host/modules/version_check/VersionCheck.ts +++ b/fbw-a32nx/src/systems/extras-host/modules/version_check/VersionCheck.ts @@ -2,13 +2,13 @@ // SPDX-License-Identifier: GPL-3.0 import { EventBus } from '@microsoft/msfs-sdk'; -import { AircraftVersionChecker } from '@fbw-common/shared/AircraftVersionChecker'; +import { AircraftGithubVersionChecker } from '@fbw-common/shared/AircraftGithubVersionChecker'; /** * This class is used to check the version of the aircraft and display a warning if it is too old. */ export class VersionCheck { - constructor(private readonly bus: EventBus) { + constructor(private readonly aircraftProjectPrefix: string, private readonly bus: EventBus) { console.log('VersionCheck: Created'); } @@ -18,7 +18,7 @@ export class VersionCheck { public startPublish(): void { console.log('VersionCheck: startPublish()'); - AircraftVersionChecker.checkVersion('a32nx'); + AircraftGithubVersionChecker.checkVersion(this.aircraftProjectPrefix); } public update(): void { diff --git a/fbw-a32nx/src/systems/instruments/src/Common/index.tsx b/fbw-a32nx/src/systems/instruments/src/Common/index.tsx index 234a0ecb4641..e0ae9d30229a 100644 --- a/fbw-a32nx/src/systems/instruments/src/Common/index.tsx +++ b/fbw-a32nx/src/systems/instruments/src/Common/index.tsx @@ -15,7 +15,7 @@ export const render = (Slot: React.ReactElement, enableSentryTracing = false, se const doRender = () => { new FbwAircraftSentryClient().onInstrumentLoaded({ dsn: process.env.SENTRY_DSN, - buildInfoFilePrefix: 'a32nx', + buildInfoFilePrefix: process.env.AIRCRAFT_PROJECT_PREFIX, enableTracing: enableSentryTracing, root: sentryRootClient, }); diff --git a/fbw-a32nx/src/systems/sentry-client/src/index.ts b/fbw-a32nx/src/systems/sentry-client/src/index.ts index b721968a9e9a..e3ac35d7ed87 100644 --- a/fbw-a32nx/src/systems/sentry-client/src/index.ts +++ b/fbw-a32nx/src/systems/sentry-client/src/index.ts @@ -8,7 +8,7 @@ declare const process: any; new FbwAircraftSentryClient().onInstrumentLoaded({ dsn: process.env.SENTRY_DSN, - buildInfoFilePrefix: 'a32nx', + buildInfoFilePrefix: process.env.AIRCRAFT_PROJECT_PREFIX, root: false, enableTracing: false, }); diff --git a/fbw-common/src/systems/instruments/src/EFB/Apis/Simbrief/simbriefParser.ts b/fbw-common/src/systems/instruments/src/EFB/Apis/Simbrief/simbriefParser.ts index 4cbe0b460d97..50e6a210878a 100644 --- a/fbw-common/src/systems/instruments/src/EFB/Apis/Simbrief/simbriefParser.ts +++ b/fbw-common/src/systems/instruments/src/EFB/Apis/Simbrief/simbriefParser.ts @@ -1,7 +1,7 @@ // Copyright (c) 2023-2024 FlyByWire Simulations // SPDX-License-Identifier: GPL-3.0 -import { AircraftVersionChecker, getAircraftType } from '@flybywiresim/fbw-sdk'; +import { AircraftGithubVersionChecker } from '@flybywiresim/fbw-sdk'; import { ISimbriefData } from './simbriefInterface'; const SIMBRIEF_BASE_URL = 'https://www.simbrief.com/api/xml.fetcher.php'; @@ -30,7 +30,7 @@ export const getSimbriefData = async (navigraphUsername: string, overrideSimbrie // will throw an error - if this is fixed (build_info for a380x is readable from the flyPad for the A380X) then // this try/catch could be removed, but it doesn't hurt to have it here even then as an extra safety measure try { - const versionInfo = await AircraftVersionChecker.getBuildInfo(getAircraftType()); + const versionInfo = await AircraftGithubVersionChecker.getBuildInfo(process.env.AIRCRAFT_PROJECT_PREFIX); simbriefApiParams.append('client', `fbw-${versionInfo.version}`); } catch (e) { console.error('Error getting build info', e); diff --git a/fbw-common/src/systems/instruments/src/EFB/Settings/Pages/AboutPage.tsx b/fbw-common/src/systems/instruments/src/EFB/Settings/Pages/AboutPage.tsx index 13fa48579836..f1b458688611 100644 --- a/fbw-common/src/systems/instruments/src/EFB/Settings/Pages/AboutPage.tsx +++ b/fbw-common/src/systems/instruments/src/EFB/Settings/Pages/AboutPage.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: GPL-3.0 import React, { useEffect, useState } from 'react'; -import { usePersistentProperty, useSessionStorage, AircraftVersionChecker, BuildInfo, SentryConsentState, SENTRY_CONSENT_KEY, useSimVar, AircraftInfo } from '@flybywiresim/fbw-sdk'; +import { usePersistentProperty, useSessionStorage, AircraftGithubVersionChecker, BuildInfo, SentryConsentState, SENTRY_CONSENT_KEY, useSimVar, AircraftInfo } from '@flybywiresim/fbw-sdk'; import { t } from '@flybywiresim/flypad'; import { SettingsPage } from '../Settings'; // @ts-ignore @@ -49,6 +49,7 @@ export const AboutPage = () => { const [sessionId] = usePersistentProperty('A32NX_SENTRY_SESSION_ID'); const [version, setVersion] = useSessionStorage('SIM_VERSION', ''); const [sentryEnabled] = usePersistentProperty(SENTRY_CONSENT_KEY, SentryConsentState.Refused); + const [aircraftInfo, setAircraftInfo] = useState(undefined); // Callback function to set sBuildVersion from the community panel const onSetPlayerData = (data: CommunityPanelPlayerData) => { @@ -59,7 +60,7 @@ export const AboutPage = () => { useViewListenerEvent('JS_LISTENER_COMMUNITY', 'SetGamercardInfo', onSetPlayerData); useEffect(() => { - AircraftVersionChecker.getBuildInfo( + AircraftGithubVersionChecker.getBuildInfo( process.env.AIRCRAFT_PROJECT_PREFIX, ).then((info) => setBuildInfo(info)); }, [process.env.AIRCRAFT_PROJECT_PREFIX]); diff --git a/fbw-common/src/systems/shared/src/AircraftVersionChecker.ts b/fbw-common/src/systems/shared/src/AircraftGithubVersionChecker.ts similarity index 96% rename from fbw-common/src/systems/shared/src/AircraftVersionChecker.ts rename to fbw-common/src/systems/shared/src/AircraftGithubVersionChecker.ts index 2e0fa7f4faaf..f2f56bf03e06 100644 --- a/fbw-common/src/systems/shared/src/AircraftVersionChecker.ts +++ b/fbw-common/src/systems/shared/src/AircraftGithubVersionChecker.ts @@ -48,7 +48,7 @@ export enum KnowBranchNames { * Provides functions to the check the version of the aircraft against the * published GitHub version */ -export class AircraftVersionChecker { +export class AircraftGithubVersionChecker { private static notification: NotificationManager; private static versionChecked = false; @@ -69,7 +69,7 @@ export class AircraftVersionChecker { * @returns true if the aircraft version has been checked, false if no check has been commenced. */ public static async checkVersion(aircraft: string): Promise { - console.log('Checking aircraft version'); + console.log(`Checking aircraft version for A/C project: ${aircraft}`); this.notification = new NotificationManager(); @@ -90,9 +90,9 @@ export class AircraftVersionChecker { const versionInfo = this.getVersionInfo(this.buildInfo.version); if (this.checkOutdated(versionInfo)) { this.setOutdatedVersionFlag(true); - console.log('Aircraft version outdated'); + console.log(`Aircraft ${aircraft} - version outdated`); } else { - console.log('Aircraft version ok'); + console.log(`Aircraft ${aircraft} - version ok`); } this.versionChecked = true; } catch (error) { @@ -176,7 +176,7 @@ export class AircraftVersionChecker { this.releaseInfo = await GitVersions.getReleases('flybywiresim', aircraft, false, 0, 1); this.newestCommit = await GitVersions.getNewestCommit('flybywiresim', aircraft, 'master'); this.newestExpCommit = await GitVersions.getNewestCommit('flybywiresim', aircraft, 'experimental'); - this.buildInfo = await AircraftVersionChecker.getBuildInfo(aircraft); + this.buildInfo = await AircraftGithubVersionChecker.getBuildInfo(aircraft); } /** diff --git a/fbw-common/src/systems/shared/src/aircraftTypeCheck.ts b/fbw-common/src/systems/shared/src/aircraftTypeCheck.ts index 44cb735c338f..a7bf5afab030 100644 --- a/fbw-common/src/systems/shared/src/aircraftTypeCheck.ts +++ b/fbw-common/src/systems/shared/src/aircraftTypeCheck.ts @@ -6,26 +6,3 @@ export enum AircraftType { A320_251N = 1, A380_842 = 2 } - -/** - * Determine the aircraft type using the Aircraft Title SimVar. - * @returns {string} - the aircraft type (a32nx, a380x, other) - */ -export function getAircraftType(): string { - const aircraftType: AircraftType = SimVar.GetSimVarValue('L:A32NX_AIRCRAFT_TYPE', 'enum'); - let aircraft: string; - - switch (aircraftType) { - case AircraftType.A320_251N: - aircraft = 'a32nx'; - break; - case AircraftType.A380_842: - aircraft = 'a380x'; - break; - case AircraftType.Unknown: - default: - aircraft = 'other'; - } - - return aircraft; -}