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} +