mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-01-12 16:19:27 -05:00
init fixes
This commit is contained in:
parent
5cec423351
commit
031d7aea82
@ -3,6 +3,7 @@ import 'dart:async';
|
|||||||
import 'package:bloc/bloc.dart';
|
import 'package:bloc/bloc.dart';
|
||||||
import 'package:veilid_support/veilid_support.dart';
|
import 'package:veilid_support/veilid_support.dart';
|
||||||
|
|
||||||
|
import '../../init.dart';
|
||||||
import '../repository/account_repository/account_repository.dart';
|
import '../repository/account_repository/account_repository.dart';
|
||||||
|
|
||||||
class ActiveLocalAccountCubit extends Cubit<TypedKey?> {
|
class ActiveLocalAccountCubit extends Cubit<TypedKey?> {
|
||||||
@ -11,6 +12,12 @@ class ActiveLocalAccountCubit extends Cubit<TypedKey?> {
|
|||||||
super(null) {
|
super(null) {
|
||||||
// Subscribe to streams
|
// Subscribe to streams
|
||||||
_initAccountRepositorySubscription();
|
_initAccountRepositorySubscription();
|
||||||
|
|
||||||
|
// Initialize when we can
|
||||||
|
Future.delayed(Duration.zero, () async {
|
||||||
|
await eventualInitialized.future;
|
||||||
|
emit(_accountRepository.getActiveLocalAccount());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _initAccountRepositorySubscription() {
|
void _initAccountRepositorySubscription() {
|
||||||
|
@ -3,6 +3,7 @@ import 'dart:async';
|
|||||||
import 'package:bloc/bloc.dart';
|
import 'package:bloc/bloc.dart';
|
||||||
import 'package:fast_immutable_collections/fast_immutable_collections.dart';
|
import 'package:fast_immutable_collections/fast_immutable_collections.dart';
|
||||||
|
|
||||||
|
import '../../init.dart';
|
||||||
import '../models/models.dart';
|
import '../models/models.dart';
|
||||||
import '../repository/account_repository/account_repository.dart';
|
import '../repository/account_repository/account_repository.dart';
|
||||||
|
|
||||||
@ -12,6 +13,12 @@ class LocalAccountsCubit extends Cubit<IList<LocalAccount>> {
|
|||||||
super(IList<LocalAccount>()) {
|
super(IList<LocalAccount>()) {
|
||||||
// Subscribe to streams
|
// Subscribe to streams
|
||||||
_initAccountRepositorySubscription();
|
_initAccountRepositorySubscription();
|
||||||
|
|
||||||
|
// Initialize when we can
|
||||||
|
Future.delayed(Duration.zero, () async {
|
||||||
|
await eventualInitialized.future;
|
||||||
|
emit(_accountRepository.getLocalAccounts());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _initAccountRepositorySubscription() {
|
void _initAccountRepositorySubscription() {
|
||||||
|
@ -3,6 +3,7 @@ import 'dart:async';
|
|||||||
import 'package:bloc/bloc.dart';
|
import 'package:bloc/bloc.dart';
|
||||||
import 'package:fast_immutable_collections/fast_immutable_collections.dart';
|
import 'package:fast_immutable_collections/fast_immutable_collections.dart';
|
||||||
|
|
||||||
|
import '../../init.dart';
|
||||||
import '../models/models.dart';
|
import '../models/models.dart';
|
||||||
import '../repository/account_repository/account_repository.dart';
|
import '../repository/account_repository/account_repository.dart';
|
||||||
|
|
||||||
@ -12,6 +13,12 @@ class UserLoginsCubit extends Cubit<IList<UserLogin>> {
|
|||||||
super(IList<UserLogin>()) {
|
super(IList<UserLogin>()) {
|
||||||
// Subscribe to streams
|
// Subscribe to streams
|
||||||
_initAccountRepositorySubscription();
|
_initAccountRepositorySubscription();
|
||||||
|
|
||||||
|
// Initialize when we can
|
||||||
|
Future.delayed(Duration.zero, () async {
|
||||||
|
await eventualInitialized.future;
|
||||||
|
emit(_accountRepository.getUserLogins());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _initAccountRepositorySubscription() {
|
void _initAccountRepositorySubscription() {
|
||||||
|
Loading…
Reference in New Issue
Block a user