aboutsummaryrefslogtreecommitdiffstats
path: root/src/sw-nwc.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-18 09:48:13 -0700
committerAdam Soltys <[email protected]>2026-10-18 09:48:13 -0700
commit5869fa2ce351efa485ae6547d618a216b09a47c1 (patch)
tree6894739087f320bd48c18c58fd5ca6fe8d8d6781 /src/sw-nwc.js
parentaaebbd5d51e0e149c36975122dd0ae59e6c011bb (diff)
downloadcoinosv3-5869fa2ce351efa485ae6547d618a216b09a47c1.tar.gz
coinosv3-5869fa2ce351efa485ae6547d618a216b09a47c1.zip
A call from someone you don't follow and haven't written to no longer vanishes: it doesn't ring, but it's a missed call in your conversation with them, saying it didn't ring and why, a tap away from calling back (with the app shut, the worker notes it for the app, without a notification). A muted person's still leaves nothing. A logged call no longer counts as having written to someone.
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013ZDf1cyCQLkfjftYhymZAg
Diffstat (limited to 'src/sw-nwc.js')
-rw-r--r--src/sw-nwc.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/sw-nwc.js b/src/sw-nwc.js
index b6af6b8..f9d383e 100644
--- a/src/sw-nwc.js
+++ b/src/sw-nwc.js
@@ -35,6 +35,17 @@ self.addEventListener('push', (e) => {
if (r.ok) ring = await classifyCall(await r.json(), await allInboxes());
} catch (err) { console.warn('[sw-call] could not open:', err && err.message); }
if (!ring) return;
+ if (ring.quiet) {
+ // no ring for them; a note for the app, which lists it as a missed call
+ try {
+ const cache = await caches.open(CALL_CACHE);
+ const had = await cache.match('/__quiet-calls');
+ const list = had ? await had.json() : [];
+ list.push(ring.offer);
+ await cache.put('/__quiet-calls', new Response(JSON.stringify(list.slice(-20)), { headers: { 'content-type': 'application/json' } }));
+ } catch (_) {}
+ return;
+ }
try {
const cache = await caches.open(CALL_CACHE);
await cache.put('/__pending-call', new Response(JSON.stringify({ offer: ring.offer, at: Date.now() }), { headers: { 'content-type': 'application/json' } }));