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