mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-08-01 18:56:03 -04:00
concurrency work in prep for speeding things up
refactor splash screen to process initialization in a better way more async tools for async cubit constructors greatly improved StateMapFollower class
This commit is contained in:
parent
8da1dc7d32
commit
9bb20f4dd2
47 changed files with 886 additions and 579 deletions
|
@ -3,24 +3,13 @@ import 'dart:async';
|
|||
import 'package:bloc/bloc.dart';
|
||||
import 'package:veilid_support/veilid_support.dart';
|
||||
|
||||
import '../../init.dart';
|
||||
import '../repository/account_repository/account_repository.dart';
|
||||
|
||||
class ActiveLocalAccountCubit extends Cubit<TypedKey?> {
|
||||
ActiveLocalAccountCubit(AccountRepository accountRepository)
|
||||
: _accountRepository = accountRepository,
|
||||
super(null) {
|
||||
super(accountRepository.getActiveLocalAccount()) {
|
||||
// Subscribe to streams
|
||||
_initAccountRepositorySubscription();
|
||||
|
||||
// Initialize when we can
|
||||
Future.delayed(Duration.zero, () async {
|
||||
await eventualInitialized.future;
|
||||
emit(_accountRepository.getActiveLocalAccount());
|
||||
});
|
||||
}
|
||||
|
||||
void _initAccountRepositorySubscription() {
|
||||
_accountRepositorySubscription = _accountRepository.stream.listen((change) {
|
||||
switch (change) {
|
||||
case AccountRepositoryChange.activeLocalAccount:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue