AOSSIE-Org / AOSSIE-Org/NeuroTrack

BUG: Logged-in users are redirected to Login screen on every app launch

Đang mở
#179 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Dart
Star
29
Fork
50
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### Is there an existing issue for this?

- [x] I have searched the existing issues

### What happened?

## 📌 Issue Overview
On every app launch, already authenticated users are redirected to the Login/Auth screen instead of being taken directly to their Home screen. The user must sign in again even though their session is still valid.

## 🔍 Steps to Reproduce
1. Install the Patient app and sign in with Google
2. Complete onboarding (personal details + assessment + consultation)
3. Close the app completely
4. Reopen the app
5. The Splash screen appears, then navigates to the Login/Auth screen - despite the user already being authenticated

## 🎯 Expected Behavior
If a valid Supabase session exists, the user should be routed directly to the Home screen (or whichever onboarding step is pending), skipping the Login screen entirely.

## 🚨 Actual Behavior
`SplashScreen._navigateToAuthScreen()` unconditionally navigates to `AuthScreen` after the 3-second delay, with no check for an existing session. This means every returning logged-in user is forced to sign in again on each launch.

**Root cause:** `splash_screen.dart` never calls `Supabase.instance.client.auth.currentSession` - it always pushes `AuthScreen` regardless of auth state.

## 📷 Screen Recording

https://github.com/user-attachments/assets/21b77570-f84e-448c-97ac-0908a5965ba1

## 💡 Suggested Improvements
In `SplashScreen`, after the splash delay, check `Supabase.instance.client.auth.currentSession`:
- If a session **exists** → route to the appropriate screen
- If **no session** → navigate to `AuthScreen` as before.

### Record

- [x] I agree to follow this project's Code of Conduct
- [x] I want to work on this issue

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.