⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.
TypeScript bookmarkbookmark-managercollaborationnextjsreact-nativeread-it-laterself-hostedtypescript
feat(mobile): share intent functionality fully implemented + bug fix
daniel31x136f87e02ebc95
diff --git a/apps/mobile/app/_layout.tsx b/apps/mobile/app/_layout.tsxindex 1b94f261..4bde5006 100644--- a/apps/mobile/app/_layout.tsx+++ b/apps/mobile/app/_layout.tsx@@ -106,9 +106,25 @@ export default function RootLayout() {headerShown: true,headerBackTitle: "Back",headerTitle: "",+ headerTintColor: colorScheme === "dark" ? "white" : "black",+ headerStyle: {+ backgroundColor:+ Platform.OS === "ios"+ ? "transparent"+ : colorScheme === "dark"+ ? rawTheme["dark"]["base-100"]+ : "white",+ },}}/><Stack.Screen name="login" />+ <Stack.Screen+ name="incoming"+ options={{+ navigationBarColor:+ rawTheme[colorScheme as ThemeName]["base-100"],+ }}+ /><Stack.Screen name="+not-found" /></Stack>)}diff --git a/apps/mobile/app/incoming.tsx b/apps/mobile/app/incoming.tsxindex a680dd12..5795f39f 100644--- a/apps/mobile/app/incoming.tsx+++ b/apps/mobile/app/incoming.tsx@@ -1,4 +1,4 @@-import React, { useEffect, useState } from "react";+import React, { useEffect } from "react";import {SafeAreaView,View,@@ -10,46 +10,58 @@ import { Redirect, useRouter } from "expo-router";import useAuthStore from "@/store/auth";import useDataStore from "@/store/data";import { Check } from "lucide-react-native";+import { useAddLink } from "@linkwarden/router/links";+import { rawTheme, ThemeName } from "@/lib/colors";+import { useColorScheme } from "nativewind";export default function IncomingScreen() {const { auth } = useAuthStore();const router = useRouter();const { data, updateData } = useDataStore();+ const addLink = useAddLink(auth);+ const { colorScheme } = useColorScheme();useEffect(() => {- if (auth.status === "unauthenticated") {- router.replace("/login");- return;- }- }, []);-- useEffect(() => {- let timeout = setTimeout(() => {- updateData({- shareIntent: {- hasShareIntent: false,- url: "",+ addLink.mutate(+ { url: data.shareIntent.url },+ {+ onSuccess: () => {+ setTimeout(() => {+ updateData({+ shareIntent: {+ hasShareIntent: false,+ url: "",+ },+ });+ router.replace("/dashboard");+ }, 1000);},- });- router.replace("/dashboard");- }, 2000);- return () => clearTimeout(timeout);+ onError: (error) => {+ console.error("Error adding link:", error);+ },+ }+ );}, []);if (auth.status === "unauthenticated") return <Redirect href="/login" />;return (- <SafeAreaView style={styles.container}>- <Text style={styles.subtitle}>{String(data?.shareIntent.url)}</Text>+ <SafeAreaView className="flex-1 bg-base-100">{data?.shareIntent.url ? (- <View style={styles.center}>- <Check size={140} style={styles.check} />- <Text style={styles.title}>Link Saved!</Text>+ <View className="flex-1 items-center justify-center">+ <Check+ size={140}+ className="mb-3 text-base-content"+ color={rawTheme[colorScheme as ThemeName].primary}+ />+ <Text className="text-2xl font-semibold text-base-content">+ Link Saved!+ </Text></View>) : (- <View style={styles.center}>+ <View className="flex-1 items-center justify-center"><ActivityIndicator size="large" />- <Text style={styles.subtitle}>+ <Text className="mt-3 text-base text-base-content opacity-70">One sec… {String(data?.shareIntent.url)}</Text></View>