mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2024-10-01 06:55:46 -04:00
more cleanup
This commit is contained in:
parent
c42736ce24
commit
adaa2951c2
@ -4,6 +4,7 @@ import 'package:async_tools/async_tools.dart';
|
||||
import 'package:fast_immutable_collections/fast_immutable_collections.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:protobuf/protobuf.dart';
|
||||
import 'package:veilid_support/veilid_support.dart';
|
||||
|
||||
import '../../account_manager/account_manager.dart';
|
||||
@ -302,8 +303,8 @@ class SingleContactMessagesCubit extends Cubit<SingleContactMessagesState> {
|
||||
_reconciledMessagesCubit?.state.state.asData?.value;
|
||||
// Get all sent messages
|
||||
final sentMessages = _sentMessagesCubit?.state.state.asData?.value;
|
||||
// Get all items in the unsent queue
|
||||
// final unsentMessages = _unsentMessagesQueue.queue;
|
||||
//Get all items in the unsent queue
|
||||
final unsentMessages = _unsentMessagesQueue.queue;
|
||||
|
||||
// If we aren't ready to render a state, say we're loading
|
||||
if (reconciledMessages == null || sentMessages == null) {
|
||||
@ -315,7 +316,7 @@ class SingleContactMessagesCubit extends Cubit<SingleContactMessagesState> {
|
||||
// final reconciledMessagesMap =
|
||||
// IMap<String, proto.ReconciledMessage>.fromValues(
|
||||
// keyMapper: (x) => x.content.authorUniqueIdString,
|
||||
// values: reconciledMessages.elements,
|
||||
// values: reconciledMessages.windowElements,
|
||||
// );
|
||||
final sentMessagesMap =
|
||||
IMap<String, OnlineElementState<proto.Message>>.fromValues(
|
||||
@ -346,6 +347,12 @@ class SingleContactMessagesCubit extends Cubit<SingleContactMessagesState> {
|
||||
sentOffline: sentOffline,
|
||||
));
|
||||
}
|
||||
for (final m in unsentMessages) {
|
||||
renderedElements.add(RenderStateElement(
|
||||
message: (m.deepCopy())..id = m.timestamp.toBytes(),
|
||||
isLocal: true,
|
||||
));
|
||||
}
|
||||
|
||||
// Render the state
|
||||
final messages = renderedElements
|
||||
|
@ -232,7 +232,12 @@ class ContactInvitationListCubit
|
||||
// inbox with our list of extant invitations
|
||||
// If we're chatting to ourselves,
|
||||
// we are validating an invitation we have created
|
||||
final isSelf = state.state.asData!.value.indexWhere((cir) =>
|
||||
final contactInvitationList = state.state.asData?.value;
|
||||
if (contactInvitationList == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final isSelf = contactInvitationList.indexWhere((cir) =>
|
||||
cir.value.contactRequestInbox.recordKey.toVeilid() ==
|
||||
contactRequestInboxKey) !=
|
||||
-1;
|
||||
|
Loading…
Reference in New Issue
Block a user