feat: Phase 1 complete — Matrix login, rooms, chat, profile
- Direct m.login.password auth against matrix.m8chat.au - Room list with unread badges, last message, timestamps - Chat timeline (text, images, files, replies, reactions) - Profile screen with expandable Notifications and Security sections - Olm E2EE initialisation (web WASM bootstrap) - Global error handler preventing Matrix SDK crashes - GoRouter with refreshListenable (no recreation on auth change) - Feature-first clean architecture: Riverpod + GoRouter + Drift - Deployed to https://app2.m8chat.au Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
29
lib/core/auth/auth_state.dart
Normal file
29
lib/core/auth/auth_state.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
// Version: 1.0.0 | Created: 2026-04-01
|
||||
// Sealed auth state hierarchy.
|
||||
// All auth transitions are expressed as one of these states — no raw booleans.
|
||||
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'auth_state.freezed.dart';
|
||||
|
||||
/// Represents every possible authentication state in the app.
|
||||
@freezed
|
||||
sealed class AuthState with _$AuthState {
|
||||
/// App has just launched; trying to restore session from storage.
|
||||
const factory AuthState.initial() = AuthInitial;
|
||||
|
||||
/// A login or session-restore attempt is in progress.
|
||||
const factory AuthState.loading() = AuthLoading;
|
||||
|
||||
/// User is authenticated. Holds the Matrix user ID and access token.
|
||||
const factory AuthState.authenticated({
|
||||
required String userId,
|
||||
required String accessToken,
|
||||
required String deviceId,
|
||||
}) = AuthAuthenticated;
|
||||
|
||||
/// User is not authenticated.
|
||||
/// [failure] is null on first launch; non-null after a failed attempt.
|
||||
const factory AuthState.unauthenticated({String? failure}) =
|
||||
AuthUnauthenticated;
|
||||
}
|
||||
Reference in New Issue
Block a user