diff --git a/apps/mobile/app/(app)/_layout.tsx b/apps/mobile/app/(app)/_layout.tsx
index e3670eb..f865e18 100644
--- a/apps/mobile/app/(app)/_layout.tsx
+++ b/apps/mobile/app/(app)/_layout.tsx
@@ -1,19 +1,42 @@
import { Redirect, Stack } from 'expo-router';
+import { ActivityIndicator, StyleSheet, View } from 'react-native';
import { useAuth } from '../../lib/authContext';
+import { colors } from '../../theme/colors';
export default function AppLayout() {
- const { session, loading } = useAuth();
- if (loading) return null;
+ const { ready, session, userKeyState } = useAuth();
+
+ if (!ready) {
+ return (
+
+
+
+ );
+ }
if (!session) return ;
+ if (userKeyState.status === 'loading') {
+ return (
+
+
+
+ );
+ }
+ if (userKeyState.status === 'needs-setup') return ;
+ if (userKeyState.status === 'needs-unlock') return ;
+
return (
-
+
-
+
+
+
+
);
}
+
+const styles = StyleSheet.create({
+ center: { flex: 1, alignItems: 'center', justifyContent: 'center', backgroundColor: colors.bg },
+});
diff --git a/apps/mobile/app/index.tsx b/apps/mobile/app/index.tsx
index 9d6c432..c908b57 100644
--- a/apps/mobile/app/index.tsx
+++ b/apps/mobile/app/index.tsx
@@ -21,13 +21,13 @@ import { colors } from '../theme/colors';
// they tap the email link and Expo Router routes the deep link to
// app/auth/callback.tsx.
export default function Landing() {
- const { session, loading } = useAuth();
+ const { session, ready } = useAuth();
const [email, setEmail] = useState('');
const [submitting, setSubmitting] = useState(false);
const [sent, setSent] = useState(false);
const [error, setError] = useState(null);
- if (loading) return null;
+ if (!ready) return null;
if (session) return ;
async function handleSubmit() {