From 859eeaad9b8e25a0309f0e27d9e84894cc99d12f Mon Sep 17 00:00:00 2001 From: Assad Isah Date: Fri, 6 Mar 2026 13:21:08 +0100 Subject: [PATCH 1/3] feat(mobile): add auth stack guard and deep link base config --- mobile/app.json | 21 +++++++++++++++++++-- mobile/app/(auth)/_layout.tsx | 14 ++++++++++++++ mobile/app/(tabs)/_layout.tsx | 8 +++++++- mobile/app/index.tsx | 5 ++++- 4 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 mobile/app/(auth)/_layout.tsx diff --git a/mobile/app.json b/mobile/app.json index bd312b6..64945eb 100644 --- a/mobile/app.json +++ b/mobile/app.json @@ -10,9 +10,26 @@ "**/*" ], "ios": { - "supportsTablet": false + "supportsTablet": false, + "bundleIdentifier": "com.discoverly.app" + }, + "android": { + "package": "com.discoverly.app", + "intentFilters": [ + { + "action": "VIEW", + "data": [ + { + "scheme": "discoverly" + } + ], + "category": [ + "BROWSABLE", + "DEFAULT" + ] + } + ] }, - "android": {}, "web": { "bundler": "metro" }, diff --git a/mobile/app/(auth)/_layout.tsx b/mobile/app/(auth)/_layout.tsx new file mode 100644 index 0000000..14a3b01 --- /dev/null +++ b/mobile/app/(auth)/_layout.tsx @@ -0,0 +1,14 @@ +import { Stack } from "expo-router" + +export default function AuthLayout() { + return ( + + + + + ) +} diff --git a/mobile/app/(tabs)/_layout.tsx b/mobile/app/(tabs)/_layout.tsx index a82e9c7..a9bdfec 100644 --- a/mobile/app/(tabs)/_layout.tsx +++ b/mobile/app/(tabs)/_layout.tsx @@ -1,9 +1,15 @@ -import { Tabs } from "expo-router" +import { Redirect, Tabs } from "expo-router" import { useCartStore } from "../../src/store/useCartStore" +import { useAuthStore } from "../../src/store/useAuthStore" export default function TabsLayout() { + const token = useAuthStore((state) => state.token) const itemCount = useCartStore((state) => state.items.length) + if (!token) { + return + } + return ( diff --git a/mobile/app/index.tsx b/mobile/app/index.tsx index 0507072..5c2d44c 100644 --- a/mobile/app/index.tsx +++ b/mobile/app/index.tsx @@ -1,5 +1,8 @@ import { Redirect } from "expo-router" +import { useAuthStore } from "../src/store/useAuthStore" export default function IndexScreen() { - return + const token = useAuthStore((state) => state.token) + + return } From e0b22510e4a4413fbc0dfb6e0d06e19604ae37fa Mon Sep 17 00:00:00 2001 From: Assad Isah Date: Sat, 7 Mar 2026 11:46:27 +0100 Subject: [PATCH 2/3] feat(mobile): wire auth screens to token-based navigation flow --- mobile/app/(auth)/login.tsx | 22 ++++++++++++++++++---- mobile/app/(auth)/register.tsx | 2 +- mobile/app/(tabs)/profile.tsx | 20 ++++++++++++++++++-- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/mobile/app/(auth)/login.tsx b/mobile/app/(auth)/login.tsx index a47c0dd..ffe6303 100644 --- a/mobile/app/(auth)/login.tsx +++ b/mobile/app/(auth)/login.tsx @@ -1,7 +1,16 @@ -import { Link } from "expo-router" -import { Text, View } from "react-native" +import { Link, useRouter } from "expo-router" +import { Pressable, Text, View } from "react-native" +import { useAuthStore } from "../../src/store/useAuthStore" export default function LoginScreen() { + const router = useRouter() + const setToken = useAuthStore((state) => state.setToken) + + const onSignIn = () => { + setToken("session_token") + router.replace("/(tabs)/discover") + } + return ( Welcome Back - Phase 1 auth UI scaffold. - Mock Sign In + Sign in to discover dishes curated for your taste. + + Sign In + Go To Register ) diff --git a/mobile/app/(auth)/register.tsx b/mobile/app/(auth)/register.tsx index 62a8764..757086a 100644 --- a/mobile/app/(auth)/register.tsx +++ b/mobile/app/(auth)/register.tsx @@ -14,7 +14,7 @@ export default function RegisterScreen() { }} > Create Account - Phase 1 registration UI scaffold. + Create your account and start matching meals instantly. Back To Login ) diff --git a/mobile/app/(tabs)/profile.tsx b/mobile/app/(tabs)/profile.tsx index 292d27c..915d3a6 100644 --- a/mobile/app/(tabs)/profile.tsx +++ b/mobile/app/(tabs)/profile.tsx @@ -1,9 +1,25 @@ -import { Text, View } from "react-native" +import { useRouter } from "expo-router" +import { Pressable, Text, View } from "react-native" +import { useAuthStore } from "../../src/store/useAuthStore" export default function ProfileScreen() { + const router = useRouter() + const logout = useAuthStore((state) => state.logout) + + const onLogout = () => { + logout() + router.replace("/(auth)/login") + } + return ( - + User Profile & Wallet. + + Logout + ) } From 4f640ac982a2623c851ae069b98be5b29e7c6185 Mon Sep 17 00:00:00 2001 From: Assad Isah Date: Sat, 7 Mar 2026 19:24:31 +0100 Subject: [PATCH 3/3] fix(mobile): redirect authenticated users away from auth stack --- mobile/app/(auth)/_layout.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mobile/app/(auth)/_layout.tsx b/mobile/app/(auth)/_layout.tsx index 14a3b01..949e0b3 100644 --- a/mobile/app/(auth)/_layout.tsx +++ b/mobile/app/(auth)/_layout.tsx @@ -1,6 +1,13 @@ -import { Stack } from "expo-router" +import { Redirect, Stack } from "expo-router" +import { useAuthStore } from "../../src/store/useAuthStore" export default function AuthLayout() { + const token = useAuthStore((state) => state.token) + + if (token) { + return + } + return (