- m8logo.svg: inline fills (flutter_svg ignores <style> blocks; logo rendered black) - theme.dart v2.0.0: purple -> site palette (#1265ED / #3B8BFF / navy darks) - app_config.dart: appVersion 1.3.0 -> 1.6.0 (profile screen showed stale version) - manifest.json: theme/background colours to match - Remove em-dashes from user-visible UI strings (global style rule) - chat_screen.dart: fix use_build_context_synchronously in _leaveRoom - Deployed to app2.m8chat.au after full functionality audit (all green) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
20 lines
698 B
Dart
20 lines
698 B
Dart
// Version: 1.1.1 | Created: 2026-04-02 | Updated: 2026-07-03
|
|
// Shared utility for generating a last-message preview string from a Room.
|
|
// Used by both RoomsRepository and SyncPersistenceService to avoid duplication.
|
|
|
|
import 'package:matrix/matrix.dart';
|
|
|
|
/// Returns a human-readable preview of the room's last event, or null if there
|
|
/// is no suitable event to preview.
|
|
String? lastMessagePreview(Room room) {
|
|
final lastEvent = room.lastEvent;
|
|
if (lastEvent == null) return null;
|
|
|
|
return switch (lastEvent.type) {
|
|
EventTypes.Message => lastEvent.body,
|
|
EventTypes.Encrypted => '\u{1F512} Encrypted. Use Element to read',
|
|
EventTypes.Sticker => 'Sticker',
|
|
_ => null,
|
|
};
|
|
}
|