mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-08-13 00:15:42 -04:00
clean up context locators
This commit is contained in:
parent
751022e743
commit
2ccad50f9a
31 changed files with 603 additions and 542 deletions
|
@ -1,5 +1,6 @@
|
|||
import 'package:async_tools/async_tools.dart';
|
||||
import 'package:bloc_advanced_tools/bloc_advanced_tools.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:veilid_support/veilid_support.dart';
|
||||
|
||||
import '../../account_manager/account_manager.dart';
|
||||
|
@ -12,8 +13,12 @@ typedef AccountRecordsBlocMapState
|
|||
class AccountRecordsBlocMapCubit extends BlocMapCubit<TypedKey,
|
||||
AsyncValue<AccountRecordState>, AccountRecordCubit>
|
||||
with StateMapFollower<UserLoginsState, TypedKey, UserLogin> {
|
||||
AccountRecordsBlocMapCubit(AccountRepository accountRepository)
|
||||
: _accountRepository = accountRepository;
|
||||
AccountRecordsBlocMapCubit(
|
||||
AccountRepository accountRepository, Locator locator)
|
||||
: _accountRepository = accountRepository {
|
||||
// Follow the user logins cubit
|
||||
follow(locator<UserLoginsCubit>());
|
||||
}
|
||||
|
||||
// Add account record cubit
|
||||
Future<void> _addAccountRecordCubit(
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:equatable/equatable.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
import 'unlocked_account_info.dart';
|
||||
|
@ -10,7 +11,7 @@ enum AccountInfoStatus {
|
|||
}
|
||||
|
||||
@immutable
|
||||
class AccountInfo {
|
||||
class AccountInfo extends Equatable {
|
||||
const AccountInfo({
|
||||
required this.status,
|
||||
required this.active,
|
||||
|
@ -20,4 +21,7 @@ class AccountInfo {
|
|||
final AccountInfoStatus status;
|
||||
final bool active;
|
||||
final UnlockedAccountInfo? unlockedAccountInfo;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [status, active, unlockedAccountInfo];
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:veilid_support/veilid_support.dart';
|
||||
|
||||
|
@ -7,12 +8,14 @@ import 'local_account/local_account.dart';
|
|||
import 'user_login/user_login.dart';
|
||||
|
||||
@immutable
|
||||
class UnlockedAccountInfo {
|
||||
class UnlockedAccountInfo extends Equatable {
|
||||
const UnlockedAccountInfo({
|
||||
required this.localAccount,
|
||||
required this.userLogin,
|
||||
});
|
||||
//
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Public Interface
|
||||
|
||||
TypedKey get superIdentityRecordKey => localAccount.superIdentity.recordKey;
|
||||
TypedKey get accountRecordKey =>
|
||||
|
@ -41,7 +44,12 @@ class UnlockedAccountInfo {
|
|||
return messagesCrypto;
|
||||
}
|
||||
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Fields
|
||||
|
||||
final LocalAccount localAccount;
|
||||
final UserLogin userLogin;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [localAccount, userLogin];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue