Skip to content

Commit 0022b2e

Browse files
committed
fix: respect notify setting for free weekend toasts
1 parent 6464545 commit 0022b2e

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

frontend/index.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -654,11 +654,24 @@ async function startPolling(): Promise<void> {
654654
} catch {}
655655
const prevIds = new Set(prev.map((g) => g.appid));
656656

657+
const nowSec = Date.now() / 1000;
658+
const merged = [...result];
659+
for (const p of prev) {
660+
if (p.until > nowSec && !merged.some((g) => g.appid === p.appid)) merged.push(p);
661+
}
662+
657663
try {
658-
await withTimeout(saveFreeWeekendCache({ payload: JSON.stringify(result) }), 3000, 0);
664+
await withTimeout(saveFreeWeekendCache({ payload: JSON.stringify(merged) }), 3000, 0);
659665
} catch {}
660-
log(`Weekend scan complete — ${result.length} game(s) playable for free`);
661-
666+
log(`Weekend scan complete — ${merged.length} game(s) playable for free`);
667+
668+
let notify = true;
669+
try {
670+
const sraw = await withTimeout(loadSettings(), 2000, '');
671+
if (sraw) notify = ({ ...DEFAULTS, ...JSON.parse(sraw) } as Settings).notifyOnGrab;
672+
} catch {}
673+
if (!notify) return;
674+
662675
for (const g of result) {
663676
if (prevIds.has(g.appid)) continue;
664677
if (isAlreadyInLibrary(g.appid)) continue;

0 commit comments

Comments
 (0)