fix: Game detection improvements
Some checks failed
Queue Release Build / prepare (push) Successful in 27s
Deploy Web Apps / deploy (push) Successful in 10m8s
Queue Release Build / finalize (push) Has been cancelled
Queue Release Build / build-windows (push) Has been cancelled
Queue Release Build / build-linux (push) Has been cancelled
Some checks failed
Queue Release Build / prepare (push) Successful in 27s
Deploy Web Apps / deploy (push) Successful in 10m8s
Queue Release Build / finalize (push) Has been cancelled
Queue Release Build / build-windows (push) Has been cancelled
Queue Release Build / build-linux (push) Has been cancelled
This commit is contained in:
@@ -36,12 +36,16 @@ export class GeneralSettingsComponent {
|
||||
closeToTray = signal(true);
|
||||
savingAutoStart = signal(false);
|
||||
savingCloseToTray = signal(false);
|
||||
ignoredGameProcesses = signal<string[]>([]);
|
||||
ignoredProcessDraft = signal('');
|
||||
savingIgnoredGameProcesses = signal(false);
|
||||
|
||||
constructor() {
|
||||
this.loadGeneralSettings();
|
||||
|
||||
if (this.isElectron) {
|
||||
void this.loadDesktopSettings();
|
||||
void this.loadIgnoredGameProcesses();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,4 +135,61 @@ export class GeneralSettingsComponent {
|
||||
this.autoStart.set(snapshot.autoStart);
|
||||
this.closeToTray.set(snapshot.closeToTray);
|
||||
}
|
||||
|
||||
onIgnoredProcessDraftChange(event: Event): void {
|
||||
const input = event.target as HTMLInputElement;
|
||||
|
||||
this.ignoredProcessDraft.set(input.value);
|
||||
}
|
||||
|
||||
async addIgnoredProcess(): Promise<void> {
|
||||
const draft = this.ignoredProcessDraft().trim();
|
||||
|
||||
if (!draft) {
|
||||
return;
|
||||
}
|
||||
|
||||
const next = Array.from(new Set([...this.ignoredGameProcesses(), draft]));
|
||||
|
||||
await this.saveIgnoredGameProcesses(next);
|
||||
this.ignoredProcessDraft.set('');
|
||||
}
|
||||
|
||||
async removeIgnoredProcess(name: string): Promise<void> {
|
||||
const next = this.ignoredGameProcesses().filter((entry) => entry !== name);
|
||||
|
||||
await this.saveIgnoredGameProcesses(next);
|
||||
}
|
||||
|
||||
private async loadIgnoredGameProcesses(): Promise<void> {
|
||||
const api = this.electronBridge.getApi();
|
||||
|
||||
if (!api?.getIgnoredGameProcesses) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const list = await api.getIgnoredGameProcesses();
|
||||
|
||||
this.ignoredGameProcesses.set(list);
|
||||
} catch {}
|
||||
}
|
||||
|
||||
private async saveIgnoredGameProcesses(list: string[]): Promise<void> {
|
||||
const api = this.electronBridge.getApi();
|
||||
|
||||
if (!api?.setIgnoredGameProcesses) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.savingIgnoredGameProcesses.set(true);
|
||||
|
||||
try {
|
||||
const normalized = await api.setIgnoredGameProcesses(list);
|
||||
|
||||
this.ignoredGameProcesses.set(normalized);
|
||||
} finally {
|
||||
this.savingIgnoredGameProcesses.set(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user