table db change tracking

This commit is contained in:
Christien Rioux 2024-05-27 20:34:54 -04:00
parent 9c5feed732
commit e04fd7ee77
7 changed files with 237 additions and 20 deletions

View file

@ -39,19 +39,9 @@ class MessageState with _$MessageState {
}
extension MessageStateExt on MessageState {
String get uniqueId {
final author = content.author.toVeilid().toString();
final id = base64UrlNoPadEncode(content.id);
return '$author|$id';
}
static (proto.TypedKey, Uint8List) splitUniqueId(String uniqueId) {
final parts = uniqueId.split('|');
if (parts.length != 2) {
throw Exception('invalid unique id');
}
final author = TypedKey.fromString(parts[0]).toProto();
final id = base64UrlNoPadDecode(parts[1]);
return (author, id);
Uint8List get uniqueId {
final author = content.author.toVeilid().decode();
final id = content.id;
return author..addAll(id);
}
}