diff --git a/lib/chat/cubits/single_contact_messages_cubit.dart b/lib/chat/cubits/single_contact_messages_cubit.dart index c444134..d2abb22 100644 --- a/lib/chat/cubits/single_contact_messages_cubit.dart +++ b/lib/chat/cubits/single_contact_messages_cubit.dart @@ -143,7 +143,8 @@ class SingleContactMessagesCubit extends Cubit { // Open reconciled chat record key Future _initReconciledMessagesCubit() async { - final tableName = _localConversationRecordKey.toString(); + final tableName = + _localConversationRecordKey.toString().replaceAll(':', '_'); final crypto = await _makeLocalMessagesCrypto(); diff --git a/lib/chat/models/message_state.dart b/lib/chat/models/message_state.dart index f9952fa..8eacc8e 100644 --- a/lib/chat/models/message_state.dart +++ b/lib/chat/models/message_state.dart @@ -4,6 +4,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:veilid_support/veilid_support.dart'; import '../../proto/proto.dart' as proto; +import '../../proto/proto.dart' show messageFromJson, messageToJson; part 'message_state.freezed.dart'; part 'message_state.g.dart'; @@ -26,7 +27,7 @@ enum MessageSendState { class MessageState with _$MessageState { const factory MessageState({ // Content of the message - @JsonKey(fromJson: proto.messageFromJson, toJson: proto.messageToJson) + @JsonKey(fromJson: messageFromJson, toJson: messageToJson) required proto.Message content, // Sent timestamp required Timestamp sentTimestamp, diff --git a/packages/veilid_support/lib/src/table_db_array_cubit.dart b/packages/veilid_support/lib/src/table_db_array_cubit.dart index 1cebab5..c4ff507 100644 --- a/packages/veilid_support/lib/src/table_db_array_cubit.dart +++ b/packages/veilid_support/lib/src/table_db_array_cubit.dart @@ -105,6 +105,9 @@ class TableDBArrayCubit extends Cubit> ) async { try { final length = _array.length; + if (length == 0) { + return AsyncValue.data(IList.empty()); + } final end = ((tail - 1) % length) + 1; final start = (count < end) ? end - count : 0; final allItems =