From bffbb94201a5637cb6b55b59b499fb0ec67218d6 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Mon, 11 Mar 2024 09:39:23 +0000 Subject: mobile: Setup share intent --- packages/mobile/.gitignore | 4 ++++ packages/mobile/app.json | 16 +++++++++++++--- packages/mobile/app/_layout.tsx | 21 +++++++++++++++++++-- packages/mobile/app/signin.tsx | 2 +- packages/mobile/bun.lockb | Bin 478034 -> 0 bytes packages/mobile/components/Logo.tsx | 2 +- packages/mobile/components/ui/Input.tsx | 2 +- packages/mobile/metro.config.js | 1 + packages/mobile/package.json | 3 +++ 9 files changed, 43 insertions(+), 8 deletions(-) delete mode 100755 packages/mobile/bun.lockb (limited to 'packages') diff --git a/packages/mobile/.gitignore b/packages/mobile/.gitignore index 05647d55..2920e5a8 100644 --- a/packages/mobile/.gitignore +++ b/packages/mobile/.gitignore @@ -33,3 +33,7 @@ yarn-error.* # typescript *.tsbuildinfo + +#build files +ios/ +android/ diff --git a/packages/mobile/app.json b/packages/mobile/app.json index 9ebea4ea..11455267 100644 --- a/packages/mobile/app.json +++ b/packages/mobile/app.json @@ -16,19 +16,29 @@ "**/*" ], "ios": { - "supportsTablet": true + "supportsTablet": true, + "bundleIdentifier": "com.anonymous.hoardermobile" }, "android": { "adaptiveIcon": { "foregroundImage": "./assets/adaptive-icon.png", "backgroundColor": "#ffffff" - } + }, + "package": "com.anonymous.hoardermobile" }, "web": { "favicon": "./assets/favicon.png" }, "plugins": [ - "expo-router" + "expo-router", + ["expo-share-intent", { + "iosActivationRules": { + "NSExtensionActivationSupportsWebURLWithMaxCount": 1, + "NSExtensionActivationSupportsWebPageWithMaxCount": 1, + "NSExtensionActivationSupportsImageWithMaxCount": 1, + "NSExtensionActivationSupportsMovieWithMaxCount": 1 + } + }] ] } } diff --git a/packages/mobile/app/_layout.tsx b/packages/mobile/app/_layout.tsx index 7403c6ff..c578d07f 100644 --- a/packages/mobile/app/_layout.tsx +++ b/packages/mobile/app/_layout.tsx @@ -1,12 +1,29 @@ import "@/globals.css"; +import "expo-dev-client"; -import { Slot } from "expo-router"; +import { Slot, useRouter } from "expo-router"; +import { useShareIntent } from "expo-share-intent"; import { StatusBar } from "expo-status-bar"; +import { useEffect } from "react"; import { View } from "react-native"; export default function RootLayout() { + const router = useRouter(); + const { hasShareIntent, shareIntent, resetShareIntent } = useShareIntent({ + debug: true, + }); + + useEffect(() => { + if (hasShareIntent) { + router.replace({ + pathname: "shareintent", + params: { shareIntent: JSON.stringify(shareIntent) }, + }); + resetShareIntent(); + } + }, [hasShareIntent]); return ( - + diff --git a/packages/mobile/app/signin.tsx b/packages/mobile/app/signin.tsx index f500e36e..491f3007 100644 --- a/packages/mobile/app/signin.tsx +++ b/packages/mobile/app/signin.tsx @@ -6,7 +6,7 @@ import { Input } from "@/components/ui/Input"; export default function Signin() { return ( - + diff --git a/packages/mobile/bun.lockb b/packages/mobile/bun.lockb deleted file mode 100755 index 219082f9..00000000 Binary files a/packages/mobile/bun.lockb and /dev/null differ diff --git a/packages/mobile/components/Logo.tsx b/packages/mobile/components/Logo.tsx index a15d8561..57f7a5c3 100644 --- a/packages/mobile/components/Logo.tsx +++ b/packages/mobile/components/Logo.tsx @@ -3,7 +3,7 @@ import { View, Text } from "react-native"; export default function Logo() { return ( - + Hoarder diff --git a/packages/mobile/components/ui/Input.tsx b/packages/mobile/components/ui/Input.tsx index 6fc90b8f..2fcb2764 100644 --- a/packages/mobile/components/ui/Input.tsx +++ b/packages/mobile/components/ui/Input.tsx @@ -17,7 +17,7 @@ const Input = forwardRef, InputProps>( diff --git a/packages/mobile/metro.config.js b/packages/mobile/metro.config.js index bbd30d1d..6b2b0477 100644 --- a/packages/mobile/metro.config.js +++ b/packages/mobile/metro.config.js @@ -2,6 +2,7 @@ const { getDefaultConfig } = require("expo/metro-config"); const { withNativeWind } = require("nativewind/metro"); /** @type {import('expo/metro-config').MetroConfig} */ +// eslint-disable-next-line no-undef const config = getDefaultConfig(__dirname); module.exports = withNativeWind(config, { input: "./globals.css" }); diff --git a/packages/mobile/package.json b/packages/mobile/package.json index 4dbd0cf5..70054835 100644 --- a/packages/mobile/package.json +++ b/packages/mobile/package.json @@ -13,9 +13,12 @@ "class-variance-authority": "^0.7.0", "clsx": "^2.1.0", "expo": "~50.0.11", + "expo-config-plugin-ios-share-extension": "^0.0.4", "expo-constants": "~15.4.5", + "expo-dev-client": "^3.3.9", "expo-linking": "~6.2.2", "expo-router": "~3.4.8", + "expo-share-intent": "^1.0.1", "expo-status-bar": "~1.11.1", "lucide-react-native": "^0.354.0", "nativewind": "^4.0.1", -- cgit v1.2.3-70-g09d2