mobile: Setup share intent

This commit is contained in:
MohamedBassem
2024-03-11 09:39:23 +00:00
parent 1f3a162fde
commit bffbb94201
13 changed files with 5104 additions and 49 deletions

View File

@@ -15,3 +15,6 @@ dist
pnpm-lock.yaml
package-lock.json
yarn.lock
# Expo build
**/.expo/**

View File

@@ -4,8 +4,8 @@
"version": "0.1.0",
"private": true,
"scripts": {
"format": "prettier . --write",
"format:check": "prettier . --check",
"format": "prettier 'packages/**/*.{js,ts,tsx,mjs,cjs}' --write",
"format:check": "prettier 'packages/**/*.{js,ts,tsx,mjs,cjs}' --check",
"lint": "eslint . --ignore-path .gitignore",
"db:migrate": "pnpm --filter @hoarder/db run migrate",
"db:studio": "pnpm --filter @hoarder/db studio",
@@ -36,5 +36,10 @@
"prettier": "3.2.5",
"prettier-plugin-tailwindcss": "^0.5.11"
},
"packageManager": "pnpm@8.15.4+sha256.cea6d0bdf2de3a0549582da3983c70c92ffc577ff4410cbf190817ddc35137c2"
"packageManager": "pnpm@8.15.4+sha256.cea6d0bdf2de3a0549582da3983c70c92ffc577ff4410cbf190817ddc35137c2",
"pnpm": {
"patchedDependencies": {
"xcode@3.0.1": "patches/xcode@3.0.1.patch"
}
}
}

View File

@@ -33,3 +33,7 @@ yarn-error.*
# typescript
*.tsbuildinfo
#build files
ios/
android/

View File

@@ -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
}
}]
]
}
}

View File

@@ -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>

View File

@@ -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>

Binary file not shown.

View File

@@ -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>

View File

@@ -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}
/>

View File

@@ -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" });

View File

@@ -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",

13
patches/xcode@3.0.1.patch Normal file
View File

@@ -0,0 +1,13 @@
diff --git a/lib/pbxProject.js b/lib/pbxProject.js
index 068548ab89dfd2d39f90d46d881c17dc86f90bf4..8ee4b8b30788ad057cd5f1b1efe41fa51478d4ce 100644
--- a/lib/pbxProject.js
+++ b/lib/pbxProject.js
@@ -1679,7 +1679,7 @@ function correctForFrameworksPath(file, project) {
function correctForPath(file, project, group) {
var r_group_dir = new RegExp('^' + group + '[\\\\/]');
- if (project.pbxGroupByName(group).path)
+ if (project.pbxGroupByName(group)&&project.pbxGroupByName(group).path)
file.path = file.path.replace(r_group_dir, '');
return file;

5075
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff