diff options
| author | MohamedBassem <me@mbassem.com> | 2024-05-06 18:05:27 +0100 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2024-05-06 18:05:27 +0100 |
| commit | 32b5a025568dcc5788a8a2afc19bf07264e01a63 (patch) | |
| tree | 7ad808c667148154c9244cb3def56315da89ef52 /apps/mobile/app/sharing.tsx | |
| parent | 02ef4bfc89e66fdf6593dd744aef53adee57b861 (diff) | |
| download | karakeep-32b5a025568dcc5788a8a2afc19bf07264e01a63.tar.zst | |
feature: Dedup links on creation. Fixes #49
Diffstat (limited to 'apps/mobile/app/sharing.tsx')
| -rw-r--r-- | apps/mobile/app/sharing.tsx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/apps/mobile/app/sharing.tsx b/apps/mobile/app/sharing.tsx index 7624474a..7339a017 100644 --- a/apps/mobile/app/sharing.tsx +++ b/apps/mobile/app/sharing.tsx @@ -12,12 +12,16 @@ import type { ZBookmark } from "@hoarder/shared/types/bookmarks"; type Mode = | { type: "idle" } | { type: "success"; bookmarkId: string } + | { type: "alreadyExists"; bookmarkId: string } | { type: "error" }; function SaveBookmark({ setMode }: { setMode: (mode: Mode) => void }) { - const onSaved = (d: ZBookmark) => { + const onSaved = (d: ZBookmark & { alreadyExists: boolean }) => { invalidateAllBookmarks(); - setMode({ type: "success", bookmarkId: d.id }); + setMode({ + type: d.alreadyExists ? "alreadyExists" : "success", + bookmarkId: d.id, + }); }; const { hasShareIntent, shareIntent, resetShareIntent } = @@ -86,6 +90,10 @@ export default function Sharing() { comp = <Text className="text-4xl text-foreground">Hoarded!</Text>; break; } + case "alreadyExists": { + comp = <Text className="text-4xl text-foreground">Already Hoarded!</Text>; + break; + } case "error": { comp = <Text className="text-4xl text-foreground">Error!</Text>; break; |
