Skip to content

Commit 2f73206

Browse files
committed
Resolve merge conflict in eas.json
2 parents ae420d3 + 3fb109e commit 2f73206

File tree

7 files changed

+79
-22
lines changed

7 files changed

+79
-22
lines changed

frontend/app.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"slug": "oto",
55
"version": "0.0.1",
66
"orientation": "portrait",
7-
"icon": "./assets/images/icon.png",
7+
"icon": "./assets/images/oto-bg-white-logo.png",
88
"scheme": "otoapp",
99
"userInterfaceStyle": "automatic",
1010
"newArchEnabled": true,
@@ -15,7 +15,7 @@
1515
"NSMicrophoneUsageDescription": "This app needs access to your microphone to record audio for voice analysis and transcription."
1616
},
1717
"icon": {
18-
"image": "./assets/images/icon.png",
18+
"image": "./assets/images/oto-bg-white-logo.png",
1919
"prerendered": true
2020
},
2121
"splash": {
@@ -53,7 +53,13 @@
5353
],
5454
"experiments": {
5555
"typedRoutes": true
56+
},
57+
"updates": {
58+
"url": "https://u.expo.dev/4dd98174-a84b-40e7-9aff-02d7e312d2b9"
59+
},
60+
"runtimeVersion": {
61+
"policy": "appVersion"
5662
}
5763
},
5864
"owner": "leq6c"
59-
}
65+
}

frontend/app/(tabs)/logout.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1+
import { navigateToTabs } from '@/lib/session';
12
import { useAuth } from '@/lib/oto-auth';
23
import { useRouter } from 'expo-router';
34
import { useEffect } from 'react';
45

56
export default function Logout() {
67
const { logout } = useAuth();
7-
const router = useRouter();
88

99
useEffect(() => {
10-
logout();
11-
router.replace('/login');
12-
}, [logout, router]);
10+
(async () => {
11+
await logout();
12+
navigateToTabs('/login');
13+
})();
14+
}, [logout]);
1315
}
12.5 KB
Loading

frontend/components/LoginScreen.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,18 @@ import { Button, ButtonText } from '@/components/ui/button';
66
import { Text, Heading } from '@/components/ui/text';
77
import { Ionicons } from '@expo/vector-icons';
88
import { useAuth } from '@/lib/oto-auth';
9+
import { navigateToTabs } from '@/lib/session';
910

1011
export default function LoginScreen() {
1112
const { login } = useLogin();
1213
const [error, setError] = useState('');
13-
const { isReady } = useAuth();
14+
const { isReady, user } = useAuth();
15+
16+
useEffect(() => {
17+
if (user) {
18+
navigateToTabs('/(tabs)');
19+
}
20+
}, [user]);
1421

1522
if (!isReady)
1623
return (

frontend/eas.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@
1515
"distribution": "internal",
1616
"ios": {
1717
"simulator": true
18-
}
18+
},
19+
"channel": "development"
1920
},
2021
"preview": {
21-
"distribution": "internal"
22+
"distribution": "internal",
23+
"channel": "preview"
2224
},
2325
"production": {
24-
"autoIncrement": true
26+
"autoIncrement": true,
27+
"channel": "production"
2528
},
2629
"testflight": {
2730
"distribution": "store",

frontend/hooks/useAuthStatus.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,25 @@ export const useAuthStatus = () => {
77
const [isLoggedIn, setIsLoggedIn] = useState<boolean | null>(null);
88

99
useEffect(() => {
10-
if (isReady) {
11-
// Check if user is authenticated through Privy
12-
const privyLoggedIn = !!user;
10+
const checkAuthStatus = async () => {
11+
if (isReady) {
12+
try {
13+
// Check if user is authenticated through Privy
14+
const privyLoggedIn = !!user;
1315

14-
// Check if user is authenticated through wallet
15-
const walletLoggedIn = hasSession();
16+
// Check if user is authenticated through wallet
17+
const walletLoggedIn = await hasSession();
1618

17-
setIsLoggedIn(!!(privyLoggedIn || walletLoggedIn));
18-
}
19+
const loggedIn = !!(privyLoggedIn || walletLoggedIn);
20+
setIsLoggedIn(loggedIn);
21+
} catch (error) {
22+
console.error('Error checking auth status:', error);
23+
setIsLoggedIn(false);
24+
}
25+
}
26+
};
27+
28+
checkAuthStatus();
1929
}, [user, isReady]);
2030

2131
return { isLoggedIn, isReady };

frontend/lib/session.ts

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,36 @@
1+
import { Platform } from 'react-native';
2+
import { Href, router } from 'expo-router';
13
import * as SecureStore from 'expo-secure-store';
24

3-
export const hasSession = () => {
4-
const walletToken = SecureStore.getItem('wallet_token');
5-
const walletAddress = SecureStore.getItem('wallet_address');
6-
return walletToken && walletAddress;
5+
export const hasSession = async (): Promise<boolean> => {
6+
try {
7+
const walletToken = await SecureStore.getItemAsync('wallet_token');
8+
const walletAddress = await SecureStore.getItemAsync('wallet_address');
9+
return !!(walletToken && walletAddress);
10+
} catch (error) {
11+
console.error('Error checking session:', error);
12+
return false;
13+
}
14+
};
15+
16+
// Helper function for robust navigation on iOS mobile device
17+
export const navigateToTabs = (href: Href) => {
18+
const navigate = () => {
19+
try {
20+
console.log('Attempting navigation to tabs');
21+
router.replace(href);
22+
} catch (error) {
23+
console.error('Navigation error:', error);
24+
// Fallback: try push instead of replace
25+
try {
26+
router.push(href);
27+
} catch (pushError) {
28+
console.error('Push navigation also failed:', pushError);
29+
}
30+
}
31+
};
32+
33+
// Use platform-specific timing for iOS mobile device
34+
const delay = Platform.OS === 'ios' ? 200 : 100;
35+
setTimeout(navigate, delay);
736
};

0 commit comments

Comments
 (0)