Try not setting url on shared object at all

pull/63/head
Lynn 2022-01-24 17:40:24 +01:00
rodzic 672b7143ee
commit 7c11cfc5a2
1 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -99,19 +99,19 @@ function Game(props: GameProps) {
}; };
async function share(url: string, copiedHint: string, text?: string) { async function share(url: string, copiedHint: string, text?: string) {
const body = url + (text ? "\n\n" + text : "");
if ( if (
/android|iphone|ipad|ipod|webos/i.test(navigator.userAgent) && /android|iphone|ipad|ipod|webos/i.test(navigator.userAgent) &&
!/firefox/i.test(navigator.userAgent) !/firefox/i.test(navigator.userAgent)
) { ) {
try { try {
await navigator.share({ url, text }); await navigator.share({ text: body });
return; return;
} catch (e) { } catch (e) {
console.warn("navigator.share failed:", e); console.warn("navigator.share failed:", e);
} }
} }
try { try {
const body = url + (text ? "\n\n" + text : "");
await navigator.clipboard.writeText(body); await navigator.clipboard.writeText(body);
setHint(copiedHint); setHint(copiedHint);
return; return;