Quit guard during transfers + background completion notifications

- before-quit is blocked while jobs are queued/scanning/running; a native
  message box asks 'N transfers are still running - quit anyway?' (Cancel
  default) and only an explicit Quit Anyway proceeds via Utils.quit()
- when the window is unfocused, finished transfers raise a native
  notification (silent for completions, sound + error message for failures)
- engine.hasActiveJobs()/activeJobCount() (truth table verified headless)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jokin
2026-07-11 23:49:36 +02:00
co-authored by Claude Fable 5
parent fbbde16f35
commit a0fc96fc44
2 changed files with 68 additions and 2 deletions
+16
View File
@@ -146,6 +146,22 @@ export class TransferEngine {
if (job && TERMINAL.includes(job.snapshot.state)) this.jobs.delete(jobId);
}
/** True while any job is queued, scanning or running (quit guard). */
hasActiveJobs(): boolean {
for (const job of this.jobs.values()) {
if (!TERMINAL.includes(job.snapshot.state)) return true;
}
return false;
}
activeJobCount(): number {
let count = 0;
for (const job of this.jobs.values()) {
if (!TERMINAL.includes(job.snapshot.state)) count++;
}
return count;
}
/** Fail every non-terminal job that touches a dead session. */
failSession(sessionId: string, reason: string): void {
for (const job of this.jobs.values()) {