From 89b2488d3c75514e7fa55cf1b58a089480a220e8 Mon Sep 17 00:00:00 2001 From: Oliver Rieger Date: Sat, 15 Aug 2026 16:46:08 +0200 Subject: [PATCH] The shared message carries the code, because an iPhone cannot open the app MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An Android phone opens the link in the installed app (the manifest's scope covers the site, so its WebAPK claims these URLs). An iOS home-screen app can claim nothing, so the link always opens in Safari — which keeps its own storage and knows nothing about the name picked inside the app. Four letters in the same message is the whole fix: a friend who has it installed types them instead. Co-Authored-By: Claude Opus 5 --- index.html | 2 +- src/main.js | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 0020170..54cc79a 100644 --- a/index.html +++ b/index.html @@ -645,6 +645,6 @@ if (location.hostname !== 'splatter-tennis.wuwi.one') { - + diff --git a/src/main.js b/src/main.js index b7f3b6e..d7c785a 100644 --- a/src/main.js +++ b/src/main.js @@ -193,11 +193,17 @@ vsCode.addEventListener('keydown', e => { if (e.key === 'Enter') vsGo(true); }); // SHARE, then COPY. navigator.share is the phone's own sheet (WhatsApp, Signal, wherever the // friend actually is) and is exactly the "easier setup" — the clipboard is the desktop fallback, // and the code stays on screen for the two of them in the same room reading it aloud. +// THE CODE RIDES THE MESSAGE, not just the link. An Android phone opens the link in the INSTALLED +// app (the manifest's scope covers the whole site, so its WebAPK claims these URLs) — but an iPhone +// home-screen app can claim nothing, so the link always opens in Safari, which keeps its own +// storage and therefore knows nothing about the name they picked inside the app. Four letters in +// the same message is the whole fix: a friend who has it installed opens their app and types them. document.getElementById('vsShare').addEventListener('click', async () => { - const url = vsLink(G.net && G.net.code || ''); + const code = G.net && G.net.code || ''; + const url = vsLink(code), text = 'COME AND PLAY ME — ROOM CODE ' + code; try { - if (navigator.share) await navigator.share({ title: 'SPLATTER TENNIS', text: 'COME AND PLAY ME', url }); - else { await navigator.clipboard.writeText(url); vsSay('vsMsg', 'LINK COPIED — SEND IT TO THEM'); } + if (navigator.share) await navigator.share({ title: 'SPLATTER TENNIS', text, url }); + else { await navigator.clipboard.writeText(text + ' ' + url); vsSay('vsMsg', 'COPIED — SEND IT TO THEM'); } } catch { /* a cancelled share sheet is not an error */ } }); const vsQuit = () => { endNetVs(); vsOpen(); }; // a room you walked out of must give its socket back