Skip to content

Commit

Permalink
chore: debug storage
Browse files Browse the repository at this point in the history
debug
  • Loading branch information
Revyn112 committed Nov 10, 2024
1 parent 0fad7f8 commit a4c3a97
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hdw-common/src/systems/instruments/src/navigraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { NXDataStore } from '@flybywiresim/fbw-sdk';
initializeApp({
clientId: process.env.CLIENT_ID,
clientSecret: process.env.CLIENT_SECRET,
scopes: [Scope.CHARTS], // Navigraph SDK doesn't offer AMDB as Scope yet
scopes: [Scope.CHARTS, 'amdb' as Scope], // Navigraph SDK doesn't offer AMDB as Scope yet
});

export const navigraphAuth = getAuth({
Expand Down
7 changes: 7 additions & 0 deletions hdw-common/src/systems/shared/src/persistence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ export class NXDataStore {
static get(key: string, defaultVal: string): string;
static get(key: string, defaultVal?: string): string | undefined;
static get(key: string, defaultVal?: string): any {
console.log("GetStoredData beginned!");
console.log(`${this.aircraftProjectPrefix}_${key}`);
const val = GetStoredData(`${this.aircraftProjectPrefix}_${key}`);
// GetStoredData returns null on error, or empty string for keys that don't exist (why isn't that an error??)
// We could use SearchStoredData, but that spams the console with every key (somebody left their debug print in)
if (val === null || val.length === 0) {
console.log("Data not found?!");
return defaultVal;
}
console.log(`${val}`);
return val;
}

Expand All @@ -39,7 +43,10 @@ export class NXDataStore {
* @param val The value to assign to the property
*/
static set(key: string, val: string): void {
console.log("SetStoredData beginned!");
console.log(`${this.aircraftProjectPrefix}_${key}: ${val}`);
SetStoredData(`${this.aircraftProjectPrefix}_${key}`, val);
console.log("SetStoredData ended!");
this.listener.triggerToAllSubscribers('HDW_NXDATASTORE_UPDATE', key, val);
}

Expand Down

0 comments on commit a4c3a97

Please sign in to comment.