diff --git a/src/app/components/SpaceInvite.svelte b/src/app/components/SpaceInvite.svelte index c4186372..d332ab13 100644 --- a/src/app/components/SpaceInvite.svelte +++ b/src/app/components/SpaceInvite.svelte @@ -30,8 +30,17 @@ const copyInvite = () => clip(invite) - const shareInvite = () => Share.share({url: invite}) + const shareInvite = async () => { + if (!canShare) return + try { + await Share.share({url: invite}) + } catch (e) { + console.error(e) + } +} + + let canShare = $state(false) let claim = $state("") let loading = $state(true) @@ -45,6 +54,13 @@ }) onMount(async () => { + try { + const {value} = await Share.canShare() + canShare = value + } catch { + canShare = false + } + const [[event]] = await Promise.all([ request({ relays: [url], @@ -84,12 +100,14 @@ {#snippet input()}
- + {#if canShare} + + {/if}