mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-08-18 18:57:51 -04:00
add multiple accounts menu
This commit is contained in:
parent
b0d4e35c6f
commit
87bb1657c7
25 changed files with 583 additions and 70 deletions
|
@ -1,12 +1,17 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:bloc_advanced_tools/bloc_advanced_tools.dart';
|
||||
import 'package:fast_immutable_collections/fast_immutable_collections.dart';
|
||||
import 'package:veilid_support/veilid_support.dart';
|
||||
|
||||
import '../models/models.dart';
|
||||
import '../repository/account_repository/account_repository.dart';
|
||||
import '../repository/account_repository.dart';
|
||||
|
||||
class UserLoginsCubit extends Cubit<IList<UserLogin>> {
|
||||
typedef UserLoginsState = IList<UserLogin>;
|
||||
|
||||
class UserLoginsCubit extends Cubit<UserLoginsState>
|
||||
with StateMapFollowable<UserLoginsState, TypedKey, UserLogin> {
|
||||
UserLoginsCubit(AccountRepository accountRepository)
|
||||
: _accountRepository = accountRepository,
|
||||
super(accountRepository.getUserLogins()) {
|
||||
|
@ -30,6 +35,16 @@ class UserLoginsCubit extends Cubit<IList<UserLogin>> {
|
|||
await _accountRepositorySubscription.cancel();
|
||||
}
|
||||
|
||||
/// StateMapFollowable /////////////////////////
|
||||
@override
|
||||
IMap<TypedKey, UserLogin> getStateMap(UserLoginsState state) {
|
||||
final stateValue = state;
|
||||
return IMap.fromIterable(stateValue,
|
||||
keyMapper: (e) => e.superIdentityRecordKey, valueMapper: (e) => e);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
final AccountRepository _accountRepository;
|
||||
late final StreamSubscription<AccountRepositoryChange>
|
||||
_accountRepositorySubscription;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue