Skip to content

Commit 94c9d99

Browse files
committed
Advance sprint 4 chat parity and message UX
Expand IRCv3 chat history, notice routing, CTCP handling, and message interactions with richer rendering and tests.
1 parent 6823c84 commit 94c9d99

22 files changed

+3131
-79
lines changed

lib/core/models/app_settings.dart

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,49 @@
1+
enum NoticeRoutingMode { server, active, notice, private }
2+
13
class AppSettings {
24
const AppSettings({
35
this.showRawEvents = true,
6+
this.noticeRouting = NoticeRoutingMode.server,
7+
this.showHeaderSearchButton = true,
8+
this.showAttachmentPreviews = true,
49
});
510

611
final bool showRawEvents;
12+
final NoticeRoutingMode noticeRouting;
13+
final bool showHeaderSearchButton;
14+
final bool showAttachmentPreviews;
715

816
AppSettings copyWith({
917
bool? showRawEvents,
18+
NoticeRoutingMode? noticeRouting,
19+
bool? showHeaderSearchButton,
20+
bool? showAttachmentPreviews,
1021
}) {
1122
return AppSettings(
1223
showRawEvents: showRawEvents ?? this.showRawEvents,
24+
noticeRouting: noticeRouting ?? this.noticeRouting,
25+
showHeaderSearchButton: showHeaderSearchButton ?? this.showHeaderSearchButton,
26+
showAttachmentPreviews: showAttachmentPreviews ?? this.showAttachmentPreviews,
1327
);
1428
}
1529

1630
Map<String, Object?> toJson() {
1731
return {
1832
'showRawEvents': showRawEvents,
33+
'noticeRouting': noticeRouting.name,
34+
'showHeaderSearchButton': showHeaderSearchButton,
35+
'showAttachmentPreviews': showAttachmentPreviews,
1936
};
2037
}
2138

2239
factory AppSettings.fromJson(Map<String, Object?> json) {
2340
return AppSettings(
2441
showRawEvents: (json['showRawEvents'] as bool?) ?? true,
42+
noticeRouting: json['noticeRouting'] is String
43+
? NoticeRoutingMode.values.byName(json['noticeRouting']! as String)
44+
: NoticeRoutingMode.server,
45+
showHeaderSearchButton: (json['showHeaderSearchButton'] as bool?) ?? true,
46+
showAttachmentPreviews: (json['showAttachmentPreviews'] as bool?) ?? true,
2547
);
2648
}
2749
}

lib/core/models/irc_message.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ class IrcMessage {
77
required this.sender,
88
required this.content,
99
required this.timestamp,
10+
this.tags = const <String, String?>{},
11+
this.isPlayback = false,
1012
this.isOwn = false,
1113
this.kind = IrcMessageKind.chat,
1214
});
@@ -16,6 +18,8 @@ class IrcMessage {
1618
final String sender;
1719
final String content;
1820
final DateTime timestamp;
21+
final Map<String, String?> tags;
22+
final bool isPlayback;
1923
final bool isOwn;
2024
final IrcMessageKind kind;
2125

@@ -26,6 +30,8 @@ class IrcMessage {
2630
'sender': sender,
2731
'content': content,
2832
'timestamp': timestamp.toIso8601String(),
33+
'tags': tags,
34+
'isPlayback': isPlayback,
2935
'isOwn': isOwn,
3036
'kind': kind.name,
3137
};
@@ -38,6 +44,8 @@ class IrcMessage {
3844
sender: json['sender']! as String,
3945
content: json['content']! as String,
4046
timestamp: DateTime.parse(json['timestamp']! as String),
47+
tags: Map<String, String?>.from((json['tags'] as Map?) ?? const <String, String?>{}),
48+
isPlayback: (json['isPlayback'] as bool?) ?? false,
4149
isOwn: (json['isOwn'] as bool?) ?? false,
4250
kind: IrcMessageKind.values.byName(
4351
(json['kind'] as String?) ?? IrcMessageKind.chat.name,

0 commit comments

Comments
 (0)