From 03f2658ac8136259e85f8b361f22353ff37aec70 Mon Sep 17 00:00:00 2001 From: Ilia Denisov Date: Tue, 30 Jun 2026 23:09:25 +0200 Subject: [PATCH] chore(ui): on-screen GCG export diagnostic (Android in-app WebView) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TEMPORARY diagnostic to find why GCG export silently does nothing on Android Telegram/VK in-app WebViews, where there is no developer console to read. Tapping Export now probes the delivery path — navigator.share / canShare presence, canShare({files}), the share-vs-download decision — performs the real attempt and captures its outcome, then renders it all in an on-screen overlay (with a Share control to send the report back). No fix yet by design (owner chose diagnostic-first): once the on-device readings come back, this is replaced by the targeted Android delivery fix. --- ui/src/game/Game.svelte | 66 +++++++++++++++++++++++++++++++++++++++-- ui/src/lib/share.ts | 51 +++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 2 deletions(-) diff --git a/ui/src/game/Game.svelte b/ui/src/game/Game.svelte index c800c80..4e6f647 100644 --- a/ui/src/game/Game.svelte +++ b/ui/src/game/Game.svelte @@ -20,7 +20,9 @@ import { variantNameKey, usesStarBlank, BLANK_STAR } from '../lib/variants'; import { alphabetLetters, hasAlphabet } from '../lib/alphabet'; import { hintsLeft } from '../lib/hints'; - import { shareOrDownloadGcg } from '../lib/share'; + import { gcgDeliveryProbe, shareText } from '../lib/share'; + import { clientChannel } from '../lib/channel'; + import { insideVK } from '../lib/vk'; import { getCachedGame, setCachedGame, setCachedDraft, type CachedGame } from '../lib/gamecache'; import { patchLobbyGame } from '../lib/lobbycache'; import { applyGameOver, applyMoveDelta, applyOpponentJoined, type DeltaResult } from '../lib/gamedelta'; @@ -835,14 +837,31 @@ return view.game.seats.some((s) => s.isWinner) ? t('game.lost') : t('game.tied'); } + // TEMPORARY: on-screen GCG-export diagnostic for the Android in-app WebView bug. Telegram and VK on + // Android expose no developer console, so tapping Export probes the delivery path, performs the real + // attempt, and renders the outcome on screen (the overlay below) to be read or shared. Revert to the + // plain shareOrDownloadGcg call once the Android delivery is fixed. + let gcgDiag = $state(null); + async function exportGcg() { try { - await shareOrDownloadGcg(await gateway.exportGcg(id)); + const gcg = await gateway.exportGcg(id); + const header = [ + `channel: ${clientChannel()} insideVK: ${insideVK()}`, + `ua: ${navigator.userAgent}`, + '', + ]; + gcgDiag = [...header, ...(await gcgDeliveryProbe(gcg))].join('\n'); } catch (e) { handleError(e); } } + async function shareGcgDiag(e: MouseEvent): Promise { + e.stopPropagation(); // a tap on Share shares; it must not also dismiss the overlay + if (gcgDiag) await shareText(gcgDiag, 'GCG export diagnostic'); + } + // --- move history: open by tapping the score bar, close by tapping or swiping up the board --- // The boardwrap surface drives two gestures, selected by `historyOpen`: // - open: the slid board is inert (CSS pointer-events), so the whole board reads as a @@ -1339,7 +1358,50 @@ {/if} +{#if gcgDiag} + + + +
(gcgDiag = null)}> + +
{gcgDiag}
+
+{/if} +