implemented chat archive

This commit is contained in:
Fabian Freund committed 2024-06-05 16:50:56 +02:00
1 parent b8100b1823
commit 692a962acf
19 files changed
+775 -30

No files matched your search

@@ -0,0 +1,23 @@
class ChatEntity {
static final _namePattern = RegExp(r"^(.*?) - (.*?)\.md$");
final String fileName;
final String? name;
final DateTime? dateTime;
ChatEntity._(this.fileName, {this.name, this.dateTime});
factory ChatEntity.fromFileName(String fileName) {
final match = _namePattern.firstMatch(fileName);
return ChatEntity._(
fileName,
name: match?.group(1),
dateTime: (match != null) ? DateTime.tryParse(match.group(2)!) : null,
);
}
@override
String toString() => name ?? fileName;
}