diff options
| author | MohamedBassem <me@mbassem.com> | 2024-03-11 09:39:23 +0000 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2024-03-11 09:41:32 +0000 |
| commit | bffbb94201a5637cb6b55b59b499fb0ec67218d6 (patch) | |
| tree | 52511960c63e5b427d599256ffd549f0932650ca /packages | |
| parent | 1f3a162fde79dbf9102d2e3f67cfc6b6e2e302e9 (diff) | |
| download | karakeep-bffbb94201a5637cb6b55b59b499fb0ec67218d6.tar.zst | |
mobile: Setup share intent
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/mobile/.gitignore | 4 | ||||
| -rw-r--r-- | packages/mobile/app.json | 16 | ||||
| -rw-r--r-- | packages/mobile/app/_layout.tsx | 21 | ||||
| -rw-r--r-- | packages/mobile/app/signin.tsx | 2 | ||||
| -rwxr-xr-x | packages/mobile/bun.lockb | bin | 478034 -> 0 bytes | |||
| -rw-r--r-- | packages/mobile/components/Logo.tsx | 2 | ||||
| -rw-r--r-- | packages/mobile/components/ui/Input.tsx | 2 | ||||
| -rw-r--r-- | packages/mobile/metro.config.js | 1 | ||||
| -rw-r--r-- | packages/mobile/package.json | 3 |
9 files changed, 43 insertions, 8 deletions
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 ( - <View className="w-full h-full bg-white"> + <View className="h-full w-full bg-white"> <Slot /> <StatusBar style="auto" /> </View> 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 ( - <View className="container justify-center h-full flex flex-col gap-2"> + <View className="container flex h-full flex-col justify-center gap-2"> <View className="items-center"> <Logo /> </View> diff --git a/packages/mobile/bun.lockb b/packages/mobile/bun.lockb Binary files differdeleted file mode 100755 index 219082f9..00000000 --- a/packages/mobile/bun.lockb +++ /dev/null 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 ( - <View className="flex flex-row gap-2 justify-center items-center "> + <View className="flex flex-row items-center justify-center gap-2 "> <PackageOpen color="black" size={70} /> <Text className="text-5xl">Hoarder</Text> </View> 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<React.ElementRef<typeof TextInput>, InputProps>( <TextInput className={cn( inputClasses, - "border border-input py-2.5 px-4 rounded-lg", + "border-input rounded-lg border px-4 py-2.5", )} {...props} /> 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", |
