Files
m8chat-app2/lib/features/chat/domain/message_model.dart
help4bis b95471b0b4 feat: Phase 3 — E2EE calls, Jitsi conferencing, help tab, web security model
- LiveKit call E2EE: CallE2EEManager exchanges encryption keys via Matrix
  to-device events (m.rtc.encryption_keys) for interop with Element X
- Olm bootstrapped in index.html before Flutter init; main.dart logs result
- Encrypted messages shown with lock icon and informative fallback text
- Profile screen: key restore dialog + security setup (cross-signing/backup)
- Jitsi feature: welcome screen (public, no login), conference tab, full-screen
  embed via JitsiMeetExternalAPI, JitsiLink parser for all common link formats
- Help tab: expandable cards for encryption, video calls, account management
- Web security model: no session persistence — device ID only across visits
- Media auth: MSC3916 authenticated endpoint for avatars (Synapse 1.120+)
- Router: welcome route as public landing page; jitsi route as public
- Manifest/index.html: M8Chat branding, dark theme colours

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 05:28:14 +10:00

47 lines
1.2 KiB
Dart

// Version: 1.1.0 | Created: 2026-04-01 | Updated: 2026-04-10
// 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,
encrypted,
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;
}