A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
mobile(android): Getting the android app ready for submission
MohamedBassem26b53e2ccc00
diff --git a/apps/mobile/app.json b/apps/mobile/app.jsonindex a857022c..1e9d1e34 100644--- a/apps/mobile/app.json+++ b/apps/mobile/app.json@@ -22,8 +22,8 @@},"android": {"adaptiveIcon": {- "foregroundImage": "./assets/icon.png",- "backgroundColor": "#ffffff"+ "foregroundImage": "./assets/adaptive-icon.png",+ "backgroundColor": "#000000"},"package": "app.hoarder.hoardermobile"},@@ -38,7 +38,11 @@"NSExtensionActivationSupportsImageWithMaxCount": 1,"NSExtensionActivationSupportsMovieWithMaxCount": 0,"NSExtensionActivationSupportsText": true- }+ },+ "androidIntentFilters": [+ "text/*",+ "image/*"+ ]}],"expo-secure-store",diff --git a/apps/mobile/app/_layout.tsx b/apps/mobile/app/_layout.tsxindex 9f8f8ad5..f36c9eec 100644--- a/apps/mobile/app/_layout.tsx+++ b/apps/mobile/app/_layout.tsx@@ -24,7 +24,7 @@ export default function RootLayout() {return (<ShareIntentProvider><Providers>- <View className="h-full w-full bg-white">+ <View className="w-full flex-1 bg-background"><StackscreenOptions={{headerShown: false,diff --git a/apps/mobile/app/dashboard/(tabs)/_layout.tsx b/apps/mobile/app/dashboard/(tabs)/_layout.tsxindex ac1a7e2b..fe40215e 100644--- a/apps/mobile/app/dashboard/(tabs)/_layout.tsx+++ b/apps/mobile/app/dashboard/(tabs)/_layout.tsx@@ -1,8 +1,15 @@-import React from "react";+import React, { useEffect } from "react";import { Tabs } from "expo-router";import { ClipboardList, Home, Search, Settings } from "lucide-react-native";+import { Platform } from "react-native";+import * as NavigationBar from 'expo-navigation-bar';export default function TabLayout() {+ useEffect(() => {+ if (Platform.OS == "android") {+ NavigationBar.setBackgroundColorAsync("white");+ }+ }, []);return (<TabsscreenOptions={{diff --git a/apps/mobile/app/dashboard/(tabs)/index.tsx b/apps/mobile/app/dashboard/(tabs)/index.tsxindex 18fb804d..804eb0b5 100644--- a/apps/mobile/app/dashboard/(tabs)/index.tsx+++ b/apps/mobile/app/dashboard/(tabs)/index.tsx@@ -1,4 +1,4 @@-import { Platform, SafeAreaView, View } from "react-native";+import { Platform, View } from "react-native";import * as Haptics from "expo-haptics";import * as ImagePicker from "expo-image-picker";import { useRouter } from "expo-router";@@ -9,6 +9,7 @@ import { useUploadAsset } from "@/lib/upload";import { MenuView } from "@react-native-menu/menu";import { SquarePen } from "lucide-react-native";import { useToast } from "@/components/ui/Toast";+import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView";function HeaderRight() {const {toast} = useToast();@@ -48,7 +49,6 @@ function HeaderRight() {title: "New Link",image: Platform.select({ios: "link",- android: "ic_menu_link",}),},{@@ -56,7 +56,6 @@ function HeaderRight() {title: "New Note",image: Platform.select({ios: "note.text",- android: "ic_menu_note",}),},{@@ -64,14 +63,13 @@ function HeaderRight() {title: "Photo Library",image: Platform.select({ios: "photo",- android: "ic_menu_photo",}),},]}shouldOpenOnLongPress={false}><View className="my-auto px-4">- <SquarePen onPress={() => Haptics.selectionAsync()} />+ <SquarePen color="rgb(0, 122, 255)" onPress={() => Haptics.selectionAsync()} /></View></MenuView>);@@ -79,7 +77,7 @@ function HeaderRight() {export default function Home() {return (- <SafeAreaView>+ <CustomSafeAreaView><UpdatingBookmarkListquery={{ archived: false }}header={@@ -89,6 +87,6 @@ export default function Home() {</View>}/>- </SafeAreaView>+ </CustomSafeAreaView>);}diff --git a/apps/mobile/app/dashboard/(tabs)/lists.tsx b/apps/mobile/app/dashboard/(tabs)/lists.tsxindex e0ed8489..0350ebd2 100644--- a/apps/mobile/app/dashboard/(tabs)/lists.tsx+++ b/apps/mobile/app/dashboard/(tabs)/lists.tsx@@ -1,9 +1,10 @@import { useEffect, useState } from "react";-import { FlatList, Pressable, SafeAreaView, Text, View } from "react-native";+import { FlatList, Pressable, Text, View } from "react-native";import { Link } from "expo-router";import { api } from "@/lib/trpc";import { ChevronRight } from "lucide-react-native";import PageTitle from "@/components/ui/PageTitle";+import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView";export default function Lists() {const [refreshing, setRefreshing] = useState(false);@@ -48,7 +49,7 @@ export default function Lists() {);return (- <SafeAreaView>+ <CustomSafeAreaView><FlatListListHeaderComponent={<PageTitle title="Lists" />@@ -62,7 +63,7 @@ export default function Lists() {<Text className="text-lg">{l.item.logo} {l.item.name}</Text>- <ChevronRight />+ <ChevronRight color="rgb(0, 122, 255)" /></Pressable></Link>)}@@ -70,6 +71,6 @@ export default function Lists() {refreshing={refreshing}onRefresh={onRefresh}/>- </SafeAreaView>+ </CustomSafeAreaView>);}diff --git a/apps/mobile/app/dashboard/(tabs)/search.tsx b/apps/mobile/app/dashboard/(tabs)/search.tsxindex c1bb178b..bcaee5af 100644--- a/apps/mobile/app/dashboard/(tabs)/search.tsx+++ b/apps/mobile/app/dashboard/(tabs)/search.tsx@@ -1,5 +1,5 @@import { useState } from "react";-import { SafeAreaView, View } from "react-native";+import { View } from "react-native";import BookmarkList from "@/components/bookmarks/BookmarkList";import FullPageSpinner from "@/components/ui/FullPageSpinner";import { Input } from "@/components/ui/Input";@@ -7,6 +7,7 @@ import PageTitle from "@/components/ui/PageTitle";import { api } from "@/lib/trpc";import { keepPreviousData } from "@tanstack/react-query";import { useDebounce } from "use-debounce";+import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView";export default function Search() {const [search, setSearch] = useState("");@@ -25,7 +26,7 @@ export default function Search() {}return (- <SafeAreaView>+ <CustomSafeAreaView><BookmarkListbookmarks={data.bookmarks}header={@@ -44,6 +45,6 @@ export default function Search() {onRefresh={onRefresh}isRefreshing={isPending}/>- </SafeAreaView>+ </CustomSafeAreaView>);}diff --git a/apps/mobile/app/dashboard/(tabs)/settings.tsx b/apps/mobile/app/dashboard/(tabs)/settings.tsxindex f60c2495..0dbf7da6 100644--- a/apps/mobile/app/dashboard/(tabs)/settings.tsx+++ b/apps/mobile/app/dashboard/(tabs)/settings.tsx@@ -1,8 +1,9 @@-import { SafeAreaView, Text, View } from "react-native";+import { Text, View } from "react-native";import { Button } from "@/components/ui/Button";import PageTitle from "@/components/ui/PageTitle";import { useSession } from "@/lib/session";import { api } from "@/lib/trpc";+import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView";export default function Dashboard() {const { logout } = useSession();@@ -14,7 +15,7 @@ export default function Dashboard() {}return (- <SafeAreaView>+ <CustomSafeAreaView><PageTitle title="Settings" /><View className="flex h-full w-full items-center gap-4 px-4 py-2"><View className="w-full rounded-lg bg-white px-4 py-2">@@ -25,6 +26,6 @@ export default function Dashboard() {<Button className="w-full" label="Log Out" onPress={logout} /></View>- </SafeAreaView>+ </CustomSafeAreaView>);}diff --git a/apps/mobile/app/dashboard/_layout.tsx b/apps/mobile/app/dashboard/_layout.tsxindex ef04fcd1..f1bb66d7 100644--- a/apps/mobile/app/dashboard/_layout.tsx+++ b/apps/mobile/app/dashboard/_layout.tsx@@ -1,7 +1,7 @@-import { useIsLoggedIn } from "@/lib/session";+import { useEffect } from "react";import { useRouter } from "expo-router";import { Stack } from "expo-router/stack";-import { useEffect } from "react";+import { useIsLoggedIn } from "@/lib/session";export default function Dashboard() {const router = useRouter();diff --git a/apps/mobile/app/dashboard/archive.tsx b/apps/mobile/app/dashboard/archive.tsxindex 93841b9d..e622a3e4 100644--- a/apps/mobile/app/dashboard/archive.tsx+++ b/apps/mobile/app/dashboard/archive.tsx@@ -1,11 +1,11 @@-import { SafeAreaView } from "react-native";import UpdatingBookmarkList from "@/components/bookmarks/UpdatingBookmarkList";import PageTitle from "@/components/ui/PageTitle";+import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView";export default function Archive() {return (- <SafeAreaView>+ <CustomSafeAreaView><UpdatingBookmarkList query={{archived: true}} header={<PageTitle title="🗄️ Archive" />} />- </SafeAreaView>+ </CustomSafeAreaView>);}diff --git a/apps/mobile/app/dashboard/favourites.tsx b/apps/mobile/app/dashboard/favourites.tsxindex aebf3885..213cc918 100644--- a/apps/mobile/app/dashboard/favourites.tsx+++ b/apps/mobile/app/dashboard/favourites.tsx@@ -1,10 +1,10 @@-import { SafeAreaView } from "react-native";import UpdatingBookmarkList from "@/components/bookmarks/UpdatingBookmarkList";import PageTitle from "@/components/ui/PageTitle";+import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView";export default function Favourites() {return (- <SafeAreaView>+ <CustomSafeAreaView><UpdatingBookmarkListquery={{archived: false,@@ -12,6 +12,6 @@ export default function Favourites() {}}header={<PageTitle title="⭐️ Favourites" />}/>- </SafeAreaView>+ </CustomSafeAreaView>);}diff --git a/apps/mobile/app/dashboard/lists/[slug].tsx b/apps/mobile/app/dashboard/lists/[slug].tsxindex 2bb5d602..c0b86a0f 100644--- a/apps/mobile/app/dashboard/lists/[slug].tsx+++ b/apps/mobile/app/dashboard/lists/[slug].tsx@@ -1,9 +1,10 @@-import { SafeAreaView, View } from "react-native";+import { View } from "react-native";import { Stack, useLocalSearchParams } from "expo-router";import UpdatingBookmarkList from "@/components/bookmarks/UpdatingBookmarkList";import FullPageSpinner from "@/components/ui/FullPageSpinner";import PageTitle from "@/components/ui/PageTitle";import { api } from "@/lib/trpc";+import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView";export default function ListView() {const { slug } = useLocalSearchParams();@@ -13,7 +14,7 @@ export default function ListView() {const { data: list } = api.lists.get.useQuery({ listId: slug });return (- <SafeAreaView>+ <CustomSafeAreaView><Stack.Screenoptions={{headerTitle: "",@@ -34,6 +35,6 @@ export default function ListView() {) : (<FullPageSpinner />)}- </SafeAreaView>+ </CustomSafeAreaView>);}diff --git a/apps/mobile/app/dashboard/tags/[slug].tsx b/apps/mobile/app/dashboard/tags/[slug].tsxindex 52c06129..26aa47ec 100644--- a/apps/mobile/app/dashboard/tags/[slug].tsx+++ b/apps/mobile/app/dashboard/tags/[slug].tsx@@ -1,9 +1,10 @@-import { SafeAreaView, View } from "react-native";+import { View } from "react-native";import { Stack, useLocalSearchParams } from "expo-router";import UpdatingBookmarkList from "@/components/bookmarks/UpdatingBookmarkList";import FullPageSpinner from "@/components/ui/FullPageSpinner";import PageTitle from "@/components/ui/PageTitle";import { api } from "@/lib/trpc";+import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView";export default function TagView() {const { slug } = useLocalSearchParams();@@ -14,7 +15,7 @@ export default function TagView() {const { data: tag } = api.tags.get.useQuery({ tagId: slug });return (- <SafeAreaView>+ <CustomSafeAreaView><Stack.Screenoptions={{headerTitle: "",@@ -35,6 +36,6 @@ export default function TagView() {) : (<FullPageSpinner />)}- </SafeAreaView>+ </CustomSafeAreaView>);}diff --git a/apps/mobile/assets/adaptive-icon.png b/apps/mobile/assets/adaptive-icon.pngnew file mode 100644index 00000000..e60f5588Binary files /dev/null and b/apps/mobile/assets/adaptive-icon.png differdiff --git a/apps/mobile/components/bookmarks/BookmarkCard.tsx b/apps/mobile/components/bookmarks/BookmarkCard.tsxindex ac6eaea4..89ce7924 100644--- a/apps/mobile/components/bookmarks/BookmarkCard.tsx+++ b/apps/mobile/components/bookmarks/BookmarkCard.tsx@@ -63,6 +63,7 @@ function ActionBar({ bookmark }: { bookmark: ZBookmark }) {showProgress: false,});apiUtils.bookmarks.getBookmarks.invalidate();+ apiUtils.bookmarks.searchBookmarks.invalidate();},onError,});@@ -85,6 +86,7 @@ function ActionBar({ bookmark }: { bookmark: ZBookmark }) {});apiUtils.bookmarks.getBookmarks.invalidate();apiUtils.bookmarks.getBookmark.invalidate({ bookmarkId: bookmark.id });+ apiUtils.bookmarks.searchBookmarks.invalidate();},onError,});@@ -128,7 +130,6 @@ function ActionBar({ bookmark }: { bookmark: ZBookmark }) {title: bookmark.archived ? "Un-archive" : "Archive",image: Platform.select({ios: "folder",- android: "ic_menu_folder",}),},{@@ -139,7 +140,6 @@ function ActionBar({ bookmark }: { bookmark: ZBookmark }) {},image: Platform.select({ios: "trash",- android: "ic_menu_delete",}),},]}diff --git a/apps/mobile/components/ui/CustomSafeAreaView.tsx b/apps/mobile/components/ui/CustomSafeAreaView.tsxnew file mode 100644index 00000000..c97dfe72--- /dev/null+++ b/apps/mobile/components/ui/CustomSafeAreaView.tsx@@ -0,0 +1,28 @@+import { Platform, SafeAreaView } from "react-native";+import { useSafeAreaInsets } from "react-native-safe-area-context";+import { useHeaderHeight } from "@react-navigation/elements";++export default function CustomSafeAreaView({+ children,+}: {+ children: React.ReactNode;+}) {+ const insets = useSafeAreaInsets();+ const headerHeight = useHeaderHeight();++ return (+ <SafeAreaView+ style={{+ paddingTop:+ // Some ugly hacks to make the app look the same on both android and ios+ Platform.OS == "android"+ ? headerHeight > 0+ ? headerHeight+ : insets.top+ : undefined,+ }}+ >+ {children}+ </SafeAreaView>+ );+}diff --git a/apps/mobile/index.ts b/apps/mobile/index.tsnew file mode 100644index 00000000..5b834183--- /dev/null+++ b/apps/mobile/index.ts@@ -0,0 +1 @@+import 'expo-router/entry';diff --git a/apps/mobile/lib/providers.tsx b/apps/mobile/lib/providers.tsxindex 688ecd5d..ed04b9bf 100644--- a/apps/mobile/lib/providers.tsx+++ b/apps/mobile/lib/providers.tsx@@ -1,4 +1,5 @@import { useEffect, useMemo } from "react";+import { SafeAreaProvider } from "react-native-safe-area-context";import FullPageSpinner from "@/components/ui/FullPageSpinner";import { ToastProvider } from "@/components/ui/Toast";import { QueryClient, QueryClientProvider } from "@tanstack/react-query";@@ -60,8 +61,10 @@ export function Providers({ children }: { children: React.ReactNode }) {}return (- <TrpcProvider settings={settings}>- <ToastProvider>{children}</ToastProvider>- </TrpcProvider>+ <SafeAreaProvider>+ <TrpcProvider settings={settings}>+ <ToastProvider>{children}</ToastProvider>+ </TrpcProvider>+ </SafeAreaProvider>);}diff --git a/apps/mobile/package.json b/apps/mobile/package.jsonindex 7c14f5fe..15b2057b 100644--- a/apps/mobile/package.json+++ b/apps/mobile/package.json@@ -1,7 +1,7 @@{"name": "@hoarder/mobile","version": "1.0.0",- "main": "expo-router/entry",+ "main": "index.ts","scripts": {"clean": "git clean -xdf .expo .turbo node_modules","start": "expo start",@@ -25,6 +25,7 @@"expo-image": "^1.10.6","expo-image-picker": "^14.7.1","expo-linking": "~6.2.2",+ "expo-navigation-bar": "~2.8.1","expo-router": "~3.4.8","expo-secure-store": "^12.8.1","expo-share-intent": "^1.1.0",@@ -67,7 +68,9 @@"@hoarder/eslint-config/react"],"ignorePatterns": [- "expo-plugins/**"+ "expo-plugins/**",+ "ios/**",+ "android/**"]},"prettier": "@hoarder/prettier-config"diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 155c1e32..fda38a1c 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -243,6 +243,9 @@ importers:expo-linking:specifier: ~6.2.2version: 6.2.2([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])(@babel/[email protected](@babel/[email protected]))))+ expo-navigation-bar:+ specifier: ~2.8.1+ version: 2.8.1([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])(@babel/[email protected](@babel/[email protected]))))expo-router:specifier: ~3.4.8version: 3.4.8([email protected]([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])(@babel/[email protected](@babel/[email protected])))))([email protected]([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])(@babel/[email protected](@babel/[email protected])))))([email protected])([email protected])([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])(@babel/[email protected](@babel/[email protected]))))([email protected]([email protected]))([email protected](@babel/[email protected])([email protected](@babel/[email protected])(@babel/[email protected](@babel/[email protected]))([email protected]))([email protected]))([email protected]([email protected](@babel/[email protected])(@babel/[email protected](@babel/[email protected]))([email protected]))([email protected]))([email protected]([email protected](@babel/[email protected])(@babel/[email protected](@babel/[email protected]))([email protected]))([email protected]))([email protected](@babel/[email protected])(@babel/[email protected](@babel/[email protected]))([email protected]))([email protected])@@ -6240,6 +6243,11 @@ packages:resolution: {integrity: sha512-L1DSxV3AUnEvR8+G1JHbMPjpwqALv0AF71oREhDJ/ehI2TDX6LkE+up5BUK1/++UjmVu1lviefbUfLut2F5wNQ==}+ resolution: {integrity: sha512-aT5G+7SUsXDVPsRwp8fF940ycka1ABb4g3QKvTZN3YP6kMWvsiYEmRqMIJVy0zUr/i6bxBG1ZergkXimWrFt3w==}+ peerDependencies:+ expo: '*'+resolution: {integrity: sha512-fOOAWHH4LSPjPFtIZbApxdTNU8xSS8qKvhZ7PfWNMfx9510J1R1Ce/nwENPzcRLHRuVofDsSAEBfi4kV03fJwg==}peerDependencies:@@ -20714,6 +20722,15 @@ snapshots:invariant: 2.2.4dev: false+ [email protected]([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])(@babel/[email protected](@babel/[email protected])))):+ dependencies:+ '@react-native/normalize-color': 2.1.0+ debug: 4.3.4+ expo: 50.0.11(@babel/[email protected])(@react-native/[email protected](@babel/[email protected])(@babel/[email protected](@babel/[email protected])))+ transitivePeerDependencies:+ - supports-color+ dev: false+? [email protected]([email protected]([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])(@babel/[email protected](@babel/[email protected])))))([email protected]([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])(@babel/[email protected](@babel/[email protected])))))([email protected])([email protected])([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])(@babel/[email protected](@babel/[email protected]))))([email protected]([email protected]))([email protected](@babel/[email protected])([email protected](@babel/[email protected])(@babel/[email protected](@babel/[email protected]))([email protected]))([email protected]))([email protected]([email protected](@babel/[email protected])(@babel/[email protected](@babel/[email protected]))([email protected]))([email protected]))([email protected]([email protected](@babel/[email protected])(@babel/[email protected](@babel/[email protected]))([email protected]))([email protected]))([email protected](@babel/[email protected])(@babel/[email protected](@babel/[email protected]))([email protected]))([email protected]): dependencies:'@expo/metro-runtime': 3.1.3([email protected](@babel/[email protected])(@babel/[email protected](@babel/[email protected]))([email protected]))