feat: implement splash and onboarding flows, update app assets, and add project design documentation

This commit is contained in:
Hamza-Ayed
2026-07-24 04:15:07 +03:00
parent 9f7bc31408
commit 213b459912
208 changed files with 23801 additions and 1066 deletions
@@ -8,13 +8,34 @@ class AuthCubit extends Cubit<AuthState> {
AuthCubit(this._repo) : super(const AuthState());
Future<void> checkAuth() async {
final hasToken = await _repo.hasSavedToken();
if (hasToken) {
final cachedUser = await _repo.getCachedUser();
if (cachedUser != null) {
emit(state.copyWith(
status: AuthStatus.authenticated,
user: cachedUser,
));
}
}
final user = await _repo.me();
emit(state.copyWith(
status: user != null ? AuthStatus.authenticated : AuthStatus.unauthenticated,
user: user,
));
if (user != null) {
emit(state.copyWith(
status: AuthStatus.authenticated,
user: user,
));
} else {
final hasTokenAfterMe = await _repo.hasSavedToken();
if (!hasTokenAfterMe) {
emit(state.copyWith(
status: AuthStatus.unauthenticated,
user: null,
));
}
}
}
Future<void> sendOtp(String phone) async {
if (phone.trim().isEmpty) {
emit(state.copyWith(status: AuthStatus.error, error: 'أدخل رقم الهاتف'));
@@ -43,4 +64,14 @@ class AuthCubit extends Cubit<AuthState> {
await _repo.logout();
emit(const AuthState(status: AuthStatus.unauthenticated));
}
Future<void> updateName(String name) async {
try {
emit(state.copyWith(status: AuthStatus.authenticating));
final user = await _repo.updateName(name);
emit(state.copyWith(status: AuthStatus.authenticated, user: user));
} catch (_) {
emit(state.copyWith(status: AuthStatus.error, error: 'تعذّر حفظ الاسم'));
}
}
}