Skip to content

Commit bffbb94

Browse files
committed
mobile: Setup share intent
1 parent 1f3a162 commit bffbb94

13 files changed

+5248
-193
lines changed

.prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ dist
1515
pnpm-lock.yaml
1616
package-lock.json
1717
yarn.lock
18+
19+
# Expo build
20+
**/.expo/**

package.json

+8-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"version": "0.1.0",
55
"private": true,
66
"scripts": {
7-
"format": "prettier . --write",
8-
"format:check": "prettier . --check",
7+
"format": "prettier 'packages/**/*.{js,ts,tsx,mjs,cjs}' --write",
8+
"format:check": "prettier 'packages/**/*.{js,ts,tsx,mjs,cjs}' --check",
99
"lint": "eslint . --ignore-path .gitignore",
1010
"db:migrate": "pnpm --filter @hoarder/db run migrate",
1111
"db:studio": "pnpm --filter @hoarder/db studio",
@@ -36,5 +36,10 @@
3636
"prettier": "3.2.5",
3737
"prettier-plugin-tailwindcss": "^0.5.11"
3838
},
39-
"packageManager": "[email protected]+sha256.cea6d0bdf2de3a0549582da3983c70c92ffc577ff4410cbf190817ddc35137c2"
39+
"packageManager": "[email protected]+sha256.cea6d0bdf2de3a0549582da3983c70c92ffc577ff4410cbf190817ddc35137c2",
40+
"pnpm": {
41+
"patchedDependencies": {
42+
43+
}
44+
}
4045
}

packages/mobile/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,7 @@ yarn-error.*
3333

3434
# typescript
3535
*.tsbuildinfo
36+
37+
#build files
38+
ios/
39+
android/

packages/mobile/app.json

+13-3
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,29 @@
1616
"**/*"
1717
],
1818
"ios": {
19-
"supportsTablet": true
19+
"supportsTablet": true,
20+
"bundleIdentifier": "com.anonymous.hoardermobile"
2021
},
2122
"android": {
2223
"adaptiveIcon": {
2324
"foregroundImage": "./assets/adaptive-icon.png",
2425
"backgroundColor": "#ffffff"
25-
}
26+
},
27+
"package": "com.anonymous.hoardermobile"
2628
},
2729
"web": {
2830
"favicon": "./assets/favicon.png"
2931
},
3032
"plugins": [
31-
"expo-router"
33+
"expo-router",
34+
["expo-share-intent", {
35+
"iosActivationRules": {
36+
"NSExtensionActivationSupportsWebURLWithMaxCount": 1,
37+
"NSExtensionActivationSupportsWebPageWithMaxCount": 1,
38+
"NSExtensionActivationSupportsImageWithMaxCount": 1,
39+
"NSExtensionActivationSupportsMovieWithMaxCount": 1
40+
}
41+
}]
3242
]
3343
}
3444
}

packages/mobile/app/_layout.tsx

+19-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,29 @@
11
import "@/globals.css";
2+
import "expo-dev-client";
23

3-
import { Slot } from "expo-router";
4+
import { Slot, useRouter } from "expo-router";
5+
import { useShareIntent } from "expo-share-intent";
46
import { StatusBar } from "expo-status-bar";
7+
import { useEffect } from "react";
58
import { View } from "react-native";
69

710
export default function RootLayout() {
11+
const router = useRouter();
12+
const { hasShareIntent, shareIntent, resetShareIntent } = useShareIntent({
13+
debug: true,
14+
});
15+
16+
useEffect(() => {
17+
if (hasShareIntent) {
18+
router.replace({
19+
pathname: "shareintent",
20+
params: { shareIntent: JSON.stringify(shareIntent) },
21+
});
22+
resetShareIntent();
23+
}
24+
}, [hasShareIntent]);
825
return (
9-
<View className="w-full h-full bg-white">
26+
<View className="h-full w-full bg-white">
1027
<Slot />
1128
<StatusBar style="auto" />
1229
</View>

packages/mobile/app/signin.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Input } from "@/components/ui/Input";
66

77
export default function Signin() {
88
return (
9-
<View className="container justify-center h-full flex flex-col gap-2">
9+
<View className="container flex h-full flex-col justify-center gap-2">
1010
<View className="items-center">
1111
<Logo />
1212
</View>

packages/mobile/bun.lockb

-467 KB
Binary file not shown.

packages/mobile/components/Logo.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { View, Text } from "react-native";
33

44
export default function Logo() {
55
return (
6-
<View className="flex flex-row gap-2 justify-center items-center ">
6+
<View className="flex flex-row items-center justify-center gap-2 ">
77
<PackageOpen color="black" size={70} />
88
<Text className="text-5xl">Hoarder</Text>
99
</View>

packages/mobile/components/ui/Input.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const Input = forwardRef<React.ElementRef<typeof TextInput>, InputProps>(
1717
<TextInput
1818
className={cn(
1919
inputClasses,
20-
"border border-input py-2.5 px-4 rounded-lg",
20+
"border-input rounded-lg border px-4 py-2.5",
2121
)}
2222
{...props}
2323
/>

packages/mobile/metro.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const { getDefaultConfig } = require("expo/metro-config");
22
const { withNativeWind } = require("nativewind/metro");
33

44
/** @type {import('expo/metro-config').MetroConfig} */
5+
// eslint-disable-next-line no-undef
56
const config = getDefaultConfig(__dirname);
67

78
module.exports = withNativeWind(config, { input: "./globals.css" });

packages/mobile/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@
1313
"class-variance-authority": "^0.7.0",
1414
"clsx": "^2.1.0",
1515
"expo": "~50.0.11",
16+
"expo-config-plugin-ios-share-extension": "^0.0.4",
1617
"expo-constants": "~15.4.5",
18+
"expo-dev-client": "^3.3.9",
1719
"expo-linking": "~6.2.2",
1820
"expo-router": "~3.4.8",
21+
"expo-share-intent": "^1.0.1",
1922
"expo-status-bar": "~1.11.1",
2023
"lucide-react-native": "^0.354.0",
2124
"nativewind": "^4.0.1",

patches/[email protected]

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/lib/pbxProject.js b/lib/pbxProject.js
2+
index 068548ab89dfd2d39f90d46d881c17dc86f90bf4..8ee4b8b30788ad057cd5f1b1efe41fa51478d4ce 100644
3+
--- a/lib/pbxProject.js
4+
+++ b/lib/pbxProject.js
5+
@@ -1679,7 +1679,7 @@ function correctForFrameworksPath(file, project) {
6+
function correctForPath(file, project, group) {
7+
var r_group_dir = new RegExp('^' + group + '[\\\\/]');
8+
9+
- if (project.pbxGroupByName(group).path)
10+
+ if (project.pbxGroupByName(group)&&project.pbxGroupByName(group).path)
11+
file.path = file.path.replace(r_group_dir, '');
12+
13+
return file;

0 commit comments

Comments
 (0)