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:
45
lib/features/chat/domain/message_model.dart
Normal file
45
lib/features/chat/domain/message_model.dart
Normal file
@@ -0,0 +1,45 @@
|
||||
// Version: 1.0.0 | Created: 2026-04-01
|
||||
// Immutable message model for the chat timeline.
|
||||
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'message_model.freezed.dart';
|
||||
|
||||
/// Content type of a message event.
|
||||
enum MessageType {
|
||||
text,
|
||||
image,
|
||||
file,
|
||||
audio,
|
||||
video,
|
||||
sticker,
|
||||
redacted,
|
||||
unsupported,
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class MessageModel with _$MessageModel {
|
||||
const factory MessageModel({
|
||||
required String eventId,
|
||||
required String roomId,
|
||||
required String senderId,
|
||||
required String senderDisplayName,
|
||||
String? senderAvatarUrl,
|
||||
required DateTime timestamp,
|
||||
required MessageType type,
|
||||
// Text content (for text messages).
|
||||
String? body,
|
||||
// URL for media messages.
|
||||
String? mediaUrl,
|
||||
// MXC URI for the media (used to download from homeserver).
|
||||
String? mxcUrl,
|
||||
// If this is a reply, the event ID of the original message.
|
||||
String? inReplyToEventId,
|
||||
// Reactions: emoji → list of sender IDs.
|
||||
@Default({}) Map<String, List<String>> reactions,
|
||||
// Read receipts: sender IDs of users who have read up to this event.
|
||||
@Default([]) List<String> readByUserIds,
|
||||
@Default(false) bool isEdited,
|
||||
@Default(false) bool isMine,
|
||||
}) = _MessageModel;
|
||||
}
|
||||
Reference in New Issue
Block a user