From cdeb7afcaeb7e13cd89c01bbaee838fd18e22cdc Mon Sep 17 00:00:00 2001 From: Saksham Jain Date: Tue, 14 Apr 2026 19:27:23 +0530 Subject: [PATCH] feat: add native share support for space invites --- package.json | 1 + pnpm-lock.yaml | 12 +++++++++ src/app/components/SpaceInvite.svelte | 36 +++++++++++++++++++++------ src/assets/icons/native-share.svg | 4 +++ 4 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 src/assets/icons/native-share.svg diff --git a/package.json b/package.json index a9237ab9..9d804001 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ "@capacitor/keyboard": "^8.0.0", "@capacitor/preferences": "^8.0.0", "@capacitor/push-notifications": "^8.0.0", + "@capacitor/share": "^8.0.1", "@capawesome/capacitor-android-dark-mode-support": "^8.0.0", "@capawesome/capacitor-badge": "^8.0.0", "@getalby/lightning-tools": "^6.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9a6e25e0..1473dd50 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -47,6 +47,9 @@ importers: '@capacitor/push-notifications': specifier: ^8.0.0 version: 8.0.0(@capacitor/core@8.0.1) + '@capacitor/share': + specifier: ^8.0.1 + version: 8.0.1(@capacitor/core@8.0.1) '@capawesome/capacitor-android-dark-mode-support': specifier: ^8.0.0 version: 8.0.0(@capacitor/core@8.0.1) @@ -838,6 +841,11 @@ packages: peerDependencies: '@capacitor/core': '>=8.0.0' + '@capacitor/share@8.0.1': + resolution: {integrity: sha512-3cSBKBCJVon54rKDROP2rqGyeGks4pBh9TbaEk9S375Kbek/ZHe72N50zIa0Vn9Eac/SuhwgehO/mmA4CsUOiw==} + peerDependencies: + '@capacitor/core': '>=8.0.0' + '@capacitor/synapse@1.0.4': resolution: {integrity: sha512-/C1FUo8/OkKuAT4nCIu/34ny9siNHr9qtFezu4kxm6GY1wNFxrCFWjfYx5C1tUhVGz3fxBABegupkpjXvjCHrw==} @@ -6021,6 +6029,10 @@ snapshots: dependencies: '@capacitor/core': 8.0.1 + '@capacitor/share@8.0.1(@capacitor/core@8.0.1)': + dependencies: + '@capacitor/core': 8.0.1 + '@capacitor/synapse@1.0.4': {} '@capawesome/capacitor-android-dark-mode-support@8.0.0(@capacitor/core@8.0.1)': diff --git a/src/app/components/SpaceInvite.svelte b/src/app/components/SpaceInvite.svelte index 79a15a84..c4186372 100644 --- a/src/app/components/SpaceInvite.svelte +++ b/src/app/components/SpaceInvite.svelte @@ -3,7 +3,9 @@ import {sleep} from "@welshman/lib" import {request} from "@welshman/net" import {displayRelayUrl, getTagValue, RELAY_INVITE} from "@welshman/util" + import {Share} from "@capacitor/share" import LinkRound from "@assets/icons/link-round.svg?dataurl" + import NativeShare from "@assets/icons/native-share.svg?dataurl" import Copy from "@assets/icons/copy.svg?dataurl" import Spinner from "@lib/components/Spinner.svelte" import Field from "@lib/components/Field.svelte" @@ -28,6 +30,8 @@ const copyInvite = () => clip(invite) + const shareInvite = () => Share.share({url: invite}) + let claim = $state("") let loading = $state(true) @@ -74,17 +78,35 @@

Oops! It looks like you're not a member of this relay.

{:else}
- +
+ +
{#snippet input()} - + + +
{/snippet} + {#snippet info()}

This invite link can be used by clicking "Add Space" and pasting it there. diff --git a/src/assets/icons/native-share.svg b/src/assets/icons/native-share.svg new file mode 100644 index 00000000..56faff7c --- /dev/null +++ b/src/assets/icons/native-share.svg @@ -0,0 +1,4 @@ + + + +