mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-07-22 06:08:54 -04:00
updates and cleanup
This commit is contained in:
parent
6bd60207d8
commit
ef1ded4494
11 changed files with 142 additions and 108 deletions
|
@ -50,8 +50,11 @@ class ChatComponentCubit extends Cubit<ChatComponentState> {
|
|||
messageWindow: const AsyncLoading(),
|
||||
title: '',
|
||||
)) {
|
||||
// Immediate Init
|
||||
_init();
|
||||
|
||||
// Async Init
|
||||
_initWait.add(_init);
|
||||
_initWait.add(_initAsync);
|
||||
}
|
||||
|
||||
factory ChatComponentCubit.singleContact(
|
||||
|
@ -68,7 +71,7 @@ class ChatComponentCubit extends Cubit<ChatComponentState> {
|
|||
messagesCubit: messagesCubit,
|
||||
);
|
||||
|
||||
Future<void> _init(Completer<void> _cancel) async {
|
||||
void _init() {
|
||||
// Get local user info and account record cubit
|
||||
_localUserIdentityKey = _accountInfo.identityTypedPublicKey;
|
||||
|
||||
|
@ -77,9 +80,6 @@ class ChatComponentCubit extends Cubit<ChatComponentState> {
|
|||
_accountRecordCubit.stream.listen(_onChangedAccountRecord);
|
||||
_onChangedAccountRecord(_accountRecordCubit.state);
|
||||
|
||||
// Subscribe to remote user info
|
||||
await _updateConversationSubscriptions();
|
||||
|
||||
// Subscribe to messages
|
||||
_messagesSubscription = _messagesCubit.stream.listen(_onChangedMessages);
|
||||
_onChangedMessages(_messagesCubit.state);
|
||||
|
@ -90,6 +90,11 @@ class ChatComponentCubit extends Cubit<ChatComponentState> {
|
|||
_onChangedContacts(_contactListCubit.state);
|
||||
}
|
||||
|
||||
Future<void> _initAsync(Completer<void> _cancel) async {
|
||||
// Subscribe to remote user info
|
||||
await _updateConversationSubscriptions();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> close() async {
|
||||
await _initWait();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue