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:
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user