From f922e1650df550b3dec2f010ffdc6c15ea11390d Mon Sep 17 00:00:00 2001
From: MohamedBassem <me@mbassem.com>
Date: Fri, 15 Mar 2024 16:34:42 +0000
Subject: fix(mobile): Bump expo-share-intent version and remove the hacks
 around the old version

---
 apps/mobile/app/sharing.tsx | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

(limited to 'apps/mobile/app/sharing.tsx')

diff --git a/apps/mobile/app/sharing.tsx b/apps/mobile/app/sharing.tsx
index f9f423b5..e8b0ad09 100644
--- a/apps/mobile/app/sharing.tsx
+++ b/apps/mobile/app/sharing.tsx
@@ -1,8 +1,7 @@
-import type { ShareIntent } from "expo-share-intent";
-import { useEffect, useMemo, useState } from "react";
+import { useEffect, useState } from "react";
 import { Text, View } from "react-native";
-import { Link, useLocalSearchParams, useRouter } from "expo-router";
-import { useShareIntent } from "expo-share-intent";
+import { Link, useRouter } from "expo-router";
+import { useShareIntentContext } from "expo-share-intent";
 import { api } from "@/lib/trpc";
 import { z } from "zod";
 
@@ -12,19 +11,7 @@ type Mode =
   | { type: "error" };
 
 function SaveBookmark({ setMode }: { setMode: (mode: Mode) => void }) {
-  // Desperate attempt to fix sharing duplication
-  const { hasShareIntent, resetShareIntent } = useShareIntent();
-
-  const params = useLocalSearchParams();
-
-  const shareIntent = useMemo(() => {
-    if (params?.shareIntent) {
-      if (typeof params.shareIntent === "string") {
-        return JSON.parse(params.shareIntent) as ShareIntent;
-      }
-    }
-    return null;
-  }, [params]);
+  const { hasShareIntent, shareIntent, resetShareIntent } = useShareIntentContext();
 
   const invalidateAllBookmarks =
     api.useUtils().bookmarks.getBookmarks.invalidate;
-- 
cgit v1.2.3-70-g09d2

