Merge branch 'debugging' into 'main'

Debugging and changelog

See merge request veilid/veilidchat!38
This commit is contained in:
Christien Rioux 2025-03-29 18:08:03 -04:00
commit 31e1f3e259
125 changed files with 4761 additions and 4228 deletions

View file

@ -1,3 +1,15 @@
## v0.4.6 ##
- Updated veilid-core to v0.4.4
- See Veilid changelog for specifics
- UI improvements: Theme fixes, wallpaper option added
- Responsiveness improved
- Contacts workflow more consistent
- Safe-area fixes
- Make layout more mobile-friendly
- Improved contact invitation menus
- Deadlock fixes in veilid_support
- _pollWatch was degenerate and only watched first subkey
## v0.4.5 ##
- Updated veilid-core to v0.4.1
- See Veilid changelog for specifics

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

9
assets/images/toilet.svg Normal file
View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 683 591" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<g transform="matrix(1,0,0,1,-258.886,-304.79)">
<path d="M863.18,714.04C889.629,689.649 905.735,659.528 906.84,627.009L479.4,627.009C471.935,627.009 465.896,620.954 465.896,613.505L465.896,383.995L258.886,383.995L258.886,644.605C317.804,660.73 358.554,675.578 386.046,711.378C413.191,746.722 425.198,800.858 426.222,895.218L734.112,895.218L734.112,782.788L734.147,782.788C734.147,776.409 738.69,770.745 745.186,769.554C792.893,760.691 834.159,740.827 863.186,714.038L863.18,714.04Z" style="fill-rule:nonzero;"/>
<path d="M921.09,600.04L922.367,599.989C927.383,600.161 932.25,597.794 935.601,594.427C942.949,587.044 942.965,575.173 935.551,567.759C932.113,564.321 927.386,562.196 922.199,562.196L492.889,562.196L492.889,599.989L919.989,599.989C920.364,599.989 920.719,600.005 921.094,600.04L921.09,600.04Z" style="fill-rule:nonzero;"/>
<rect x="258.89" y="304.79" width="207.01" height="52.199" style="fill-rule:nonzero;"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -23,7 +23,6 @@ class AccountInfoCubit extends Cubit<AccountInfo> {
if (acctInfo != null) {
emit(acctInfo);
}
break;
}
});
}

View file

@ -20,7 +20,6 @@ class LocalAccountsCubit extends Cubit<LocalAccountsState>
switch (change) {
case AccountRepositoryChange.localAccounts:
emit(_accountRepository.getLocalAccounts());
break;
// Ignore these
case AccountRepositoryChange.userLogins:
case AccountRepositoryChange.activeLocalAccount:

View file

@ -15,6 +15,9 @@ import '../../notifications/notifications.dart';
import '../../proto/proto.dart' as proto;
import '../account_manager.dart';
const _kAccountRecordSubscriptionListenKey =
'accountRecordSubscriptionListenKey';
class PerAccountCollectionCubit extends Cubit<PerAccountCollectionState> {
PerAccountCollectionCubit({
required Locator locator,
@ -32,6 +35,7 @@ class PerAccountCollectionCubit extends Cubit<PerAccountCollectionState> {
await _processor.close();
await accountInfoCubit.close();
await _accountRecordSubscription?.cancel();
await serialFutureClose((this, _kAccountRecordSubscriptionListenKey));
await accountRecordCubit?.close();
await activeSingleContactChatBlocMapCubitUpdater.close();
@ -83,7 +87,7 @@ class PerAccountCollectionCubit extends Cubit<PerAccountCollectionState> {
accountRecordCubit = null;
// Update state to 'loading'
nextState = _updateAccountRecordState(nextState, null);
nextState = await _updateAccountRecordState(nextState, null);
emit(nextState);
} else {
///////////////// Logged in ///////////////////
@ -95,20 +99,22 @@ class PerAccountCollectionCubit extends Cubit<PerAccountCollectionState> {
// Update state to value
nextState =
_updateAccountRecordState(nextState, accountRecordCubit!.state);
await _updateAccountRecordState(nextState, accountRecordCubit!.state);
emit(nextState);
// Subscribe AccountRecordCubit
_accountRecordSubscription ??=
accountRecordCubit!.stream.listen((avAccountRecordState) {
emit(_updateAccountRecordState(state, avAccountRecordState));
serialFuture((this, _kAccountRecordSubscriptionListenKey), () async {
emit(await _updateAccountRecordState(state, avAccountRecordState));
});
});
}
}
PerAccountCollectionState _updateAccountRecordState(
Future<PerAccountCollectionState> _updateAccountRecordState(
PerAccountCollectionState prevState,
AsyncValue<AccountRecordState>? avAccountRecordState) {
AsyncValue<AccountRecordState>? avAccountRecordState) async {
// Get next state
final nextState =
prevState.copyWith(avAccountRecordState: avAccountRecordState);
@ -121,8 +127,8 @@ class PerAccountCollectionCubit extends Cubit<PerAccountCollectionState> {
.avAccountRecordState?.asData?.value.contactInvitationRecords
.toVeilid();
final contactInvitationListCubit = contactInvitationListCubitUpdater.update(
accountInfo.userLogin == null ||
final contactInvitationListCubit = await contactInvitationListCubitUpdater
.update(accountInfo.userLogin == null ||
contactInvitationListRecordPointer == null
? null
: (accountInfo, contactInvitationListRecordPointer));
@ -131,34 +137,35 @@ class PerAccountCollectionCubit extends Cubit<PerAccountCollectionState> {
final contactListRecordPointer =
nextState.avAccountRecordState?.asData?.value.contactList.toVeilid();
final contactListCubit = contactListCubitUpdater.update(
final contactListCubit = await contactListCubitUpdater.update(
accountInfo.userLogin == null || contactListRecordPointer == null
? null
: (accountInfo, contactListRecordPointer));
// WaitingInvitationsBlocMapCubit
final waitingInvitationsBlocMapCubit = waitingInvitationsBlocMapCubitUpdater
.update(accountInfo.userLogin == null ||
contactInvitationListCubit == null ||
contactListCubit == null
? null
: (
accountInfo,
accountRecordCubit!,
contactInvitationListCubit,
contactListCubit,
_locator<NotificationsCubit>(),
));
final waitingInvitationsBlocMapCubit =
await waitingInvitationsBlocMapCubitUpdater.update(
accountInfo.userLogin == null ||
contactInvitationListCubit == null ||
contactListCubit == null
? null
: (
accountInfo,
accountRecordCubit!,
contactInvitationListCubit,
contactListCubit,
_locator<NotificationsCubit>(),
));
// ActiveChatCubit
final activeChatCubit = activeChatCubitUpdater
final activeChatCubit = await activeChatCubitUpdater
.update((accountInfo.userLogin == null) ? null : true);
// ChatListCubit
final chatListRecordPointer =
nextState.avAccountRecordState?.asData?.value.chatList.toVeilid();
final chatListCubit = chatListCubitUpdater.update(
final chatListCubit = await chatListCubitUpdater.update(
accountInfo.userLogin == null ||
chatListRecordPointer == null ||
activeChatCubit == null
@ -167,7 +174,7 @@ class PerAccountCollectionCubit extends Cubit<PerAccountCollectionState> {
// ActiveConversationsBlocMapCubit
final activeConversationsBlocMapCubit =
activeConversationsBlocMapCubitUpdater.update(
await activeConversationsBlocMapCubitUpdater.update(
accountRecordCubit == null ||
chatListCubit == null ||
contactListCubit == null
@ -181,7 +188,7 @@ class PerAccountCollectionCubit extends Cubit<PerAccountCollectionState> {
// ActiveSingleContactChatBlocMapCubit
final activeSingleContactChatBlocMapCubit =
activeSingleContactChatBlocMapCubitUpdater.update(
await activeSingleContactChatBlocMapCubitUpdater.update(
accountInfo.userLogin == null ||
activeConversationsBlocMapCubit == null
? null

View file

@ -17,7 +17,6 @@ class UserLoginsCubit extends Cubit<UserLoginsState> {
switch (change) {
case AccountRepositoryChange.userLogins:
emit(_accountRepository.getUserLogins());
break;
// Ignore these
case AccountRepositoryChange.localAccounts:
case AccountRepositoryChange.activeLocalAccount:

View file

@ -13,7 +13,7 @@ enum AccountInfoStatus {
}
@immutable
class AccountInfo extends Equatable {
class AccountInfo extends Equatable implements ToDebugMap {
const AccountInfo({
required this.status,
required this.localAccount,
@ -30,6 +30,13 @@ class AccountInfo extends Equatable {
localAccount,
userLogin,
];
@override
Map<String, dynamic> toDebugMap() => {
'status': status,
'localAccount': localAccount,
'userLogin': userLogin,
};
}
extension AccountInfoExt on AccountInfo {

View file

@ -16,7 +16,7 @@ part 'local_account.freezed.dart';
// This is the root of the account information tree for VeilidChat
//
@freezed
class LocalAccount with _$LocalAccount {
sealed class LocalAccount with _$LocalAccount {
const factory LocalAccount({
// The super identity key record for the account,
// containing the publicKey in the currentIdentity

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
@ -9,238 +10,43 @@ part of 'local_account.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
LocalAccount _$LocalAccountFromJson(Map<String, dynamic> json) {
return _LocalAccount.fromJson(json);
}
/// @nodoc
mixin _$LocalAccount {
// The super identity key record for the account,
// containing the publicKey in the currentIdentity
SuperIdentity get superIdentity =>
throw _privateConstructorUsedError; // The encrypted currentIdentity secret that goes with
SuperIdentity
get superIdentity; // The encrypted currentIdentity secret that goes with
// the identityPublicKey with appended salt
@Uint8ListJsonConverter()
Uint8List get identitySecretBytes =>
throw _privateConstructorUsedError; // The kind of encryption input used on the account
EncryptionKeyType get encryptionKeyType =>
throw _privateConstructorUsedError; // If account is not hidden, password can be retrieved via
bool get biometricsEnabled =>
throw _privateConstructorUsedError; // Keep account hidden unless account password is entered
Uint8List
get identitySecretBytes; // The kind of encryption input used on the account
EncryptionKeyType
get encryptionKeyType; // If account is not hidden, password can be retrieved via
bool
get biometricsEnabled; // Keep account hidden unless account password is entered
// (tries all hidden accounts with auth method (no biometrics))
bool get hiddenAccount =>
throw _privateConstructorUsedError; // Display name for account until it is unlocked
String get name => throw _privateConstructorUsedError;
/// Serializes this LocalAccount to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
bool get hiddenAccount; // Display name for account until it is unlocked
String get name;
/// Create a copy of LocalAccount
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$LocalAccountCopyWith<LocalAccount> get copyWith =>
throw _privateConstructorUsedError;
}
_$LocalAccountCopyWithImpl<LocalAccount>(
this as LocalAccount, _$identity);
/// @nodoc
abstract class $LocalAccountCopyWith<$Res> {
factory $LocalAccountCopyWith(
LocalAccount value, $Res Function(LocalAccount) then) =
_$LocalAccountCopyWithImpl<$Res, LocalAccount>;
@useResult
$Res call(
{SuperIdentity superIdentity,
@Uint8ListJsonConverter() Uint8List identitySecretBytes,
EncryptionKeyType encryptionKeyType,
bool biometricsEnabled,
bool hiddenAccount,
String name});
$SuperIdentityCopyWith<$Res> get superIdentity;
}
/// @nodoc
class _$LocalAccountCopyWithImpl<$Res, $Val extends LocalAccount>
implements $LocalAccountCopyWith<$Res> {
_$LocalAccountCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of LocalAccount
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? superIdentity = null,
Object? identitySecretBytes = null,
Object? encryptionKeyType = null,
Object? biometricsEnabled = null,
Object? hiddenAccount = null,
Object? name = null,
}) {
return _then(_value.copyWith(
superIdentity: null == superIdentity
? _value.superIdentity
: superIdentity // ignore: cast_nullable_to_non_nullable
as SuperIdentity,
identitySecretBytes: null == identitySecretBytes
? _value.identitySecretBytes
: identitySecretBytes // ignore: cast_nullable_to_non_nullable
as Uint8List,
encryptionKeyType: null == encryptionKeyType
? _value.encryptionKeyType
: encryptionKeyType // ignore: cast_nullable_to_non_nullable
as EncryptionKeyType,
biometricsEnabled: null == biometricsEnabled
? _value.biometricsEnabled
: biometricsEnabled // ignore: cast_nullable_to_non_nullable
as bool,
hiddenAccount: null == hiddenAccount
? _value.hiddenAccount
: hiddenAccount // ignore: cast_nullable_to_non_nullable
as bool,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
/// Create a copy of LocalAccount
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$SuperIdentityCopyWith<$Res> get superIdentity {
return $SuperIdentityCopyWith<$Res>(_value.superIdentity, (value) {
return _then(_value.copyWith(superIdentity: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$LocalAccountImplCopyWith<$Res>
implements $LocalAccountCopyWith<$Res> {
factory _$$LocalAccountImplCopyWith(
_$LocalAccountImpl value, $Res Function(_$LocalAccountImpl) then) =
__$$LocalAccountImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{SuperIdentity superIdentity,
@Uint8ListJsonConverter() Uint8List identitySecretBytes,
EncryptionKeyType encryptionKeyType,
bool biometricsEnabled,
bool hiddenAccount,
String name});
@override
$SuperIdentityCopyWith<$Res> get superIdentity;
}
/// @nodoc
class __$$LocalAccountImplCopyWithImpl<$Res>
extends _$LocalAccountCopyWithImpl<$Res, _$LocalAccountImpl>
implements _$$LocalAccountImplCopyWith<$Res> {
__$$LocalAccountImplCopyWithImpl(
_$LocalAccountImpl _value, $Res Function(_$LocalAccountImpl) _then)
: super(_value, _then);
/// Create a copy of LocalAccount
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? superIdentity = null,
Object? identitySecretBytes = null,
Object? encryptionKeyType = null,
Object? biometricsEnabled = null,
Object? hiddenAccount = null,
Object? name = null,
}) {
return _then(_$LocalAccountImpl(
superIdentity: null == superIdentity
? _value.superIdentity
: superIdentity // ignore: cast_nullable_to_non_nullable
as SuperIdentity,
identitySecretBytes: null == identitySecretBytes
? _value.identitySecretBytes
: identitySecretBytes // ignore: cast_nullable_to_non_nullable
as Uint8List,
encryptionKeyType: null == encryptionKeyType
? _value.encryptionKeyType
: encryptionKeyType // ignore: cast_nullable_to_non_nullable
as EncryptionKeyType,
biometricsEnabled: null == biometricsEnabled
? _value.biometricsEnabled
: biometricsEnabled // ignore: cast_nullable_to_non_nullable
as bool,
hiddenAccount: null == hiddenAccount
? _value.hiddenAccount
: hiddenAccount // ignore: cast_nullable_to_non_nullable
as bool,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
@JsonSerializable()
class _$LocalAccountImpl implements _LocalAccount {
const _$LocalAccountImpl(
{required this.superIdentity,
@Uint8ListJsonConverter() required this.identitySecretBytes,
required this.encryptionKeyType,
required this.biometricsEnabled,
required this.hiddenAccount,
required this.name});
factory _$LocalAccountImpl.fromJson(Map<String, dynamic> json) =>
_$$LocalAccountImplFromJson(json);
// The super identity key record for the account,
// containing the publicKey in the currentIdentity
@override
final SuperIdentity superIdentity;
// The encrypted currentIdentity secret that goes with
// the identityPublicKey with appended salt
@override
@Uint8ListJsonConverter()
final Uint8List identitySecretBytes;
// The kind of encryption input used on the account
@override
final EncryptionKeyType encryptionKeyType;
// If account is not hidden, password can be retrieved via
@override
final bool biometricsEnabled;
// Keep account hidden unless account password is entered
// (tries all hidden accounts with auth method (no biometrics))
@override
final bool hiddenAccount;
// Display name for account until it is unlocked
@override
final String name;
@override
String toString() {
return 'LocalAccount(superIdentity: $superIdentity, identitySecretBytes: $identitySecretBytes, encryptionKeyType: $encryptionKeyType, biometricsEnabled: $biometricsEnabled, hiddenAccount: $hiddenAccount, name: $name)';
}
/// Serializes this LocalAccount to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$LocalAccountImpl &&
other is LocalAccount &&
(identical(other.superIdentity, superIdentity) ||
other.superIdentity == superIdentity) &&
const DeepCollectionEquality()
@ -265,60 +71,250 @@ class _$LocalAccountImpl implements _LocalAccount {
hiddenAccount,
name);
/// Create a copy of LocalAccount
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$LocalAccountImplCopyWith<_$LocalAccountImpl> get copyWith =>
__$$LocalAccountImplCopyWithImpl<_$LocalAccountImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$LocalAccountImplToJson(
this,
);
String toString() {
return 'LocalAccount(superIdentity: $superIdentity, identitySecretBytes: $identitySecretBytes, encryptionKeyType: $encryptionKeyType, biometricsEnabled: $biometricsEnabled, hiddenAccount: $hiddenAccount, name: $name)';
}
}
abstract class _LocalAccount implements LocalAccount {
const factory _LocalAccount(
{required final SuperIdentity superIdentity,
@Uint8ListJsonConverter() required final Uint8List identitySecretBytes,
required final EncryptionKeyType encryptionKeyType,
required final bool biometricsEnabled,
required final bool hiddenAccount,
required final String name}) = _$LocalAccountImpl;
/// @nodoc
abstract mixin class $LocalAccountCopyWith<$Res> {
factory $LocalAccountCopyWith(
LocalAccount value, $Res Function(LocalAccount) _then) =
_$LocalAccountCopyWithImpl;
@useResult
$Res call(
{SuperIdentity superIdentity,
@Uint8ListJsonConverter() Uint8List identitySecretBytes,
EncryptionKeyType encryptionKeyType,
bool biometricsEnabled,
bool hiddenAccount,
String name});
factory _LocalAccount.fromJson(Map<String, dynamic> json) =
_$LocalAccountImpl.fromJson;
$SuperIdentityCopyWith<$Res> get superIdentity;
}
/// @nodoc
class _$LocalAccountCopyWithImpl<$Res> implements $LocalAccountCopyWith<$Res> {
_$LocalAccountCopyWithImpl(this._self, this._then);
final LocalAccount _self;
final $Res Function(LocalAccount) _then;
/// Create a copy of LocalAccount
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? superIdentity = null,
Object? identitySecretBytes = null,
Object? encryptionKeyType = null,
Object? biometricsEnabled = null,
Object? hiddenAccount = null,
Object? name = null,
}) {
return _then(_self.copyWith(
superIdentity: null == superIdentity
? _self.superIdentity
: superIdentity // ignore: cast_nullable_to_non_nullable
as SuperIdentity,
identitySecretBytes: null == identitySecretBytes
? _self.identitySecretBytes
: identitySecretBytes // ignore: cast_nullable_to_non_nullable
as Uint8List,
encryptionKeyType: null == encryptionKeyType
? _self.encryptionKeyType
: encryptionKeyType // ignore: cast_nullable_to_non_nullable
as EncryptionKeyType,
biometricsEnabled: null == biometricsEnabled
? _self.biometricsEnabled
: biometricsEnabled // ignore: cast_nullable_to_non_nullable
as bool,
hiddenAccount: null == hiddenAccount
? _self.hiddenAccount
: hiddenAccount // ignore: cast_nullable_to_non_nullable
as bool,
name: null == name
? _self.name
: name // ignore: cast_nullable_to_non_nullable
as String,
));
}
/// Create a copy of LocalAccount
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$SuperIdentityCopyWith<$Res> get superIdentity {
return $SuperIdentityCopyWith<$Res>(_self.superIdentity, (value) {
return _then(_self.copyWith(superIdentity: value));
});
}
}
/// @nodoc
@JsonSerializable()
class _LocalAccount implements LocalAccount {
const _LocalAccount(
{required this.superIdentity,
@Uint8ListJsonConverter() required this.identitySecretBytes,
required this.encryptionKeyType,
required this.biometricsEnabled,
required this.hiddenAccount,
required this.name});
factory _LocalAccount.fromJson(Map<String, dynamic> json) =>
_$LocalAccountFromJson(json);
// The super identity key record for the account,
// containing the publicKey in the currentIdentity
@override
SuperIdentity
get superIdentity; // The encrypted currentIdentity secret that goes with
final SuperIdentity superIdentity;
// The encrypted currentIdentity secret that goes with
// the identityPublicKey with appended salt
@override
@Uint8ListJsonConverter()
Uint8List
get identitySecretBytes; // The kind of encryption input used on the account
final Uint8List identitySecretBytes;
// The kind of encryption input used on the account
@override
EncryptionKeyType
get encryptionKeyType; // If account is not hidden, password can be retrieved via
final EncryptionKeyType encryptionKeyType;
// If account is not hidden, password can be retrieved via
@override
bool
get biometricsEnabled; // Keep account hidden unless account password is entered
final bool biometricsEnabled;
// Keep account hidden unless account password is entered
// (tries all hidden accounts with auth method (no biometrics))
@override
bool get hiddenAccount; // Display name for account until it is unlocked
final bool hiddenAccount;
// Display name for account until it is unlocked
@override
String get name;
final String name;
/// Create a copy of LocalAccount
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$LocalAccountImplCopyWith<_$LocalAccountImpl> get copyWith =>
throw _privateConstructorUsedError;
@pragma('vm:prefer-inline')
_$LocalAccountCopyWith<_LocalAccount> get copyWith =>
__$LocalAccountCopyWithImpl<_LocalAccount>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$LocalAccountToJson(
this,
);
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _LocalAccount &&
(identical(other.superIdentity, superIdentity) ||
other.superIdentity == superIdentity) &&
const DeepCollectionEquality()
.equals(other.identitySecretBytes, identitySecretBytes) &&
(identical(other.encryptionKeyType, encryptionKeyType) ||
other.encryptionKeyType == encryptionKeyType) &&
(identical(other.biometricsEnabled, biometricsEnabled) ||
other.biometricsEnabled == biometricsEnabled) &&
(identical(other.hiddenAccount, hiddenAccount) ||
other.hiddenAccount == hiddenAccount) &&
(identical(other.name, name) || other.name == name));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
superIdentity,
const DeepCollectionEquality().hash(identitySecretBytes),
encryptionKeyType,
biometricsEnabled,
hiddenAccount,
name);
@override
String toString() {
return 'LocalAccount(superIdentity: $superIdentity, identitySecretBytes: $identitySecretBytes, encryptionKeyType: $encryptionKeyType, biometricsEnabled: $biometricsEnabled, hiddenAccount: $hiddenAccount, name: $name)';
}
}
/// @nodoc
abstract mixin class _$LocalAccountCopyWith<$Res>
implements $LocalAccountCopyWith<$Res> {
factory _$LocalAccountCopyWith(
_LocalAccount value, $Res Function(_LocalAccount) _then) =
__$LocalAccountCopyWithImpl;
@override
@useResult
$Res call(
{SuperIdentity superIdentity,
@Uint8ListJsonConverter() Uint8List identitySecretBytes,
EncryptionKeyType encryptionKeyType,
bool biometricsEnabled,
bool hiddenAccount,
String name});
@override
$SuperIdentityCopyWith<$Res> get superIdentity;
}
/// @nodoc
class __$LocalAccountCopyWithImpl<$Res>
implements _$LocalAccountCopyWith<$Res> {
__$LocalAccountCopyWithImpl(this._self, this._then);
final _LocalAccount _self;
final $Res Function(_LocalAccount) _then;
/// Create a copy of LocalAccount
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$Res call({
Object? superIdentity = null,
Object? identitySecretBytes = null,
Object? encryptionKeyType = null,
Object? biometricsEnabled = null,
Object? hiddenAccount = null,
Object? name = null,
}) {
return _then(_LocalAccount(
superIdentity: null == superIdentity
? _self.superIdentity
: superIdentity // ignore: cast_nullable_to_non_nullable
as SuperIdentity,
identitySecretBytes: null == identitySecretBytes
? _self.identitySecretBytes
: identitySecretBytes // ignore: cast_nullable_to_non_nullable
as Uint8List,
encryptionKeyType: null == encryptionKeyType
? _self.encryptionKeyType
: encryptionKeyType // ignore: cast_nullable_to_non_nullable
as EncryptionKeyType,
biometricsEnabled: null == biometricsEnabled
? _self.biometricsEnabled
: biometricsEnabled // ignore: cast_nullable_to_non_nullable
as bool,
hiddenAccount: null == hiddenAccount
? _self.hiddenAccount
: hiddenAccount // ignore: cast_nullable_to_non_nullable
as bool,
name: null == name
? _self.name
: name // ignore: cast_nullable_to_non_nullable
as String,
));
}
/// Create a copy of LocalAccount
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$SuperIdentityCopyWith<$Res> get superIdentity {
return $SuperIdentityCopyWith<$Res>(_self.superIdentity, (value) {
return _then(_self.copyWith(superIdentity: value));
});
}
}
// dart format on

View file

@ -6,8 +6,8 @@ part of 'local_account.dart';
// JsonSerializableGenerator
// **************************************************************************
_$LocalAccountImpl _$$LocalAccountImplFromJson(Map<String, dynamic> json) =>
_$LocalAccountImpl(
_LocalAccount _$LocalAccountFromJson(Map<String, dynamic> json) =>
_LocalAccount(
superIdentity: SuperIdentity.fromJson(json['super_identity']),
identitySecretBytes: const Uint8ListJsonConverter()
.fromJson(json['identity_secret_bytes']),
@ -18,7 +18,7 @@ _$LocalAccountImpl _$$LocalAccountImplFromJson(Map<String, dynamic> json) =>
name: json['name'] as String,
);
Map<String, dynamic> _$$LocalAccountImplToJson(_$LocalAccountImpl instance) =>
Map<String, dynamic> _$LocalAccountToJson(_LocalAccount instance) =>
<String, dynamic>{
'super_identity': instance.superIdentity.toJson(),
'identity_secret_bytes':

View file

@ -2,6 +2,7 @@ import 'package:async_tools/async_tools.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:veilid_support/veilid_support.dart';
import '../../../chat/chat.dart';
import '../../../chat_list/chat_list.dart';
@ -14,7 +15,9 @@ import '../../account_manager.dart';
part 'per_account_collection_state.freezed.dart';
@freezed
class PerAccountCollectionState with _$PerAccountCollectionState {
sealed class PerAccountCollectionState
with _$PerAccountCollectionState
implements ToDebugMap {
const factory PerAccountCollectionState({
required AccountInfo accountInfo,
required AsyncValue<AccountRecordState>? avAccountRecordState,
@ -29,6 +32,23 @@ class PerAccountCollectionState with _$PerAccountCollectionState {
required ActiveSingleContactChatBlocMapCubit?
activeSingleContactChatBlocMapCubit,
}) = _PerAccountCollectionState;
const PerAccountCollectionState._();
@override
Map<String, dynamic> toDebugMap() => {
'accountInfo': accountInfo,
'avAccountRecordState': avAccountRecordState,
'accountInfoCubit': accountInfoCubit,
'accountRecordCubit': accountRecordCubit,
'contactInvitationListCubit': contactInvitationListCubit,
'contactListCubit': contactListCubit,
'waitingInvitationsBlocMapCubit': waitingInvitationsBlocMapCubit,
'activeChatCubit': activeChatCubit,
'chatListCubit': chatListCubit,
'activeConversationsBlocMapCubit': activeConversationsBlocMapCubit,
'activeSingleContactChatBlocMapCubit':
activeSingleContactChatBlocMapCubit,
};
}
extension PerAccountCollectionStateExt on PerAccountCollectionState {

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
@ -9,311 +10,36 @@ part of 'per_account_collection_state.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$PerAccountCollectionState {
AccountInfo get accountInfo => throw _privateConstructorUsedError;
AsyncValue<Account>? get avAccountRecordState =>
throw _privateConstructorUsedError;
AccountInfoCubit? get accountInfoCubit => throw _privateConstructorUsedError;
AccountRecordCubit? get accountRecordCubit =>
throw _privateConstructorUsedError;
ContactInvitationListCubit? get contactInvitationListCubit =>
throw _privateConstructorUsedError;
ContactListCubit? get contactListCubit => throw _privateConstructorUsedError;
WaitingInvitationsBlocMapCubit? get waitingInvitationsBlocMapCubit =>
throw _privateConstructorUsedError;
ActiveChatCubit? get activeChatCubit => throw _privateConstructorUsedError;
ChatListCubit? get chatListCubit => throw _privateConstructorUsedError;
ActiveConversationsBlocMapCubit? get activeConversationsBlocMapCubit =>
throw _privateConstructorUsedError;
ActiveSingleContactChatBlocMapCubit?
get activeSingleContactChatBlocMapCubit =>
throw _privateConstructorUsedError;
AccountInfo get accountInfo;
AsyncValue<AccountRecordState>? get avAccountRecordState;
AccountInfoCubit? get accountInfoCubit;
AccountRecordCubit? get accountRecordCubit;
ContactInvitationListCubit? get contactInvitationListCubit;
ContactListCubit? get contactListCubit;
WaitingInvitationsBlocMapCubit? get waitingInvitationsBlocMapCubit;
ActiveChatCubit? get activeChatCubit;
ChatListCubit? get chatListCubit;
ActiveConversationsBlocMapCubit? get activeConversationsBlocMapCubit;
ActiveSingleContactChatBlocMapCubit? get activeSingleContactChatBlocMapCubit;
/// Create a copy of PerAccountCollectionState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$PerAccountCollectionStateCopyWith<PerAccountCollectionState> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $PerAccountCollectionStateCopyWith<$Res> {
factory $PerAccountCollectionStateCopyWith(PerAccountCollectionState value,
$Res Function(PerAccountCollectionState) then) =
_$PerAccountCollectionStateCopyWithImpl<$Res, PerAccountCollectionState>;
@useResult
$Res call(
{AccountInfo accountInfo,
AsyncValue<Account>? avAccountRecordState,
AccountInfoCubit? accountInfoCubit,
AccountRecordCubit? accountRecordCubit,
ContactInvitationListCubit? contactInvitationListCubit,
ContactListCubit? contactListCubit,
WaitingInvitationsBlocMapCubit? waitingInvitationsBlocMapCubit,
ActiveChatCubit? activeChatCubit,
ChatListCubit? chatListCubit,
ActiveConversationsBlocMapCubit? activeConversationsBlocMapCubit,
ActiveSingleContactChatBlocMapCubit?
activeSingleContactChatBlocMapCubit});
$AsyncValueCopyWith<Account, $Res>? get avAccountRecordState;
}
/// @nodoc
class _$PerAccountCollectionStateCopyWithImpl<$Res,
$Val extends PerAccountCollectionState>
implements $PerAccountCollectionStateCopyWith<$Res> {
_$PerAccountCollectionStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of PerAccountCollectionState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? accountInfo = null,
Object? avAccountRecordState = freezed,
Object? accountInfoCubit = freezed,
Object? accountRecordCubit = freezed,
Object? contactInvitationListCubit = freezed,
Object? contactListCubit = freezed,
Object? waitingInvitationsBlocMapCubit = freezed,
Object? activeChatCubit = freezed,
Object? chatListCubit = freezed,
Object? activeConversationsBlocMapCubit = freezed,
Object? activeSingleContactChatBlocMapCubit = freezed,
}) {
return _then(_value.copyWith(
accountInfo: null == accountInfo
? _value.accountInfo
: accountInfo // ignore: cast_nullable_to_non_nullable
as AccountInfo,
avAccountRecordState: freezed == avAccountRecordState
? _value.avAccountRecordState
: avAccountRecordState // ignore: cast_nullable_to_non_nullable
as AsyncValue<Account>?,
accountInfoCubit: freezed == accountInfoCubit
? _value.accountInfoCubit
: accountInfoCubit // ignore: cast_nullable_to_non_nullable
as AccountInfoCubit?,
accountRecordCubit: freezed == accountRecordCubit
? _value.accountRecordCubit
: accountRecordCubit // ignore: cast_nullable_to_non_nullable
as AccountRecordCubit?,
contactInvitationListCubit: freezed == contactInvitationListCubit
? _value.contactInvitationListCubit
: contactInvitationListCubit // ignore: cast_nullable_to_non_nullable
as ContactInvitationListCubit?,
contactListCubit: freezed == contactListCubit
? _value.contactListCubit
: contactListCubit // ignore: cast_nullable_to_non_nullable
as ContactListCubit?,
waitingInvitationsBlocMapCubit: freezed == waitingInvitationsBlocMapCubit
? _value.waitingInvitationsBlocMapCubit
: waitingInvitationsBlocMapCubit // ignore: cast_nullable_to_non_nullable
as WaitingInvitationsBlocMapCubit?,
activeChatCubit: freezed == activeChatCubit
? _value.activeChatCubit
: activeChatCubit // ignore: cast_nullable_to_non_nullable
as ActiveChatCubit?,
chatListCubit: freezed == chatListCubit
? _value.chatListCubit
: chatListCubit // ignore: cast_nullable_to_non_nullable
as ChatListCubit?,
activeConversationsBlocMapCubit: freezed ==
activeConversationsBlocMapCubit
? _value.activeConversationsBlocMapCubit
: activeConversationsBlocMapCubit // ignore: cast_nullable_to_non_nullable
as ActiveConversationsBlocMapCubit?,
activeSingleContactChatBlocMapCubit: freezed ==
activeSingleContactChatBlocMapCubit
? _value.activeSingleContactChatBlocMapCubit
: activeSingleContactChatBlocMapCubit // ignore: cast_nullable_to_non_nullable
as ActiveSingleContactChatBlocMapCubit?,
) as $Val);
}
/// Create a copy of PerAccountCollectionState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AsyncValueCopyWith<Account, $Res>? get avAccountRecordState {
if (_value.avAccountRecordState == null) {
return null;
}
return $AsyncValueCopyWith<Account, $Res>(_value.avAccountRecordState!,
(value) {
return _then(_value.copyWith(avAccountRecordState: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$PerAccountCollectionStateImplCopyWith<$Res>
implements $PerAccountCollectionStateCopyWith<$Res> {
factory _$$PerAccountCollectionStateImplCopyWith(
_$PerAccountCollectionStateImpl value,
$Res Function(_$PerAccountCollectionStateImpl) then) =
__$$PerAccountCollectionStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{AccountInfo accountInfo,
AsyncValue<Account>? avAccountRecordState,
AccountInfoCubit? accountInfoCubit,
AccountRecordCubit? accountRecordCubit,
ContactInvitationListCubit? contactInvitationListCubit,
ContactListCubit? contactListCubit,
WaitingInvitationsBlocMapCubit? waitingInvitationsBlocMapCubit,
ActiveChatCubit? activeChatCubit,
ChatListCubit? chatListCubit,
ActiveConversationsBlocMapCubit? activeConversationsBlocMapCubit,
ActiveSingleContactChatBlocMapCubit?
activeSingleContactChatBlocMapCubit});
@override
$AsyncValueCopyWith<Account, $Res>? get avAccountRecordState;
}
/// @nodoc
class __$$PerAccountCollectionStateImplCopyWithImpl<$Res>
extends _$PerAccountCollectionStateCopyWithImpl<$Res,
_$PerAccountCollectionStateImpl>
implements _$$PerAccountCollectionStateImplCopyWith<$Res> {
__$$PerAccountCollectionStateImplCopyWithImpl(
_$PerAccountCollectionStateImpl _value,
$Res Function(_$PerAccountCollectionStateImpl) _then)
: super(_value, _then);
/// Create a copy of PerAccountCollectionState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? accountInfo = null,
Object? avAccountRecordState = freezed,
Object? accountInfoCubit = freezed,
Object? accountRecordCubit = freezed,
Object? contactInvitationListCubit = freezed,
Object? contactListCubit = freezed,
Object? waitingInvitationsBlocMapCubit = freezed,
Object? activeChatCubit = freezed,
Object? chatListCubit = freezed,
Object? activeConversationsBlocMapCubit = freezed,
Object? activeSingleContactChatBlocMapCubit = freezed,
}) {
return _then(_$PerAccountCollectionStateImpl(
accountInfo: null == accountInfo
? _value.accountInfo
: accountInfo // ignore: cast_nullable_to_non_nullable
as AccountInfo,
avAccountRecordState: freezed == avAccountRecordState
? _value.avAccountRecordState
: avAccountRecordState // ignore: cast_nullable_to_non_nullable
as AsyncValue<Account>?,
accountInfoCubit: freezed == accountInfoCubit
? _value.accountInfoCubit
: accountInfoCubit // ignore: cast_nullable_to_non_nullable
as AccountInfoCubit?,
accountRecordCubit: freezed == accountRecordCubit
? _value.accountRecordCubit
: accountRecordCubit // ignore: cast_nullable_to_non_nullable
as AccountRecordCubit?,
contactInvitationListCubit: freezed == contactInvitationListCubit
? _value.contactInvitationListCubit
: contactInvitationListCubit // ignore: cast_nullable_to_non_nullable
as ContactInvitationListCubit?,
contactListCubit: freezed == contactListCubit
? _value.contactListCubit
: contactListCubit // ignore: cast_nullable_to_non_nullable
as ContactListCubit?,
waitingInvitationsBlocMapCubit: freezed == waitingInvitationsBlocMapCubit
? _value.waitingInvitationsBlocMapCubit
: waitingInvitationsBlocMapCubit // ignore: cast_nullable_to_non_nullable
as WaitingInvitationsBlocMapCubit?,
activeChatCubit: freezed == activeChatCubit
? _value.activeChatCubit
: activeChatCubit // ignore: cast_nullable_to_non_nullable
as ActiveChatCubit?,
chatListCubit: freezed == chatListCubit
? _value.chatListCubit
: chatListCubit // ignore: cast_nullable_to_non_nullable
as ChatListCubit?,
activeConversationsBlocMapCubit: freezed ==
activeConversationsBlocMapCubit
? _value.activeConversationsBlocMapCubit
: activeConversationsBlocMapCubit // ignore: cast_nullable_to_non_nullable
as ActiveConversationsBlocMapCubit?,
activeSingleContactChatBlocMapCubit: freezed ==
activeSingleContactChatBlocMapCubit
? _value.activeSingleContactChatBlocMapCubit
: activeSingleContactChatBlocMapCubit // ignore: cast_nullable_to_non_nullable
as ActiveSingleContactChatBlocMapCubit?,
));
}
}
/// @nodoc
class _$PerAccountCollectionStateImpl implements _PerAccountCollectionState {
const _$PerAccountCollectionStateImpl(
{required this.accountInfo,
required this.avAccountRecordState,
required this.accountInfoCubit,
required this.accountRecordCubit,
required this.contactInvitationListCubit,
required this.contactListCubit,
required this.waitingInvitationsBlocMapCubit,
required this.activeChatCubit,
required this.chatListCubit,
required this.activeConversationsBlocMapCubit,
required this.activeSingleContactChatBlocMapCubit});
@override
final AccountInfo accountInfo;
@override
final AsyncValue<Account>? avAccountRecordState;
@override
final AccountInfoCubit? accountInfoCubit;
@override
final AccountRecordCubit? accountRecordCubit;
@override
final ContactInvitationListCubit? contactInvitationListCubit;
@override
final ContactListCubit? contactListCubit;
@override
final WaitingInvitationsBlocMapCubit? waitingInvitationsBlocMapCubit;
@override
final ActiveChatCubit? activeChatCubit;
@override
final ChatListCubit? chatListCubit;
@override
final ActiveConversationsBlocMapCubit? activeConversationsBlocMapCubit;
@override
final ActiveSingleContactChatBlocMapCubit?
activeSingleContactChatBlocMapCubit;
@override
String toString() {
return 'PerAccountCollectionState(accountInfo: $accountInfo, avAccountRecordState: $avAccountRecordState, accountInfoCubit: $accountInfoCubit, accountRecordCubit: $accountRecordCubit, contactInvitationListCubit: $contactInvitationListCubit, contactListCubit: $contactListCubit, waitingInvitationsBlocMapCubit: $waitingInvitationsBlocMapCubit, activeChatCubit: $activeChatCubit, chatListCubit: $chatListCubit, activeConversationsBlocMapCubit: $activeConversationsBlocMapCubit, activeSingleContactChatBlocMapCubit: $activeSingleContactChatBlocMapCubit)';
}
_$PerAccountCollectionStateCopyWithImpl<PerAccountCollectionState>(
this as PerAccountCollectionState, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PerAccountCollectionStateImpl &&
other is PerAccountCollectionState &&
(identical(other.accountInfo, accountInfo) ||
other.accountInfo == accountInfo) &&
(identical(other.avAccountRecordState, avAccountRecordState) ||
@ -361,61 +87,350 @@ class _$PerAccountCollectionStateImpl implements _PerAccountCollectionState {
activeConversationsBlocMapCubit,
activeSingleContactChatBlocMapCubit);
@override
String toString() {
return 'PerAccountCollectionState(accountInfo: $accountInfo, avAccountRecordState: $avAccountRecordState, accountInfoCubit: $accountInfoCubit, accountRecordCubit: $accountRecordCubit, contactInvitationListCubit: $contactInvitationListCubit, contactListCubit: $contactListCubit, waitingInvitationsBlocMapCubit: $waitingInvitationsBlocMapCubit, activeChatCubit: $activeChatCubit, chatListCubit: $chatListCubit, activeConversationsBlocMapCubit: $activeConversationsBlocMapCubit, activeSingleContactChatBlocMapCubit: $activeSingleContactChatBlocMapCubit)';
}
}
/// @nodoc
abstract mixin class $PerAccountCollectionStateCopyWith<$Res> {
factory $PerAccountCollectionStateCopyWith(PerAccountCollectionState value,
$Res Function(PerAccountCollectionState) _then) =
_$PerAccountCollectionStateCopyWithImpl;
@useResult
$Res call(
{AccountInfo accountInfo,
AsyncValue<Account>? avAccountRecordState,
AccountInfoCubit? accountInfoCubit,
AccountRecordCubit? accountRecordCubit,
ContactInvitationListCubit? contactInvitationListCubit,
ContactListCubit? contactListCubit,
WaitingInvitationsBlocMapCubit? waitingInvitationsBlocMapCubit,
ActiveChatCubit? activeChatCubit,
ChatListCubit? chatListCubit,
ActiveConversationsBlocMapCubit? activeConversationsBlocMapCubit,
ActiveSingleContactChatBlocMapCubit?
activeSingleContactChatBlocMapCubit});
$AsyncValueCopyWith<Account, $Res>? get avAccountRecordState;
}
/// @nodoc
class _$PerAccountCollectionStateCopyWithImpl<$Res>
implements $PerAccountCollectionStateCopyWith<$Res> {
_$PerAccountCollectionStateCopyWithImpl(this._self, this._then);
final PerAccountCollectionState _self;
final $Res Function(PerAccountCollectionState) _then;
/// Create a copy of PerAccountCollectionState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? accountInfo = null,
Object? avAccountRecordState = freezed,
Object? accountInfoCubit = freezed,
Object? accountRecordCubit = freezed,
Object? contactInvitationListCubit = freezed,
Object? contactListCubit = freezed,
Object? waitingInvitationsBlocMapCubit = freezed,
Object? activeChatCubit = freezed,
Object? chatListCubit = freezed,
Object? activeConversationsBlocMapCubit = freezed,
Object? activeSingleContactChatBlocMapCubit = freezed,
}) {
return _then(_self.copyWith(
accountInfo: null == accountInfo
? _self.accountInfo
: accountInfo // ignore: cast_nullable_to_non_nullable
as AccountInfo,
avAccountRecordState: freezed == avAccountRecordState
? _self.avAccountRecordState!
: avAccountRecordState // ignore: cast_nullable_to_non_nullable
as AsyncValue<Account>?,
accountInfoCubit: freezed == accountInfoCubit
? _self.accountInfoCubit
: accountInfoCubit // ignore: cast_nullable_to_non_nullable
as AccountInfoCubit?,
accountRecordCubit: freezed == accountRecordCubit
? _self.accountRecordCubit
: accountRecordCubit // ignore: cast_nullable_to_non_nullable
as AccountRecordCubit?,
contactInvitationListCubit: freezed == contactInvitationListCubit
? _self.contactInvitationListCubit
: contactInvitationListCubit // ignore: cast_nullable_to_non_nullable
as ContactInvitationListCubit?,
contactListCubit: freezed == contactListCubit
? _self.contactListCubit
: contactListCubit // ignore: cast_nullable_to_non_nullable
as ContactListCubit?,
waitingInvitationsBlocMapCubit: freezed == waitingInvitationsBlocMapCubit
? _self.waitingInvitationsBlocMapCubit
: waitingInvitationsBlocMapCubit // ignore: cast_nullable_to_non_nullable
as WaitingInvitationsBlocMapCubit?,
activeChatCubit: freezed == activeChatCubit
? _self.activeChatCubit
: activeChatCubit // ignore: cast_nullable_to_non_nullable
as ActiveChatCubit?,
chatListCubit: freezed == chatListCubit
? _self.chatListCubit
: chatListCubit // ignore: cast_nullable_to_non_nullable
as ChatListCubit?,
activeConversationsBlocMapCubit: freezed ==
activeConversationsBlocMapCubit
? _self.activeConversationsBlocMapCubit
: activeConversationsBlocMapCubit // ignore: cast_nullable_to_non_nullable
as ActiveConversationsBlocMapCubit?,
activeSingleContactChatBlocMapCubit: freezed ==
activeSingleContactChatBlocMapCubit
? _self.activeSingleContactChatBlocMapCubit
: activeSingleContactChatBlocMapCubit // ignore: cast_nullable_to_non_nullable
as ActiveSingleContactChatBlocMapCubit?,
));
}
/// Create a copy of PerAccountCollectionState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$PerAccountCollectionStateImplCopyWith<_$PerAccountCollectionStateImpl>
get copyWith => __$$PerAccountCollectionStateImplCopyWithImpl<
_$PerAccountCollectionStateImpl>(this, _$identity);
$AsyncValueCopyWith<Account, $Res>? get avAccountRecordState {
if (_self.avAccountRecordState == null) {
return null;
}
return $AsyncValueCopyWith<Account, $Res>(_self.avAccountRecordState!,
(value) {
return _then(_self.copyWith(avAccountRecordState: value));
});
}
}
abstract class _PerAccountCollectionState implements PerAccountCollectionState {
const factory _PerAccountCollectionState(
{required final AccountInfo accountInfo,
required final AsyncValue<Account>? avAccountRecordState,
required final AccountInfoCubit? accountInfoCubit,
required final AccountRecordCubit? accountRecordCubit,
required final ContactInvitationListCubit? contactInvitationListCubit,
required final ContactListCubit? contactListCubit,
required final WaitingInvitationsBlocMapCubit?
waitingInvitationsBlocMapCubit,
required final ActiveChatCubit? activeChatCubit,
required final ChatListCubit? chatListCubit,
required final ActiveConversationsBlocMapCubit?
activeConversationsBlocMapCubit,
required final ActiveSingleContactChatBlocMapCubit?
activeSingleContactChatBlocMapCubit}) =
_$PerAccountCollectionStateImpl;
/// @nodoc
class _PerAccountCollectionState extends PerAccountCollectionState {
const _PerAccountCollectionState(
{required this.accountInfo,
required this.avAccountRecordState,
required this.accountInfoCubit,
required this.accountRecordCubit,
required this.contactInvitationListCubit,
required this.contactListCubit,
required this.waitingInvitationsBlocMapCubit,
required this.activeChatCubit,
required this.chatListCubit,
required this.activeConversationsBlocMapCubit,
required this.activeSingleContactChatBlocMapCubit})
: super._();
@override
AccountInfo get accountInfo;
final AccountInfo accountInfo;
@override
AsyncValue<Account>? get avAccountRecordState;
final AsyncValue<Account>? avAccountRecordState;
@override
AccountInfoCubit? get accountInfoCubit;
final AccountInfoCubit? accountInfoCubit;
@override
AccountRecordCubit? get accountRecordCubit;
final AccountRecordCubit? accountRecordCubit;
@override
ContactInvitationListCubit? get contactInvitationListCubit;
final ContactInvitationListCubit? contactInvitationListCubit;
@override
ContactListCubit? get contactListCubit;
final ContactListCubit? contactListCubit;
@override
WaitingInvitationsBlocMapCubit? get waitingInvitationsBlocMapCubit;
final WaitingInvitationsBlocMapCubit? waitingInvitationsBlocMapCubit;
@override
ActiveChatCubit? get activeChatCubit;
final ActiveChatCubit? activeChatCubit;
@override
ChatListCubit? get chatListCubit;
final ChatListCubit? chatListCubit;
@override
ActiveConversationsBlocMapCubit? get activeConversationsBlocMapCubit;
final ActiveConversationsBlocMapCubit? activeConversationsBlocMapCubit;
@override
ActiveSingleContactChatBlocMapCubit? get activeSingleContactChatBlocMapCubit;
final ActiveSingleContactChatBlocMapCubit?
activeSingleContactChatBlocMapCubit;
/// Create a copy of PerAccountCollectionState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$PerAccountCollectionStateImplCopyWith<_$PerAccountCollectionStateImpl>
get copyWith => throw _privateConstructorUsedError;
@pragma('vm:prefer-inline')
_$PerAccountCollectionStateCopyWith<_PerAccountCollectionState>
get copyWith =>
__$PerAccountCollectionStateCopyWithImpl<_PerAccountCollectionState>(
this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _PerAccountCollectionState &&
(identical(other.accountInfo, accountInfo) ||
other.accountInfo == accountInfo) &&
(identical(other.avAccountRecordState, avAccountRecordState) ||
other.avAccountRecordState == avAccountRecordState) &&
(identical(other.accountInfoCubit, accountInfoCubit) ||
other.accountInfoCubit == accountInfoCubit) &&
(identical(other.accountRecordCubit, accountRecordCubit) ||
other.accountRecordCubit == accountRecordCubit) &&
(identical(other.contactInvitationListCubit,
contactInvitationListCubit) ||
other.contactInvitationListCubit ==
contactInvitationListCubit) &&
(identical(other.contactListCubit, contactListCubit) ||
other.contactListCubit == contactListCubit) &&
(identical(other.waitingInvitationsBlocMapCubit,
waitingInvitationsBlocMapCubit) ||
other.waitingInvitationsBlocMapCubit ==
waitingInvitationsBlocMapCubit) &&
(identical(other.activeChatCubit, activeChatCubit) ||
other.activeChatCubit == activeChatCubit) &&
(identical(other.chatListCubit, chatListCubit) ||
other.chatListCubit == chatListCubit) &&
(identical(other.activeConversationsBlocMapCubit,
activeConversationsBlocMapCubit) ||
other.activeConversationsBlocMapCubit ==
activeConversationsBlocMapCubit) &&
(identical(other.activeSingleContactChatBlocMapCubit,
activeSingleContactChatBlocMapCubit) ||
other.activeSingleContactChatBlocMapCubit ==
activeSingleContactChatBlocMapCubit));
}
@override
int get hashCode => Object.hash(
runtimeType,
accountInfo,
avAccountRecordState,
accountInfoCubit,
accountRecordCubit,
contactInvitationListCubit,
contactListCubit,
waitingInvitationsBlocMapCubit,
activeChatCubit,
chatListCubit,
activeConversationsBlocMapCubit,
activeSingleContactChatBlocMapCubit);
@override
String toString() {
return 'PerAccountCollectionState(accountInfo: $accountInfo, avAccountRecordState: $avAccountRecordState, accountInfoCubit: $accountInfoCubit, accountRecordCubit: $accountRecordCubit, contactInvitationListCubit: $contactInvitationListCubit, contactListCubit: $contactListCubit, waitingInvitationsBlocMapCubit: $waitingInvitationsBlocMapCubit, activeChatCubit: $activeChatCubit, chatListCubit: $chatListCubit, activeConversationsBlocMapCubit: $activeConversationsBlocMapCubit, activeSingleContactChatBlocMapCubit: $activeSingleContactChatBlocMapCubit)';
}
}
/// @nodoc
abstract mixin class _$PerAccountCollectionStateCopyWith<$Res>
implements $PerAccountCollectionStateCopyWith<$Res> {
factory _$PerAccountCollectionStateCopyWith(_PerAccountCollectionState value,
$Res Function(_PerAccountCollectionState) _then) =
__$PerAccountCollectionStateCopyWithImpl;
@override
@useResult
$Res call(
{AccountInfo accountInfo,
AsyncValue<Account>? avAccountRecordState,
AccountInfoCubit? accountInfoCubit,
AccountRecordCubit? accountRecordCubit,
ContactInvitationListCubit? contactInvitationListCubit,
ContactListCubit? contactListCubit,
WaitingInvitationsBlocMapCubit? waitingInvitationsBlocMapCubit,
ActiveChatCubit? activeChatCubit,
ChatListCubit? chatListCubit,
ActiveConversationsBlocMapCubit? activeConversationsBlocMapCubit,
ActiveSingleContactChatBlocMapCubit?
activeSingleContactChatBlocMapCubit});
@override
$AsyncValueCopyWith<Account, $Res>? get avAccountRecordState;
}
/// @nodoc
class __$PerAccountCollectionStateCopyWithImpl<$Res>
implements _$PerAccountCollectionStateCopyWith<$Res> {
__$PerAccountCollectionStateCopyWithImpl(this._self, this._then);
final _PerAccountCollectionState _self;
final $Res Function(_PerAccountCollectionState) _then;
/// Create a copy of PerAccountCollectionState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$Res call({
Object? accountInfo = null,
Object? avAccountRecordState = freezed,
Object? accountInfoCubit = freezed,
Object? accountRecordCubit = freezed,
Object? contactInvitationListCubit = freezed,
Object? contactListCubit = freezed,
Object? waitingInvitationsBlocMapCubit = freezed,
Object? activeChatCubit = freezed,
Object? chatListCubit = freezed,
Object? activeConversationsBlocMapCubit = freezed,
Object? activeSingleContactChatBlocMapCubit = freezed,
}) {
return _then(_PerAccountCollectionState(
accountInfo: null == accountInfo
? _self.accountInfo
: accountInfo // ignore: cast_nullable_to_non_nullable
as AccountInfo,
avAccountRecordState: freezed == avAccountRecordState
? _self.avAccountRecordState
: avAccountRecordState // ignore: cast_nullable_to_non_nullable
as AsyncValue<Account>?,
accountInfoCubit: freezed == accountInfoCubit
? _self.accountInfoCubit
: accountInfoCubit // ignore: cast_nullable_to_non_nullable
as AccountInfoCubit?,
accountRecordCubit: freezed == accountRecordCubit
? _self.accountRecordCubit
: accountRecordCubit // ignore: cast_nullable_to_non_nullable
as AccountRecordCubit?,
contactInvitationListCubit: freezed == contactInvitationListCubit
? _self.contactInvitationListCubit
: contactInvitationListCubit // ignore: cast_nullable_to_non_nullable
as ContactInvitationListCubit?,
contactListCubit: freezed == contactListCubit
? _self.contactListCubit
: contactListCubit // ignore: cast_nullable_to_non_nullable
as ContactListCubit?,
waitingInvitationsBlocMapCubit: freezed == waitingInvitationsBlocMapCubit
? _self.waitingInvitationsBlocMapCubit
: waitingInvitationsBlocMapCubit // ignore: cast_nullable_to_non_nullable
as WaitingInvitationsBlocMapCubit?,
activeChatCubit: freezed == activeChatCubit
? _self.activeChatCubit
: activeChatCubit // ignore: cast_nullable_to_non_nullable
as ActiveChatCubit?,
chatListCubit: freezed == chatListCubit
? _self.chatListCubit
: chatListCubit // ignore: cast_nullable_to_non_nullable
as ChatListCubit?,
activeConversationsBlocMapCubit: freezed ==
activeConversationsBlocMapCubit
? _self.activeConversationsBlocMapCubit
: activeConversationsBlocMapCubit // ignore: cast_nullable_to_non_nullable
as ActiveConversationsBlocMapCubit?,
activeSingleContactChatBlocMapCubit: freezed ==
activeSingleContactChatBlocMapCubit
? _self.activeSingleContactChatBlocMapCubit
: activeSingleContactChatBlocMapCubit // ignore: cast_nullable_to_non_nullable
as ActiveSingleContactChatBlocMapCubit?,
));
}
/// Create a copy of PerAccountCollectionState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AsyncValueCopyWith<Account, $Res>? get avAccountRecordState {
if (_self.avAccountRecordState == null) {
return null;
}
return $AsyncValueCopyWith<Account, $Res>(_self.avAccountRecordState!,
(value) {
return _then(_self.copyWith(avAccountRecordState: value));
});
}
}
// dart format on

View file

@ -9,7 +9,7 @@ part 'user_login.g.dart';
// User logins are stored in the user_logins tablestore table
// indexed by the accountSuperIdentityRecordKey
@freezed
class UserLogin with _$UserLogin {
sealed class UserLogin with _$UserLogin {
const factory UserLogin({
// SuperIdentity record key for the user
// used to index the local accounts table

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
@ -9,195 +10,36 @@ part of 'user_login.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
UserLogin _$UserLoginFromJson(Map<String, dynamic> json) {
return _UserLogin.fromJson(json);
}
/// @nodoc
mixin _$UserLogin {
// SuperIdentity record key for the user
// used to index the local accounts table
Typed<FixedEncodedString43> get superIdentityRecordKey =>
throw _privateConstructorUsedError; // The identity secret as unlocked from the local accounts table
Typed<FixedEncodedString43> get identitySecret =>
throw _privateConstructorUsedError; // The account record key, owner key and secret pulled from the identity
AccountRecordInfo get accountRecordInfo =>
throw _privateConstructorUsedError; // The time this login was most recently used
Timestamp get lastActive => throw _privateConstructorUsedError;
/// Serializes this UserLogin to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
TypedKey
get superIdentityRecordKey; // The identity secret as unlocked from the local accounts table
TypedSecret
get identitySecret; // The account record key, owner key and secret pulled from the identity
AccountRecordInfo
get accountRecordInfo; // The time this login was most recently used
Timestamp get lastActive;
/// Create a copy of UserLogin
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$UserLoginCopyWith<UserLogin> get copyWith =>
throw _privateConstructorUsedError;
}
_$UserLoginCopyWithImpl<UserLogin>(this as UserLogin, _$identity);
/// @nodoc
abstract class $UserLoginCopyWith<$Res> {
factory $UserLoginCopyWith(UserLogin value, $Res Function(UserLogin) then) =
_$UserLoginCopyWithImpl<$Res, UserLogin>;
@useResult
$Res call(
{Typed<FixedEncodedString43> superIdentityRecordKey,
Typed<FixedEncodedString43> identitySecret,
AccountRecordInfo accountRecordInfo,
Timestamp lastActive});
$AccountRecordInfoCopyWith<$Res> get accountRecordInfo;
}
/// @nodoc
class _$UserLoginCopyWithImpl<$Res, $Val extends UserLogin>
implements $UserLoginCopyWith<$Res> {
_$UserLoginCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of UserLogin
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? superIdentityRecordKey = null,
Object? identitySecret = null,
Object? accountRecordInfo = null,
Object? lastActive = null,
}) {
return _then(_value.copyWith(
superIdentityRecordKey: null == superIdentityRecordKey
? _value.superIdentityRecordKey
: superIdentityRecordKey // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>,
identitySecret: null == identitySecret
? _value.identitySecret
: identitySecret // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>,
accountRecordInfo: null == accountRecordInfo
? _value.accountRecordInfo
: accountRecordInfo // ignore: cast_nullable_to_non_nullable
as AccountRecordInfo,
lastActive: null == lastActive
? _value.lastActive
: lastActive // ignore: cast_nullable_to_non_nullable
as Timestamp,
) as $Val);
}
/// Create a copy of UserLogin
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AccountRecordInfoCopyWith<$Res> get accountRecordInfo {
return $AccountRecordInfoCopyWith<$Res>(_value.accountRecordInfo, (value) {
return _then(_value.copyWith(accountRecordInfo: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$UserLoginImplCopyWith<$Res>
implements $UserLoginCopyWith<$Res> {
factory _$$UserLoginImplCopyWith(
_$UserLoginImpl value, $Res Function(_$UserLoginImpl) then) =
__$$UserLoginImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{Typed<FixedEncodedString43> superIdentityRecordKey,
Typed<FixedEncodedString43> identitySecret,
AccountRecordInfo accountRecordInfo,
Timestamp lastActive});
@override
$AccountRecordInfoCopyWith<$Res> get accountRecordInfo;
}
/// @nodoc
class __$$UserLoginImplCopyWithImpl<$Res>
extends _$UserLoginCopyWithImpl<$Res, _$UserLoginImpl>
implements _$$UserLoginImplCopyWith<$Res> {
__$$UserLoginImplCopyWithImpl(
_$UserLoginImpl _value, $Res Function(_$UserLoginImpl) _then)
: super(_value, _then);
/// Create a copy of UserLogin
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? superIdentityRecordKey = null,
Object? identitySecret = null,
Object? accountRecordInfo = null,
Object? lastActive = null,
}) {
return _then(_$UserLoginImpl(
superIdentityRecordKey: null == superIdentityRecordKey
? _value.superIdentityRecordKey
: superIdentityRecordKey // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>,
identitySecret: null == identitySecret
? _value.identitySecret
: identitySecret // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>,
accountRecordInfo: null == accountRecordInfo
? _value.accountRecordInfo
: accountRecordInfo // ignore: cast_nullable_to_non_nullable
as AccountRecordInfo,
lastActive: null == lastActive
? _value.lastActive
: lastActive // ignore: cast_nullable_to_non_nullable
as Timestamp,
));
}
}
/// @nodoc
@JsonSerializable()
class _$UserLoginImpl implements _UserLogin {
const _$UserLoginImpl(
{required this.superIdentityRecordKey,
required this.identitySecret,
required this.accountRecordInfo,
required this.lastActive});
factory _$UserLoginImpl.fromJson(Map<String, dynamic> json) =>
_$$UserLoginImplFromJson(json);
// SuperIdentity record key for the user
// used to index the local accounts table
@override
final Typed<FixedEncodedString43> superIdentityRecordKey;
// The identity secret as unlocked from the local accounts table
@override
final Typed<FixedEncodedString43> identitySecret;
// The account record key, owner key and secret pulled from the identity
@override
final AccountRecordInfo accountRecordInfo;
// The time this login was most recently used
@override
final Timestamp lastActive;
@override
String toString() {
return 'UserLogin(superIdentityRecordKey: $superIdentityRecordKey, identitySecret: $identitySecret, accountRecordInfo: $accountRecordInfo, lastActive: $lastActive)';
}
/// Serializes this UserLogin to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$UserLoginImpl &&
other is UserLogin &&
(identical(other.superIdentityRecordKey, superIdentityRecordKey) ||
other.superIdentityRecordKey == superIdentityRecordKey) &&
(identical(other.identitySecret, identitySecret) ||
@ -213,50 +55,204 @@ class _$UserLoginImpl implements _UserLogin {
int get hashCode => Object.hash(runtimeType, superIdentityRecordKey,
identitySecret, accountRecordInfo, lastActive);
/// Create a copy of UserLogin
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$UserLoginImplCopyWith<_$UserLoginImpl> get copyWith =>
__$$UserLoginImplCopyWithImpl<_$UserLoginImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$UserLoginImplToJson(
this,
);
String toString() {
return 'UserLogin(superIdentityRecordKey: $superIdentityRecordKey, identitySecret: $identitySecret, accountRecordInfo: $accountRecordInfo, lastActive: $lastActive)';
}
}
abstract class _UserLogin implements UserLogin {
const factory _UserLogin(
{required final Typed<FixedEncodedString43> superIdentityRecordKey,
required final Typed<FixedEncodedString43> identitySecret,
required final AccountRecordInfo accountRecordInfo,
required final Timestamp lastActive}) = _$UserLoginImpl;
/// @nodoc
abstract mixin class $UserLoginCopyWith<$Res> {
factory $UserLoginCopyWith(UserLogin value, $Res Function(UserLogin) _then) =
_$UserLoginCopyWithImpl;
@useResult
$Res call(
{Typed<FixedEncodedString43> superIdentityRecordKey,
Typed<FixedEncodedString43> identitySecret,
AccountRecordInfo accountRecordInfo,
Timestamp lastActive});
factory _UserLogin.fromJson(Map<String, dynamic> json) =
_$UserLoginImpl.fromJson;
$AccountRecordInfoCopyWith<$Res> get accountRecordInfo;
}
/// @nodoc
class _$UserLoginCopyWithImpl<$Res> implements $UserLoginCopyWith<$Res> {
_$UserLoginCopyWithImpl(this._self, this._then);
final UserLogin _self;
final $Res Function(UserLogin) _then;
/// Create a copy of UserLogin
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? superIdentityRecordKey = null,
Object? identitySecret = null,
Object? accountRecordInfo = null,
Object? lastActive = null,
}) {
return _then(_self.copyWith(
superIdentityRecordKey: null == superIdentityRecordKey
? _self.superIdentityRecordKey!
: superIdentityRecordKey // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>,
identitySecret: null == identitySecret
? _self.identitySecret!
: identitySecret // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>,
accountRecordInfo: null == accountRecordInfo
? _self.accountRecordInfo
: accountRecordInfo // ignore: cast_nullable_to_non_nullable
as AccountRecordInfo,
lastActive: null == lastActive
? _self.lastActive
: lastActive // ignore: cast_nullable_to_non_nullable
as Timestamp,
));
}
/// Create a copy of UserLogin
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AccountRecordInfoCopyWith<$Res> get accountRecordInfo {
return $AccountRecordInfoCopyWith<$Res>(_self.accountRecordInfo, (value) {
return _then(_self.copyWith(accountRecordInfo: value));
});
}
}
/// @nodoc
@JsonSerializable()
class _UserLogin implements UserLogin {
const _UserLogin(
{required this.superIdentityRecordKey,
required this.identitySecret,
required this.accountRecordInfo,
required this.lastActive});
factory _UserLogin.fromJson(Map<String, dynamic> json) =>
_$UserLoginFromJson(json);
// SuperIdentity record key for the user
// used to index the local accounts table
@override
Typed<FixedEncodedString43>
get superIdentityRecordKey; // The identity secret as unlocked from the local accounts table
final Typed<FixedEncodedString43> superIdentityRecordKey;
// The identity secret as unlocked from the local accounts table
@override
Typed<FixedEncodedString43>
get identitySecret; // The account record key, owner key and secret pulled from the identity
final Typed<FixedEncodedString43> identitySecret;
// The account record key, owner key and secret pulled from the identity
@override
AccountRecordInfo
get accountRecordInfo; // The time this login was most recently used
final AccountRecordInfo accountRecordInfo;
// The time this login was most recently used
@override
Timestamp get lastActive;
final Timestamp lastActive;
/// Create a copy of UserLogin
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$UserLoginImplCopyWith<_$UserLoginImpl> get copyWith =>
throw _privateConstructorUsedError;
@pragma('vm:prefer-inline')
_$UserLoginCopyWith<_UserLogin> get copyWith =>
__$UserLoginCopyWithImpl<_UserLogin>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$UserLoginToJson(
this,
);
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _UserLogin &&
(identical(other.superIdentityRecordKey, superIdentityRecordKey) ||
other.superIdentityRecordKey == superIdentityRecordKey) &&
(identical(other.identitySecret, identitySecret) ||
other.identitySecret == identitySecret) &&
(identical(other.accountRecordInfo, accountRecordInfo) ||
other.accountRecordInfo == accountRecordInfo) &&
(identical(other.lastActive, lastActive) ||
other.lastActive == lastActive));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, superIdentityRecordKey,
identitySecret, accountRecordInfo, lastActive);
@override
String toString() {
return 'UserLogin(superIdentityRecordKey: $superIdentityRecordKey, identitySecret: $identitySecret, accountRecordInfo: $accountRecordInfo, lastActive: $lastActive)';
}
}
/// @nodoc
abstract mixin class _$UserLoginCopyWith<$Res>
implements $UserLoginCopyWith<$Res> {
factory _$UserLoginCopyWith(
_UserLogin value, $Res Function(_UserLogin) _then) =
__$UserLoginCopyWithImpl;
@override
@useResult
$Res call(
{Typed<FixedEncodedString43> superIdentityRecordKey,
Typed<FixedEncodedString43> identitySecret,
AccountRecordInfo accountRecordInfo,
Timestamp lastActive});
@override
$AccountRecordInfoCopyWith<$Res> get accountRecordInfo;
}
/// @nodoc
class __$UserLoginCopyWithImpl<$Res> implements _$UserLoginCopyWith<$Res> {
__$UserLoginCopyWithImpl(this._self, this._then);
final _UserLogin _self;
final $Res Function(_UserLogin) _then;
/// Create a copy of UserLogin
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$Res call({
Object? superIdentityRecordKey = null,
Object? identitySecret = null,
Object? accountRecordInfo = null,
Object? lastActive = null,
}) {
return _then(_UserLogin(
superIdentityRecordKey: null == superIdentityRecordKey
? _self.superIdentityRecordKey
: superIdentityRecordKey // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>,
identitySecret: null == identitySecret
? _self.identitySecret
: identitySecret // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>,
accountRecordInfo: null == accountRecordInfo
? _self.accountRecordInfo
: accountRecordInfo // ignore: cast_nullable_to_non_nullable
as AccountRecordInfo,
lastActive: null == lastActive
? _self.lastActive
: lastActive // ignore: cast_nullable_to_non_nullable
as Timestamp,
));
}
/// Create a copy of UserLogin
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AccountRecordInfoCopyWith<$Res> get accountRecordInfo {
return $AccountRecordInfoCopyWith<$Res>(_self.accountRecordInfo, (value) {
return _then(_self.copyWith(accountRecordInfo: value));
});
}
}
// dart format on

View file

@ -6,8 +6,7 @@ part of 'user_login.dart';
// JsonSerializableGenerator
// **************************************************************************
_$UserLoginImpl _$$UserLoginImplFromJson(Map<String, dynamic> json) =>
_$UserLoginImpl(
_UserLogin _$UserLoginFromJson(Map<String, dynamic> json) => _UserLogin(
superIdentityRecordKey: Typed<FixedEncodedString43>.fromJson(
json['super_identity_record_key']),
identitySecret:
@ -17,7 +16,7 @@ _$UserLoginImpl _$$UserLoginImplFromJson(Map<String, dynamic> json) =>
lastActive: Timestamp.fromJson(json['last_active']),
);
Map<String, dynamic> _$$UserLoginImplToJson(_$UserLoginImpl instance) =>
Map<String, dynamic> _$UserLoginToJson(_UserLogin instance) =>
<String, dynamic>{
'super_identity_record_key': instance.superIdentityRecordKey.toJson(),
'identity_secret': instance.identitySecret.toJson(),

View file

@ -61,6 +61,13 @@ class _EditAccountPageState extends WindowSetupState<EditAccountPage> {
);
Future<void> _onRemoveAccount() async {
// dismiss the keyboard by unfocusing the textfield
FocusScope.of(context).unfocus();
await asyncSleep(const Duration(milliseconds: 250));
if (!mounted) {
return;
}
final confirmed = await StyledDialog.show<bool>(
context: context,
title: translate('edit_account_page.remove_account_confirm'),
@ -87,10 +94,7 @@ class _EditAccountPageState extends WindowSetupState<EditAccountPage> {
]))
]).paddingAll(24)
]));
if (confirmed != null && confirmed && mounted) {
// dismiss the keyboard by unfocusing the textfield
FocusScope.of(context).unfocus();
if (confirmed != null && confirmed) {
try {
setState(() {
_isInAsyncCall = true;
@ -125,6 +129,13 @@ class _EditAccountPageState extends WindowSetupState<EditAccountPage> {
}
Future<void> _onDestroyAccount() async {
// dismiss the keyboard by unfocusing the textfield
FocusScope.of(context).unfocus();
await asyncSleep(const Duration(milliseconds: 250));
if (!mounted) {
return;
}
final confirmed = await StyledDialog.show<bool>(
context: context,
title: translate('edit_account_page.destroy_account_confirm'),
@ -154,10 +165,7 @@ class _EditAccountPageState extends WindowSetupState<EditAccountPage> {
]))
]).paddingAll(24)
]));
if (confirmed != null && confirmed && mounted) {
// dismiss the keyboard by unfocusing the textfield
FocusScope.of(context).unfocus();
if (confirmed != null && confirmed) {
try {
setState(() {
_isInAsyncCall = true;

View file

@ -282,9 +282,6 @@ class _EditProfileFormState extends State<EditProfileForm> {
FormBuilderCheckbox(
name: EditProfileForm.formFieldAutoAway,
initialValue: _savedValue.autoAway,
side: BorderSide(color: scale.primaryScale.border, width: 2),
checkColor: scale.primaryScale.borderText,
activeColor: scale.primaryScale.border,
title: Text(translate('account.form_auto_away'),
style: textTheme.labelMedium),
onChanged: (v) {

View file

@ -43,7 +43,7 @@ class ProfileWidget extends StatelessWidget {
: scale.primaryScale.borderText,
width: 2),
borderRadius: BorderRadius.all(
Radius.circular(12 * scaleConfig.borderRadiusScale))),
Radius.circular(8 * scaleConfig.borderRadiusScale))),
),
child: Row(children: [
const Spacer(),
@ -54,7 +54,7 @@ class ProfileWidget extends StatelessWidget {
? scale.primaryScale.border
: scale.primaryScale.borderText),
textAlign: TextAlign.left,
).paddingAll(12),
).paddingAll(8),
if (_profile.pronouns.isNotEmpty && _showPronouns)
Text('(${_profile.pronouns})',
textAlign: TextAlign.right,
@ -62,7 +62,7 @@ class ProfileWidget extends StatelessWidget {
color: scaleConfig.preferBorders
? scale.primaryScale.border
: scale.primaryScale.primary))
.paddingAll(12),
.paddingAll(8),
const Spacer()
]),
);

View file

@ -1,15 +1,12 @@
import 'package:animated_theme_switcher/animated_theme_switcher.dart';
import 'package:async_tools/async_tools.dart';
import 'package:fast_immutable_collections/fast_immutable_collections.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_translate/flutter_translate.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:provider/provider.dart';
import 'package:veilid_support/veilid_support.dart';
import 'account_manager/account_manager.dart';
import 'init.dart';
@ -19,17 +16,8 @@ import 'router/router.dart';
import 'settings/settings.dart';
import 'theme/theme.dart';
import 'tick.dart';
import 'tools/loggy.dart';
import 'veilid_processor/veilid_processor.dart';
class ReloadThemeIntent extends Intent {
const ReloadThemeIntent();
}
class AttachDetachIntent extends Intent {
const AttachDetachIntent();
}
class ScrollBehaviorModified extends ScrollBehavior {
const ScrollBehaviorModified();
@override
@ -47,59 +35,6 @@ class VeilidChatApp extends StatelessWidget {
final ThemeData initialThemeData;
void _reloadTheme(BuildContext context) {
singleFuture(this, () async {
log.info('Reloading theme');
await VeilidChatGlobalInit.loadAssetManifest();
final theme =
PreferencesRepository.instance.value.themePreference.themeData();
if (context.mounted) {
ThemeSwitcher.of(context).changeTheme(theme: theme);
// Hack to reload translations
final localizationDelegate = LocalizedApp.of(context).delegate;
await LocalizationDelegate.create(
fallbackLocale: localizationDelegate.fallbackLocale.toString(),
supportedLocales: localizationDelegate.supportedLocales
.map((x) => x.toString())
.toList());
}
});
}
void _attachDetach(BuildContext context) {
singleFuture(this, () async {
if (ProcessorRepository.instance.processorConnectionState.isAttached) {
log.info('Detaching');
await Veilid.instance.detach();
} else if (ProcessorRepository
.instance.processorConnectionState.isDetached) {
log.info('Attaching');
await Veilid.instance.attach();
}
});
}
Widget _buildShortcuts({required Widget Function(BuildContext) builder}) =>
ThemeSwitcher(
builder: (context) => Shortcuts(
shortcuts: <LogicalKeySet, Intent>{
LogicalKeySet(
LogicalKeyboardKey.alt, LogicalKeyboardKey.keyR):
const ReloadThemeIntent(),
LogicalKeySet(
LogicalKeyboardKey.alt, LogicalKeyboardKey.keyD):
const AttachDetachIntent(),
},
child: Actions(actions: <Type, Action<Intent>>{
ReloadThemeIntent: CallbackAction<ReloadThemeIntent>(
onInvoke: (intent) => _reloadTheme(context)),
AttachDetachIntent: CallbackAction<AttachDetachIntent>(
onInvoke: (intent) => _attachDetach(context)),
}, child: Focus(autofocus: true, child: builder(context)))));
Widget appBuilder(
BuildContext context, LocalizationDelegate localizationDelegate) =>
ThemeProvider(
@ -138,8 +73,7 @@ class VeilidChatApp extends StatelessWidget {
accountRepository: AccountRepository.instance,
locator: context.read)),
],
child:
BackgroundTicker(child: _buildShortcuts(builder: (context) {
child: BackgroundTicker(child: Builder(builder: (context) {
final scale = theme.extension<ScaleScheme>()!;
final scaleConfig = theme.extension<ScaleConfig>()!;

View file

@ -2,7 +2,6 @@ import 'dart:async';
import 'dart:typed_data';
import 'package:async_tools/async_tools.dart';
import 'package:bloc_advanced_tools/bloc_advanced_tools.dart';
import 'package:fast_immutable_collections/fast_immutable_collections.dart';
import 'package:fixnum/fixnum.dart';
import 'package:flutter/widgets.dart';
@ -184,9 +183,7 @@ class ChatComponentCubit extends Cubit<ChatComponentState> {
emit(_convertMessages(state, avMessagesState));
}
void _onChangedContacts(
BlocBusyState<AsyncValue<IList<DHTShortArrayElementState<proto.Contact>>>>
bavContacts) {
void _onChangedContacts(DHTShortArrayCubitState<proto.Contact> bavContacts) {
// Rewrite users when contacts change
singleFuture((this, _sfChangedContacts), _updateConversationSubscriptions);
}
@ -353,6 +350,7 @@ class ChatComponentCubit extends Cubit<ChatComponentState> {
case proto.Message_Kind.membership:
case proto.Message_Kind.moderation:
case proto.Message_Kind.notSet:
case proto.Message_Kind.readReceipt:
return (currentState, null);
}
}
@ -440,9 +438,7 @@ class ChatComponentCubit extends Cubit<ChatComponentState> {
final Map<TypedKey, StreamSubscription<AsyncValue<ActiveConversationState>>>
_conversationSubscriptions = {};
late StreamSubscription<SingleContactMessagesState> _messagesSubscription;
late StreamSubscription<
BlocBusyState<
AsyncValue<IList<DHTShortArrayElementState<proto.Contact>>>>>
late StreamSubscription<DHTShortArrayCubitState<proto.Contact>>
_contactListSubscription;
double scrollOffset = 0;
}

View file

@ -13,7 +13,7 @@ import 'window_state.dart';
part 'chat_component_state.freezed.dart';
@freezed
class ChatComponentState with _$ChatComponentState {
sealed class ChatComponentState with _$ChatComponentState {
const factory ChatComponentState(
{
// GlobalKey for the chat

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
@ -9,44 +10,78 @@ part of 'chat_component_state.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$ChatComponentState {
// GlobalKey for the chat
GlobalKey<ChatState> get chatKey =>
throw _privateConstructorUsedError; // ScrollController for the chat
AutoScrollController get scrollController =>
throw _privateConstructorUsedError; // TextEditingController for the chat
InputTextFieldController get textEditingController =>
throw _privateConstructorUsedError; // Local user
User? get localUser =>
throw _privateConstructorUsedError; // Active remote users
IMap<Typed<FixedEncodedString43>, User> get remoteUsers =>
throw _privateConstructorUsedError; // Historical remote users
IMap<Typed<FixedEncodedString43>, User> get historicalRemoteUsers =>
throw _privateConstructorUsedError; // Unknown users
IMap<Typed<FixedEncodedString43>, User> get unknownUsers =>
throw _privateConstructorUsedError; // Messages state
AsyncValue<WindowState<Message>> get messageWindow =>
throw _privateConstructorUsedError; // Title of the chat
String get title => throw _privateConstructorUsedError;
GlobalKey<ChatState> get chatKey; // ScrollController for the chat
AutoScrollController
get scrollController; // TextEditingController for the chat
InputTextFieldController get textEditingController; // Local user
User? get localUser; // Active remote users
IMap<TypedKey, User> get remoteUsers; // Historical remote users
IMap<TypedKey, User> get historicalRemoteUsers; // Unknown users
IMap<TypedKey, User> get unknownUsers; // Messages state
AsyncValue<WindowState<Message>> get messageWindow; // Title of the chat
String get title;
/// Create a copy of ChatComponentState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$ChatComponentStateCopyWith<ChatComponentState> get copyWith =>
throw _privateConstructorUsedError;
_$ChatComponentStateCopyWithImpl<ChatComponentState>(
this as ChatComponentState, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is ChatComponentState &&
(identical(other.chatKey, chatKey) || other.chatKey == chatKey) &&
(identical(other.scrollController, scrollController) ||
other.scrollController == scrollController) &&
(identical(other.textEditingController, textEditingController) ||
other.textEditingController == textEditingController) &&
(identical(other.localUser, localUser) ||
other.localUser == localUser) &&
(identical(other.remoteUsers, remoteUsers) ||
other.remoteUsers == remoteUsers) &&
(identical(other.historicalRemoteUsers, historicalRemoteUsers) ||
other.historicalRemoteUsers == historicalRemoteUsers) &&
(identical(other.unknownUsers, unknownUsers) ||
other.unknownUsers == unknownUsers) &&
(identical(other.messageWindow, messageWindow) ||
other.messageWindow == messageWindow) &&
(identical(other.title, title) || other.title == title));
}
@override
int get hashCode => Object.hash(
runtimeType,
chatKey,
scrollController,
textEditingController,
localUser,
remoteUsers,
historicalRemoteUsers,
unknownUsers,
messageWindow,
title);
@override
String toString() {
return 'ChatComponentState(chatKey: $chatKey, scrollController: $scrollController, textEditingController: $textEditingController, localUser: $localUser, remoteUsers: $remoteUsers, historicalRemoteUsers: $historicalRemoteUsers, unknownUsers: $unknownUsers, messageWindow: $messageWindow, title: $title)';
}
}
/// @nodoc
abstract class $ChatComponentStateCopyWith<$Res> {
abstract mixin class $ChatComponentStateCopyWith<$Res> {
factory $ChatComponentStateCopyWith(
ChatComponentState value, $Res Function(ChatComponentState) then) =
_$ChatComponentStateCopyWithImpl<$Res, ChatComponentState>;
ChatComponentState value, $Res Function(ChatComponentState) _then) =
_$ChatComponentStateCopyWithImpl;
@useResult
$Res call(
{GlobalKey<ChatState> chatKey,
@ -63,14 +98,12 @@ abstract class $ChatComponentStateCopyWith<$Res> {
}
/// @nodoc
class _$ChatComponentStateCopyWithImpl<$Res, $Val extends ChatComponentState>
class _$ChatComponentStateCopyWithImpl<$Res>
implements $ChatComponentStateCopyWith<$Res> {
_$ChatComponentStateCopyWithImpl(this._value, this._then);
_$ChatComponentStateCopyWithImpl(this._self, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
final ChatComponentState _self;
final $Res Function(ChatComponentState) _then;
/// Create a copy of ChatComponentState
/// with the given fields replaced by the non-null parameter values.
@ -87,44 +120,44 @@ class _$ChatComponentStateCopyWithImpl<$Res, $Val extends ChatComponentState>
Object? messageWindow = null,
Object? title = null,
}) {
return _then(_value.copyWith(
return _then(_self.copyWith(
chatKey: null == chatKey
? _value.chatKey
? _self.chatKey
: chatKey // ignore: cast_nullable_to_non_nullable
as GlobalKey<ChatState>,
scrollController: null == scrollController
? _value.scrollController
? _self.scrollController
: scrollController // ignore: cast_nullable_to_non_nullable
as AutoScrollController,
textEditingController: null == textEditingController
? _value.textEditingController
? _self.textEditingController
: textEditingController // ignore: cast_nullable_to_non_nullable
as InputTextFieldController,
localUser: freezed == localUser
? _value.localUser
? _self.localUser
: localUser // ignore: cast_nullable_to_non_nullable
as User?,
remoteUsers: null == remoteUsers
? _value.remoteUsers
? _self.remoteUsers!
: remoteUsers // ignore: cast_nullable_to_non_nullable
as IMap<Typed<FixedEncodedString43>, User>,
historicalRemoteUsers: null == historicalRemoteUsers
? _value.historicalRemoteUsers
? _self.historicalRemoteUsers!
: historicalRemoteUsers // ignore: cast_nullable_to_non_nullable
as IMap<Typed<FixedEncodedString43>, User>,
unknownUsers: null == unknownUsers
? _value.unknownUsers
? _self.unknownUsers!
: unknownUsers // ignore: cast_nullable_to_non_nullable
as IMap<Typed<FixedEncodedString43>, User>,
messageWindow: null == messageWindow
? _value.messageWindow
? _self.messageWindow
: messageWindow // ignore: cast_nullable_to_non_nullable
as AsyncValue<WindowState<Message>>,
title: null == title
? _value.title
? _self.title
: title // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
));
}
/// Create a copy of ChatComponentState
@ -132,104 +165,17 @@ class _$ChatComponentStateCopyWithImpl<$Res, $Val extends ChatComponentState>
@override
@pragma('vm:prefer-inline')
$AsyncValueCopyWith<WindowState<Message>, $Res> get messageWindow {
return $AsyncValueCopyWith<WindowState<Message>, $Res>(_value.messageWindow,
return $AsyncValueCopyWith<WindowState<Message>, $Res>(_self.messageWindow,
(value) {
return _then(_value.copyWith(messageWindow: value) as $Val);
return _then(_self.copyWith(messageWindow: value));
});
}
}
/// @nodoc
abstract class _$$ChatComponentStateImplCopyWith<$Res>
implements $ChatComponentStateCopyWith<$Res> {
factory _$$ChatComponentStateImplCopyWith(_$ChatComponentStateImpl value,
$Res Function(_$ChatComponentStateImpl) then) =
__$$ChatComponentStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{GlobalKey<ChatState> chatKey,
AutoScrollController scrollController,
InputTextFieldController textEditingController,
User? localUser,
IMap<Typed<FixedEncodedString43>, User> remoteUsers,
IMap<Typed<FixedEncodedString43>, User> historicalRemoteUsers,
IMap<Typed<FixedEncodedString43>, User> unknownUsers,
AsyncValue<WindowState<Message>> messageWindow,
String title});
@override
$AsyncValueCopyWith<WindowState<Message>, $Res> get messageWindow;
}
/// @nodoc
class __$$ChatComponentStateImplCopyWithImpl<$Res>
extends _$ChatComponentStateCopyWithImpl<$Res, _$ChatComponentStateImpl>
implements _$$ChatComponentStateImplCopyWith<$Res> {
__$$ChatComponentStateImplCopyWithImpl(_$ChatComponentStateImpl _value,
$Res Function(_$ChatComponentStateImpl) _then)
: super(_value, _then);
/// Create a copy of ChatComponentState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? chatKey = null,
Object? scrollController = null,
Object? textEditingController = null,
Object? localUser = freezed,
Object? remoteUsers = null,
Object? historicalRemoteUsers = null,
Object? unknownUsers = null,
Object? messageWindow = null,
Object? title = null,
}) {
return _then(_$ChatComponentStateImpl(
chatKey: null == chatKey
? _value.chatKey
: chatKey // ignore: cast_nullable_to_non_nullable
as GlobalKey<ChatState>,
scrollController: null == scrollController
? _value.scrollController
: scrollController // ignore: cast_nullable_to_non_nullable
as AutoScrollController,
textEditingController: null == textEditingController
? _value.textEditingController
: textEditingController // ignore: cast_nullable_to_non_nullable
as InputTextFieldController,
localUser: freezed == localUser
? _value.localUser
: localUser // ignore: cast_nullable_to_non_nullable
as User?,
remoteUsers: null == remoteUsers
? _value.remoteUsers
: remoteUsers // ignore: cast_nullable_to_non_nullable
as IMap<Typed<FixedEncodedString43>, User>,
historicalRemoteUsers: null == historicalRemoteUsers
? _value.historicalRemoteUsers
: historicalRemoteUsers // ignore: cast_nullable_to_non_nullable
as IMap<Typed<FixedEncodedString43>, User>,
unknownUsers: null == unknownUsers
? _value.unknownUsers
: unknownUsers // ignore: cast_nullable_to_non_nullable
as IMap<Typed<FixedEncodedString43>, User>,
messageWindow: null == messageWindow
? _value.messageWindow
: messageWindow // ignore: cast_nullable_to_non_nullable
as AsyncValue<WindowState<Message>>,
title: null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
class _$ChatComponentStateImpl implements _ChatComponentState {
const _$ChatComponentStateImpl(
class _ChatComponentState implements ChatComponentState {
const _ChatComponentState(
{required this.chatKey,
required this.scrollController,
required this.textEditingController,
@ -268,16 +214,19 @@ class _$ChatComponentStateImpl implements _ChatComponentState {
@override
final String title;
/// Create a copy of ChatComponentState
/// with the given fields replaced by the non-null parameter values.
@override
String toString() {
return 'ChatComponentState(chatKey: $chatKey, scrollController: $scrollController, textEditingController: $textEditingController, localUser: $localUser, remoteUsers: $remoteUsers, historicalRemoteUsers: $historicalRemoteUsers, unknownUsers: $unknownUsers, messageWindow: $messageWindow, title: $title)';
}
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$ChatComponentStateCopyWith<_ChatComponentState> get copyWith =>
__$ChatComponentStateCopyWithImpl<_ChatComponentState>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ChatComponentStateImpl &&
other is _ChatComponentState &&
(identical(other.chatKey, chatKey) || other.chatKey == chatKey) &&
(identical(other.scrollController, scrollController) ||
other.scrollController == scrollController) &&
@ -309,56 +258,108 @@ class _$ChatComponentStateImpl implements _ChatComponentState {
messageWindow,
title);
@override
String toString() {
return 'ChatComponentState(chatKey: $chatKey, scrollController: $scrollController, textEditingController: $textEditingController, localUser: $localUser, remoteUsers: $remoteUsers, historicalRemoteUsers: $historicalRemoteUsers, unknownUsers: $unknownUsers, messageWindow: $messageWindow, title: $title)';
}
}
/// @nodoc
abstract mixin class _$ChatComponentStateCopyWith<$Res>
implements $ChatComponentStateCopyWith<$Res> {
factory _$ChatComponentStateCopyWith(
_ChatComponentState value, $Res Function(_ChatComponentState) _then) =
__$ChatComponentStateCopyWithImpl;
@override
@useResult
$Res call(
{GlobalKey<ChatState> chatKey,
AutoScrollController scrollController,
InputTextFieldController textEditingController,
User? localUser,
IMap<Typed<FixedEncodedString43>, User> remoteUsers,
IMap<Typed<FixedEncodedString43>, User> historicalRemoteUsers,
IMap<Typed<FixedEncodedString43>, User> unknownUsers,
AsyncValue<WindowState<Message>> messageWindow,
String title});
@override
$AsyncValueCopyWith<WindowState<Message>, $Res> get messageWindow;
}
/// @nodoc
class __$ChatComponentStateCopyWithImpl<$Res>
implements _$ChatComponentStateCopyWith<$Res> {
__$ChatComponentStateCopyWithImpl(this._self, this._then);
final _ChatComponentState _self;
final $Res Function(_ChatComponentState) _then;
/// Create a copy of ChatComponentState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ChatComponentStateImplCopyWith<_$ChatComponentStateImpl> get copyWith =>
__$$ChatComponentStateImplCopyWithImpl<_$ChatComponentStateImpl>(
this, _$identity);
}
abstract class _ChatComponentState implements ChatComponentState {
const factory _ChatComponentState(
{required final GlobalKey<ChatState> chatKey,
required final AutoScrollController scrollController,
required final InputTextFieldController textEditingController,
required final User? localUser,
required final IMap<Typed<FixedEncodedString43>, User> remoteUsers,
required final IMap<Typed<FixedEncodedString43>, User>
historicalRemoteUsers,
required final IMap<Typed<FixedEncodedString43>, User> unknownUsers,
required final AsyncValue<WindowState<Message>> messageWindow,
required final String title}) = _$ChatComponentStateImpl;
// GlobalKey for the chat
@override
GlobalKey<ChatState> get chatKey; // ScrollController for the chat
@override
AutoScrollController
get scrollController; // TextEditingController for the chat
@override
InputTextFieldController get textEditingController; // Local user
@override
User? get localUser; // Active remote users
@override
IMap<Typed<FixedEncodedString43>, User>
get remoteUsers; // Historical remote users
@override
IMap<Typed<FixedEncodedString43>, User>
get historicalRemoteUsers; // Unknown users
@override
IMap<Typed<FixedEncodedString43>, User> get unknownUsers; // Messages state
@override
AsyncValue<WindowState<Message>> get messageWindow; // Title of the chat
@override
String get title;
$Res call({
Object? chatKey = null,
Object? scrollController = null,
Object? textEditingController = null,
Object? localUser = freezed,
Object? remoteUsers = null,
Object? historicalRemoteUsers = null,
Object? unknownUsers = null,
Object? messageWindow = null,
Object? title = null,
}) {
return _then(_ChatComponentState(
chatKey: null == chatKey
? _self.chatKey
: chatKey // ignore: cast_nullable_to_non_nullable
as GlobalKey<ChatState>,
scrollController: null == scrollController
? _self.scrollController
: scrollController // ignore: cast_nullable_to_non_nullable
as AutoScrollController,
textEditingController: null == textEditingController
? _self.textEditingController
: textEditingController // ignore: cast_nullable_to_non_nullable
as InputTextFieldController,
localUser: freezed == localUser
? _self.localUser
: localUser // ignore: cast_nullable_to_non_nullable
as User?,
remoteUsers: null == remoteUsers
? _self.remoteUsers
: remoteUsers // ignore: cast_nullable_to_non_nullable
as IMap<Typed<FixedEncodedString43>, User>,
historicalRemoteUsers: null == historicalRemoteUsers
? _self.historicalRemoteUsers
: historicalRemoteUsers // ignore: cast_nullable_to_non_nullable
as IMap<Typed<FixedEncodedString43>, User>,
unknownUsers: null == unknownUsers
? _self.unknownUsers
: unknownUsers // ignore: cast_nullable_to_non_nullable
as IMap<Typed<FixedEncodedString43>, User>,
messageWindow: null == messageWindow
? _self.messageWindow
: messageWindow // ignore: cast_nullable_to_non_nullable
as AsyncValue<WindowState<Message>>,
title: null == title
? _self.title
: title // ignore: cast_nullable_to_non_nullable
as String,
));
}
/// Create a copy of ChatComponentState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ChatComponentStateImplCopyWith<_$ChatComponentStateImpl> get copyWith =>
throw _privateConstructorUsedError;
@pragma('vm:prefer-inline')
$AsyncValueCopyWith<WindowState<Message>, $Res> get messageWindow {
return $AsyncValueCopyWith<WindowState<Message>, $Res>(_self.messageWindow,
(value) {
return _then(_self.copyWith(messageWindow: value));
});
}
}
// dart format on

View file

@ -24,7 +24,7 @@ enum MessageSendState {
}
@freezed
class MessageState with _$MessageState {
sealed class MessageState with _$MessageState {
const factory MessageState({
// Content of the message
@JsonKey(fromJson: messageFromJson, toJson: messageToJson)

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
@ -9,99 +10,69 @@ part of 'message_state.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
MessageState _$MessageStateFromJson(Map<String, dynamic> json) {
return _MessageState.fromJson(json);
}
/// @nodoc
mixin _$MessageState {
mixin _$MessageState implements DiagnosticableTreeMixin {
// Content of the message
@JsonKey(fromJson: messageFromJson, toJson: messageToJson)
proto.Message get content =>
throw _privateConstructorUsedError; // Sent timestamp
Timestamp get sentTimestamp =>
throw _privateConstructorUsedError; // Reconciled timestamp
Timestamp? get reconciledTimestamp =>
throw _privateConstructorUsedError; // The state of the message
MessageSendState? get sendState => throw _privateConstructorUsedError;
/// Serializes this MessageState to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
proto.Message get content; // Sent timestamp
Timestamp get sentTimestamp; // Reconciled timestamp
Timestamp? get reconciledTimestamp; // The state of the message
MessageSendState? get sendState;
/// Create a copy of MessageState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$MessageStateCopyWith<MessageState> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $MessageStateCopyWith<$Res> {
factory $MessageStateCopyWith(
MessageState value, $Res Function(MessageState) then) =
_$MessageStateCopyWithImpl<$Res, MessageState>;
@useResult
$Res call(
{@JsonKey(fromJson: messageFromJson, toJson: messageToJson)
proto.Message content,
Timestamp sentTimestamp,
Timestamp? reconciledTimestamp,
MessageSendState? sendState});
}
/// @nodoc
class _$MessageStateCopyWithImpl<$Res, $Val extends MessageState>
implements $MessageStateCopyWith<$Res> {
_$MessageStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of MessageState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
$MessageStateCopyWith<MessageState> get copyWith =>
_$MessageStateCopyWithImpl<MessageState>(
this as MessageState, _$identity);
/// Serializes this MessageState to a JSON map.
Map<String, dynamic> toJson();
@override
$Res call({
Object? content = null,
Object? sentTimestamp = null,
Object? reconciledTimestamp = freezed,
Object? sendState = freezed,
}) {
return _then(_value.copyWith(
content: null == content
? _value.content
: content // ignore: cast_nullable_to_non_nullable
as proto.Message,
sentTimestamp: null == sentTimestamp
? _value.sentTimestamp
: sentTimestamp // ignore: cast_nullable_to_non_nullable
as Timestamp,
reconciledTimestamp: freezed == reconciledTimestamp
? _value.reconciledTimestamp
: reconciledTimestamp // ignore: cast_nullable_to_non_nullable
as Timestamp?,
sendState: freezed == sendState
? _value.sendState
: sendState // ignore: cast_nullable_to_non_nullable
as MessageSendState?,
) as $Val);
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
properties
..add(DiagnosticsProperty('type', 'MessageState'))
..add(DiagnosticsProperty('content', content))
..add(DiagnosticsProperty('sentTimestamp', sentTimestamp))
..add(DiagnosticsProperty('reconciledTimestamp', reconciledTimestamp))
..add(DiagnosticsProperty('sendState', sendState));
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is MessageState &&
(identical(other.content, content) || other.content == content) &&
(identical(other.sentTimestamp, sentTimestamp) ||
other.sentTimestamp == sentTimestamp) &&
(identical(other.reconciledTimestamp, reconciledTimestamp) ||
other.reconciledTimestamp == reconciledTimestamp) &&
(identical(other.sendState, sendState) ||
other.sendState == sendState));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, content, sentTimestamp, reconciledTimestamp, sendState);
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'MessageState(content: $content, sentTimestamp: $sentTimestamp, reconciledTimestamp: $reconciledTimestamp, sendState: $sendState)';
}
}
/// @nodoc
abstract class _$$MessageStateImplCopyWith<$Res>
implements $MessageStateCopyWith<$Res> {
factory _$$MessageStateImplCopyWith(
_$MessageStateImpl value, $Res Function(_$MessageStateImpl) then) =
__$$MessageStateImplCopyWithImpl<$Res>;
@override
abstract mixin class $MessageStateCopyWith<$Res> {
factory $MessageStateCopyWith(
MessageState value, $Res Function(MessageState) _then) =
_$MessageStateCopyWithImpl;
@useResult
$Res call(
{@JsonKey(fromJson: messageFromJson, toJson: messageToJson)
@ -112,12 +83,11 @@ abstract class _$$MessageStateImplCopyWith<$Res>
}
/// @nodoc
class __$$MessageStateImplCopyWithImpl<$Res>
extends _$MessageStateCopyWithImpl<$Res, _$MessageStateImpl>
implements _$$MessageStateImplCopyWith<$Res> {
__$$MessageStateImplCopyWithImpl(
_$MessageStateImpl _value, $Res Function(_$MessageStateImpl) _then)
: super(_value, _then);
class _$MessageStateCopyWithImpl<$Res> implements $MessageStateCopyWith<$Res> {
_$MessageStateCopyWithImpl(this._self, this._then);
final MessageState _self;
final $Res Function(MessageState) _then;
/// Create a copy of MessageState
/// with the given fields replaced by the non-null parameter values.
@ -129,21 +99,21 @@ class __$$MessageStateImplCopyWithImpl<$Res>
Object? reconciledTimestamp = freezed,
Object? sendState = freezed,
}) {
return _then(_$MessageStateImpl(
return _then(_self.copyWith(
content: null == content
? _value.content
? _self.content
: content // ignore: cast_nullable_to_non_nullable
as proto.Message,
sentTimestamp: null == sentTimestamp
? _value.sentTimestamp
? _self.sentTimestamp
: sentTimestamp // ignore: cast_nullable_to_non_nullable
as Timestamp,
reconciledTimestamp: freezed == reconciledTimestamp
? _value.reconciledTimestamp
? _self.reconciledTimestamp
: reconciledTimestamp // ignore: cast_nullable_to_non_nullable
as Timestamp?,
sendState: freezed == sendState
? _value.sendState
? _self.sendState
: sendState // ignore: cast_nullable_to_non_nullable
as MessageSendState?,
));
@ -152,16 +122,15 @@ class __$$MessageStateImplCopyWithImpl<$Res>
/// @nodoc
@JsonSerializable()
class _$MessageStateImpl with DiagnosticableTreeMixin implements _MessageState {
const _$MessageStateImpl(
class _MessageState with DiagnosticableTreeMixin implements MessageState {
const _MessageState(
{@JsonKey(fromJson: messageFromJson, toJson: messageToJson)
required this.content,
required this.sentTimestamp,
required this.reconciledTimestamp,
required this.sendState});
factory _$MessageStateImpl.fromJson(Map<String, dynamic> json) =>
_$$MessageStateImplFromJson(json);
factory _MessageState.fromJson(Map<String, dynamic> json) =>
_$MessageStateFromJson(json);
// Content of the message
@override
@ -177,14 +146,23 @@ class _$MessageStateImpl with DiagnosticableTreeMixin implements _MessageState {
@override
final MessageSendState? sendState;
/// Create a copy of MessageState
/// with the given fields replaced by the non-null parameter values.
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'MessageState(content: $content, sentTimestamp: $sentTimestamp, reconciledTimestamp: $reconciledTimestamp, sendState: $sendState)';
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$MessageStateCopyWith<_MessageState> get copyWith =>
__$MessageStateCopyWithImpl<_MessageState>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$MessageStateToJson(
this,
);
}
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties
..add(DiagnosticsProperty('type', 'MessageState'))
..add(DiagnosticsProperty('content', content))
@ -197,7 +175,7 @@ class _$MessageStateImpl with DiagnosticableTreeMixin implements _MessageState {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$MessageStateImpl &&
other is _MessageState &&
(identical(other.content, content) || other.content == content) &&
(identical(other.sentTimestamp, sentTimestamp) ||
other.sentTimestamp == sentTimestamp) &&
@ -212,48 +190,65 @@ class _$MessageStateImpl with DiagnosticableTreeMixin implements _MessageState {
int get hashCode => Object.hash(
runtimeType, content, sentTimestamp, reconciledTimestamp, sendState);
/// Create a copy of MessageState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$MessageStateImplCopyWith<_$MessageStateImpl> get copyWith =>
__$$MessageStateImplCopyWithImpl<_$MessageStateImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$MessageStateImplToJson(
this,
);
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'MessageState(content: $content, sentTimestamp: $sentTimestamp, reconciledTimestamp: $reconciledTimestamp, sendState: $sendState)';
}
}
abstract class _MessageState implements MessageState {
const factory _MessageState(
/// @nodoc
abstract mixin class _$MessageStateCopyWith<$Res>
implements $MessageStateCopyWith<$Res> {
factory _$MessageStateCopyWith(
_MessageState value, $Res Function(_MessageState) _then) =
__$MessageStateCopyWithImpl;
@override
@useResult
$Res call(
{@JsonKey(fromJson: messageFromJson, toJson: messageToJson)
required final proto.Message content,
required final Timestamp sentTimestamp,
required final Timestamp? reconciledTimestamp,
required final MessageSendState? sendState}) = _$MessageStateImpl;
proto.Message content,
Timestamp sentTimestamp,
Timestamp? reconciledTimestamp,
MessageSendState? sendState});
}
factory _MessageState.fromJson(Map<String, dynamic> json) =
_$MessageStateImpl.fromJson;
/// @nodoc
class __$MessageStateCopyWithImpl<$Res>
implements _$MessageStateCopyWith<$Res> {
__$MessageStateCopyWithImpl(this._self, this._then);
// Content of the message
@override
@JsonKey(fromJson: messageFromJson, toJson: messageToJson)
proto.Message get content; // Sent timestamp
@override
Timestamp get sentTimestamp; // Reconciled timestamp
@override
Timestamp? get reconciledTimestamp; // The state of the message
@override
MessageSendState? get sendState;
final _MessageState _self;
final $Res Function(_MessageState) _then;
/// Create a copy of MessageState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$MessageStateImplCopyWith<_$MessageStateImpl> get copyWith =>
throw _privateConstructorUsedError;
@pragma('vm:prefer-inline')
$Res call({
Object? content = null,
Object? sentTimestamp = null,
Object? reconciledTimestamp = freezed,
Object? sendState = freezed,
}) {
return _then(_MessageState(
content: null == content
? _self.content
: content // ignore: cast_nullable_to_non_nullable
as proto.Message,
sentTimestamp: null == sentTimestamp
? _self.sentTimestamp
: sentTimestamp // ignore: cast_nullable_to_non_nullable
as Timestamp,
reconciledTimestamp: freezed == reconciledTimestamp
? _self.reconciledTimestamp
: reconciledTimestamp // ignore: cast_nullable_to_non_nullable
as Timestamp?,
sendState: freezed == sendState
? _self.sendState
: sendState // ignore: cast_nullable_to_non_nullable
as MessageSendState?,
));
}
}
// dart format on

View file

@ -6,8 +6,8 @@ part of 'message_state.dart';
// JsonSerializableGenerator
// **************************************************************************
_$MessageStateImpl _$$MessageStateImplFromJson(Map<String, dynamic> json) =>
_$MessageStateImpl(
_MessageState _$MessageStateFromJson(Map<String, dynamic> json) =>
_MessageState(
content: messageFromJson(json['content'] as Map<String, dynamic>),
sentTimestamp: Timestamp.fromJson(json['sent_timestamp']),
reconciledTimestamp: json['reconciled_timestamp'] == null
@ -18,7 +18,7 @@ _$MessageStateImpl _$$MessageStateImplFromJson(Map<String, dynamic> json) =>
: MessageSendState.fromJson(json['send_state']),
);
Map<String, dynamic> _$$MessageStateImplToJson(_$MessageStateImpl instance) =>
Map<String, dynamic> _$MessageStateToJson(_MessageState instance) =>
<String, dynamic>{
'content': messageToJson(instance.content),
'sent_timestamp': instance.sentTimestamp.toJson(),

View file

@ -5,7 +5,7 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'window_state.freezed.dart';
@freezed
class WindowState<T> with _$WindowState<T> {
sealed class WindowState<T> with _$WindowState<T> {
const factory WindowState({
// List of objects in the window
required IList<T> window,

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
@ -9,98 +10,71 @@ part of 'window_state.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$WindowState<T> {
mixin _$WindowState<T> implements DiagnosticableTreeMixin {
// List of objects in the window
IList<T> get window =>
throw _privateConstructorUsedError; // Total number of objects (windowTail max)
int get length =>
throw _privateConstructorUsedError; // One past the end of the last element
int get windowTail =>
throw _privateConstructorUsedError; // The total number of elements to try to keep in the window
int get windowCount =>
throw _privateConstructorUsedError; // If we should have the tail following the array
bool get follow => throw _privateConstructorUsedError;
IList<T> get window; // Total number of objects (windowTail max)
int get length; // One past the end of the last element
int get windowTail; // The total number of elements to try to keep in the window
int get windowCount; // If we should have the tail following the array
bool get follow;
/// Create a copy of WindowState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$WindowStateCopyWith<T, WindowState<T>> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $WindowStateCopyWith<T, $Res> {
factory $WindowStateCopyWith(
WindowState<T> value, $Res Function(WindowState<T>) then) =
_$WindowStateCopyWithImpl<T, $Res, WindowState<T>>;
@useResult
$Res call(
{IList<T> window,
int length,
int windowTail,
int windowCount,
bool follow});
}
/// @nodoc
class _$WindowStateCopyWithImpl<T, $Res, $Val extends WindowState<T>>
implements $WindowStateCopyWith<T, $Res> {
_$WindowStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of WindowState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
$WindowStateCopyWith<T, WindowState<T>> get copyWith =>
_$WindowStateCopyWithImpl<T, WindowState<T>>(
this as WindowState<T>, _$identity);
@override
$Res call({
Object? window = null,
Object? length = null,
Object? windowTail = null,
Object? windowCount = null,
Object? follow = null,
}) {
return _then(_value.copyWith(
window: null == window
? _value.window
: window // ignore: cast_nullable_to_non_nullable
as IList<T>,
length: null == length
? _value.length
: length // ignore: cast_nullable_to_non_nullable
as int,
windowTail: null == windowTail
? _value.windowTail
: windowTail // ignore: cast_nullable_to_non_nullable
as int,
windowCount: null == windowCount
? _value.windowCount
: windowCount // ignore: cast_nullable_to_non_nullable
as int,
follow: null == follow
? _value.follow
: follow // ignore: cast_nullable_to_non_nullable
as bool,
) as $Val);
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
properties
..add(DiagnosticsProperty('type', 'WindowState<$T>'))
..add(DiagnosticsProperty('window', window))
..add(DiagnosticsProperty('length', length))
..add(DiagnosticsProperty('windowTail', windowTail))
..add(DiagnosticsProperty('windowCount', windowCount))
..add(DiagnosticsProperty('follow', follow));
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is WindowState<T> &&
const DeepCollectionEquality().equals(other.window, window) &&
(identical(other.length, length) || other.length == length) &&
(identical(other.windowTail, windowTail) ||
other.windowTail == windowTail) &&
(identical(other.windowCount, windowCount) ||
other.windowCount == windowCount) &&
(identical(other.follow, follow) || other.follow == follow));
}
@override
int get hashCode => Object.hash(
runtimeType,
const DeepCollectionEquality().hash(window),
length,
windowTail,
windowCount,
follow);
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'WindowState<$T>(window: $window, length: $length, windowTail: $windowTail, windowCount: $windowCount, follow: $follow)';
}
}
/// @nodoc
abstract class _$$WindowStateImplCopyWith<T, $Res>
implements $WindowStateCopyWith<T, $Res> {
factory _$$WindowStateImplCopyWith(_$WindowStateImpl<T> value,
$Res Function(_$WindowStateImpl<T>) then) =
__$$WindowStateImplCopyWithImpl<T, $Res>;
@override
abstract mixin class $WindowStateCopyWith<T, $Res> {
factory $WindowStateCopyWith(
WindowState<T> value, $Res Function(WindowState<T>) _then) =
_$WindowStateCopyWithImpl;
@useResult
$Res call(
{IList<T> window,
@ -111,12 +85,12 @@ abstract class _$$WindowStateImplCopyWith<T, $Res>
}
/// @nodoc
class __$$WindowStateImplCopyWithImpl<T, $Res>
extends _$WindowStateCopyWithImpl<T, $Res, _$WindowStateImpl<T>>
implements _$$WindowStateImplCopyWith<T, $Res> {
__$$WindowStateImplCopyWithImpl(
_$WindowStateImpl<T> _value, $Res Function(_$WindowStateImpl<T>) _then)
: super(_value, _then);
class _$WindowStateCopyWithImpl<T, $Res>
implements $WindowStateCopyWith<T, $Res> {
_$WindowStateCopyWithImpl(this._self, this._then);
final WindowState<T> _self;
final $Res Function(WindowState<T>) _then;
/// Create a copy of WindowState
/// with the given fields replaced by the non-null parameter values.
@ -129,25 +103,25 @@ class __$$WindowStateImplCopyWithImpl<T, $Res>
Object? windowCount = null,
Object? follow = null,
}) {
return _then(_$WindowStateImpl<T>(
return _then(_self.copyWith(
window: null == window
? _value.window
? _self.window
: window // ignore: cast_nullable_to_non_nullable
as IList<T>,
length: null == length
? _value.length
? _self.length
: length // ignore: cast_nullable_to_non_nullable
as int,
windowTail: null == windowTail
? _value.windowTail
? _self.windowTail
: windowTail // ignore: cast_nullable_to_non_nullable
as int,
windowCount: null == windowCount
? _value.windowCount
? _self.windowCount
: windowCount // ignore: cast_nullable_to_non_nullable
as int,
follow: null == follow
? _value.follow
? _self.follow
: follow // ignore: cast_nullable_to_non_nullable
as bool,
));
@ -156,10 +130,8 @@ class __$$WindowStateImplCopyWithImpl<T, $Res>
/// @nodoc
class _$WindowStateImpl<T>
with DiagnosticableTreeMixin
implements _WindowState<T> {
const _$WindowStateImpl(
class _WindowState<T> with DiagnosticableTreeMixin implements WindowState<T> {
const _WindowState(
{required this.window,
required this.length,
required this.windowTail,
@ -182,14 +154,16 @@ class _$WindowStateImpl<T>
@override
final bool follow;
/// Create a copy of WindowState
/// with the given fields replaced by the non-null parameter values.
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'WindowState<$T>(window: $window, length: $length, windowTail: $windowTail, windowCount: $windowCount, follow: $follow)';
}
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$WindowStateCopyWith<T, _WindowState<T>> get copyWith =>
__$WindowStateCopyWithImpl<T, _WindowState<T>>(this, _$identity);
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties
..add(DiagnosticsProperty('type', 'WindowState<$T>'))
..add(DiagnosticsProperty('window', window))
@ -203,7 +177,7 @@ class _$WindowStateImpl<T>
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$WindowStateImpl<T> &&
other is _WindowState<T> &&
const DeepCollectionEquality().equals(other.window, window) &&
(identical(other.length, length) || other.length == length) &&
(identical(other.windowTail, windowTail) ||
@ -222,40 +196,70 @@ class _$WindowStateImpl<T>
windowCount,
follow);
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'WindowState<$T>(window: $window, length: $length, windowTail: $windowTail, windowCount: $windowCount, follow: $follow)';
}
}
/// @nodoc
abstract mixin class _$WindowStateCopyWith<T, $Res>
implements $WindowStateCopyWith<T, $Res> {
factory _$WindowStateCopyWith(
_WindowState<T> value, $Res Function(_WindowState<T>) _then) =
__$WindowStateCopyWithImpl;
@override
@useResult
$Res call(
{IList<T> window,
int length,
int windowTail,
int windowCount,
bool follow});
}
/// @nodoc
class __$WindowStateCopyWithImpl<T, $Res>
implements _$WindowStateCopyWith<T, $Res> {
__$WindowStateCopyWithImpl(this._self, this._then);
final _WindowState<T> _self;
final $Res Function(_WindowState<T>) _then;
/// Create a copy of WindowState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$WindowStateImplCopyWith<T, _$WindowStateImpl<T>> get copyWith =>
__$$WindowStateImplCopyWithImpl<T, _$WindowStateImpl<T>>(
this, _$identity);
$Res call({
Object? window = null,
Object? length = null,
Object? windowTail = null,
Object? windowCount = null,
Object? follow = null,
}) {
return _then(_WindowState<T>(
window: null == window
? _self.window
: window // ignore: cast_nullable_to_non_nullable
as IList<T>,
length: null == length
? _self.length
: length // ignore: cast_nullable_to_non_nullable
as int,
windowTail: null == windowTail
? _self.windowTail
: windowTail // ignore: cast_nullable_to_non_nullable
as int,
windowCount: null == windowCount
? _self.windowCount
: windowCount // ignore: cast_nullable_to_non_nullable
as int,
follow: null == follow
? _self.follow
: follow // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
abstract class _WindowState<T> implements WindowState<T> {
const factory _WindowState(
{required final IList<T> window,
required final int length,
required final int windowTail,
required final int windowCount,
required final bool follow}) = _$WindowStateImpl<T>;
// List of objects in the window
@override
IList<T> get window; // Total number of objects (windowTail max)
@override
int get length; // One past the end of the last element
@override
int get windowTail; // The total number of elements to try to keep in the window
@override
int get windowCount; // If we should have the tail following the array
@override
bool get follow;
/// Create a copy of WindowState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$WindowStateImplCopyWith<T, _$WindowStateImpl<T>> get copyWith =>
throw _privateConstructorUsedError;
}
// dart format on

View file

@ -120,7 +120,7 @@ class ChatComponentWidget extends StatelessWidget {
return Column(
children: [
Container(
height: 40,
height: 48,
decoration: BoxDecoration(
color: scale.border,
),

View file

@ -13,7 +13,7 @@ import '../../proto/proto.dart' as proto;
//////////////////////////////////////////////////
// Mutable state for per-account chat list
typedef ChatListCubitState = DHTShortArrayBusyState<proto.Chat>;
typedef ChatListCubitState = DHTShortArrayCubitState<proto.Chat>;
class ChatListCubit extends DHTShortArrayCubit<proto.Chat>
with StateMapFollowable<ChatListCubitState, TypedKey, proto.Chat> {
@ -86,14 +86,12 @@ class ChatListCubit extends DHTShortArrayCubit<proto.Chat>
// Nothing to do here
return;
}
break;
case proto.Chat_Kind.group:
if (c.group.localConversationRecordKey ==
contact.localConversationRecordKey) {
throw StateError('direct conversation record key should'
' not be used for group chats!');
}
break;
case proto.Chat_Kind.notSet:
throw StateError('unknown chat kind');
}

View file

@ -8,7 +8,6 @@ import 'package:veilid_support/veilid_support.dart';
import '../../contacts/contacts.dart';
import '../../proto/proto.dart' as proto;
import '../../proto/proto.dart';
import '../../theme/theme.dart';
import '../chat_list.dart';
@ -26,7 +25,7 @@ class ChatListWidget extends StatelessWidget {
}
List<proto.Chat> _itemFilter(IMap<proto.TypedKey, proto.Contact> contactMap,
IList<DHTShortArrayElementState<Chat>> chatList, String filter) {
IList<OnlineElementState<proto.Chat>> chatList, String filter) {
final lowerValue = filter.toLowerCase();
return chatList.map((x) => x.value).where((c) {
switch (c.whichKind()) {
@ -48,7 +47,6 @@ class ChatListWidget extends StatelessWidget {
}
@override
// ignore: prefer_expression_function_bodies
Widget build(BuildContext context) {
final contactListV = context.watch<ContactListCubit>().state;
@ -83,7 +81,8 @@ class ChatListWidget extends StatelessWidget {
},
filter: (value) =>
_itemFilter(contactMap, chatList, value),
spaceBetweenSearchAndList: 4,
searchFieldPadding:
const EdgeInsets.fromLTRB(0, 0, 0, 4),
inputDecoration: InputDecoration(
labelText: translate('chat_list.search'),
),

View file

@ -50,7 +50,7 @@ class ChatSingleContactItemWidget extends StatelessWidget {
final avatar = AvatarWidget(
name: name,
size: 34,
size: 32,
borderColor: scaleTheme.config.useVisualIndicators
? scaleTheme.scheme.primaryScale.primaryText
: scaleTheme.scheme.primaryScale.subtleBorder,
@ -75,7 +75,7 @@ class ChatSingleContactItemWidget extends StatelessWidget {
trailing: AvailabilityWidget(
availability: availability,
color: scaleTileTheme.textColor,
),
).fit(fit: BoxFit.scaleDown),
onTap: () {
singleFuture(activeChatCubit, () async {
activeChatCubit.setActiveChat(_localConversationRecordKey);

View file

@ -27,7 +27,7 @@ typedef GetEncryptionKeyCallback = Future<SecretKey?> Function(
//////////////////////////////////////////////////
typedef ContactInvitiationListState
= DHTShortArrayBusyState<proto.ContactInvitationRecord>;
= DHTShortArrayCubitState<proto.ContactInvitationRecord>;
//////////////////////////////////////////////////
// Mutable state for per-account contact invitations

View file

@ -18,7 +18,7 @@ typedef WaitingInvitationsBlocMapState
class WaitingInvitationsBlocMapCubit extends BlocMapCubit<TypedKey,
AsyncValue<InvitationStatus>, WaitingInvitationCubit>
with
StateMapFollower<DHTShortArrayBusyState<proto.ContactInvitationRecord>,
StateMapFollower<DHTShortArrayCubitState<proto.ContactInvitationRecord>,
TypedKey, proto.ContactInvitationRecord> {
WaitingInvitationsBlocMapCubit(
{required AccountInfo accountInfo,

View file

@ -191,6 +191,7 @@ class _CreateInvitationDialogState extends State<CreateInvitationDialog> {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
TextField(
autofocus: true,
controller: _recipientTextController,
onChanged: (value) {
setState(() {});

View file

@ -86,7 +86,7 @@ class ScannerOverlay extends CustomPainter {
final cutoutPath = Path()..addRect(scanWindow);
final backgroundPaint = Paint()
..color = Colors.black.withOpacity(0.5)
..color = Colors.black.withAlpha(127)
..style = PaintingStyle.fill
..blendMode = BlendMode.dstOut;
@ -188,7 +188,7 @@ class ScanInvitationDialogState extends State<ScanInvitationDialog> {
child: Container(
alignment: Alignment.bottomCenter,
height: 100,
color: Colors.black.withOpacity(0.4),
color: Colors.black.withAlpha(127),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [

View file

@ -149,10 +149,14 @@ class ContactListCubit extends DHTShortArrayCubit<proto.Contact> {
// Mark the conversation records for deletion
await DHTRecordPool.instance
.deleteRecord(deletedItem.localConversationRecordKey.toVeilid());
} on Exception catch (e) {
log.debug('error deleting local conversation record: $e', e);
}
try {
await DHTRecordPool.instance
.deleteRecord(deletedItem.remoteConversationRecordKey.toVeilid());
} on Exception catch (e) {
log.debug('error deleting conversation records: $e', e);
log.debug('error deleting remote conversation record: $e', e);
}
}
}

View file

@ -1,35 +1,39 @@
import 'package:awesome_extensions/awesome_extensions.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutter_translate/flutter_translate.dart';
import '../../proto/proto.dart' as proto;
import '../../theme/theme.dart';
class AvailabilityWidget extends StatelessWidget {
const AvailabilityWidget(
{required this.availability,
required this.color,
this.vertical = true,
this.iconSize = 24,
this.size = 32,
super.key});
static Widget availabilityIcon(proto.Availability availability, Color color,
{double size = 24}) {
late final Widget iconData;
late final Widget icon;
switch (availability) {
case proto.Availability.AVAILABILITY_AWAY:
iconData = ImageIcon(const AssetImage('assets/images/toilet.png'),
size: size, color: color);
icon = SvgPicture.asset('assets/images/toilet.svg',
width: size,
height: size,
colorFilter: ColorFilter.mode(color, BlendMode.srcATop));
case proto.Availability.AVAILABILITY_BUSY:
iconData = Icon(Icons.event_busy, size: size);
icon = Icon(Icons.event_busy, size: size);
case proto.Availability.AVAILABILITY_FREE:
iconData = Icon(Icons.event_available, size: size);
icon = Icon(Icons.event_available, size: size);
case proto.Availability.AVAILABILITY_OFFLINE:
iconData = Icon(Icons.cloud_off, size: size);
icon = Icon(Icons.cloud_off, size: size);
case proto.Availability.AVAILABILITY_UNSPECIFIED:
iconData = Icon(Icons.question_mark, size: size);
icon = Icon(Icons.question_mark, size: size);
}
return iconData;
return icon;
}
static String availabilityName(proto.Availability availability) {
@ -53,26 +57,25 @@ class AvailabilityWidget extends StatelessWidget {
Widget build(BuildContext context) {
final theme = Theme.of(context);
final textTheme = theme.textTheme;
// final scale = theme.extension<ScaleScheme>()!;
// final scaleConfig = theme.extension<ScaleConfig>()!;
final name = availabilityName(availability);
final icon = availabilityIcon(availability, color, size: iconSize);
final icon = availabilityIcon(availability, color, size: size * 2 / 3);
return vertical
? Column(
mainAxisSize: MainAxisSize.min,
//mainAxisAlignment: MainAxisAlignment.center,
children: [
icon,
Text(name, style: textTheme.labelSmall!.copyWith(color: color))
.paddingLTRB(0, 0, 0, 0)
])
: Row(mainAxisSize: MainAxisSize.min, children: [
icon,
Text(name, style: textTheme.labelLarge!.copyWith(color: color))
.paddingLTRB(8, 0, 0, 0)
]);
? ConstrainedBox(
constraints: BoxConstraints.tightFor(width: size),
child: Column(mainAxisSize: MainAxisSize.min, children: [
icon,
Text(name, style: textTheme.labelSmall!.copyWith(color: color))
.fit(fit: BoxFit.scaleDown)
]))
: ConstrainedBox(
constraints: BoxConstraints.tightFor(height: size),
child: Row(mainAxisSize: MainAxisSize.min, children: [
icon,
Text(name, style: textTheme.labelLarge!.copyWith(color: color))
.paddingLTRB(size / 4, 0, 0, 0)
]));
}
////////////////////////////////////////////////////////////////////////////
@ -80,7 +83,7 @@ class AvailabilityWidget extends StatelessWidget {
final proto.Availability availability;
final Color color;
final bool vertical;
final double iconSize;
final double size;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@ -89,7 +92,7 @@ class AvailabilityWidget extends StatelessWidget {
..add(
DiagnosticsProperty<proto.Availability>('availability', availability))
..add(DiagnosticsProperty<bool>('vertical', vertical))
..add(DoubleProperty('iconSize', iconSize))
..add(DoubleProperty('size', size))
..add(ColorProperty('color', color));
}
}

View file

@ -1,6 +1,5 @@
import 'package:async_tools/async_tools.dart';
import 'package:awesome_extensions/awesome_extensions.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_translate/flutter_translate.dart';
import 'package:provider/provider.dart';
@ -30,8 +29,10 @@ class _ContactsPageState extends State<ContactsPage> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final scale = theme.extension<ScaleScheme>()!;
final appBarIconColor = scale.primaryScale.borderText;
final scaleTheme = theme.extension<ScaleTheme>()!;
final appBarTheme = scaleTheme.appBarTheme();
final scaleScheme = theme.extension<ScaleScheme>()!;
final scale = scaleScheme.scale(ScaleKind.primary);
final enableSplit = !isMobileSize(context);
final enableLeft = enableSplit || _selectedContact == null;
@ -39,9 +40,11 @@ class _ContactsPageState extends State<ContactsPage> {
return StyledScaffold(
appBar: DefaultAppBar(
title: Text(!enableSplit && enableRight
? translate('contacts_dialog.edit_contact')
: translate('contacts_dialog.contacts')),
title: Text(
!enableSplit && enableRight
? translate('contacts_dialog.edit_contact')
: translate('contacts_dialog.contacts'),
),
leading: IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: () {
@ -60,41 +63,29 @@ class _ContactsPageState extends State<ContactsPage> {
),
actions: [
if (_selectedContact != null)
FittedBox(
fit: BoxFit.scaleDown,
child: Column(mainAxisSize: MainAxisSize.min, children: [
IconButton(
icon: const Icon(Icons.chat_bubble),
color: appBarIconColor,
tooltip: translate('contacts_dialog.new_chat'),
onPressed: () async {
await _onChatStarted(_selectedContact!);
}),
Text(translate('contacts_dialog.new_chat'),
style: theme.textTheme.labelSmall!
.copyWith(color: appBarIconColor)),
])).paddingLTRB(8, 0, 8, 0),
IconButton(
icon: const Icon(Icons.chat_bubble),
iconSize: 24,
color: appBarTheme.iconColor,
tooltip: translate('contacts_dialog.new_chat'),
onPressed: () async {
await _onChatStarted(_selectedContact!);
}).paddingLTRB(8, 0, 8, 0),
if (enableSplit && _selectedContact != null)
FittedBox(
fit: BoxFit.scaleDown,
child: Column(mainAxisSize: MainAxisSize.min, children: [
IconButton(
icon: const Icon(Icons.close),
color: appBarIconColor,
tooltip: translate('contacts_dialog.close_contact'),
onPressed: () async {
await _onContactSelected(null);
}),
Text(translate('contacts_dialog.close_contact'),
style: theme.textTheme.labelSmall!
.copyWith(color: appBarIconColor)),
])).paddingLTRB(8, 0, 8, 0),
IconButton(
icon: const Icon(Icons.close),
iconSize: 24,
color: appBarTheme.iconColor,
tooltip: translate('contacts_dialog.close_contact'),
onPressed: () async {
await _onContactSelected(null);
}).paddingLTRB(8, 0, 8, 0),
]),
body: LayoutBuilder(builder: (context, constraint) {
final maxWidth = constraint.maxWidth;
return ColoredBox(
color: scale.primaryScale.appBackground,
color: scale.appBackground,
child:
Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
Offstage(
@ -104,20 +95,20 @@ class _ContactsPageState extends State<ContactsPage> {
? maxWidth
: (maxWidth / 3).clamp(200, 500),
child: DecoratedBox(
decoration: BoxDecoration(
color: scale.primaryScale.subtleBackground),
decoration:
BoxDecoration(color: scale.subtleBackground),
child: ContactsBrowser(
selectedContactRecordKey: _selectedContact
?.localConversationRecordKey
.toVeilid(),
onContactSelected: _onContactSelected,
onStartChat: _onChatStarted,
).paddingLTRB(8, 0, 8, 8)))),
).paddingLTRB(4, 0, 4, 8)))),
if (enableRight && enableLeft)
Container(
constraints:
const BoxConstraints(minWidth: 1, maxWidth: 1),
color: scale.primaryScale.subtleBorder),
color: scale.subtleBorder),
if (enableRight)
if (_selectedContact == null)
const NoContactWidget().expanded()

View file

@ -195,9 +195,6 @@ class _EditContactFormState extends State<EditContactForm> {
FormBuilderCheckbox(
name: EditContactForm.formFieldShowAvailability,
initialValue: _savedValue.showAvailability,
side: BorderSide(color: scale.primaryScale.border, width: 2),
checkColor: scale.primaryScale.borderText,
activeColor: scale.primaryScale.border,
title: Text(translate('contact_form.form_show_availability'),
style: textTheme.labelMedium),
),

View file

@ -15,8 +15,7 @@ class EmptyContactListWidget extends StatelessWidget {
final textTheme = theme.textTheme;
final scale = theme.extension<ScaleScheme>()!;
return Expanded(
child: Column(
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.center,
@ -35,6 +34,6 @@ class EmptyContactListWidget extends StatelessWidget {
),
),
],
));
);
}
}

View file

@ -50,7 +50,7 @@ typedef ActiveConversationsBlocMapState
// We currently only build the cubits for the chats that are active, not
// archived chats or contacts that are not actively in a chat.
//
// TODO: Polling contacts for new inactive chats is yet to be done
// TODO(crioux): Polling contacts for new inactive chats is yet to be done
//
class ActiveConversationsBlocMapCubit extends BlocMapCubit<TypedKey,
AsyncValue<ActiveConversationState>, ActiveConversationCubit>
@ -166,7 +166,6 @@ class ActiveConversationsBlocMapCubit extends BlocMapCubit<TypedKey,
localConversationRecordKey: localConversationRecordKey,
remoteConversationRecordKey: remoteConversationRecordKey);
break;
case proto.Chat_Kind.group:
break;
}

View file

@ -4,9 +4,12 @@ import 'package:flutter_svg/flutter_svg.dart';
class DefaultAppBar extends AppBar {
DefaultAppBar(
{required super.title, super.key, Widget? leading, super.actions})
{super.title,
super.flexibleSpace,
super.key,
Widget? leading,
super.actions})
: super(
titleSpacing: 0,
leading: leading ??
Container(
margin: const EdgeInsets.all(4),
@ -14,6 +17,6 @@ class DefaultAppBar extends AppBar {
color: Colors.black.withAlpha(32),
shape: BoxShape.circle),
child:
SvgPicture.asset('assets/images/vlogo.svg', height: 32)
SvgPicture.asset('assets/images/vlogo.svg', height: 24)
.paddingAll(4)));
}

View file

@ -9,6 +9,7 @@ import 'package:go_router/go_router.dart';
import 'package:veilid_support/veilid_support.dart';
import '../../../account_manager/account_manager.dart';
import '../../../keyboard_shortcuts.dart';
import '../../../theme/theme.dart';
import '../../../tools/tools.dart';
import '../../../veilid_processor/veilid_processor.dart';
@ -362,12 +363,18 @@ class _DrawerMenuState extends State<DrawerMenu> {
// ? grayColorFilter
// : null)
// .paddingLTRB(0, 0, 16, 0),
SvgPicture.asset(
height: 48,
'assets/images/title.svg',
colorFilter: scaleConfig.useVisualIndicators
? grayColorFilter
: src96StencilFilter),
GestureDetector(
onLongPress: () async {
context
.findAncestorWidgetOfExactType<KeyboardShortcuts>()!
.reloadTheme(context);
},
child: SvgPicture.asset(
height: 48,
'assets/images/title.svg',
colorFilter: scaleConfig.useVisualIndicators
? grayColorFilter
: src96StencilFilter)),
]))),
Text(translate('menu.accounts'),
style: theme.textTheme.titleMedium!.copyWith(

View file

@ -33,7 +33,7 @@ class _HomeAccountReadyState extends State<HomeAccountReady> {
color: scaleConfig.preferBorders
? scale.primaryScale.border
: scale.primaryScale.borderText,
constraints: const BoxConstraints.expand(height: 48, width: 48),
constraints: const BoxConstraints.expand(height: 40, width: 40),
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all(
scaleConfig.preferBorders
@ -50,7 +50,7 @@ class _HomeAccountReadyState extends State<HomeAccountReady> {
: scale.primaryScale.borderText,
width: 2),
borderRadius: BorderRadius.all(
Radius.circular(12 * scaleConfig.borderRadiusScale))),
Radius.circular(8 * scaleConfig.borderRadiusScale))),
)),
tooltip: translate('menu.accounts_menu_tooltip'),
onPressed: () async {
@ -68,7 +68,7 @@ class _HomeAccountReadyState extends State<HomeAccountReady> {
color: scaleConfig.preferBorders
? scale.primaryScale.border
: scale.primaryScale.borderText,
constraints: const BoxConstraints.expand(height: 48, width: 48),
constraints: const BoxConstraints.expand(height: 40, width: 40),
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all(
scaleConfig.preferBorders
@ -85,7 +85,7 @@ class _HomeAccountReadyState extends State<HomeAccountReady> {
: scale.primaryScale.borderText,
width: 2),
borderRadius: BorderRadius.all(
Radius.circular(12 * scaleConfig.borderRadiusScale))),
Radius.circular(8 * scaleConfig.borderRadiusScale))),
)),
tooltip: translate('menu.contacts_tooltip'),
onPressed: () async {

View file

@ -66,10 +66,11 @@ class HomeScreenState extends State<HomeScreen>
final scale = theme.extension<ScaleScheme>()!;
final scaleConfig = theme.extension<ScaleConfig>()!;
await showWarningWidgetModal(
await showAlertWidgetModal(
context: context,
title: translate('splash.beta_title'),
child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
const Icon(Icons.warning, size: 64),
RichText(
textAlign: TextAlign.center,
text: TextSpan(

View file

@ -5,7 +5,7 @@ part 'notifications_preference.freezed.dart';
part 'notifications_preference.g.dart';
@freezed
class NotificationsPreference with _$NotificationsPreference {
sealed class NotificationsPreference with _$NotificationsPreference {
const factory NotificationsPreference({
@Default(true) bool displayBetaWarning,
@Default(true) bool enableBadge,

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
@ -9,270 +10,37 @@ part of 'notifications_preference.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
NotificationsPreference _$NotificationsPreferenceFromJson(
Map<String, dynamic> json) {
return _NotificationsPreference.fromJson(json);
}
/// @nodoc
mixin _$NotificationsPreference {
bool get displayBetaWarning => throw _privateConstructorUsedError;
bool get enableBadge => throw _privateConstructorUsedError;
bool get enableNotifications => throw _privateConstructorUsedError;
MessageNotificationContent get messageNotificationContent =>
throw _privateConstructorUsedError;
NotificationMode get onInvitationAcceptedMode =>
throw _privateConstructorUsedError;
SoundEffect get onInvitationAcceptedSound =>
throw _privateConstructorUsedError;
NotificationMode get onMessageReceivedMode =>
throw _privateConstructorUsedError;
SoundEffect get onMessageReceivedSound => throw _privateConstructorUsedError;
SoundEffect get onMessageSentSound => throw _privateConstructorUsedError;
/// Serializes this NotificationsPreference to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
bool get displayBetaWarning;
bool get enableBadge;
bool get enableNotifications;
MessageNotificationContent get messageNotificationContent;
NotificationMode get onInvitationAcceptedMode;
SoundEffect get onInvitationAcceptedSound;
NotificationMode get onMessageReceivedMode;
SoundEffect get onMessageReceivedSound;
SoundEffect get onMessageSentSound;
/// Create a copy of NotificationsPreference
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$NotificationsPreferenceCopyWith<NotificationsPreference> get copyWith =>
throw _privateConstructorUsedError;
}
_$NotificationsPreferenceCopyWithImpl<NotificationsPreference>(
this as NotificationsPreference, _$identity);
/// @nodoc
abstract class $NotificationsPreferenceCopyWith<$Res> {
factory $NotificationsPreferenceCopyWith(NotificationsPreference value,
$Res Function(NotificationsPreference) then) =
_$NotificationsPreferenceCopyWithImpl<$Res, NotificationsPreference>;
@useResult
$Res call(
{bool displayBetaWarning,
bool enableBadge,
bool enableNotifications,
MessageNotificationContent messageNotificationContent,
NotificationMode onInvitationAcceptedMode,
SoundEffect onInvitationAcceptedSound,
NotificationMode onMessageReceivedMode,
SoundEffect onMessageReceivedSound,
SoundEffect onMessageSentSound});
}
/// @nodoc
class _$NotificationsPreferenceCopyWithImpl<$Res,
$Val extends NotificationsPreference>
implements $NotificationsPreferenceCopyWith<$Res> {
_$NotificationsPreferenceCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of NotificationsPreference
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? displayBetaWarning = null,
Object? enableBadge = null,
Object? enableNotifications = null,
Object? messageNotificationContent = null,
Object? onInvitationAcceptedMode = null,
Object? onInvitationAcceptedSound = null,
Object? onMessageReceivedMode = null,
Object? onMessageReceivedSound = null,
Object? onMessageSentSound = null,
}) {
return _then(_value.copyWith(
displayBetaWarning: null == displayBetaWarning
? _value.displayBetaWarning
: displayBetaWarning // ignore: cast_nullable_to_non_nullable
as bool,
enableBadge: null == enableBadge
? _value.enableBadge
: enableBadge // ignore: cast_nullable_to_non_nullable
as bool,
enableNotifications: null == enableNotifications
? _value.enableNotifications
: enableNotifications // ignore: cast_nullable_to_non_nullable
as bool,
messageNotificationContent: null == messageNotificationContent
? _value.messageNotificationContent
: messageNotificationContent // ignore: cast_nullable_to_non_nullable
as MessageNotificationContent,
onInvitationAcceptedMode: null == onInvitationAcceptedMode
? _value.onInvitationAcceptedMode
: onInvitationAcceptedMode // ignore: cast_nullable_to_non_nullable
as NotificationMode,
onInvitationAcceptedSound: null == onInvitationAcceptedSound
? _value.onInvitationAcceptedSound
: onInvitationAcceptedSound // ignore: cast_nullable_to_non_nullable
as SoundEffect,
onMessageReceivedMode: null == onMessageReceivedMode
? _value.onMessageReceivedMode
: onMessageReceivedMode // ignore: cast_nullable_to_non_nullable
as NotificationMode,
onMessageReceivedSound: null == onMessageReceivedSound
? _value.onMessageReceivedSound
: onMessageReceivedSound // ignore: cast_nullable_to_non_nullable
as SoundEffect,
onMessageSentSound: null == onMessageSentSound
? _value.onMessageSentSound
: onMessageSentSound // ignore: cast_nullable_to_non_nullable
as SoundEffect,
) as $Val);
}
}
/// @nodoc
abstract class _$$NotificationsPreferenceImplCopyWith<$Res>
implements $NotificationsPreferenceCopyWith<$Res> {
factory _$$NotificationsPreferenceImplCopyWith(
_$NotificationsPreferenceImpl value,
$Res Function(_$NotificationsPreferenceImpl) then) =
__$$NotificationsPreferenceImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{bool displayBetaWarning,
bool enableBadge,
bool enableNotifications,
MessageNotificationContent messageNotificationContent,
NotificationMode onInvitationAcceptedMode,
SoundEffect onInvitationAcceptedSound,
NotificationMode onMessageReceivedMode,
SoundEffect onMessageReceivedSound,
SoundEffect onMessageSentSound});
}
/// @nodoc
class __$$NotificationsPreferenceImplCopyWithImpl<$Res>
extends _$NotificationsPreferenceCopyWithImpl<$Res,
_$NotificationsPreferenceImpl>
implements _$$NotificationsPreferenceImplCopyWith<$Res> {
__$$NotificationsPreferenceImplCopyWithImpl(
_$NotificationsPreferenceImpl _value,
$Res Function(_$NotificationsPreferenceImpl) _then)
: super(_value, _then);
/// Create a copy of NotificationsPreference
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? displayBetaWarning = null,
Object? enableBadge = null,
Object? enableNotifications = null,
Object? messageNotificationContent = null,
Object? onInvitationAcceptedMode = null,
Object? onInvitationAcceptedSound = null,
Object? onMessageReceivedMode = null,
Object? onMessageReceivedSound = null,
Object? onMessageSentSound = null,
}) {
return _then(_$NotificationsPreferenceImpl(
displayBetaWarning: null == displayBetaWarning
? _value.displayBetaWarning
: displayBetaWarning // ignore: cast_nullable_to_non_nullable
as bool,
enableBadge: null == enableBadge
? _value.enableBadge
: enableBadge // ignore: cast_nullable_to_non_nullable
as bool,
enableNotifications: null == enableNotifications
? _value.enableNotifications
: enableNotifications // ignore: cast_nullable_to_non_nullable
as bool,
messageNotificationContent: null == messageNotificationContent
? _value.messageNotificationContent
: messageNotificationContent // ignore: cast_nullable_to_non_nullable
as MessageNotificationContent,
onInvitationAcceptedMode: null == onInvitationAcceptedMode
? _value.onInvitationAcceptedMode
: onInvitationAcceptedMode // ignore: cast_nullable_to_non_nullable
as NotificationMode,
onInvitationAcceptedSound: null == onInvitationAcceptedSound
? _value.onInvitationAcceptedSound
: onInvitationAcceptedSound // ignore: cast_nullable_to_non_nullable
as SoundEffect,
onMessageReceivedMode: null == onMessageReceivedMode
? _value.onMessageReceivedMode
: onMessageReceivedMode // ignore: cast_nullable_to_non_nullable
as NotificationMode,
onMessageReceivedSound: null == onMessageReceivedSound
? _value.onMessageReceivedSound
: onMessageReceivedSound // ignore: cast_nullable_to_non_nullable
as SoundEffect,
onMessageSentSound: null == onMessageSentSound
? _value.onMessageSentSound
: onMessageSentSound // ignore: cast_nullable_to_non_nullable
as SoundEffect,
));
}
}
/// @nodoc
@JsonSerializable()
class _$NotificationsPreferenceImpl implements _NotificationsPreference {
const _$NotificationsPreferenceImpl(
{this.displayBetaWarning = true,
this.enableBadge = true,
this.enableNotifications = true,
this.messageNotificationContent =
MessageNotificationContent.nameAndContent,
this.onInvitationAcceptedMode = NotificationMode.inAppOrPush,
this.onInvitationAcceptedSound = SoundEffect.beepBaDeep,
this.onMessageReceivedMode = NotificationMode.inAppOrPush,
this.onMessageReceivedSound = SoundEffect.boop,
this.onMessageSentSound = SoundEffect.bonk});
factory _$NotificationsPreferenceImpl.fromJson(Map<String, dynamic> json) =>
_$$NotificationsPreferenceImplFromJson(json);
@override
@JsonKey()
final bool displayBetaWarning;
@override
@JsonKey()
final bool enableBadge;
@override
@JsonKey()
final bool enableNotifications;
@override
@JsonKey()
final MessageNotificationContent messageNotificationContent;
@override
@JsonKey()
final NotificationMode onInvitationAcceptedMode;
@override
@JsonKey()
final SoundEffect onInvitationAcceptedSound;
@override
@JsonKey()
final NotificationMode onMessageReceivedMode;
@override
@JsonKey()
final SoundEffect onMessageReceivedSound;
@override
@JsonKey()
final SoundEffect onMessageSentSound;
@override
String toString() {
return 'NotificationsPreference(displayBetaWarning: $displayBetaWarning, enableBadge: $enableBadge, enableNotifications: $enableNotifications, messageNotificationContent: $messageNotificationContent, onInvitationAcceptedMode: $onInvitationAcceptedMode, onInvitationAcceptedSound: $onInvitationAcceptedSound, onMessageReceivedMode: $onMessageReceivedMode, onMessageReceivedSound: $onMessageReceivedSound, onMessageSentSound: $onMessageSentSound)';
}
/// Serializes this NotificationsPreference to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$NotificationsPreferenceImpl &&
other is NotificationsPreference &&
(identical(other.displayBetaWarning, displayBetaWarning) ||
other.displayBetaWarning == displayBetaWarning) &&
(identical(other.enableBadge, enableBadge) ||
@ -311,61 +79,286 @@ class _$NotificationsPreferenceImpl implements _NotificationsPreference {
onMessageReceivedSound,
onMessageSentSound);
/// Create a copy of NotificationsPreference
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$NotificationsPreferenceImplCopyWith<_$NotificationsPreferenceImpl>
get copyWith => __$$NotificationsPreferenceImplCopyWithImpl<
_$NotificationsPreferenceImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$NotificationsPreferenceImplToJson(
this,
);
String toString() {
return 'NotificationsPreference(displayBetaWarning: $displayBetaWarning, enableBadge: $enableBadge, enableNotifications: $enableNotifications, messageNotificationContent: $messageNotificationContent, onInvitationAcceptedMode: $onInvitationAcceptedMode, onInvitationAcceptedSound: $onInvitationAcceptedSound, onMessageReceivedMode: $onMessageReceivedMode, onMessageReceivedSound: $onMessageReceivedSound, onMessageSentSound: $onMessageSentSound)';
}
}
abstract class _NotificationsPreference implements NotificationsPreference {
const factory _NotificationsPreference(
{final bool displayBetaWarning,
final bool enableBadge,
final bool enableNotifications,
final MessageNotificationContent messageNotificationContent,
final NotificationMode onInvitationAcceptedMode,
final SoundEffect onInvitationAcceptedSound,
final NotificationMode onMessageReceivedMode,
final SoundEffect onMessageReceivedSound,
final SoundEffect onMessageSentSound}) = _$NotificationsPreferenceImpl;
/// @nodoc
abstract mixin class $NotificationsPreferenceCopyWith<$Res> {
factory $NotificationsPreferenceCopyWith(NotificationsPreference value,
$Res Function(NotificationsPreference) _then) =
_$NotificationsPreferenceCopyWithImpl;
@useResult
$Res call(
{bool displayBetaWarning,
bool enableBadge,
bool enableNotifications,
MessageNotificationContent messageNotificationContent,
NotificationMode onInvitationAcceptedMode,
SoundEffect onInvitationAcceptedSound,
NotificationMode onMessageReceivedMode,
SoundEffect onMessageReceivedSound,
SoundEffect onMessageSentSound});
}
factory _NotificationsPreference.fromJson(Map<String, dynamic> json) =
_$NotificationsPreferenceImpl.fromJson;
/// @nodoc
class _$NotificationsPreferenceCopyWithImpl<$Res>
implements $NotificationsPreferenceCopyWith<$Res> {
_$NotificationsPreferenceCopyWithImpl(this._self, this._then);
final NotificationsPreference _self;
final $Res Function(NotificationsPreference) _then;
/// Create a copy of NotificationsPreference
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? displayBetaWarning = null,
Object? enableBadge = null,
Object? enableNotifications = null,
Object? messageNotificationContent = null,
Object? onInvitationAcceptedMode = null,
Object? onInvitationAcceptedSound = null,
Object? onMessageReceivedMode = null,
Object? onMessageReceivedSound = null,
Object? onMessageSentSound = null,
}) {
return _then(_self.copyWith(
displayBetaWarning: null == displayBetaWarning
? _self.displayBetaWarning
: displayBetaWarning // ignore: cast_nullable_to_non_nullable
as bool,
enableBadge: null == enableBadge
? _self.enableBadge
: enableBadge // ignore: cast_nullable_to_non_nullable
as bool,
enableNotifications: null == enableNotifications
? _self.enableNotifications
: enableNotifications // ignore: cast_nullable_to_non_nullable
as bool,
messageNotificationContent: null == messageNotificationContent
? _self.messageNotificationContent
: messageNotificationContent // ignore: cast_nullable_to_non_nullable
as MessageNotificationContent,
onInvitationAcceptedMode: null == onInvitationAcceptedMode
? _self.onInvitationAcceptedMode
: onInvitationAcceptedMode // ignore: cast_nullable_to_non_nullable
as NotificationMode,
onInvitationAcceptedSound: null == onInvitationAcceptedSound
? _self.onInvitationAcceptedSound
: onInvitationAcceptedSound // ignore: cast_nullable_to_non_nullable
as SoundEffect,
onMessageReceivedMode: null == onMessageReceivedMode
? _self.onMessageReceivedMode
: onMessageReceivedMode // ignore: cast_nullable_to_non_nullable
as NotificationMode,
onMessageReceivedSound: null == onMessageReceivedSound
? _self.onMessageReceivedSound
: onMessageReceivedSound // ignore: cast_nullable_to_non_nullable
as SoundEffect,
onMessageSentSound: null == onMessageSentSound
? _self.onMessageSentSound
: onMessageSentSound // ignore: cast_nullable_to_non_nullable
as SoundEffect,
));
}
}
/// @nodoc
@JsonSerializable()
class _NotificationsPreference implements NotificationsPreference {
const _NotificationsPreference(
{this.displayBetaWarning = true,
this.enableBadge = true,
this.enableNotifications = true,
this.messageNotificationContent =
MessageNotificationContent.nameAndContent,
this.onInvitationAcceptedMode = NotificationMode.inAppOrPush,
this.onInvitationAcceptedSound = SoundEffect.beepBaDeep,
this.onMessageReceivedMode = NotificationMode.inAppOrPush,
this.onMessageReceivedSound = SoundEffect.boop,
this.onMessageSentSound = SoundEffect.bonk});
factory _NotificationsPreference.fromJson(Map<String, dynamic> json) =>
_$NotificationsPreferenceFromJson(json);
@override
bool get displayBetaWarning;
@JsonKey()
final bool displayBetaWarning;
@override
bool get enableBadge;
@JsonKey()
final bool enableBadge;
@override
bool get enableNotifications;
@JsonKey()
final bool enableNotifications;
@override
MessageNotificationContent get messageNotificationContent;
@JsonKey()
final MessageNotificationContent messageNotificationContent;
@override
NotificationMode get onInvitationAcceptedMode;
@JsonKey()
final NotificationMode onInvitationAcceptedMode;
@override
SoundEffect get onInvitationAcceptedSound;
@JsonKey()
final SoundEffect onInvitationAcceptedSound;
@override
NotificationMode get onMessageReceivedMode;
@JsonKey()
final NotificationMode onMessageReceivedMode;
@override
SoundEffect get onMessageReceivedSound;
@JsonKey()
final SoundEffect onMessageReceivedSound;
@override
SoundEffect get onMessageSentSound;
@JsonKey()
final SoundEffect onMessageSentSound;
/// Create a copy of NotificationsPreference
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$NotificationsPreferenceImplCopyWith<_$NotificationsPreferenceImpl>
get copyWith => throw _privateConstructorUsedError;
@pragma('vm:prefer-inline')
_$NotificationsPreferenceCopyWith<_NotificationsPreference> get copyWith =>
__$NotificationsPreferenceCopyWithImpl<_NotificationsPreference>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$NotificationsPreferenceToJson(
this,
);
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _NotificationsPreference &&
(identical(other.displayBetaWarning, displayBetaWarning) ||
other.displayBetaWarning == displayBetaWarning) &&
(identical(other.enableBadge, enableBadge) ||
other.enableBadge == enableBadge) &&
(identical(other.enableNotifications, enableNotifications) ||
other.enableNotifications == enableNotifications) &&
(identical(other.messageNotificationContent,
messageNotificationContent) ||
other.messageNotificationContent ==
messageNotificationContent) &&
(identical(
other.onInvitationAcceptedMode, onInvitationAcceptedMode) ||
other.onInvitationAcceptedMode == onInvitationAcceptedMode) &&
(identical(other.onInvitationAcceptedSound,
onInvitationAcceptedSound) ||
other.onInvitationAcceptedSound == onInvitationAcceptedSound) &&
(identical(other.onMessageReceivedMode, onMessageReceivedMode) ||
other.onMessageReceivedMode == onMessageReceivedMode) &&
(identical(other.onMessageReceivedSound, onMessageReceivedSound) ||
other.onMessageReceivedSound == onMessageReceivedSound) &&
(identical(other.onMessageSentSound, onMessageSentSound) ||
other.onMessageSentSound == onMessageSentSound));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
displayBetaWarning,
enableBadge,
enableNotifications,
messageNotificationContent,
onInvitationAcceptedMode,
onInvitationAcceptedSound,
onMessageReceivedMode,
onMessageReceivedSound,
onMessageSentSound);
@override
String toString() {
return 'NotificationsPreference(displayBetaWarning: $displayBetaWarning, enableBadge: $enableBadge, enableNotifications: $enableNotifications, messageNotificationContent: $messageNotificationContent, onInvitationAcceptedMode: $onInvitationAcceptedMode, onInvitationAcceptedSound: $onInvitationAcceptedSound, onMessageReceivedMode: $onMessageReceivedMode, onMessageReceivedSound: $onMessageReceivedSound, onMessageSentSound: $onMessageSentSound)';
}
}
/// @nodoc
abstract mixin class _$NotificationsPreferenceCopyWith<$Res>
implements $NotificationsPreferenceCopyWith<$Res> {
factory _$NotificationsPreferenceCopyWith(_NotificationsPreference value,
$Res Function(_NotificationsPreference) _then) =
__$NotificationsPreferenceCopyWithImpl;
@override
@useResult
$Res call(
{bool displayBetaWarning,
bool enableBadge,
bool enableNotifications,
MessageNotificationContent messageNotificationContent,
NotificationMode onInvitationAcceptedMode,
SoundEffect onInvitationAcceptedSound,
NotificationMode onMessageReceivedMode,
SoundEffect onMessageReceivedSound,
SoundEffect onMessageSentSound});
}
/// @nodoc
class __$NotificationsPreferenceCopyWithImpl<$Res>
implements _$NotificationsPreferenceCopyWith<$Res> {
__$NotificationsPreferenceCopyWithImpl(this._self, this._then);
final _NotificationsPreference _self;
final $Res Function(_NotificationsPreference) _then;
/// Create a copy of NotificationsPreference
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$Res call({
Object? displayBetaWarning = null,
Object? enableBadge = null,
Object? enableNotifications = null,
Object? messageNotificationContent = null,
Object? onInvitationAcceptedMode = null,
Object? onInvitationAcceptedSound = null,
Object? onMessageReceivedMode = null,
Object? onMessageReceivedSound = null,
Object? onMessageSentSound = null,
}) {
return _then(_NotificationsPreference(
displayBetaWarning: null == displayBetaWarning
? _self.displayBetaWarning
: displayBetaWarning // ignore: cast_nullable_to_non_nullable
as bool,
enableBadge: null == enableBadge
? _self.enableBadge
: enableBadge // ignore: cast_nullable_to_non_nullable
as bool,
enableNotifications: null == enableNotifications
? _self.enableNotifications
: enableNotifications // ignore: cast_nullable_to_non_nullable
as bool,
messageNotificationContent: null == messageNotificationContent
? _self.messageNotificationContent
: messageNotificationContent // ignore: cast_nullable_to_non_nullable
as MessageNotificationContent,
onInvitationAcceptedMode: null == onInvitationAcceptedMode
? _self.onInvitationAcceptedMode
: onInvitationAcceptedMode // ignore: cast_nullable_to_non_nullable
as NotificationMode,
onInvitationAcceptedSound: null == onInvitationAcceptedSound
? _self.onInvitationAcceptedSound
: onInvitationAcceptedSound // ignore: cast_nullable_to_non_nullable
as SoundEffect,
onMessageReceivedMode: null == onMessageReceivedMode
? _self.onMessageReceivedMode
: onMessageReceivedMode // ignore: cast_nullable_to_non_nullable
as NotificationMode,
onMessageReceivedSound: null == onMessageReceivedSound
? _self.onMessageReceivedSound
: onMessageReceivedSound // ignore: cast_nullable_to_non_nullable
as SoundEffect,
onMessageSentSound: null == onMessageSentSound
? _self.onMessageSentSound
: onMessageSentSound // ignore: cast_nullable_to_non_nullable
as SoundEffect,
));
}
}
// dart format on

View file

@ -6,9 +6,9 @@ part of 'notifications_preference.dart';
// JsonSerializableGenerator
// **************************************************************************
_$NotificationsPreferenceImpl _$$NotificationsPreferenceImplFromJson(
_NotificationsPreference _$NotificationsPreferenceFromJson(
Map<String, dynamic> json) =>
_$NotificationsPreferenceImpl(
_NotificationsPreference(
displayBetaWarning: json['display_beta_warning'] as bool? ?? true,
enableBadge: json['enable_badge'] as bool? ?? true,
enableNotifications: json['enable_notifications'] as bool? ?? true,
@ -33,8 +33,8 @@ _$NotificationsPreferenceImpl _$$NotificationsPreferenceImplFromJson(
: SoundEffect.fromJson(json['on_message_sent_sound']),
);
Map<String, dynamic> _$$NotificationsPreferenceImplToJson(
_$NotificationsPreferenceImpl instance) =>
Map<String, dynamic> _$NotificationsPreferenceToJson(
_NotificationsPreference instance) =>
<String, dynamic>{
'display_beta_warning': instance.displayBetaWarning,
'enable_badge': instance.enableBadge,

View file

@ -9,7 +9,7 @@ enum NotificationType {
}
@freezed
class NotificationItem with _$NotificationItem {
sealed class NotificationItem with _$NotificationItem {
const factory NotificationItem(
{required NotificationType type,
required String text,
@ -17,7 +17,7 @@ class NotificationItem with _$NotificationItem {
}
@freezed
class NotificationsState with _$NotificationsState {
sealed class NotificationsState with _$NotificationsState {
const factory NotificationsState({required IList<NotificationItem> queue}) =
_NotificationsState;
}

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
@ -9,137 +10,28 @@ part of 'notifications_state.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$NotificationItem {
NotificationType get type => throw _privateConstructorUsedError;
String get text => throw _privateConstructorUsedError;
String? get title => throw _privateConstructorUsedError;
NotificationType get type;
String get text;
String? get title;
/// Create a copy of NotificationItem
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$NotificationItemCopyWith<NotificationItem> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $NotificationItemCopyWith<$Res> {
factory $NotificationItemCopyWith(
NotificationItem value, $Res Function(NotificationItem) then) =
_$NotificationItemCopyWithImpl<$Res, NotificationItem>;
@useResult
$Res call({NotificationType type, String text, String? title});
}
/// @nodoc
class _$NotificationItemCopyWithImpl<$Res, $Val extends NotificationItem>
implements $NotificationItemCopyWith<$Res> {
_$NotificationItemCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of NotificationItem
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? type = null,
Object? text = null,
Object? title = freezed,
}) {
return _then(_value.copyWith(
type: null == type
? _value.type
: type // ignore: cast_nullable_to_non_nullable
as NotificationType,
text: null == text
? _value.text
: text // ignore: cast_nullable_to_non_nullable
as String,
title: freezed == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String?,
) as $Val);
}
}
/// @nodoc
abstract class _$$NotificationItemImplCopyWith<$Res>
implements $NotificationItemCopyWith<$Res> {
factory _$$NotificationItemImplCopyWith(_$NotificationItemImpl value,
$Res Function(_$NotificationItemImpl) then) =
__$$NotificationItemImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({NotificationType type, String text, String? title});
}
/// @nodoc
class __$$NotificationItemImplCopyWithImpl<$Res>
extends _$NotificationItemCopyWithImpl<$Res, _$NotificationItemImpl>
implements _$$NotificationItemImplCopyWith<$Res> {
__$$NotificationItemImplCopyWithImpl(_$NotificationItemImpl _value,
$Res Function(_$NotificationItemImpl) _then)
: super(_value, _then);
/// Create a copy of NotificationItem
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? type = null,
Object? text = null,
Object? title = freezed,
}) {
return _then(_$NotificationItemImpl(
type: null == type
? _value.type
: type // ignore: cast_nullable_to_non_nullable
as NotificationType,
text: null == text
? _value.text
: text // ignore: cast_nullable_to_non_nullable
as String,
title: freezed == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
class _$NotificationItemImpl implements _NotificationItem {
const _$NotificationItemImpl(
{required this.type, required this.text, this.title});
@override
final NotificationType type;
@override
final String text;
@override
final String? title;
@override
String toString() {
return 'NotificationItem(type: $type, text: $text, title: $title)';
}
_$NotificationItemCopyWithImpl<NotificationItem>(
this as NotificationItem, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$NotificationItemImpl &&
other is NotificationItem &&
(identical(other.type, type) || other.type == type) &&
(identical(other.text, text) || other.text == text) &&
(identical(other.title, title) || other.title == title));
@ -148,101 +40,185 @@ class _$NotificationItemImpl implements _NotificationItem {
@override
int get hashCode => Object.hash(runtimeType, type, text, title);
/// Create a copy of NotificationItem
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$NotificationItemImplCopyWith<_$NotificationItemImpl> get copyWith =>
__$$NotificationItemImplCopyWithImpl<_$NotificationItemImpl>(
this, _$identity);
}
abstract class _NotificationItem implements NotificationItem {
const factory _NotificationItem(
{required final NotificationType type,
required final String text,
final String? title}) = _$NotificationItemImpl;
@override
NotificationType get type;
@override
String get text;
@override
String? get title;
/// Create a copy of NotificationItem
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$NotificationItemImplCopyWith<_$NotificationItemImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$NotificationsState {
IList<NotificationItem> get queue => throw _privateConstructorUsedError;
/// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$NotificationsStateCopyWith<NotificationsState> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $NotificationsStateCopyWith<$Res> {
factory $NotificationsStateCopyWith(
NotificationsState value, $Res Function(NotificationsState) then) =
_$NotificationsStateCopyWithImpl<$Res, NotificationsState>;
@useResult
$Res call({IList<NotificationItem> queue});
}
/// @nodoc
class _$NotificationsStateCopyWithImpl<$Res, $Val extends NotificationsState>
implements $NotificationsStateCopyWith<$Res> {
_$NotificationsStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? queue = null,
}) {
return _then(_value.copyWith(
queue: null == queue
? _value.queue
: queue // ignore: cast_nullable_to_non_nullable
as IList<NotificationItem>,
) as $Val);
String toString() {
return 'NotificationItem(type: $type, text: $text, title: $title)';
}
}
/// @nodoc
abstract class _$$NotificationsStateImplCopyWith<$Res>
implements $NotificationsStateCopyWith<$Res> {
factory _$$NotificationsStateImplCopyWith(_$NotificationsStateImpl value,
$Res Function(_$NotificationsStateImpl) then) =
__$$NotificationsStateImplCopyWithImpl<$Res>;
abstract mixin class $NotificationItemCopyWith<$Res> {
factory $NotificationItemCopyWith(
NotificationItem value, $Res Function(NotificationItem) _then) =
_$NotificationItemCopyWithImpl;
@useResult
$Res call({NotificationType type, String text, String? title});
}
/// @nodoc
class _$NotificationItemCopyWithImpl<$Res>
implements $NotificationItemCopyWith<$Res> {
_$NotificationItemCopyWithImpl(this._self, this._then);
final NotificationItem _self;
final $Res Function(NotificationItem) _then;
/// Create a copy of NotificationItem
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? type = null,
Object? text = null,
Object? title = freezed,
}) {
return _then(_self.copyWith(
type: null == type
? _self.type
: type // ignore: cast_nullable_to_non_nullable
as NotificationType,
text: null == text
? _self.text
: text // ignore: cast_nullable_to_non_nullable
as String,
title: freezed == title
? _self.title
: title // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
class _NotificationItem implements NotificationItem {
const _NotificationItem({required this.type, required this.text, this.title});
@override
final NotificationType type;
@override
final String text;
@override
final String? title;
/// Create a copy of NotificationItem
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$NotificationItemCopyWith<_NotificationItem> get copyWith =>
__$NotificationItemCopyWithImpl<_NotificationItem>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _NotificationItem &&
(identical(other.type, type) || other.type == type) &&
(identical(other.text, text) || other.text == text) &&
(identical(other.title, title) || other.title == title));
}
@override
int get hashCode => Object.hash(runtimeType, type, text, title);
@override
String toString() {
return 'NotificationItem(type: $type, text: $text, title: $title)';
}
}
/// @nodoc
abstract mixin class _$NotificationItemCopyWith<$Res>
implements $NotificationItemCopyWith<$Res> {
factory _$NotificationItemCopyWith(
_NotificationItem value, $Res Function(_NotificationItem) _then) =
__$NotificationItemCopyWithImpl;
@override
@useResult
$Res call({NotificationType type, String text, String? title});
}
/// @nodoc
class __$NotificationItemCopyWithImpl<$Res>
implements _$NotificationItemCopyWith<$Res> {
__$NotificationItemCopyWithImpl(this._self, this._then);
final _NotificationItem _self;
final $Res Function(_NotificationItem) _then;
/// Create a copy of NotificationItem
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$Res call({
Object? type = null,
Object? text = null,
Object? title = freezed,
}) {
return _then(_NotificationItem(
type: null == type
? _self.type
: type // ignore: cast_nullable_to_non_nullable
as NotificationType,
text: null == text
? _self.text
: text // ignore: cast_nullable_to_non_nullable
as String,
title: freezed == title
? _self.title
: title // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
mixin _$NotificationsState {
IList<NotificationItem> get queue;
/// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$NotificationsStateCopyWith<NotificationsState> get copyWith =>
_$NotificationsStateCopyWithImpl<NotificationsState>(
this as NotificationsState, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is NotificationsState &&
const DeepCollectionEquality().equals(other.queue, queue));
}
@override
int get hashCode =>
Object.hash(runtimeType, const DeepCollectionEquality().hash(queue));
@override
String toString() {
return 'NotificationsState(queue: $queue)';
}
}
/// @nodoc
abstract mixin class $NotificationsStateCopyWith<$Res> {
factory $NotificationsStateCopyWith(
NotificationsState value, $Res Function(NotificationsState) _then) =
_$NotificationsStateCopyWithImpl;
@useResult
$Res call({IList<NotificationItem> queue});
}
/// @nodoc
class __$$NotificationsStateImplCopyWithImpl<$Res>
extends _$NotificationsStateCopyWithImpl<$Res, _$NotificationsStateImpl>
implements _$$NotificationsStateImplCopyWith<$Res> {
__$$NotificationsStateImplCopyWithImpl(_$NotificationsStateImpl _value,
$Res Function(_$NotificationsStateImpl) _then)
: super(_value, _then);
class _$NotificationsStateCopyWithImpl<$Res>
implements $NotificationsStateCopyWith<$Res> {
_$NotificationsStateCopyWithImpl(this._self, this._then);
final NotificationsState _self;
final $Res Function(NotificationsState) _then;
/// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values.
@ -251,9 +227,9 @@ class __$$NotificationsStateImplCopyWithImpl<$Res>
$Res call({
Object? queue = null,
}) {
return _then(_$NotificationsStateImpl(
return _then(_self.copyWith(
queue: null == queue
? _value.queue
? _self.queue
: queue // ignore: cast_nullable_to_non_nullable
as IList<NotificationItem>,
));
@ -262,22 +238,25 @@ class __$$NotificationsStateImplCopyWithImpl<$Res>
/// @nodoc
class _$NotificationsStateImpl implements _NotificationsState {
const _$NotificationsStateImpl({required this.queue});
class _NotificationsState implements NotificationsState {
const _NotificationsState({required this.queue});
@override
final IList<NotificationItem> queue;
/// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values.
@override
String toString() {
return 'NotificationsState(queue: $queue)';
}
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$NotificationsStateCopyWith<_NotificationsState> get copyWith =>
__$NotificationsStateCopyWithImpl<_NotificationsState>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$NotificationsStateImpl &&
other is _NotificationsState &&
const DeepCollectionEquality().equals(other.queue, queue));
}
@ -285,28 +264,45 @@ class _$NotificationsStateImpl implements _NotificationsState {
int get hashCode =>
Object.hash(runtimeType, const DeepCollectionEquality().hash(queue));
@override
String toString() {
return 'NotificationsState(queue: $queue)';
}
}
/// @nodoc
abstract mixin class _$NotificationsStateCopyWith<$Res>
implements $NotificationsStateCopyWith<$Res> {
factory _$NotificationsStateCopyWith(
_NotificationsState value, $Res Function(_NotificationsState) _then) =
__$NotificationsStateCopyWithImpl;
@override
@useResult
$Res call({IList<NotificationItem> queue});
}
/// @nodoc
class __$NotificationsStateCopyWithImpl<$Res>
implements _$NotificationsStateCopyWith<$Res> {
__$NotificationsStateCopyWithImpl(this._self, this._then);
final _NotificationsState _self;
final $Res Function(_NotificationsState) _then;
/// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$NotificationsStateImplCopyWith<_$NotificationsStateImpl> get copyWith =>
__$$NotificationsStateImplCopyWithImpl<_$NotificationsStateImpl>(
this, _$identity);
$Res call({
Object? queue = null,
}) {
return _then(_NotificationsState(
queue: null == queue
? _self.queue
: queue // ignore: cast_nullable_to_non_nullable
as IList<NotificationItem>,
));
}
}
abstract class _NotificationsState implements NotificationsState {
const factory _NotificationsState(
{required final IList<NotificationItem> queue}) =
_$NotificationsStateImpl;
@override
IList<NotificationItem> get queue;
/// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$NotificationsStateImplCopyWith<_$NotificationsStateImpl> get copyWith =>
throw _privateConstructorUsedError;
}
// dart format on

View file

@ -129,9 +129,6 @@ Widget buildSettingsPageNotificationPreferences(
// Display Beta Warning
FormBuilderCheckbox(
name: formFieldDisplayBetaWarning,
side: BorderSide(color: scale.primaryScale.border, width: 2),
checkColor: scale.primaryScale.borderText,
activeColor: scale.primaryScale.border,
title: Text(translate('settings_page.display_beta_warning'),
style: textTheme.labelMedium),
initialValue: notificationsPreference.displayBetaWarning,
@ -147,9 +144,6 @@ Widget buildSettingsPageNotificationPreferences(
// Enable Badge
FormBuilderCheckbox(
name: formFieldEnableBadge,
side: BorderSide(color: scale.primaryScale.border, width: 2),
checkColor: scale.primaryScale.borderText,
activeColor: scale.primaryScale.border,
title: Text(translate('settings_page.enable_badge'),
style: textTheme.labelMedium),
initialValue: notificationsPreference.enableBadge,
@ -164,9 +158,6 @@ Widget buildSettingsPageNotificationPreferences(
// Enable Notifications
FormBuilderCheckbox(
name: formFieldEnableNotifications,
side: BorderSide(color: scale.primaryScale.border, width: 2),
checkColor: scale.primaryScale.borderText,
activeColor: scale.primaryScale.border,
title: Text(translate('settings_page.enable_notifications'),
style: textTheme.labelMedium),
initialValue: notificationsPreference.enableNotifications,

View file

@ -1,3 +1,6 @@
import 'package:veilid_support/veilid_support.dart';
import 'veilidchat.pb.dart' as vcproto;
export 'package:veilid_support/dht_support/proto/proto.dart';
export 'package:veilid_support/proto/proto.dart';
@ -6,3 +9,292 @@ export 'veilidchat.pb.dart';
export 'veilidchat.pbenum.dart';
export 'veilidchat.pbjson.dart';
export 'veilidchat.pbserver.dart';
void registerVeilidchatProtoToDebug() {
dynamic toDebug(dynamic obj) {
if (obj is vcproto.DHTDataReference) {
return {
'dhtData': obj.dhtData,
'hash': obj.hash,
};
}
if (obj is vcproto.BlockStoreDataReference) {
return {
'block': obj.block,
};
}
if (obj is vcproto.DataReference) {
return {
'kind': obj.whichKind(),
if (obj.whichKind() == vcproto.DataReference_Kind.dhtData)
'dhtData': obj.dhtData,
if (obj.whichKind() == vcproto.DataReference_Kind.blockStoreData)
'blockStoreData': obj.blockStoreData,
};
}
if (obj is vcproto.Attachment) {
return {
'kind': obj.whichKind(),
if (obj.whichKind() == vcproto.Attachment_Kind.media)
'media': obj.media,
'signature': obj.signature,
};
}
if (obj is vcproto.AttachmentMedia) {
return {
'mime': obj.mime,
'name': obj.name,
'content': obj.content,
};
}
if (obj is vcproto.Permissions) {
return {
'canAddMembers': obj.canAddMembers,
'canEditInfo': obj.canEditInfo,
'moderated': obj.moderated,
};
}
if (obj is vcproto.Membership) {
return {
'watchers': obj.watchers,
'moderated': obj.moderated,
'talkers': obj.talkers,
'moderators': obj.moderators,
'admins': obj.admins,
};
}
if (obj is vcproto.ChatSettings) {
return {
'title': obj.title,
'description': obj.description,
'icon': obj.icon,
'defaultExpiration': obj.defaultExpiration,
};
}
if (obj is vcproto.ChatSettings) {
return {
'title': obj.title,
'description': obj.description,
'icon': obj.icon,
'defaultExpiration': obj.defaultExpiration,
};
}
if (obj is vcproto.Message) {
return {
'id': obj.id,
'author': obj.author,
'timestamp': obj.timestamp,
'kind': obj.whichKind(),
if (obj.whichKind() == vcproto.Message_Kind.text) 'text': obj.text,
if (obj.whichKind() == vcproto.Message_Kind.secret)
'secret': obj.secret,
if (obj.whichKind() == vcproto.Message_Kind.delete)
'delete': obj.delete,
if (obj.whichKind() == vcproto.Message_Kind.erase) 'erase': obj.erase,
if (obj.whichKind() == vcproto.Message_Kind.settings)
'settings': obj.settings,
if (obj.whichKind() == vcproto.Message_Kind.permissions)
'permissions': obj.permissions,
if (obj.whichKind() == vcproto.Message_Kind.membership)
'membership': obj.membership,
if (obj.whichKind() == vcproto.Message_Kind.moderation)
'moderation': obj.moderation,
'signature': obj.signature,
};
}
if (obj is vcproto.Message_Text) {
return {
'text': obj.text,
'topic': obj.topic,
'replyId': obj.replyId,
'expiration': obj.expiration,
'viewLimit': obj.viewLimit,
'attachments': obj.attachments,
};
}
if (obj is vcproto.Message_Secret) {
return {
'ciphertext': obj.ciphertext,
'expiration': obj.expiration,
};
}
if (obj is vcproto.Message_ControlDelete) {
return {
'ids': obj.ids,
};
}
if (obj is vcproto.Message_ControlErase) {
return {
'timestamp': obj.timestamp,
};
}
if (obj is vcproto.Message_ControlSettings) {
return {
'settings': obj.settings,
};
}
if (obj is vcproto.Message_ControlPermissions) {
return {
'permissions': obj.permissions,
};
}
if (obj is vcproto.Message_ControlMembership) {
return {
'membership': obj.membership,
};
}
if (obj is vcproto.Message_ControlModeration) {
return {
'acceptedIds': obj.acceptedIds,
'rejectdIds': obj.rejectedIds,
};
}
if (obj is vcproto.Message_ControlModeration) {
return {
'acceptedIds': obj.acceptedIds,
'rejectdIds': obj.rejectedIds,
};
}
if (obj is vcproto.Message_ControlReadReceipt) {
return {
'readIds': obj.readIds,
};
}
if (obj is vcproto.ReconciledMessage) {
return {
'content': obj.content,
'reconciledTime': obj.reconciledTime,
};
}
if (obj is vcproto.Conversation) {
return {
'profile': obj.profile,
'superIdentityJson': obj.superIdentityJson,
'messages': obj.messages
};
}
if (obj is vcproto.ChatMember) {
return {
'remoteIdentityPublicKey': obj.remoteIdentityPublicKey,
'remoteConversationRecordKey': obj.remoteConversationRecordKey,
};
}
if (obj is vcproto.DirectChat) {
return {
'settings': obj.settings,
'localConversationRecordKey': obj.localConversationRecordKey,
'remoteMember': obj.remoteMember,
};
}
if (obj is vcproto.GroupChat) {
return {
'settings': obj.settings,
'membership': obj.membership,
'permissions': obj.permissions,
'localConversationRecordKey': obj.localConversationRecordKey,
'remoteMembers': obj.remoteMembers,
};
}
if (obj is vcproto.Chat) {
return {
'kind': obj.whichKind(),
if (obj.whichKind() == vcproto.Chat_Kind.direct) 'direct': obj.direct,
if (obj.whichKind() == vcproto.Chat_Kind.group) 'group': obj.group,
};
}
if (obj is vcproto.Profile) {
return {
'name': obj.name,
'pronouns': obj.pronouns,
'about': obj.about,
'status': obj.status,
'availability': obj.availability,
'avatar': obj.avatar,
'timestamp': obj.timestamp,
};
}
if (obj is vcproto.Account) {
return {
'profile': obj.profile,
'invisible': obj.invisible,
'autoAwayTimeoutMin': obj.autoAwayTimeoutMin,
'contact_list': obj.contactList,
'contactInvitationRecords': obj.contactInvitationRecords,
'chatList': obj.chatList,
'groupChatList': obj.groupChatList,
'freeMessage': obj.freeMessage,
'busyMessage': obj.busyMessage,
'awayMessage': obj.awayMessage,
'autodetectAway': obj.autodetectAway,
};
}
if (obj is vcproto.Contact) {
return {
'nickname': obj.nickname,
'profile': obj.profile,
'superIdentityJson': obj.superIdentityJson,
'identityPublicKey': obj.identityPublicKey,
'remoteConversationRecordKey': obj.remoteConversationRecordKey,
'localConversationRecordKey': obj.localConversationRecordKey,
'showAvailability': obj.showAvailability,
'notes': obj.notes,
};
}
if (obj is vcproto.ContactInvitation) {
return {
'contactRequestInboxKey': obj.contactRequestInboxKey,
'writerSecret': obj.writerSecret,
};
}
if (obj is vcproto.SignedContactInvitation) {
return {
'contactInvitation': obj.contactInvitation,
'identitySignature': obj.identitySignature,
};
}
if (obj is vcproto.ContactRequest) {
return {
'encryptionKeyType': obj.encryptionKeyType,
'private': obj.private,
};
}
if (obj is vcproto.ContactRequestPrivate) {
return {
'writerKey': obj.writerKey,
'profile': obj.profile,
'superIdentityRecordKey': obj.superIdentityRecordKey,
'chatRecordKey': obj.chatRecordKey,
'expiration': obj.expiration,
};
}
if (obj is vcproto.ContactResponse) {
return {
'accept': obj.accept,
'superIdentityRecordKey': obj.superIdentityRecordKey,
'remoteConversationRecordKey': obj.remoteConversationRecordKey,
};
}
if (obj is vcproto.SignedContactResponse) {
return {
'contactResponse': obj.contactResponse,
'identitySignature': obj.identitySignature,
};
}
if (obj is vcproto.ContactInvitationRecord) {
return {
'contactRequestInbox': obj.contactRequestInbox,
'writerKey': obj.writerKey,
'writerSecret': obj.writerSecret,
'localConversationRecordKey': obj.localConversationRecordKey,
'expiration': obj.expiration,
'invitation': obj.invitation,
'message': obj.message,
'recipient': obj.recipient,
};
}
return obj;
}
DynamicDebug.registerToDebug(toDebug);
}

View file

@ -1216,6 +1216,7 @@ enum Message_Kind {
permissions,
membership,
moderation,
readReceipt,
notSet
}
@ -1234,6 +1235,7 @@ class Message extends $pb.GeneratedMessage {
Message_ControlMembership? membership,
Message_ControlModeration? moderation,
$0.Signature? signature,
Message_ControlReadReceipt? readReceipt,
}) {
final $result = create();
if (id != null) {
@ -1272,6 +1274,9 @@ class Message extends $pb.GeneratedMessage {
if (signature != null) {
$result.signature = signature;
}
if (readReceipt != null) {
$result.readReceipt = readReceipt;
}
return $result;
}
Message._() : super();
@ -1287,10 +1292,11 @@ class Message extends $pb.GeneratedMessage {
9 : Message_Kind.permissions,
10 : Message_Kind.membership,
11 : Message_Kind.moderation,
13 : Message_Kind.readReceipt,
0 : Message_Kind.notSet
};
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Message', package: const $pb.PackageName(_omitMessageNames ? '' : 'veilidchat'), createEmptyInstance: create)
..oo(0, [4, 5, 6, 7, 8, 9, 10, 11])
..oo(0, [4, 5, 6, 7, 8, 9, 10, 11, 13])
..a<$core.List<$core.int>>(1, _omitFieldNames ? '' : 'id', $pb.PbFieldType.OY)
..aOM<$0.TypedKey>(2, _omitFieldNames ? '' : 'author', subBuilder: $0.TypedKey.create)
..a<$fixnum.Int64>(3, _omitFieldNames ? '' : 'timestamp', $pb.PbFieldType.OU6, defaultOrMaker: $fixnum.Int64.ZERO)
@ -1303,6 +1309,7 @@ class Message extends $pb.GeneratedMessage {
..aOM<Message_ControlMembership>(10, _omitFieldNames ? '' : 'membership', subBuilder: Message_ControlMembership.create)
..aOM<Message_ControlModeration>(11, _omitFieldNames ? '' : 'moderation', subBuilder: Message_ControlModeration.create)
..aOM<$0.Signature>(12, _omitFieldNames ? '' : 'signature', subBuilder: $0.Signature.create)
..aOM<Message_ControlReadReceipt>(13, _omitFieldNames ? '' : 'readReceipt', protoName: 'readReceipt', subBuilder: Message_ControlReadReceipt.create)
..hasRequiredFields = false
;
@ -1462,6 +1469,17 @@ class Message extends $pb.GeneratedMessage {
void clearSignature() => clearField(12);
@$pb.TagNumber(12)
$0.Signature ensureSignature() => $_ensure(11);
@$pb.TagNumber(13)
Message_ControlReadReceipt get readReceipt => $_getN(12);
@$pb.TagNumber(13)
set readReceipt(Message_ControlReadReceipt v) { setField(13, v); }
@$pb.TagNumber(13)
$core.bool hasReadReceipt() => $_has(12);
@$pb.TagNumber(13)
void clearReadReceipt() => clearField(13);
@$pb.TagNumber(13)
Message_ControlReadReceipt ensureReadReceipt() => $_ensure(12);
}
/// Locally stored messages for chats

View file

@ -215,6 +215,7 @@ const Message$json = {
{'1': 'permissions', '3': 9, '4': 1, '5': 11, '6': '.veilidchat.Message.ControlPermissions', '9': 0, '10': 'permissions'},
{'1': 'membership', '3': 10, '4': 1, '5': 11, '6': '.veilidchat.Message.ControlMembership', '9': 0, '10': 'membership'},
{'1': 'moderation', '3': 11, '4': 1, '5': 11, '6': '.veilidchat.Message.ControlModeration', '9': 0, '10': 'moderation'},
{'1': 'readReceipt', '3': 13, '4': 1, '5': 11, '6': '.veilidchat.Message.ControlReadReceipt', '9': 0, '10': 'readReceipt'},
{'1': 'signature', '3': 12, '4': 1, '5': 11, '6': '.veilid.Signature', '10': 'signature'},
],
'3': [Message_Text$json, Message_Secret$json, Message_ControlDelete$json, Message_ControlErase$json, Message_ControlSettings$json, Message_ControlPermissions$json, Message_ControlMembership$json, Message_ControlModeration$json, Message_ControlReadReceipt$json],
@ -318,22 +319,24 @@ final $typed_data.Uint8List messageDescriptor = $convert.base64Decode(
'twZXJtaXNzaW9ucxgJIAEoCzImLnZlaWxpZGNoYXQuTWVzc2FnZS5Db250cm9sUGVybWlzc2lv'
'bnNIAFILcGVybWlzc2lvbnMSRwoKbWVtYmVyc2hpcBgKIAEoCzIlLnZlaWxpZGNoYXQuTWVzc2'
'FnZS5Db250cm9sTWVtYmVyc2hpcEgAUgptZW1iZXJzaGlwEkcKCm1vZGVyYXRpb24YCyABKAsy'
'JS52ZWlsaWRjaGF0Lk1lc3NhZ2UuQ29udHJvbE1vZGVyYXRpb25IAFIKbW9kZXJhdGlvbhIvCg'
'lzaWduYXR1cmUYDCABKAsyES52ZWlsaWQuU2lnbmF0dXJlUglzaWduYXR1cmUa5QEKBFRleHQS'
'EgoEdGV4dBgBIAEoCVIEdGV4dBIZCgV0b3BpYxgCIAEoCUgAUgV0b3BpY4gBARIeCghyZXBseV'
'9pZBgDIAEoDEgBUgdyZXBseUlkiAEBEh4KCmV4cGlyYXRpb24YBCABKARSCmV4cGlyYXRpb24S'
'HQoKdmlld19saW1pdBgFIAEoDVIJdmlld0xpbWl0EjgKC2F0dGFjaG1lbnRzGAYgAygLMhYudm'
'VpbGlkY2hhdC5BdHRhY2htZW50UgthdHRhY2htZW50c0IICgZfdG9waWNCCwoJX3JlcGx5X2lk'
'GkgKBlNlY3JldBIeCgpjaXBoZXJ0ZXh0GAEgASgMUgpjaXBoZXJ0ZXh0Eh4KCmV4cGlyYXRpb2'
'4YAiABKARSCmV4cGlyYXRpb24aIQoNQ29udHJvbERlbGV0ZRIQCgNpZHMYASADKAxSA2lkcxos'
'CgxDb250cm9sRXJhc2USHAoJdGltZXN0YW1wGAEgASgEUgl0aW1lc3RhbXAaRwoPQ29udHJvbF'
'NldHRpbmdzEjQKCHNldHRpbmdzGAEgASgLMhgudmVpbGlkY2hhdC5DaGF0U2V0dGluZ3NSCHNl'
'dHRpbmdzGk8KEkNvbnRyb2xQZXJtaXNzaW9ucxI5CgtwZXJtaXNzaW9ucxgBIAEoCzIXLnZlaW'
'xpZGNoYXQuUGVybWlzc2lvbnNSC3Blcm1pc3Npb25zGksKEUNvbnRyb2xNZW1iZXJzaGlwEjYK'
'Cm1lbWJlcnNoaXAYASABKAsyFi52ZWlsaWRjaGF0Lk1lbWJlcnNoaXBSCm1lbWJlcnNoaXAaWQ'
'oRQ29udHJvbE1vZGVyYXRpb24SIQoMYWNjZXB0ZWRfaWRzGAEgAygMUgthY2NlcHRlZElkcxIh'
'CgxyZWplY3RlZF9pZHMYAiADKAxSC3JlamVjdGVkSWRzGi8KEkNvbnRyb2xSZWFkUmVjZWlwdB'
'IZCghyZWFkX2lkcxgBIAMoDFIHcmVhZElkc0IGCgRraW5k');
'JS52ZWlsaWRjaGF0Lk1lc3NhZ2UuQ29udHJvbE1vZGVyYXRpb25IAFIKbW9kZXJhdGlvbhJKCg'
'tyZWFkUmVjZWlwdBgNIAEoCzImLnZlaWxpZGNoYXQuTWVzc2FnZS5Db250cm9sUmVhZFJlY2Vp'
'cHRIAFILcmVhZFJlY2VpcHQSLwoJc2lnbmF0dXJlGAwgASgLMhEudmVpbGlkLlNpZ25hdHVyZV'
'IJc2lnbmF0dXJlGuUBCgRUZXh0EhIKBHRleHQYASABKAlSBHRleHQSGQoFdG9waWMYAiABKAlI'
'AFIFdG9waWOIAQESHgoIcmVwbHlfaWQYAyABKAxIAVIHcmVwbHlJZIgBARIeCgpleHBpcmF0aW'
'9uGAQgASgEUgpleHBpcmF0aW9uEh0KCnZpZXdfbGltaXQYBSABKA1SCXZpZXdMaW1pdBI4Cgth'
'dHRhY2htZW50cxgGIAMoCzIWLnZlaWxpZGNoYXQuQXR0YWNobWVudFILYXR0YWNobWVudHNCCA'
'oGX3RvcGljQgsKCV9yZXBseV9pZBpICgZTZWNyZXQSHgoKY2lwaGVydGV4dBgBIAEoDFIKY2lw'
'aGVydGV4dBIeCgpleHBpcmF0aW9uGAIgASgEUgpleHBpcmF0aW9uGiEKDUNvbnRyb2xEZWxldG'
'USEAoDaWRzGAEgAygMUgNpZHMaLAoMQ29udHJvbEVyYXNlEhwKCXRpbWVzdGFtcBgBIAEoBFIJ'
'dGltZXN0YW1wGkcKD0NvbnRyb2xTZXR0aW5ncxI0CghzZXR0aW5ncxgBIAEoCzIYLnZlaWxpZG'
'NoYXQuQ2hhdFNldHRpbmdzUghzZXR0aW5ncxpPChJDb250cm9sUGVybWlzc2lvbnMSOQoLcGVy'
'bWlzc2lvbnMYASABKAsyFy52ZWlsaWRjaGF0LlBlcm1pc3Npb25zUgtwZXJtaXNzaW9ucxpLCh'
'FDb250cm9sTWVtYmVyc2hpcBI2CgptZW1iZXJzaGlwGAEgASgLMhYudmVpbGlkY2hhdC5NZW1i'
'ZXJzaGlwUgptZW1iZXJzaGlwGlkKEUNvbnRyb2xNb2RlcmF0aW9uEiEKDGFjY2VwdGVkX2lkcx'
'gBIAMoDFILYWNjZXB0ZWRJZHMSIQoMcmVqZWN0ZWRfaWRzGAIgAygMUgtyZWplY3RlZElkcxov'
'ChJDb250cm9sUmVhZFJlY2VpcHQSGQoIcmVhZF9pZHMYASADKAxSB3JlYWRJZHNCBgoEa2luZA'
'==');
@$core.Deprecated('Use reconciledMessageDescriptor instead')
const ReconciledMessage$json = {

View file

@ -228,6 +228,7 @@ message Message {
ControlPermissions permissions = 9;
ControlMembership membership = 10;
ControlModeration moderation = 11;
ControlReadReceipt readReceipt = 13;
}
// Author signature over all of the fields and attachment signatures

View file

@ -16,13 +16,15 @@ import '../../tools/tools.dart';
import '../../veilid_processor/views/developer.dart';
import '../views/router_shell.dart';
export 'package:go_router/go_router.dart';
part 'router_cubit.freezed.dart';
part 'router_cubit.g.dart';
final _rootNavKey = GlobalKey<NavigatorState>(debugLabel: 'rootNavKey');
@freezed
class RouterState with _$RouterState {
sealed class RouterState with _$RouterState {
const factory RouterState({
required bool hasAnyAccount,
}) = _RouterState;
@ -164,3 +166,14 @@ class RouterCubit extends Cubit<RouterState> {
_accountRepositorySubscription;
GoRouter? _router;
}
extension GoRouterExtension on GoRouter {
String location() {
final lastMatch = routerDelegate.currentConfiguration.last;
final matchList = lastMatch is ImperativeRouteMatch
? lastMatch.matches
: routerDelegate.currentConfiguration;
final location = matchList.uri.toString();
return location;
}
}

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
@ -9,118 +10,25 @@ part of 'router_cubit.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
RouterState _$RouterStateFromJson(Map<String, dynamic> json) {
return _RouterState.fromJson(json);
}
/// @nodoc
mixin _$RouterState {
bool get hasAnyAccount => throw _privateConstructorUsedError;
/// Serializes this RouterState to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
mixin _$RouterState implements DiagnosticableTreeMixin {
bool get hasAnyAccount;
/// Create a copy of RouterState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$RouterStateCopyWith<RouterState> get copyWith =>
throw _privateConstructorUsedError;
}
_$RouterStateCopyWithImpl<RouterState>(this as RouterState, _$identity);
/// @nodoc
abstract class $RouterStateCopyWith<$Res> {
factory $RouterStateCopyWith(
RouterState value, $Res Function(RouterState) then) =
_$RouterStateCopyWithImpl<$Res, RouterState>;
@useResult
$Res call({bool hasAnyAccount});
}
/// @nodoc
class _$RouterStateCopyWithImpl<$Res, $Val extends RouterState>
implements $RouterStateCopyWith<$Res> {
_$RouterStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of RouterState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? hasAnyAccount = null,
}) {
return _then(_value.copyWith(
hasAnyAccount: null == hasAnyAccount
? _value.hasAnyAccount
: hasAnyAccount // ignore: cast_nullable_to_non_nullable
as bool,
) as $Val);
}
}
/// @nodoc
abstract class _$$RouterStateImplCopyWith<$Res>
implements $RouterStateCopyWith<$Res> {
factory _$$RouterStateImplCopyWith(
_$RouterStateImpl value, $Res Function(_$RouterStateImpl) then) =
__$$RouterStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({bool hasAnyAccount});
}
/// @nodoc
class __$$RouterStateImplCopyWithImpl<$Res>
extends _$RouterStateCopyWithImpl<$Res, _$RouterStateImpl>
implements _$$RouterStateImplCopyWith<$Res> {
__$$RouterStateImplCopyWithImpl(
_$RouterStateImpl _value, $Res Function(_$RouterStateImpl) _then)
: super(_value, _then);
/// Create a copy of RouterState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? hasAnyAccount = null,
}) {
return _then(_$RouterStateImpl(
hasAnyAccount: null == hasAnyAccount
? _value.hasAnyAccount
: hasAnyAccount // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
/// @nodoc
@JsonSerializable()
class _$RouterStateImpl with DiagnosticableTreeMixin implements _RouterState {
const _$RouterStateImpl({required this.hasAnyAccount});
factory _$RouterStateImpl.fromJson(Map<String, dynamic> json) =>
_$$RouterStateImplFromJson(json);
@override
final bool hasAnyAccount;
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'RouterState(hasAnyAccount: $hasAnyAccount)';
}
/// Serializes this RouterState to a JSON map.
Map<String, dynamic> toJson();
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties
..add(DiagnosticsProperty('type', 'RouterState'))
..add(DiagnosticsProperty('hasAnyAccount', hasAnyAccount));
@ -130,7 +38,7 @@ class _$RouterStateImpl with DiagnosticableTreeMixin implements _RouterState {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$RouterStateImpl &&
other is RouterState &&
(identical(other.hasAnyAccount, hasAnyAccount) ||
other.hasAnyAccount == hasAnyAccount));
}
@ -139,36 +47,127 @@ class _$RouterStateImpl with DiagnosticableTreeMixin implements _RouterState {
@override
int get hashCode => Object.hash(runtimeType, hasAnyAccount);
/// Create a copy of RouterState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$RouterStateImplCopyWith<_$RouterStateImpl> get copyWith =>
__$$RouterStateImplCopyWithImpl<_$RouterStateImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$RouterStateImplToJson(
this,
);
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'RouterState(hasAnyAccount: $hasAnyAccount)';
}
}
abstract class _RouterState implements RouterState {
const factory _RouterState({required final bool hasAnyAccount}) =
_$RouterStateImpl;
/// @nodoc
abstract mixin class $RouterStateCopyWith<$Res> {
factory $RouterStateCopyWith(
RouterState value, $Res Function(RouterState) _then) =
_$RouterStateCopyWithImpl;
@useResult
$Res call({bool hasAnyAccount});
}
factory _RouterState.fromJson(Map<String, dynamic> json) =
_$RouterStateImpl.fromJson;
/// @nodoc
class _$RouterStateCopyWithImpl<$Res> implements $RouterStateCopyWith<$Res> {
_$RouterStateCopyWithImpl(this._self, this._then);
final RouterState _self;
final $Res Function(RouterState) _then;
/// Create a copy of RouterState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? hasAnyAccount = null,
}) {
return _then(_self.copyWith(
hasAnyAccount: null == hasAnyAccount
? _self.hasAnyAccount
: hasAnyAccount // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
/// @nodoc
@JsonSerializable()
class _RouterState with DiagnosticableTreeMixin implements RouterState {
const _RouterState({required this.hasAnyAccount});
factory _RouterState.fromJson(Map<String, dynamic> json) =>
_$RouterStateFromJson(json);
@override
bool get hasAnyAccount;
final bool hasAnyAccount;
/// Create a copy of RouterState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$RouterStateImplCopyWith<_$RouterStateImpl> get copyWith =>
throw _privateConstructorUsedError;
@pragma('vm:prefer-inline')
_$RouterStateCopyWith<_RouterState> get copyWith =>
__$RouterStateCopyWithImpl<_RouterState>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$RouterStateToJson(
this,
);
}
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
properties
..add(DiagnosticsProperty('type', 'RouterState'))
..add(DiagnosticsProperty('hasAnyAccount', hasAnyAccount));
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _RouterState &&
(identical(other.hasAnyAccount, hasAnyAccount) ||
other.hasAnyAccount == hasAnyAccount));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, hasAnyAccount);
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'RouterState(hasAnyAccount: $hasAnyAccount)';
}
}
/// @nodoc
abstract mixin class _$RouterStateCopyWith<$Res>
implements $RouterStateCopyWith<$Res> {
factory _$RouterStateCopyWith(
_RouterState value, $Res Function(_RouterState) _then) =
__$RouterStateCopyWithImpl;
@override
@useResult
$Res call({bool hasAnyAccount});
}
/// @nodoc
class __$RouterStateCopyWithImpl<$Res> implements _$RouterStateCopyWith<$Res> {
__$RouterStateCopyWithImpl(this._self, this._then);
final _RouterState _self;
final $Res Function(_RouterState) _then;
/// Create a copy of RouterState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$Res call({
Object? hasAnyAccount = null,
}) {
return _then(_RouterState(
hasAnyAccount: null == hasAnyAccount
? _self.hasAnyAccount
: hasAnyAccount // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
// dart format on

View file

@ -6,12 +6,11 @@ part of 'router_cubit.dart';
// JsonSerializableGenerator
// **************************************************************************
_$RouterStateImpl _$$RouterStateImplFromJson(Map<String, dynamic> json) =>
_$RouterStateImpl(
_RouterState _$RouterStateFromJson(Map<String, dynamic> json) => _RouterState(
hasAnyAccount: json['has_any_account'] as bool,
);
Map<String, dynamic> _$$RouterStateImplToJson(_$RouterStateImpl instance) =>
Map<String, dynamic> _$RouterStateToJson(_RouterState instance) =>
<String, dynamic>{
'has_any_account': instance.hasAnyAccount,
};

View file

@ -1,12 +1,14 @@
import 'package:flutter/widgets.dart';
import '../../keyboard_shortcuts.dart';
import '../../notifications/notifications.dart';
class RouterShell extends StatelessWidget {
const RouterShell({required Widget child, super.key}) : _child = child;
@override
Widget build(BuildContext context) => NotificationsWidget(child: _child);
Widget build(BuildContext context) =>
NotificationsWidget(child: KeyboardShortcuts(child: _child));
final Widget _child;
}

View file

@ -10,7 +10,7 @@ part 'preferences.g.dart';
// Lock preference changes how frequently the messenger locks its
// interface and requires the identitySecretKey to be entered (pin/password/etc)
@freezed
class LockPreference with _$LockPreference {
sealed class LockPreference with _$LockPreference {
const factory LockPreference({
@Default(0) int inactivityLockSecs,
@Default(false) bool lockWhenSwitching,
@ -37,7 +37,7 @@ enum LanguagePreference {
// Preferences are stored in a table locally and globally affect all
// accounts imported/added and the app in general
@freezed
class Preferences with _$Preferences {
sealed class Preferences with _$Preferences {
const factory Preferences({
@Default(ThemePreferences.defaults) ThemePreferences themePreference,
@Default(LanguagePreference.defaults) LanguagePreference languagePreference,

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
@ -9,158 +10,31 @@ part of 'preferences.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
LockPreference _$LockPreferenceFromJson(Map<String, dynamic> json) {
return _LockPreference.fromJson(json);
}
/// @nodoc
mixin _$LockPreference {
int get inactivityLockSecs => throw _privateConstructorUsedError;
bool get lockWhenSwitching => throw _privateConstructorUsedError;
bool get lockWithSystemLock => throw _privateConstructorUsedError;
/// Serializes this LockPreference to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
int get inactivityLockSecs;
bool get lockWhenSwitching;
bool get lockWithSystemLock;
/// Create a copy of LockPreference
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$LockPreferenceCopyWith<LockPreference> get copyWith =>
throw _privateConstructorUsedError;
}
_$LockPreferenceCopyWithImpl<LockPreference>(
this as LockPreference, _$identity);
/// @nodoc
abstract class $LockPreferenceCopyWith<$Res> {
factory $LockPreferenceCopyWith(
LockPreference value, $Res Function(LockPreference) then) =
_$LockPreferenceCopyWithImpl<$Res, LockPreference>;
@useResult
$Res call(
{int inactivityLockSecs,
bool lockWhenSwitching,
bool lockWithSystemLock});
}
/// @nodoc
class _$LockPreferenceCopyWithImpl<$Res, $Val extends LockPreference>
implements $LockPreferenceCopyWith<$Res> {
_$LockPreferenceCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of LockPreference
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? inactivityLockSecs = null,
Object? lockWhenSwitching = null,
Object? lockWithSystemLock = null,
}) {
return _then(_value.copyWith(
inactivityLockSecs: null == inactivityLockSecs
? _value.inactivityLockSecs
: inactivityLockSecs // ignore: cast_nullable_to_non_nullable
as int,
lockWhenSwitching: null == lockWhenSwitching
? _value.lockWhenSwitching
: lockWhenSwitching // ignore: cast_nullable_to_non_nullable
as bool,
lockWithSystemLock: null == lockWithSystemLock
? _value.lockWithSystemLock
: lockWithSystemLock // ignore: cast_nullable_to_non_nullable
as bool,
) as $Val);
}
}
/// @nodoc
abstract class _$$LockPreferenceImplCopyWith<$Res>
implements $LockPreferenceCopyWith<$Res> {
factory _$$LockPreferenceImplCopyWith(_$LockPreferenceImpl value,
$Res Function(_$LockPreferenceImpl) then) =
__$$LockPreferenceImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{int inactivityLockSecs,
bool lockWhenSwitching,
bool lockWithSystemLock});
}
/// @nodoc
class __$$LockPreferenceImplCopyWithImpl<$Res>
extends _$LockPreferenceCopyWithImpl<$Res, _$LockPreferenceImpl>
implements _$$LockPreferenceImplCopyWith<$Res> {
__$$LockPreferenceImplCopyWithImpl(
_$LockPreferenceImpl _value, $Res Function(_$LockPreferenceImpl) _then)
: super(_value, _then);
/// Create a copy of LockPreference
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? inactivityLockSecs = null,
Object? lockWhenSwitching = null,
Object? lockWithSystemLock = null,
}) {
return _then(_$LockPreferenceImpl(
inactivityLockSecs: null == inactivityLockSecs
? _value.inactivityLockSecs
: inactivityLockSecs // ignore: cast_nullable_to_non_nullable
as int,
lockWhenSwitching: null == lockWhenSwitching
? _value.lockWhenSwitching
: lockWhenSwitching // ignore: cast_nullable_to_non_nullable
as bool,
lockWithSystemLock: null == lockWithSystemLock
? _value.lockWithSystemLock
: lockWithSystemLock // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
/// @nodoc
@JsonSerializable()
class _$LockPreferenceImpl implements _LockPreference {
const _$LockPreferenceImpl(
{this.inactivityLockSecs = 0,
this.lockWhenSwitching = false,
this.lockWithSystemLock = false});
factory _$LockPreferenceImpl.fromJson(Map<String, dynamic> json) =>
_$$LockPreferenceImplFromJson(json);
@override
@JsonKey()
final int inactivityLockSecs;
@override
@JsonKey()
final bool lockWhenSwitching;
@override
@JsonKey()
final bool lockWithSystemLock;
@override
String toString() {
return 'LockPreference(inactivityLockSecs: $inactivityLockSecs, lockWhenSwitching: $lockWhenSwitching, lockWithSystemLock: $lockWithSystemLock)';
}
/// Serializes this LockPreference to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$LockPreferenceImpl &&
other is LockPreference &&
(identical(other.inactivityLockSecs, inactivityLockSecs) ||
other.inactivityLockSecs == inactivityLockSecs) &&
(identical(other.lockWhenSwitching, lockWhenSwitching) ||
@ -174,255 +48,187 @@ class _$LockPreferenceImpl implements _LockPreference {
int get hashCode => Object.hash(
runtimeType, inactivityLockSecs, lockWhenSwitching, lockWithSystemLock);
/// Create a copy of LockPreference
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$LockPreferenceImplCopyWith<_$LockPreferenceImpl> get copyWith =>
__$$LockPreferenceImplCopyWithImpl<_$LockPreferenceImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$LockPreferenceImplToJson(
this,
);
String toString() {
return 'LockPreference(inactivityLockSecs: $inactivityLockSecs, lockWhenSwitching: $lockWhenSwitching, lockWithSystemLock: $lockWithSystemLock)';
}
}
abstract class _LockPreference implements LockPreference {
const factory _LockPreference(
{final int inactivityLockSecs,
final bool lockWhenSwitching,
final bool lockWithSystemLock}) = _$LockPreferenceImpl;
factory _LockPreference.fromJson(Map<String, dynamic> json) =
_$LockPreferenceImpl.fromJson;
@override
int get inactivityLockSecs;
@override
bool get lockWhenSwitching;
@override
bool get lockWithSystemLock;
/// Create a copy of LockPreference
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$LockPreferenceImplCopyWith<_$LockPreferenceImpl> get copyWith =>
throw _privateConstructorUsedError;
}
Preferences _$PreferencesFromJson(Map<String, dynamic> json) {
return _Preferences.fromJson(json);
}
/// @nodoc
mixin _$Preferences {
ThemePreferences get themePreference => throw _privateConstructorUsedError;
LanguagePreference get languagePreference =>
throw _privateConstructorUsedError;
LockPreference get lockPreference => throw _privateConstructorUsedError;
NotificationsPreference get notificationsPreference =>
throw _privateConstructorUsedError;
/// Serializes this Preferences to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Preferences
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$PreferencesCopyWith<Preferences> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $PreferencesCopyWith<$Res> {
factory $PreferencesCopyWith(
Preferences value, $Res Function(Preferences) then) =
_$PreferencesCopyWithImpl<$Res, Preferences>;
abstract mixin class $LockPreferenceCopyWith<$Res> {
factory $LockPreferenceCopyWith(
LockPreference value, $Res Function(LockPreference) _then) =
_$LockPreferenceCopyWithImpl;
@useResult
$Res call(
{ThemePreferences themePreference,
LanguagePreference languagePreference,
LockPreference lockPreference,
NotificationsPreference notificationsPreference});
$ThemePreferencesCopyWith<$Res> get themePreference;
$LockPreferenceCopyWith<$Res> get lockPreference;
$NotificationsPreferenceCopyWith<$Res> get notificationsPreference;
{int inactivityLockSecs,
bool lockWhenSwitching,
bool lockWithSystemLock});
}
/// @nodoc
class _$PreferencesCopyWithImpl<$Res, $Val extends Preferences>
implements $PreferencesCopyWith<$Res> {
_$PreferencesCopyWithImpl(this._value, this._then);
class _$LockPreferenceCopyWithImpl<$Res>
implements $LockPreferenceCopyWith<$Res> {
_$LockPreferenceCopyWithImpl(this._self, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
final LockPreference _self;
final $Res Function(LockPreference) _then;
/// Create a copy of Preferences
/// Create a copy of LockPreference
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? themePreference = null,
Object? languagePreference = null,
Object? lockPreference = null,
Object? notificationsPreference = null,
Object? inactivityLockSecs = null,
Object? lockWhenSwitching = null,
Object? lockWithSystemLock = null,
}) {
return _then(_value.copyWith(
themePreference: null == themePreference
? _value.themePreference
: themePreference // ignore: cast_nullable_to_non_nullable
as ThemePreferences,
languagePreference: null == languagePreference
? _value.languagePreference
: languagePreference // ignore: cast_nullable_to_non_nullable
as LanguagePreference,
lockPreference: null == lockPreference
? _value.lockPreference
: lockPreference // ignore: cast_nullable_to_non_nullable
as LockPreference,
notificationsPreference: null == notificationsPreference
? _value.notificationsPreference
: notificationsPreference // ignore: cast_nullable_to_non_nullable
as NotificationsPreference,
) as $Val);
}
/// Create a copy of Preferences
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ThemePreferencesCopyWith<$Res> get themePreference {
return $ThemePreferencesCopyWith<$Res>(_value.themePreference, (value) {
return _then(_value.copyWith(themePreference: value) as $Val);
});
}
/// Create a copy of Preferences
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$LockPreferenceCopyWith<$Res> get lockPreference {
return $LockPreferenceCopyWith<$Res>(_value.lockPreference, (value) {
return _then(_value.copyWith(lockPreference: value) as $Val);
});
}
/// Create a copy of Preferences
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$NotificationsPreferenceCopyWith<$Res> get notificationsPreference {
return $NotificationsPreferenceCopyWith<$Res>(
_value.notificationsPreference, (value) {
return _then(_value.copyWith(notificationsPreference: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$PreferencesImplCopyWith<$Res>
implements $PreferencesCopyWith<$Res> {
factory _$$PreferencesImplCopyWith(
_$PreferencesImpl value, $Res Function(_$PreferencesImpl) then) =
__$$PreferencesImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{ThemePreferences themePreference,
LanguagePreference languagePreference,
LockPreference lockPreference,
NotificationsPreference notificationsPreference});
@override
$ThemePreferencesCopyWith<$Res> get themePreference;
@override
$LockPreferenceCopyWith<$Res> get lockPreference;
@override
$NotificationsPreferenceCopyWith<$Res> get notificationsPreference;
}
/// @nodoc
class __$$PreferencesImplCopyWithImpl<$Res>
extends _$PreferencesCopyWithImpl<$Res, _$PreferencesImpl>
implements _$$PreferencesImplCopyWith<$Res> {
__$$PreferencesImplCopyWithImpl(
_$PreferencesImpl _value, $Res Function(_$PreferencesImpl) _then)
: super(_value, _then);
/// Create a copy of Preferences
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? themePreference = null,
Object? languagePreference = null,
Object? lockPreference = null,
Object? notificationsPreference = null,
}) {
return _then(_$PreferencesImpl(
themePreference: null == themePreference
? _value.themePreference
: themePreference // ignore: cast_nullable_to_non_nullable
as ThemePreferences,
languagePreference: null == languagePreference
? _value.languagePreference
: languagePreference // ignore: cast_nullable_to_non_nullable
as LanguagePreference,
lockPreference: null == lockPreference
? _value.lockPreference
: lockPreference // ignore: cast_nullable_to_non_nullable
as LockPreference,
notificationsPreference: null == notificationsPreference
? _value.notificationsPreference
: notificationsPreference // ignore: cast_nullable_to_non_nullable
as NotificationsPreference,
return _then(_self.copyWith(
inactivityLockSecs: null == inactivityLockSecs
? _self.inactivityLockSecs
: inactivityLockSecs // ignore: cast_nullable_to_non_nullable
as int,
lockWhenSwitching: null == lockWhenSwitching
? _self.lockWhenSwitching
: lockWhenSwitching // ignore: cast_nullable_to_non_nullable
as bool,
lockWithSystemLock: null == lockWithSystemLock
? _self.lockWithSystemLock
: lockWithSystemLock // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
/// @nodoc
@JsonSerializable()
class _$PreferencesImpl implements _Preferences {
const _$PreferencesImpl(
{this.themePreference = ThemePreferences.defaults,
this.languagePreference = LanguagePreference.defaults,
this.lockPreference = LockPreference.defaults,
this.notificationsPreference = NotificationsPreference.defaults});
factory _$PreferencesImpl.fromJson(Map<String, dynamic> json) =>
_$$PreferencesImplFromJson(json);
class _LockPreference implements LockPreference {
const _LockPreference(
{this.inactivityLockSecs = 0,
this.lockWhenSwitching = false,
this.lockWithSystemLock = false});
factory _LockPreference.fromJson(Map<String, dynamic> json) =>
_$LockPreferenceFromJson(json);
@override
@JsonKey()
final ThemePreferences themePreference;
final int inactivityLockSecs;
@override
@JsonKey()
final LanguagePreference languagePreference;
final bool lockWhenSwitching;
@override
@JsonKey()
final LockPreference lockPreference;
final bool lockWithSystemLock;
/// Create a copy of LockPreference
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey()
final NotificationsPreference notificationsPreference;
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$LockPreferenceCopyWith<_LockPreference> get copyWith =>
__$LockPreferenceCopyWithImpl<_LockPreference>(this, _$identity);
@override
String toString() {
return 'Preferences(themePreference: $themePreference, languagePreference: $languagePreference, lockPreference: $lockPreference, notificationsPreference: $notificationsPreference)';
Map<String, dynamic> toJson() {
return _$LockPreferenceToJson(
this,
);
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PreferencesImpl &&
other is _LockPreference &&
(identical(other.inactivityLockSecs, inactivityLockSecs) ||
other.inactivityLockSecs == inactivityLockSecs) &&
(identical(other.lockWhenSwitching, lockWhenSwitching) ||
other.lockWhenSwitching == lockWhenSwitching) &&
(identical(other.lockWithSystemLock, lockWithSystemLock) ||
other.lockWithSystemLock == lockWithSystemLock));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, inactivityLockSecs, lockWhenSwitching, lockWithSystemLock);
@override
String toString() {
return 'LockPreference(inactivityLockSecs: $inactivityLockSecs, lockWhenSwitching: $lockWhenSwitching, lockWithSystemLock: $lockWithSystemLock)';
}
}
/// @nodoc
abstract mixin class _$LockPreferenceCopyWith<$Res>
implements $LockPreferenceCopyWith<$Res> {
factory _$LockPreferenceCopyWith(
_LockPreference value, $Res Function(_LockPreference) _then) =
__$LockPreferenceCopyWithImpl;
@override
@useResult
$Res call(
{int inactivityLockSecs,
bool lockWhenSwitching,
bool lockWithSystemLock});
}
/// @nodoc
class __$LockPreferenceCopyWithImpl<$Res>
implements _$LockPreferenceCopyWith<$Res> {
__$LockPreferenceCopyWithImpl(this._self, this._then);
final _LockPreference _self;
final $Res Function(_LockPreference) _then;
/// Create a copy of LockPreference
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$Res call({
Object? inactivityLockSecs = null,
Object? lockWhenSwitching = null,
Object? lockWithSystemLock = null,
}) {
return _then(_LockPreference(
inactivityLockSecs: null == inactivityLockSecs
? _self.inactivityLockSecs
: inactivityLockSecs // ignore: cast_nullable_to_non_nullable
as int,
lockWhenSwitching: null == lockWhenSwitching
? _self.lockWhenSwitching
: lockWhenSwitching // ignore: cast_nullable_to_non_nullable
as bool,
lockWithSystemLock: null == lockWithSystemLock
? _self.lockWithSystemLock
: lockWithSystemLock // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
/// @nodoc
mixin _$Preferences {
ThemePreferences get themePreference;
LanguagePreference get languagePreference;
LockPreference get lockPreference;
NotificationsPreference get notificationsPreference;
/// Create a copy of Preferences
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$PreferencesCopyWith<Preferences> get copyWith =>
_$PreferencesCopyWithImpl<Preferences>(this as Preferences, _$identity);
/// Serializes this Preferences to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is Preferences &&
(identical(other.themePreference, themePreference) ||
other.themePreference == themePreference) &&
(identical(other.languagePreference, languagePreference) ||
@ -439,46 +245,253 @@ class _$PreferencesImpl implements _Preferences {
int get hashCode => Object.hash(runtimeType, themePreference,
languagePreference, lockPreference, notificationsPreference);
/// Create a copy of Preferences
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$PreferencesImplCopyWith<_$PreferencesImpl> get copyWith =>
__$$PreferencesImplCopyWithImpl<_$PreferencesImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$PreferencesImplToJson(
this,
);
String toString() {
return 'Preferences(themePreference: $themePreference, languagePreference: $languagePreference, lockPreference: $lockPreference, notificationsPreference: $notificationsPreference)';
}
}
abstract class _Preferences implements Preferences {
const factory _Preferences(
{final ThemePreferences themePreference,
final LanguagePreference languagePreference,
final LockPreference lockPreference,
final NotificationsPreference notificationsPreference}) =
_$PreferencesImpl;
/// @nodoc
abstract mixin class $PreferencesCopyWith<$Res> {
factory $PreferencesCopyWith(
Preferences value, $Res Function(Preferences) _then) =
_$PreferencesCopyWithImpl;
@useResult
$Res call(
{ThemePreferences themePreference,
LanguagePreference languagePreference,
LockPreference lockPreference,
NotificationsPreference notificationsPreference});
factory _Preferences.fromJson(Map<String, dynamic> json) =
_$PreferencesImpl.fromJson;
$ThemePreferencesCopyWith<$Res> get themePreference;
$LockPreferenceCopyWith<$Res> get lockPreference;
$NotificationsPreferenceCopyWith<$Res> get notificationsPreference;
}
/// @nodoc
class _$PreferencesCopyWithImpl<$Res> implements $PreferencesCopyWith<$Res> {
_$PreferencesCopyWithImpl(this._self, this._then);
final Preferences _self;
final $Res Function(Preferences) _then;
/// Create a copy of Preferences
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? themePreference = null,
Object? languagePreference = null,
Object? lockPreference = null,
Object? notificationsPreference = null,
}) {
return _then(_self.copyWith(
themePreference: null == themePreference
? _self.themePreference
: themePreference // ignore: cast_nullable_to_non_nullable
as ThemePreferences,
languagePreference: null == languagePreference
? _self.languagePreference
: languagePreference // ignore: cast_nullable_to_non_nullable
as LanguagePreference,
lockPreference: null == lockPreference
? _self.lockPreference
: lockPreference // ignore: cast_nullable_to_non_nullable
as LockPreference,
notificationsPreference: null == notificationsPreference
? _self.notificationsPreference
: notificationsPreference // ignore: cast_nullable_to_non_nullable
as NotificationsPreference,
));
}
/// Create a copy of Preferences
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ThemePreferencesCopyWith<$Res> get themePreference {
return $ThemePreferencesCopyWith<$Res>(_self.themePreference, (value) {
return _then(_self.copyWith(themePreference: value));
});
}
/// Create a copy of Preferences
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$LockPreferenceCopyWith<$Res> get lockPreference {
return $LockPreferenceCopyWith<$Res>(_self.lockPreference, (value) {
return _then(_self.copyWith(lockPreference: value));
});
}
/// Create a copy of Preferences
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$NotificationsPreferenceCopyWith<$Res> get notificationsPreference {
return $NotificationsPreferenceCopyWith<$Res>(_self.notificationsPreference,
(value) {
return _then(_self.copyWith(notificationsPreference: value));
});
}
}
/// @nodoc
@JsonSerializable()
class _Preferences implements Preferences {
const _Preferences(
{this.themePreference = ThemePreferences.defaults,
this.languagePreference = LanguagePreference.defaults,
this.lockPreference = LockPreference.defaults,
this.notificationsPreference = NotificationsPreference.defaults});
factory _Preferences.fromJson(Map<String, dynamic> json) =>
_$PreferencesFromJson(json);
@override
ThemePreferences get themePreference;
@JsonKey()
final ThemePreferences themePreference;
@override
LanguagePreference get languagePreference;
@JsonKey()
final LanguagePreference languagePreference;
@override
LockPreference get lockPreference;
@JsonKey()
final LockPreference lockPreference;
@override
NotificationsPreference get notificationsPreference;
@JsonKey()
final NotificationsPreference notificationsPreference;
/// Create a copy of Preferences
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$PreferencesImplCopyWith<_$PreferencesImpl> get copyWith =>
throw _privateConstructorUsedError;
@pragma('vm:prefer-inline')
_$PreferencesCopyWith<_Preferences> get copyWith =>
__$PreferencesCopyWithImpl<_Preferences>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$PreferencesToJson(
this,
);
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _Preferences &&
(identical(other.themePreference, themePreference) ||
other.themePreference == themePreference) &&
(identical(other.languagePreference, languagePreference) ||
other.languagePreference == languagePreference) &&
(identical(other.lockPreference, lockPreference) ||
other.lockPreference == lockPreference) &&
(identical(
other.notificationsPreference, notificationsPreference) ||
other.notificationsPreference == notificationsPreference));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, themePreference,
languagePreference, lockPreference, notificationsPreference);
@override
String toString() {
return 'Preferences(themePreference: $themePreference, languagePreference: $languagePreference, lockPreference: $lockPreference, notificationsPreference: $notificationsPreference)';
}
}
/// @nodoc
abstract mixin class _$PreferencesCopyWith<$Res>
implements $PreferencesCopyWith<$Res> {
factory _$PreferencesCopyWith(
_Preferences value, $Res Function(_Preferences) _then) =
__$PreferencesCopyWithImpl;
@override
@useResult
$Res call(
{ThemePreferences themePreference,
LanguagePreference languagePreference,
LockPreference lockPreference,
NotificationsPreference notificationsPreference});
@override
$ThemePreferencesCopyWith<$Res> get themePreference;
@override
$LockPreferenceCopyWith<$Res> get lockPreference;
@override
$NotificationsPreferenceCopyWith<$Res> get notificationsPreference;
}
/// @nodoc
class __$PreferencesCopyWithImpl<$Res> implements _$PreferencesCopyWith<$Res> {
__$PreferencesCopyWithImpl(this._self, this._then);
final _Preferences _self;
final $Res Function(_Preferences) _then;
/// Create a copy of Preferences
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$Res call({
Object? themePreference = null,
Object? languagePreference = null,
Object? lockPreference = null,
Object? notificationsPreference = null,
}) {
return _then(_Preferences(
themePreference: null == themePreference
? _self.themePreference
: themePreference // ignore: cast_nullable_to_non_nullable
as ThemePreferences,
languagePreference: null == languagePreference
? _self.languagePreference
: languagePreference // ignore: cast_nullable_to_non_nullable
as LanguagePreference,
lockPreference: null == lockPreference
? _self.lockPreference
: lockPreference // ignore: cast_nullable_to_non_nullable
as LockPreference,
notificationsPreference: null == notificationsPreference
? _self.notificationsPreference
: notificationsPreference // ignore: cast_nullable_to_non_nullable
as NotificationsPreference,
));
}
/// Create a copy of Preferences
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ThemePreferencesCopyWith<$Res> get themePreference {
return $ThemePreferencesCopyWith<$Res>(_self.themePreference, (value) {
return _then(_self.copyWith(themePreference: value));
});
}
/// Create a copy of Preferences
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$LockPreferenceCopyWith<$Res> get lockPreference {
return $LockPreferenceCopyWith<$Res>(_self.lockPreference, (value) {
return _then(_self.copyWith(lockPreference: value));
});
}
/// Create a copy of Preferences
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$NotificationsPreferenceCopyWith<$Res> get notificationsPreference {
return $NotificationsPreferenceCopyWith<$Res>(_self.notificationsPreference,
(value) {
return _then(_self.copyWith(notificationsPreference: value));
});
}
}
// dart format on

View file

@ -6,23 +6,21 @@ part of 'preferences.dart';
// JsonSerializableGenerator
// **************************************************************************
_$LockPreferenceImpl _$$LockPreferenceImplFromJson(Map<String, dynamic> json) =>
_$LockPreferenceImpl(
_LockPreference _$LockPreferenceFromJson(Map<String, dynamic> json) =>
_LockPreference(
inactivityLockSecs: (json['inactivity_lock_secs'] as num?)?.toInt() ?? 0,
lockWhenSwitching: json['lock_when_switching'] as bool? ?? false,
lockWithSystemLock: json['lock_with_system_lock'] as bool? ?? false,
);
Map<String, dynamic> _$$LockPreferenceImplToJson(
_$LockPreferenceImpl instance) =>
Map<String, dynamic> _$LockPreferenceToJson(_LockPreference instance) =>
<String, dynamic>{
'inactivity_lock_secs': instance.inactivityLockSecs,
'lock_when_switching': instance.lockWhenSwitching,
'lock_with_system_lock': instance.lockWithSystemLock,
};
_$PreferencesImpl _$$PreferencesImplFromJson(Map<String, dynamic> json) =>
_$PreferencesImpl(
_Preferences _$PreferencesFromJson(Map<String, dynamic> json) => _Preferences(
themePreference: json['theme_preference'] == null
? ThemePreferences.defaults
: ThemePreferences.fromJson(json['theme_preference']),
@ -37,7 +35,7 @@ _$PreferencesImpl _$$PreferencesImplFromJson(Map<String, dynamic> json) =>
: NotificationsPreference.fromJson(json['notifications_preference']),
);
Map<String, dynamic> _$$PreferencesImplToJson(_$PreferencesImpl instance) =>
Map<String, dynamic> _$PreferencesToJson(_Preferences instance) =>
<String, dynamic>{
'theme_preference': instance.themePreference.toJson(),
'language_preference': instance.languagePreference.toJson(),

View file

@ -638,7 +638,7 @@ ThemeData radixGenerator(Brightness brightness, RadixThemeColor themeColor) {
useVisualIndicators: false,
preferBorders: false,
borderRadiusScale: 1,
wallpaperAlpha: wallpaperAlpha(brightness, themeColor),
wallpaperOpacity: wallpaperAlpha(brightness, themeColor),
);
final scaleTheme = ScaleTheme(

View file

@ -0,0 +1,31 @@
import 'package:flutter/material.dart';
import 'scale_theme.dart';
class ScaleAppBarTheme {
ScaleAppBarTheme({
required this.textStyle,
required this.iconColor,
required this.backgroundColor,
});
final TextStyle textStyle;
final Color iconColor;
final Color backgroundColor;
}
extension ScaleAppBarThemeExt on ScaleTheme {
ScaleAppBarTheme appBarTheme({ScaleKind scaleKind = ScaleKind.primary}) {
final scale = scheme.scale(scaleKind);
final textStyle = textTheme.titleLarge!.copyWith(color: scale.borderText);
final iconColor = scale.borderText;
final backgroundColor = scale.border;
return ScaleAppBarTheme(
textStyle: textStyle,
iconColor: iconColor,
backgroundColor: backgroundColor,
);
}
}

View file

@ -50,11 +50,11 @@ class ScaleColor {
Color? subtleBorder,
Color? border,
Color? hoverBorder,
Color? background,
Color? hoverBackground,
Color? primary,
Color? hoverPrimary,
Color? subtleText,
Color? appText,
Color? foregroundText,
Color? primaryText,
Color? borderText,
Color? dialogBorder,
Color? dialogBorderText,
@ -72,11 +72,11 @@ class ScaleColor {
subtleBorder: subtleBorder ?? this.subtleBorder,
border: border ?? this.border,
hoverBorder: hoverBorder ?? this.hoverBorder,
primary: background ?? this.primary,
hoverPrimary: hoverBackground ?? this.hoverPrimary,
primary: primary ?? this.primary,
hoverPrimary: hoverPrimary ?? this.hoverPrimary,
subtleText: subtleText ?? this.subtleText,
appText: appText ?? this.appText,
primaryText: foregroundText ?? this.primaryText,
primaryText: primaryText ?? this.primaryText,
borderText: borderText ?? this.borderText,
dialogBorder: dialogBorder ?? this.dialogBorder,
dialogBorderText: dialogBorderText ?? this.dialogBorderText,

View file

@ -68,7 +68,7 @@ extension ScaleCustomDropdownThemeExt on ScaleTheme {
listItemDecoration: null,
);
final disabledDecoration = CustomDropdownDisabledDecoration(
const disabledDecoration = CustomDropdownDisabledDecoration(
fillColor: null,
shadow: null,
suffixIcon: null,

View file

@ -111,27 +111,27 @@ class ScaleConfig extends ThemeExtension<ScaleConfig> {
required this.useVisualIndicators,
required this.preferBorders,
required this.borderRadiusScale,
required double wallpaperAlpha,
}) : _wallpaperAlpha = wallpaperAlpha;
required this.wallpaperOpacity,
});
final bool useVisualIndicators;
final bool preferBorders;
final double borderRadiusScale;
final double _wallpaperAlpha;
final double wallpaperOpacity;
int get wallpaperAlpha => _wallpaperAlpha.toInt();
int get wallpaperAlpha => wallpaperOpacity.toInt();
@override
ScaleConfig copyWith(
{bool? useVisualIndicators,
bool? preferBorders,
double? borderRadiusScale,
double? wallpaperAlpha}) =>
double? wallpaperOpacity}) =>
ScaleConfig(
useVisualIndicators: useVisualIndicators ?? this.useVisualIndicators,
preferBorders: preferBorders ?? this.preferBorders,
borderRadiusScale: borderRadiusScale ?? this.borderRadiusScale,
wallpaperAlpha: wallpaperAlpha ?? this._wallpaperAlpha,
wallpaperOpacity: wallpaperOpacity ?? this.wallpaperOpacity,
);
@override
@ -145,7 +145,7 @@ class ScaleConfig extends ThemeExtension<ScaleConfig> {
preferBorders: t < .5 ? preferBorders : other.preferBorders,
borderRadiusScale:
lerpDouble(borderRadiusScale, other.borderRadiusScale, t) ?? 1,
wallpaperAlpha:
lerpDouble(_wallpaperAlpha, other._wallpaperAlpha, t) ?? 1);
wallpaperOpacity:
lerpDouble(wallpaperOpacity, other.wallpaperOpacity, t) ?? 1);
}
}

View file

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'scale_input_decorator_theme.dart';
import 'scale_scheme.dart';
export 'scale_app_bar_theme.dart';
export 'scale_color.dart';
export 'scale_input_decorator_theme.dart';
export 'scale_scheme.dart';
@ -83,6 +84,24 @@ class ScaleTheme extends ThemeExtension<ScaleTheme> {
scheme.primaryScale.borderText, scheme.primaryScale.primary, 0.25);
});
WidgetStateProperty<Color?> checkboxFillColorWidgetStateProperty() =>
WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.selected)) {
if (states.contains(WidgetState.disabled)) {
return scheme.grayScale.primary.withAlpha(0x7F);
} else if (states.contains(WidgetState.pressed)) {
return scheme.primaryScale.hoverBorder;
} else if (states.contains(WidgetState.hovered)) {
return scheme.primaryScale.hoverBorder;
} else if (states.contains(WidgetState.focused)) {
return scheme.primaryScale.border;
}
return scheme.primaryScale.border;
} else {
return Colors.transparent;
}
});
// WidgetStateProperty<Color?> elementBackgroundWidgetStateProperty() {
// return null;
// }
@ -137,8 +156,10 @@ class ScaleTheme extends ThemeExtension<ScaleTheme> {
return scheme.primaryScale.subtleBorder;
})),
appBarTheme: baseThemeData.appBarTheme.copyWith(
backgroundColor: scheme.primaryScale.border,
foregroundColor: scheme.primaryScale.borderText),
backgroundColor: scheme.primaryScale.border,
foregroundColor: scheme.primaryScale.borderText,
toolbarHeight: 48,
),
bottomSheetTheme: baseThemeData.bottomSheetTheme.copyWith(
elevation: 0,
modalElevation: 0,
@ -147,6 +168,11 @@ class ScaleTheme extends ThemeExtension<ScaleTheme> {
topLeft: Radius.circular(16 * config.borderRadiusScale),
topRight: Radius.circular(16 * config.borderRadiusScale)))),
canvasColor: scheme.primaryScale.subtleBackground,
checkboxTheme: baseThemeData.checkboxTheme.copyWith(
side: BorderSide(color: scheme.primaryScale.border, width: 2),
checkColor: elementColorWidgetStateProperty(),
fillColor: checkboxFillColorWidgetStateProperty(),
),
chipTheme: baseThemeData.chipTheme.copyWith(
backgroundColor: scheme.primaryScale.elementBackground,
selectedColor: scheme.primaryScale.activeElementBackground,

View file

@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'scale_scheme.dart';
import 'scale_theme.dart';
class ScaleTileTheme {

View file

@ -1,6 +1,5 @@
import 'package:change_case/change_case.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
@ -50,7 +49,7 @@ enum ColorPreference {
}
@freezed
class ThemePreferences with _$ThemePreferences {
sealed class ThemePreferences with _$ThemePreferences {
const factory ThemePreferences({
@Default(BrightnessPreference.system)
BrightnessPreference brightnessPreference,
@ -103,7 +102,7 @@ extension ThemePreferencesExt on ThemePreferences {
useVisualIndicators: true,
preferBorders: false,
borderRadiusScale: 1,
wallpaperAlpha: 255),
wallpaperOpacity: 255),
primaryFront: Colors.black,
primaryBack: Colors.white,
secondaryFront: Colors.black,
@ -123,7 +122,7 @@ extension ThemePreferencesExt on ThemePreferences {
useVisualIndicators: true,
preferBorders: true,
borderRadiusScale: 0.2,
wallpaperAlpha: 208),
wallpaperOpacity: 208),
primaryFront: const Color(0xFF000000),
primaryBack: const Color(0xFF00FF00),
secondaryFront: const Color(0xFF000000),
@ -141,7 +140,7 @@ extension ThemePreferencesExt on ThemePreferences {
useVisualIndicators: true,
preferBorders: true,
borderRadiusScale: 0.2,
wallpaperAlpha: 192),
wallpaperOpacity: 192),
primaryFront: const Color(0xFF000000),
primaryBack: const Color(0xFF00FF00),
secondaryFront: const Color(0xFF000000),

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
@ -9,176 +10,32 @@ part of 'theme_preference.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
ThemePreferences _$ThemePreferencesFromJson(Map<String, dynamic> json) {
return _ThemePreferences.fromJson(json);
}
/// @nodoc
mixin _$ThemePreferences {
BrightnessPreference get brightnessPreference =>
throw _privateConstructorUsedError;
ColorPreference get colorPreference => throw _privateConstructorUsedError;
double get displayScale => throw _privateConstructorUsedError;
bool get enableWallpaper => throw _privateConstructorUsedError;
/// Serializes this ThemePreferences to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
BrightnessPreference get brightnessPreference;
ColorPreference get colorPreference;
double get displayScale;
bool get enableWallpaper;
/// Create a copy of ThemePreferences
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$ThemePreferencesCopyWith<ThemePreferences> get copyWith =>
throw _privateConstructorUsedError;
}
_$ThemePreferencesCopyWithImpl<ThemePreferences>(
this as ThemePreferences, _$identity);
/// @nodoc
abstract class $ThemePreferencesCopyWith<$Res> {
factory $ThemePreferencesCopyWith(
ThemePreferences value, $Res Function(ThemePreferences) then) =
_$ThemePreferencesCopyWithImpl<$Res, ThemePreferences>;
@useResult
$Res call(
{BrightnessPreference brightnessPreference,
ColorPreference colorPreference,
double displayScale,
bool enableWallpaper});
}
/// @nodoc
class _$ThemePreferencesCopyWithImpl<$Res, $Val extends ThemePreferences>
implements $ThemePreferencesCopyWith<$Res> {
_$ThemePreferencesCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ThemePreferences
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? brightnessPreference = null,
Object? colorPreference = null,
Object? displayScale = null,
Object? enableWallpaper = null,
}) {
return _then(_value.copyWith(
brightnessPreference: null == brightnessPreference
? _value.brightnessPreference
: brightnessPreference // ignore: cast_nullable_to_non_nullable
as BrightnessPreference,
colorPreference: null == colorPreference
? _value.colorPreference
: colorPreference // ignore: cast_nullable_to_non_nullable
as ColorPreference,
displayScale: null == displayScale
? _value.displayScale
: displayScale // ignore: cast_nullable_to_non_nullable
as double,
enableWallpaper: null == enableWallpaper
? _value.enableWallpaper
: enableWallpaper // ignore: cast_nullable_to_non_nullable
as bool,
) as $Val);
}
}
/// @nodoc
abstract class _$$ThemePreferencesImplCopyWith<$Res>
implements $ThemePreferencesCopyWith<$Res> {
factory _$$ThemePreferencesImplCopyWith(_$ThemePreferencesImpl value,
$Res Function(_$ThemePreferencesImpl) then) =
__$$ThemePreferencesImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{BrightnessPreference brightnessPreference,
ColorPreference colorPreference,
double displayScale,
bool enableWallpaper});
}
/// @nodoc
class __$$ThemePreferencesImplCopyWithImpl<$Res>
extends _$ThemePreferencesCopyWithImpl<$Res, _$ThemePreferencesImpl>
implements _$$ThemePreferencesImplCopyWith<$Res> {
__$$ThemePreferencesImplCopyWithImpl(_$ThemePreferencesImpl _value,
$Res Function(_$ThemePreferencesImpl) _then)
: super(_value, _then);
/// Create a copy of ThemePreferences
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? brightnessPreference = null,
Object? colorPreference = null,
Object? displayScale = null,
Object? enableWallpaper = null,
}) {
return _then(_$ThemePreferencesImpl(
brightnessPreference: null == brightnessPreference
? _value.brightnessPreference
: brightnessPreference // ignore: cast_nullable_to_non_nullable
as BrightnessPreference,
colorPreference: null == colorPreference
? _value.colorPreference
: colorPreference // ignore: cast_nullable_to_non_nullable
as ColorPreference,
displayScale: null == displayScale
? _value.displayScale
: displayScale // ignore: cast_nullable_to_non_nullable
as double,
enableWallpaper: null == enableWallpaper
? _value.enableWallpaper
: enableWallpaper // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
/// @nodoc
@JsonSerializable()
class _$ThemePreferencesImpl implements _ThemePreferences {
const _$ThemePreferencesImpl(
{this.brightnessPreference = BrightnessPreference.system,
this.colorPreference = ColorPreference.vapor,
this.displayScale = 1,
this.enableWallpaper = true});
factory _$ThemePreferencesImpl.fromJson(Map<String, dynamic> json) =>
_$$ThemePreferencesImplFromJson(json);
@override
@JsonKey()
final BrightnessPreference brightnessPreference;
@override
@JsonKey()
final ColorPreference colorPreference;
@override
@JsonKey()
final double displayScale;
@override
@JsonKey()
final bool enableWallpaper;
@override
String toString() {
return 'ThemePreferences(brightnessPreference: $brightnessPreference, colorPreference: $colorPreference, displayScale: $displayScale, enableWallpaper: $enableWallpaper)';
}
/// Serializes this ThemePreferences to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ThemePreferencesImpl &&
other is ThemePreferences &&
(identical(other.brightnessPreference, brightnessPreference) ||
other.brightnessPreference == brightnessPreference) &&
(identical(other.colorPreference, colorPreference) ||
@ -194,46 +51,181 @@ class _$ThemePreferencesImpl implements _ThemePreferences {
int get hashCode => Object.hash(runtimeType, brightnessPreference,
colorPreference, displayScale, enableWallpaper);
/// Create a copy of ThemePreferences
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ThemePreferencesImplCopyWith<_$ThemePreferencesImpl> get copyWith =>
__$$ThemePreferencesImplCopyWithImpl<_$ThemePreferencesImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$ThemePreferencesImplToJson(
this,
);
String toString() {
return 'ThemePreferences(brightnessPreference: $brightnessPreference, colorPreference: $colorPreference, displayScale: $displayScale, enableWallpaper: $enableWallpaper)';
}
}
abstract class _ThemePreferences implements ThemePreferences {
const factory _ThemePreferences(
{final BrightnessPreference brightnessPreference,
final ColorPreference colorPreference,
final double displayScale,
final bool enableWallpaper}) = _$ThemePreferencesImpl;
/// @nodoc
abstract mixin class $ThemePreferencesCopyWith<$Res> {
factory $ThemePreferencesCopyWith(
ThemePreferences value, $Res Function(ThemePreferences) _then) =
_$ThemePreferencesCopyWithImpl;
@useResult
$Res call(
{BrightnessPreference brightnessPreference,
ColorPreference colorPreference,
double displayScale,
bool enableWallpaper});
}
factory _ThemePreferences.fromJson(Map<String, dynamic> json) =
_$ThemePreferencesImpl.fromJson;
/// @nodoc
class _$ThemePreferencesCopyWithImpl<$Res>
implements $ThemePreferencesCopyWith<$Res> {
_$ThemePreferencesCopyWithImpl(this._self, this._then);
final ThemePreferences _self;
final $Res Function(ThemePreferences) _then;
/// Create a copy of ThemePreferences
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? brightnessPreference = null,
Object? colorPreference = null,
Object? displayScale = null,
Object? enableWallpaper = null,
}) {
return _then(_self.copyWith(
brightnessPreference: null == brightnessPreference
? _self.brightnessPreference
: brightnessPreference // ignore: cast_nullable_to_non_nullable
as BrightnessPreference,
colorPreference: null == colorPreference
? _self.colorPreference
: colorPreference // ignore: cast_nullable_to_non_nullable
as ColorPreference,
displayScale: null == displayScale
? _self.displayScale
: displayScale // ignore: cast_nullable_to_non_nullable
as double,
enableWallpaper: null == enableWallpaper
? _self.enableWallpaper
: enableWallpaper // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
/// @nodoc
@JsonSerializable()
class _ThemePreferences implements ThemePreferences {
const _ThemePreferences(
{this.brightnessPreference = BrightnessPreference.system,
this.colorPreference = ColorPreference.vapor,
this.displayScale = 1,
this.enableWallpaper = true});
factory _ThemePreferences.fromJson(Map<String, dynamic> json) =>
_$ThemePreferencesFromJson(json);
@override
BrightnessPreference get brightnessPreference;
@JsonKey()
final BrightnessPreference brightnessPreference;
@override
ColorPreference get colorPreference;
@JsonKey()
final ColorPreference colorPreference;
@override
double get displayScale;
@JsonKey()
final double displayScale;
@override
bool get enableWallpaper;
@JsonKey()
final bool enableWallpaper;
/// Create a copy of ThemePreferences
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ThemePreferencesImplCopyWith<_$ThemePreferencesImpl> get copyWith =>
throw _privateConstructorUsedError;
@pragma('vm:prefer-inline')
_$ThemePreferencesCopyWith<_ThemePreferences> get copyWith =>
__$ThemePreferencesCopyWithImpl<_ThemePreferences>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$ThemePreferencesToJson(
this,
);
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _ThemePreferences &&
(identical(other.brightnessPreference, brightnessPreference) ||
other.brightnessPreference == brightnessPreference) &&
(identical(other.colorPreference, colorPreference) ||
other.colorPreference == colorPreference) &&
(identical(other.displayScale, displayScale) ||
other.displayScale == displayScale) &&
(identical(other.enableWallpaper, enableWallpaper) ||
other.enableWallpaper == enableWallpaper));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, brightnessPreference,
colorPreference, displayScale, enableWallpaper);
@override
String toString() {
return 'ThemePreferences(brightnessPreference: $brightnessPreference, colorPreference: $colorPreference, displayScale: $displayScale, enableWallpaper: $enableWallpaper)';
}
}
/// @nodoc
abstract mixin class _$ThemePreferencesCopyWith<$Res>
implements $ThemePreferencesCopyWith<$Res> {
factory _$ThemePreferencesCopyWith(
_ThemePreferences value, $Res Function(_ThemePreferences) _then) =
__$ThemePreferencesCopyWithImpl;
@override
@useResult
$Res call(
{BrightnessPreference brightnessPreference,
ColorPreference colorPreference,
double displayScale,
bool enableWallpaper});
}
/// @nodoc
class __$ThemePreferencesCopyWithImpl<$Res>
implements _$ThemePreferencesCopyWith<$Res> {
__$ThemePreferencesCopyWithImpl(this._self, this._then);
final _ThemePreferences _self;
final $Res Function(_ThemePreferences) _then;
/// Create a copy of ThemePreferences
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$Res call({
Object? brightnessPreference = null,
Object? colorPreference = null,
Object? displayScale = null,
Object? enableWallpaper = null,
}) {
return _then(_ThemePreferences(
brightnessPreference: null == brightnessPreference
? _self.brightnessPreference
: brightnessPreference // ignore: cast_nullable_to_non_nullable
as BrightnessPreference,
colorPreference: null == colorPreference
? _self.colorPreference
: colorPreference // ignore: cast_nullable_to_non_nullable
as ColorPreference,
displayScale: null == displayScale
? _self.displayScale
: displayScale // ignore: cast_nullable_to_non_nullable
as double,
enableWallpaper: null == enableWallpaper
? _self.enableWallpaper
: enableWallpaper // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
// dart format on

View file

@ -6,9 +6,8 @@ part of 'theme_preference.dart';
// JsonSerializableGenerator
// **************************************************************************
_$ThemePreferencesImpl _$$ThemePreferencesImplFromJson(
Map<String, dynamic> json) =>
_$ThemePreferencesImpl(
_ThemePreferences _$ThemePreferencesFromJson(Map<String, dynamic> json) =>
_ThemePreferences(
brightnessPreference: json['brightness_preference'] == null
? BrightnessPreference.system
: BrightnessPreference.fromJson(json['brightness_preference']),
@ -19,8 +18,7 @@ _$ThemePreferencesImpl _$$ThemePreferencesImplFromJson(
enableWallpaper: json['enable_wallpaper'] as bool? ?? true,
);
Map<String, dynamic> _$$ThemePreferencesImplToJson(
_$ThemePreferencesImpl instance) =>
Map<String, dynamic> _$ThemePreferencesToJson(_ThemePreferences instance) =>
<String, dynamic>{
'brightness_preference': instance.brightnessPreference.toJson(),
'color_preference': instance.colorPreference.toJson(),

View file

@ -14,16 +14,12 @@ class ScannerErrorWidget extends StatelessWidget {
switch (error.errorCode) {
case MobileScannerErrorCode.controllerUninitialized:
errorMessage = 'Controller not ready.';
break;
case MobileScannerErrorCode.permissionDenied:
errorMessage = 'Permission denied';
break;
case MobileScannerErrorCode.unsupported:
errorMessage = 'Scanning is unsupported on this device';
break;
default:
errorMessage = 'Generic Error';
break;
}
return ColoredBox(

View file

@ -125,15 +125,13 @@ class SliderTile extends StatelessWidget {
child: ListTile(
onTap: onTap,
dense: true,
visualDensity:
const VisualDensity(horizontal: -4, vertical: -4),
title: Text(
title,
overflow: TextOverflow.fade,
softWrap: false,
),
subtitle: subtitle.isNotEmpty ? Text(subtitle) : null,
minTileHeight: 48,
minTileHeight: 52,
iconColor: scaleTileTheme.textColor,
textColor: scaleTileTheme.textColor,
leading:

View file

@ -11,6 +11,7 @@ AlertStyle _alertStyle(BuildContext context) {
return AlertStyle(
animationType: AnimationType.grow,
isCloseButton: false,
//animationDuration: const Duration(milliseconds: 200),
alertBorder: RoundedRectangleBorder(
side: !scaleConfig.useVisualIndicators
@ -131,7 +132,7 @@ Future<void> showErrorStacktraceModal(
);
}
Future<void> showWarningModal(
Future<void> showAlertModal(
{required BuildContext context,
required String title,
required String text}) async {
@ -139,7 +140,7 @@ Future<void> showWarningModal(
context: context,
style: _alertStyle(context),
useRootNavigator: false,
type: AlertType.warning,
type: AlertType.none,
title: title,
desc: text,
buttons: [
@ -161,7 +162,7 @@ Future<void> showWarningModal(
).show();
}
Future<void> showWarningWidgetModal(
Future<void> showAlertWidgetModal(
{required BuildContext context,
required String title,
required Widget child}) async {
@ -169,7 +170,7 @@ Future<void> showWarningWidgetModal(
context: context,
style: _alertStyle(context),
useRootNavigator: false,
type: AlertType.warning,
type: AlertType.none,
title: title,
content: child,
buttons: [

View file

@ -14,9 +14,13 @@ Widget buildSettingsPageWallpaperPreferences(
required ThemeSwitcherState switcher}) {
final preferencesRepository = PreferencesRepository.instance;
final themePreferences = preferencesRepository.value.themePreference;
final theme = Theme.of(context);
final textTheme = theme.textTheme;
return FormBuilderCheckbox(
name: formFieldEnableWallpaper,
title: Text(translate('settings_page.enable_wallpaper')),
title: Text(translate('settings_page.enable_wallpaper'),
style: textTheme.labelMedium),
initialValue: themePreferences.enableWallpaper,
onChanged: (value) async {
if (value != null) {

View file

@ -442,7 +442,7 @@ Widget styledTitleContainer({
color: borderColor ?? scale.primaryScale.border,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(12 * scaleConfig.borderRadiusScale),
BorderRadius.circular(8 * scaleConfig.borderRadiusScale),
)),
child: Column(children: [
Text(
@ -456,7 +456,7 @@ Widget styledTitleContainer({
backgroundColor ?? scale.primaryScale.subtleBackground,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
12 * scaleConfig.borderRadiusScale),
8 * scaleConfig.borderRadiusScale),
)),
child: child)
.paddingAll(4)

View file

@ -8,6 +8,7 @@ import 'package:intl/intl.dart';
import 'package:loggy/loggy.dart';
import 'package:veilid_support/veilid_support.dart';
import '../proto/proto.dart';
import '../veilid_processor/views/developer.dart';
import 'state_logger.dart';
@ -121,6 +122,7 @@ class CallbackPrinter extends LoggyPrinter {
callback?.call(record);
}
// Change callback function
// ignore: use_setters_to_change_properties
void setCallback(void Function(LogRecord)? cb) {
callback = cb;
@ -147,6 +149,7 @@ void initLoggy() {
logOptions: getLogOptions(null),
);
// Allow trace logging from the command line
// ignore: do_not_use_environment
const isTrace = String.fromEnvironment('LOG_TRACE') != '';
LogLevel logLevel;
@ -159,5 +162,8 @@ void initLoggy() {
Loggy('').level = getLogOptions(logLevel);
// Create state logger
registerVeilidProtoToDebug();
registerVeilidDHTProtoToDebug();
registerVeilidchatProtoToDebug();
Bloc.observer = const StateLogger();
}

View file

@ -1,5 +1,8 @@
import 'dart:convert';
import 'package:bloc/bloc.dart';
import 'package:loggy/loggy.dart';
import 'package:veilid_support/veilid_support.dart';
import 'loggy.dart';
const Map<String, LogLevel> _blocChangeLogLevels = {
@ -38,7 +41,12 @@ class StateLogger extends BlocObserver {
void onChange(BlocBase<dynamic> bloc, Change<dynamic> change) {
super.onChange(bloc, change);
_checkLogLevel(_blocChangeLogLevels, LogLevel.debug, bloc, (logLevel) {
log.log(logLevel, 'Change: ${bloc.runtimeType} $change');
const encoder = JsonEncoder.withIndent(' ', DynamicDebug.toDebug);
log.log(
logLevel,
'Change: ${bloc.runtimeType}\n'
'currentState: ${encoder.convert(change.currentState)}\n'
'nextState: ${encoder.convert(change.nextState)}\n');
});
}

View file

@ -4,7 +4,7 @@ import 'package:veilid_support/veilid_support.dart';
part 'processor_connection_state.freezed.dart';
@freezed
class ProcessorConnectionState with _$ProcessorConnectionState {
sealed class ProcessorConnectionState with _$ProcessorConnectionState {
const factory ProcessorConnectionState({
required VeilidStateAttachment attachment,
required VeilidStateNetwork network,

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
@ -9,157 +10,27 @@ part of 'processor_connection_state.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$ProcessorConnectionState {
VeilidStateAttachment get attachment => throw _privateConstructorUsedError;
VeilidStateNetwork get network => throw _privateConstructorUsedError;
VeilidStateAttachment get attachment;
VeilidStateNetwork get network;
/// Create a copy of ProcessorConnectionState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$ProcessorConnectionStateCopyWith<ProcessorConnectionState> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ProcessorConnectionStateCopyWith<$Res> {
factory $ProcessorConnectionStateCopyWith(ProcessorConnectionState value,
$Res Function(ProcessorConnectionState) then) =
_$ProcessorConnectionStateCopyWithImpl<$Res, ProcessorConnectionState>;
@useResult
$Res call({VeilidStateAttachment attachment, VeilidStateNetwork network});
$VeilidStateAttachmentCopyWith<$Res> get attachment;
$VeilidStateNetworkCopyWith<$Res> get network;
}
/// @nodoc
class _$ProcessorConnectionStateCopyWithImpl<$Res,
$Val extends ProcessorConnectionState>
implements $ProcessorConnectionStateCopyWith<$Res> {
_$ProcessorConnectionStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ProcessorConnectionState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? attachment = null,
Object? network = null,
}) {
return _then(_value.copyWith(
attachment: null == attachment
? _value.attachment
: attachment // ignore: cast_nullable_to_non_nullable
as VeilidStateAttachment,
network: null == network
? _value.network
: network // ignore: cast_nullable_to_non_nullable
as VeilidStateNetwork,
) as $Val);
}
/// Create a copy of ProcessorConnectionState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$VeilidStateAttachmentCopyWith<$Res> get attachment {
return $VeilidStateAttachmentCopyWith<$Res>(_value.attachment, (value) {
return _then(_value.copyWith(attachment: value) as $Val);
});
}
/// Create a copy of ProcessorConnectionState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$VeilidStateNetworkCopyWith<$Res> get network {
return $VeilidStateNetworkCopyWith<$Res>(_value.network, (value) {
return _then(_value.copyWith(network: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$ProcessorConnectionStateImplCopyWith<$Res>
implements $ProcessorConnectionStateCopyWith<$Res> {
factory _$$ProcessorConnectionStateImplCopyWith(
_$ProcessorConnectionStateImpl value,
$Res Function(_$ProcessorConnectionStateImpl) then) =
__$$ProcessorConnectionStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({VeilidStateAttachment attachment, VeilidStateNetwork network});
@override
$VeilidStateAttachmentCopyWith<$Res> get attachment;
@override
$VeilidStateNetworkCopyWith<$Res> get network;
}
/// @nodoc
class __$$ProcessorConnectionStateImplCopyWithImpl<$Res>
extends _$ProcessorConnectionStateCopyWithImpl<$Res,
_$ProcessorConnectionStateImpl>
implements _$$ProcessorConnectionStateImplCopyWith<$Res> {
__$$ProcessorConnectionStateImplCopyWithImpl(
_$ProcessorConnectionStateImpl _value,
$Res Function(_$ProcessorConnectionStateImpl) _then)
: super(_value, _then);
/// Create a copy of ProcessorConnectionState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? attachment = null,
Object? network = null,
}) {
return _then(_$ProcessorConnectionStateImpl(
attachment: null == attachment
? _value.attachment
: attachment // ignore: cast_nullable_to_non_nullable
as VeilidStateAttachment,
network: null == network
? _value.network
: network // ignore: cast_nullable_to_non_nullable
as VeilidStateNetwork,
));
}
}
/// @nodoc
class _$ProcessorConnectionStateImpl extends _ProcessorConnectionState {
const _$ProcessorConnectionStateImpl(
{required this.attachment, required this.network})
: super._();
@override
final VeilidStateAttachment attachment;
@override
final VeilidStateNetwork network;
@override
String toString() {
return 'ProcessorConnectionState(attachment: $attachment, network: $network)';
}
_$ProcessorConnectionStateCopyWithImpl<ProcessorConnectionState>(
this as ProcessorConnectionState, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ProcessorConnectionStateImpl &&
other is ProcessorConnectionState &&
(identical(other.attachment, attachment) ||
other.attachment == attachment) &&
(identical(other.network, network) || other.network == network));
@ -168,32 +39,176 @@ class _$ProcessorConnectionStateImpl extends _ProcessorConnectionState {
@override
int get hashCode => Object.hash(runtimeType, attachment, network);
@override
String toString() {
return 'ProcessorConnectionState(attachment: $attachment, network: $network)';
}
}
/// @nodoc
abstract mixin class $ProcessorConnectionStateCopyWith<$Res> {
factory $ProcessorConnectionStateCopyWith(ProcessorConnectionState value,
$Res Function(ProcessorConnectionState) _then) =
_$ProcessorConnectionStateCopyWithImpl;
@useResult
$Res call({VeilidStateAttachment attachment, VeilidStateNetwork network});
$VeilidStateAttachmentCopyWith<$Res> get attachment;
$VeilidStateNetworkCopyWith<$Res> get network;
}
/// @nodoc
class _$ProcessorConnectionStateCopyWithImpl<$Res>
implements $ProcessorConnectionStateCopyWith<$Res> {
_$ProcessorConnectionStateCopyWithImpl(this._self, this._then);
final ProcessorConnectionState _self;
final $Res Function(ProcessorConnectionState) _then;
/// Create a copy of ProcessorConnectionState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? attachment = null,
Object? network = null,
}) {
return _then(_self.copyWith(
attachment: null == attachment
? _self.attachment
: attachment // ignore: cast_nullable_to_non_nullable
as VeilidStateAttachment,
network: null == network
? _self.network
: network // ignore: cast_nullable_to_non_nullable
as VeilidStateNetwork,
));
}
/// Create a copy of ProcessorConnectionState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ProcessorConnectionStateImplCopyWith<_$ProcessorConnectionStateImpl>
get copyWith => __$$ProcessorConnectionStateImplCopyWithImpl<
_$ProcessorConnectionStateImpl>(this, _$identity);
$VeilidStateAttachmentCopyWith<$Res> get attachment {
return $VeilidStateAttachmentCopyWith<$Res>(_self.attachment, (value) {
return _then(_self.copyWith(attachment: value));
});
}
/// Create a copy of ProcessorConnectionState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$VeilidStateNetworkCopyWith<$Res> get network {
return $VeilidStateNetworkCopyWith<$Res>(_self.network, (value) {
return _then(_self.copyWith(network: value));
});
}
}
abstract class _ProcessorConnectionState extends ProcessorConnectionState {
const factory _ProcessorConnectionState(
{required final VeilidStateAttachment attachment,
required final VeilidStateNetwork network}) =
_$ProcessorConnectionStateImpl;
const _ProcessorConnectionState._() : super._();
/// @nodoc
class _ProcessorConnectionState extends ProcessorConnectionState {
const _ProcessorConnectionState(
{required this.attachment, required this.network})
: super._();
@override
VeilidStateAttachment get attachment;
final VeilidStateAttachment attachment;
@override
VeilidStateNetwork get network;
final VeilidStateNetwork network;
/// Create a copy of ProcessorConnectionState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ProcessorConnectionStateImplCopyWith<_$ProcessorConnectionStateImpl>
get copyWith => throw _privateConstructorUsedError;
@pragma('vm:prefer-inline')
_$ProcessorConnectionStateCopyWith<_ProcessorConnectionState> get copyWith =>
__$ProcessorConnectionStateCopyWithImpl<_ProcessorConnectionState>(
this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _ProcessorConnectionState &&
(identical(other.attachment, attachment) ||
other.attachment == attachment) &&
(identical(other.network, network) || other.network == network));
}
@override
int get hashCode => Object.hash(runtimeType, attachment, network);
@override
String toString() {
return 'ProcessorConnectionState(attachment: $attachment, network: $network)';
}
}
/// @nodoc
abstract mixin class _$ProcessorConnectionStateCopyWith<$Res>
implements $ProcessorConnectionStateCopyWith<$Res> {
factory _$ProcessorConnectionStateCopyWith(_ProcessorConnectionState value,
$Res Function(_ProcessorConnectionState) _then) =
__$ProcessorConnectionStateCopyWithImpl;
@override
@useResult
$Res call({VeilidStateAttachment attachment, VeilidStateNetwork network});
@override
$VeilidStateAttachmentCopyWith<$Res> get attachment;
@override
$VeilidStateNetworkCopyWith<$Res> get network;
}
/// @nodoc
class __$ProcessorConnectionStateCopyWithImpl<$Res>
implements _$ProcessorConnectionStateCopyWith<$Res> {
__$ProcessorConnectionStateCopyWithImpl(this._self, this._then);
final _ProcessorConnectionState _self;
final $Res Function(_ProcessorConnectionState) _then;
/// Create a copy of ProcessorConnectionState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$Res call({
Object? attachment = null,
Object? network = null,
}) {
return _then(_ProcessorConnectionState(
attachment: null == attachment
? _self.attachment
: attachment // ignore: cast_nullable_to_non_nullable
as VeilidStateAttachment,
network: null == network
? _self.network
: network // ignore: cast_nullable_to_non_nullable
as VeilidStateNetwork,
));
}
/// Create a copy of ProcessorConnectionState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$VeilidStateAttachmentCopyWith<$Res> get attachment {
return $VeilidStateAttachmentCopyWith<$Res>(_self.attachment, (value) {
return _then(_self.copyWith(attachment: value));
});
}
/// Create a copy of ProcessorConnectionState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$VeilidStateNetworkCopyWith<$Res> get network {
return $VeilidStateNetworkCopyWith<$Res>(_self.network, (value) {
return _then(_self.copyWith(network: value));
});
}
}
// dart format on

View file

@ -44,13 +44,6 @@ class ProcessorRepository {
log.info('Veilid version: $veilidVersion');
// HACK: In case of hot restart shut down first
try {
await Veilid.instance.shutdownVeilidCore();
} on Exception {
// Do nothing on failure here
}
final updateStream = await Veilid.instance
.startupVeilidCore(await getVeilidConfig(kIsWeb, VeilidChatApp.name));
_updateSubscription = updateStream.listen((update) {

View file

@ -5,9 +5,11 @@
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/
# IntelliJ related

View file

@ -36,6 +36,51 @@ void main() {
setUpAll(veilidFixture.attach);
tearDownAll(veilidFixture.detach);
group('DHT Support Tests', () {
setUpAll(updateProcessorFixture.setUp);
setUpAll(tickerFixture.setUp);
tearDownAll(tickerFixture.tearDown);
tearDownAll(updateProcessorFixture.tearDown);
test('create pool', testDHTRecordPoolCreate);
group('DHTRecordPool Tests', () {
setUpAll(dhtRecordPoolFixture.setUp);
tearDownAll(dhtRecordPoolFixture.tearDown);
test('create/delete record', testDHTRecordCreateDelete);
test('record scopes', testDHTRecordScopes);
test('create/delete deep record', testDHTRecordDeepCreateDelete);
});
group('DHTShortArray Tests', () {
setUpAll(dhtRecordPoolFixture.setUp);
tearDownAll(dhtRecordPoolFixture.tearDown);
for (final stride in [256, 16 /*64, 32, 16, 8, 4, 2, 1 */]) {
test('create shortarray stride=$stride',
makeTestDHTShortArrayCreateDelete(stride: stride));
test('add shortarray stride=$stride',
makeTestDHTShortArrayAdd(stride: stride));
}
});
group('DHTLog Tests', () {
setUpAll(dhtRecordPoolFixture.setUp);
tearDownAll(dhtRecordPoolFixture.tearDown);
for (final stride in [256, 16 /*64, 32, 16, 8, 4, 2, 1 */]) {
test('create log stride=$stride',
makeTestDHTLogCreateDelete(stride: stride));
test(
timeout: const Timeout(Duration(seconds: 480)),
'add/truncate log stride=$stride',
makeTestDHTLogAddTruncate(stride: stride),
);
}
});
});
group('TableDB Tests', () {
group('TableDBArray Tests', () {
// test('create/delete TableDBArray', testTableDBArrayCreateDelete);
@ -146,51 +191,6 @@ void main() {
});
});
});
group('DHT Support Tests', () {
setUpAll(updateProcessorFixture.setUp);
setUpAll(tickerFixture.setUp);
tearDownAll(tickerFixture.tearDown);
tearDownAll(updateProcessorFixture.tearDown);
test('create pool', testDHTRecordPoolCreate);
group('DHTRecordPool Tests', () {
setUpAll(dhtRecordPoolFixture.setUp);
tearDownAll(dhtRecordPoolFixture.tearDown);
test('create/delete record', testDHTRecordCreateDelete);
test('record scopes', testDHTRecordScopes);
test('create/delete deep record', testDHTRecordDeepCreateDelete);
});
group('DHTShortArray Tests', () {
setUpAll(dhtRecordPoolFixture.setUp);
tearDownAll(dhtRecordPoolFixture.tearDown);
for (final stride in [256, 16 /*64, 32, 16, 8, 4, 2, 1 */]) {
test('create shortarray stride=$stride',
makeTestDHTShortArrayCreateDelete(stride: stride));
test('add shortarray stride=$stride',
makeTestDHTShortArrayAdd(stride: stride));
}
});
group('DHTLog Tests', () {
setUpAll(dhtRecordPoolFixture.setUp);
tearDownAll(dhtRecordPoolFixture.tearDown);
for (final stride in [256, 16 /*64, 32, 16, 8, 4, 2, 1 */]) {
test('create log stride=$stride',
makeTestDHTLogCreateDelete(stride: stride));
test(
timeout: const Timeout(Duration(seconds: 480)),
'add/truncate log stride=$stride',
makeTestDHTLogAddTruncate(stride: stride),
);
}
});
});
});
});
}

View file

@ -21,9 +21,9 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
veilid: a54f57b7bcf0e4e072fe99272d76ca126b2026d0
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
veilid: 319e2e78836d7b3d08203596d0b4a0e244b68d29
PODFILE CHECKSUM: 16208599a12443d53889ba2270a4985981cfb204
COCOAPODS: 1.15.2
COCOAPODS: 1.16.2

View file

@ -59,6 +59,7 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
enableGPUValidationMode = "1"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">

View file

@ -6,4 +6,8 @@ class AppDelegate: FlutterAppDelegate {
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
}
override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
return true
}
}

View file

@ -5,31 +5,26 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: "16e298750b6d0af7ce8a3ba7c18c69c3785d11b15ec83f6dcd0ad2a0009b3cab"
sha256: dc27559385e905ad30838356c5f5d574014ba39872d732111cd07ac0beff4c57
url: "https://pub.dev"
source: hosted
version: "76.0.0"
_macros:
dependency: transitive
description: dart
source: sdk
version: "0.3.3"
version: "80.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
sha256: "1f14db053a8c23e260789e9b0980fa27f2680dd640932cae5e1137cce0e46e1e"
sha256: "192d1c5b944e7e53b24b5586db760db934b177d4147c42fbca8c8c5f1eb8d11e"
url: "https://pub.dev"
source: hosted
version: "6.11.0"
version: "7.3.0"
args:
dependency: transitive
description:
name: args
sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6
sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04
url: "https://pub.dev"
source: hosted
version: "2.6.0"
version: "2.7.0"
async:
dependency: transitive
description:
@ -42,26 +37,26 @@ packages:
dependency: "direct dev"
description:
name: async_tools
sha256: bbded696bfcb1437d0ca510ac047f261f9c7494fea2c488dd32ba2800e7f49e8
sha256: afd5426e76631172f8ce6a6359b264b092fa9d2a52cd2528100115be9525e067
url: "https://pub.dev"
source: hosted
version: "0.1.7"
version: "0.1.9"
bloc:
dependency: transitive
description:
name: bloc
sha256: "106842ad6569f0b60297619e9e0b1885c2fb9bf84812935490e6c5275777804e"
sha256: "52c10575f4445c61dd9e0cafcc6356fdd827c4c64dd7945ef3c4105f6b6ac189"
url: "https://pub.dev"
source: hosted
version: "8.1.4"
version: "9.0.0"
bloc_advanced_tools:
dependency: transitive
description:
name: bloc_advanced_tools
sha256: d8a680d8a0469456399fb26bae9f7a1d2a1420b5bdf75e204e0fadab9edb0811
sha256: "7c7f294b425552c2d4831b01ad0d3e1f33f2bdf9acfb7b639caa072781d228cf"
url: "https://pub.dev"
source: hosted
version: "0.1.8"
version: "0.1.10"
boolean_selector:
dependency: transitive
description:
@ -162,18 +157,18 @@ packages:
dependency: transitive
description:
name: fast_immutable_collections
sha256: c3c73f4f989d3302066e4ec94e6ec73b5dc872592d02194f49f1352d64126b8c
sha256: "95a69b9380483dff49ae2c12c9eb92e2b4e1aeff481a33c2a20883471771598a"
url: "https://pub.dev"
source: hosted
version: "10.2.4"
version: "11.0.3"
ffi:
dependency: transitive
description:
name: ffi
sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6"
sha256: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418"
url: "https://pub.dev"
source: hosted
version: "2.1.3"
version: "2.1.4"
file:
dependency: transitive
description:
@ -214,10 +209,10 @@ packages:
dependency: transitive
description:
name: freezed_annotation
sha256: c2e2d632dd9b8a2b7751117abcfc2b4888ecfe181bd9fca7170d9ef02e595fe2
sha256: c87ff004c8aa6af2d531668b46a4ea379f7191dc6dfa066acd53d506da6e044b
url: "https://pub.dev"
source: hosted
version: "2.4.4"
version: "3.0.0"
frontend_server_client:
dependency: transitive
description:
@ -280,10 +275,10 @@ packages:
dependency: transitive
description:
name: js
sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf
sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc"
url: "https://pub.dev"
source: hosted
version: "0.7.1"
version: "0.7.2"
json_annotation:
dependency: transitive
description:
@ -320,10 +315,10 @@ packages:
dependency: "direct dev"
description:
name: lint_hard
sha256: "638d2cce6d3d5499826be71311d18cded797a51351eaa1aee7a35a2f0f9bc46e"
sha256: ffe7058cb49e021d244d67e650a63380445b56643c2849c6929e938246b99058
url: "https://pub.dev"
source: hosted
version: "5.0.0"
version: "6.0.0"
logging:
dependency: transitive
description:
@ -340,14 +335,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.3"
macros:
dependency: transitive
description:
name: macros
sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656"
url: "https://pub.dev"
source: hosted
version: "0.1.3-main.0"
matcher:
dependency: transitive
description:
@ -392,10 +379,10 @@ packages:
dependency: transitive
description:
name: package_config
sha256: "92d4488434b520a62570293fbd33bb556c7d49230791c1b4bbd973baf6d2dc67"
sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "2.2.0"
path:
dependency: transitive
description:
@ -416,10 +403,10 @@ packages:
dependency: transitive
description:
name: path_provider_android
sha256: "4adf4fd5423ec60a29506c76581bc05854c55e3a0b72d35bb28d661c9686edf2"
sha256: "0ca7359dad67fd7063cb2892ab0c0737b2daafd807cf1acecd62374c8fae6c12"
url: "https://pub.dev"
source: hosted
version: "2.2.15"
version: "2.2.16"
path_provider_foundation:
dependency: transitive
description:
@ -496,10 +483,10 @@ packages:
dependency: transitive
description:
name: pub_semver
sha256: "7b3cfbf654f3edd0c6298ecd5be782ce997ddf0e00531b9464b55245185bbbbd"
sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585"
url: "https://pub.dev"
source: hosted
version: "2.1.5"
version: "2.2.0"
shelf:
dependency: transitive
description:
@ -528,10 +515,10 @@ packages:
dependency: transitive
description:
name: shelf_web_socket
sha256: cc36c297b52866d203dbf9332263c94becc2fe0ceaa9681d07b6ef9807023b67
sha256: "3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "3.0.0"
sky_engine:
dependency: transitive
description: flutter
@ -698,10 +685,10 @@ packages:
dependency: transitive
description:
name: web
sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb
sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
version: "1.1.1"
web_socket:
dependency: transitive
description:
@ -751,5 +738,5 @@ packages:
source: hosted
version: "3.1.3"
sdks:
dart: ">=3.7.0-0 <4.0.0"
flutter: ">=3.24.0"
dart: ">=3.7.0 <4.0.0"
flutter: ">=3.27.0"

View file

@ -14,11 +14,11 @@ dependencies:
path: ../
dev_dependencies:
async_tools: ^0.1.6
async_tools: ^0.1.9
integration_test:
sdk: flutter
lint_hard: ^5.0.0
test: ^1.25.2
lint_hard: ^6.0.0
test: ^1.25.15
veilid_test:
path: ../../../../veilid/veilid-flutter/packages/veilid_test

View file

@ -5,13 +5,12 @@
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:example/main.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:example/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
testWidgets('Counter increments smoke test', (tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());

View file

@ -1,5 +1,6 @@
import '../../proto/dht.pb.dart' as dhtproto;
import '../../proto/proto.dart' as veilidproto;
import '../../src/dynamic_debug.dart';
import '../dht_support.dart';
export '../../proto/dht.pb.dart';
@ -23,3 +24,44 @@ extension ProtoOwnedDHTRecordPointer on dhtproto.OwnedDHTRecordPointer {
OwnedDHTRecordPointer toVeilid() => OwnedDHTRecordPointer(
recordKey: recordKey.toVeilid(), owner: owner.toVeilid());
}
void registerVeilidDHTProtoToDebug() {
dynamic toDebug(dynamic obj) {
if (obj is dhtproto.OwnedDHTRecordPointer) {
return {
r'$runtimeType': obj.runtimeType,
'recordKey': obj.recordKey,
'owner': obj.owner,
};
}
if (obj is dhtproto.DHTData) {
return {
r'$runtimeType': obj.runtimeType,
'keys': obj.keys,
'hash': obj.hash,
'chunk': obj.chunk,
'size': obj.size
};
}
if (obj is dhtproto.DHTLog) {
return {
r'$runtimeType': obj.runtimeType,
'head': obj.head,
'tail': obj.tail,
'stride': obj.stride,
};
}
if (obj is dhtproto.DHTShortArray) {
return {
r'$runtimeType': obj.runtimeType,
'keys': obj.keys,
'index': obj.index,
'seqs': obj.seqs,
};
}
return obj;
}
DynamicDebug.registerToDebug(toDebug);
}

View file

@ -171,32 +171,31 @@ class DHTLog implements DHTDeleteable<DHTLog> {
/// Add a reference to this log
@override
Future<void> ref() async => _mutex.protect(() async {
_openCount++;
});
void ref() {
_openCount++;
}
/// Free all resources for the DHTLog
@override
Future<bool> close() async => _mutex.protect(() async {
if (_openCount == 0) {
throw StateError('already closed');
}
_openCount--;
if (_openCount != 0) {
return false;
}
await _watchController?.close();
_watchController = null;
await _spine.close();
return true;
});
Future<bool> close() async {
if (_openCount == 0) {
throw StateError('already closed');
}
_openCount--;
if (_openCount != 0) {
return false;
}
//
await _watchController?.close();
_watchController = null;
await _spine.close();
return true;
}
/// Free all resources for the DHTLog and delete it from the DHT
/// Will wait until the short array is closed to delete it
@override
Future<void> delete() async {
await _spine.delete();
}
Future<bool> delete() => _spine.delete();
////////////////////////////////////////////////////////////////////////////
// Public API
@ -306,7 +305,6 @@ class DHTLog implements DHTDeleteable<DHTLog> {
// Openable
int _openCount;
final _mutex = Mutex(debugLockTimeout: kIsDebugMode ? 60 : null);
// Watch mutex to ensure we keep the representation valid
final Mutex _listenMutex = Mutex(debugLockTimeout: kIsDebugMode ? 60 : null);

View file

@ -31,6 +31,14 @@ class DHTLogStateData<T> extends Equatable {
@override
List<Object?> get props => [length, window, windowTail, windowSize, follow];
@override
String toString() => 'DHTLogStateData('
'length: $length, '
'windowTail: $windowTail, '
'windowSize: $windowSize, '
'follow: $follow, '
'window: ${DynamicDebug.toDebug(window)})';
}
typedef DHTLogState<T> = AsyncValue<DHTLogStateData<T>>;

View file

@ -24,13 +24,11 @@ class _DHTLogPosition extends DHTCloseable<DHTShortArray> {
/// Add a reference to this log
@override
Future<void> ref() async {
await shortArray.ref();
}
void ref() => shortArray.ref();
/// Free all resources for the DHTLogPosition
@override
Future<bool> close() async => _dhtLogSpine._segmentClosed(_segmentNumber);
Future<bool> close() => _dhtLogSpine._segmentClosed(_segmentNumber);
}
class _DHTLogSegmentLookup extends Equatable {
@ -124,18 +122,11 @@ class _DHTLogSpine {
});
}
Future<void> delete() async {
await _spineMutex.protect(() async {
// Will deep delete all segment records as they are children
await _spineRecord.delete();
});
}
// Will deep delete all segment records as they are children
Future<bool> delete() async => _spineMutex.protect(_spineRecord.delete);
Future<T> operate<T>(Future<T> Function(_DHTLogSpine) closure) async =>
// ignore: prefer_expression_function_bodies
_spineMutex.protect(() async {
return closure(this);
});
_spineMutex.protect(() async => closure(this));
Future<T> operateAppend<T>(Future<T> Function(_DHTLogSpine) closure) async =>
_spineMutex.protect(() async {
@ -431,7 +422,7 @@ class _DHTLogSpine {
late DHTShortArray shortArray;
if (openedSegment != null) {
// If so, return a ref
await openedSegment.ref();
openedSegment.ref();
shortArray = openedSegment;
} else {
// Otherwise open a segment
@ -453,7 +444,7 @@ class _DHTLogSpine {
// LRU cache the segment number
if (!_openCache.remove(segmentNumber)) {
// If this is new to the cache ref it when it goes in
await shortArray.ref();
shortArray.ref();
}
_openCache.add(segmentNumber);
if (_openCache.length > _openCacheSize) {

View file

@ -64,34 +64,35 @@ class DHTRecord implements DHTDeleteable<DHTRecord> {
/// Add a reference to this DHTRecord
@override
Future<void> ref() async => _mutex.protect(() async {
_openCount++;
});
void ref() {
_openCount++;
}
/// Free all resources for the DHTRecord
@override
Future<bool> close() async => _mutex.protect(() async {
if (_openCount == 0) {
throw StateError('already closed');
}
_openCount--;
if (_openCount != 0) {
return false;
}
Future<bool> close() async {
if (_openCount == 0) {
throw StateError('already closed');
}
_openCount--;
if (_openCount != 0) {
return false;
}
await serialFutureClose((this, _sfListen));
await _watchController?.close();
_watchController = null;
await DHTRecordPool.instance._recordClosed(this);
return true;
});
await _watchController?.close();
_watchController = null;
await serialFutureClose((this, _sfListen));
await DHTRecordPool.instance._recordClosed(this);
return true;
}
/// Free all resources for the DHTRecord and delete it from the DHT
/// Will wait until the record is closed to delete it
/// Returns true if the deletion was processed immediately
/// Returns false if the deletion was marked for later
@override
Future<void> delete() async => _mutex.protect(() async {
await DHTRecordPool.instance.deleteRecord(key);
});
Future<bool> delete() async => DHTRecordPool.instance.deleteRecord(key);
////////////////////////////////////////////////////////////////////////////
// Public API
@ -510,7 +511,7 @@ class DHTRecord implements DHTDeleteable<DHTRecord> {
key,
subkeys: [ValueSubkeyRange.single(subkey)],
);
return rr.localSeqs.firstOrNull ?? 0xFFFFFFFF;
return rr.localSeqs.firstOrNull ?? emptySeq;
}
void _addValueChange(
@ -562,8 +563,9 @@ class DHTRecord implements DHTDeleteable<DHTRecord> {
final KeyPair? _writer;
final VeilidCrypto _crypto;
final String debugName;
final _mutex = Mutex(debugLockTimeout: kIsDebugMode ? 60 : null);
int _openCount;
StreamController<DHTRecordWatchChange>? _watchController;
_WatchState? _watchState;
static const int emptySeq = 0xFFFFFFFF;
}

View file

@ -9,6 +9,7 @@ import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:protobuf/protobuf.dart';
import '../../../../veilid_support.dart';
import 'extensions.dart';
export 'package:fast_immutable_collections/fast_immutable_collections.dart'
show Output;
@ -32,7 +33,7 @@ typedef DHTRecordPoolLogger = void Function(String message);
/// Record pool that managed DHTRecords and allows for tagged deletion
/// String versions of keys due to IMap<> json unsupported in key
@freezed
class DHTRecordPoolAllocations with _$DHTRecordPoolAllocations {
sealed class DHTRecordPoolAllocations with _$DHTRecordPoolAllocations {
const factory DHTRecordPoolAllocations({
@Default(IMapConst<String, ISet<TypedKey>>({}))
IMap<String, ISet<TypedKey>> childrenByParent,
@ -49,7 +50,7 @@ class DHTRecordPoolAllocations with _$DHTRecordPoolAllocations {
/// Pointer to an owned record, with key, owner key and owner secret
/// Ensure that these are only serialized encrypted
@freezed
class OwnedDHTRecordPointer with _$OwnedDHTRecordPointer {
sealed class OwnedDHTRecordPointer with _$OwnedDHTRecordPointer {
const factory OwnedDHTRecordPointer({
required TypedKey recordKey,
required KeyPair owner,
@ -479,25 +480,29 @@ class DHTRecordPool with TableDBBackedJson<DHTRecordPoolAllocations> {
// Called when a DHTRecord is closed
// Cleans up the opened record housekeeping and processes any late deletions
Future<void> _recordClosed(DHTRecord record) async {
await _recordTagLock.protect(record.key,
closure: () => _mutex.protect(() async {
final key = record.key;
final key = record.key;
await _recordTagLock.protect(key, closure: () async {
await _mutex.protect(() async {
log('closeDHTRecord: debugName=${record.debugName} key=$key');
log('closeDHTRecord: debugName=${record.debugName} key=$key');
final openedRecordInfo = _opened[key];
if (openedRecordInfo == null ||
!openedRecordInfo.records.remove(record)) {
throw StateError('record already closed');
}
if (openedRecordInfo.records.isNotEmpty) {
return;
}
_opened.remove(key);
await _routingContext.closeDHTRecord(key);
await _checkForLateDeletesInner(key);
});
final openedRecordInfo = _opened[key];
if (openedRecordInfo == null ||
!openedRecordInfo.records.remove(record)) {
throw StateError('record already closed');
}
if (openedRecordInfo.records.isEmpty) {
await _watchStateProcessors.remove(key);
await _routingContext.closeDHTRecord(key);
_opened.remove(key);
await _checkForLateDeletesInner(key);
}
}));
// This happens after the mutex is released
// because the record has already been removed from _opened
// which means that updates to the state processor won't happen
await _watchStateProcessors.remove(key);
});
}
// Check to see if this key can finally be deleted
@ -839,8 +844,12 @@ class DHTRecordPool with TableDBBackedJson<DHTRecordPoolAllocations> {
log('Timeout in watch cancel for key=$openedRecordKey');
} on VeilidAPIException catch (e) {
// Failed to cancel DHT watch, try again next tick
log('Exception in watch cancel for key=$openedRecordKey: $e');
log('VeilidAPIException in watch cancel for key=$openedRecordKey: $e');
} catch (e) {
log('Unhandled exception in watch cancel for key=$openedRecordKey: $e');
rethrow;
}
return;
}
@ -883,7 +892,10 @@ class DHTRecordPool with TableDBBackedJson<DHTRecordPoolAllocations> {
log('Timeout in watch update for key=$openedRecordKey');
} on VeilidAPIException catch (e) {
// Failed to update DHT watch, try again next tick
log('Exception in watch update for key=$openedRecordKey: $e');
log('VeilidAPIException in watch update for key=$openedRecordKey: $e');
} catch (e) {
log('Unhandled exception in watch update for key=$openedRecordKey: $e');
rethrow;
}
// If we still need a state update after this then do a poll instead
@ -900,28 +912,29 @@ class DHTRecordPool with TableDBBackedJson<DHTRecordPoolAllocations> {
singleFuture((this, _sfPollWatch, openedRecordKey), () async {
final dhtctx = openedRecordInfo.shared.defaultRoutingContext;
// Get single subkey to poll
// XXX: veilid api limits this for now until everyone supports
// inspectDHTRecord
final pollSubkey = unionWatchState.subkeys?.firstSubkey;
if (pollSubkey == null) {
return;
final currentReport = await dhtctx.inspectDHTRecord(openedRecordKey,
subkeys: unionWatchState.subkeys, scope: DHTReportScope.syncGet);
final fsc = currentReport.firstSeqChange;
if (fsc == null) {
return null;
}
final pollSubkeys = [ValueSubkeyRange.single(pollSubkey)];
final newerSubkeys = currentReport.newerSubkeys;
final currentReport =
await dhtctx.inspectDHTRecord(openedRecordKey, subkeys: pollSubkeys);
final currentSeq = currentReport.localSeqs.firstOrNull ?? -1;
final valueData = await dhtctx.getDHTValue(openedRecordKey, pollSubkey,
final valueData = await dhtctx.getDHTValue(openedRecordKey, fsc.subkey,
forceRefresh: true);
if (valueData == null) {
return;
}
if (valueData.seq > currentSeq) {
if (valueData.seq < fsc.newSeq) {
log('inspect returned a newer seq than get: ${valueData.seq} < $fsc');
}
if (valueData.seq > fsc.oldSeq && valueData.seq != DHTRecord.emptySeq) {
processRemoteValueChange(VeilidUpdateValueChange(
key: openedRecordKey,
subkeys: pollSubkeys,
subkeys: newerSubkeys,
count: 0xFFFFFFFF,
value: valueData));
}
@ -929,40 +942,37 @@ class DHTRecordPool with TableDBBackedJson<DHTRecordPoolAllocations> {
}
/// Ticker to check watch state change requests
Future<void> tick() async {
final now = veilid.now();
Future<void> tick() async => _mutex.protect(() async {
// See if any opened records need watch state changes
final now = veilid.now();
for (final kv in _opened.entries) {
final openedRecordKey = kv.key;
final openedRecordInfo = kv.value;
await _mutex.protect(() async {
// See if any opened records need watch state changes
for (final kv in _opened.entries) {
final openedRecordKey = kv.key;
final openedRecordInfo = kv.value;
var wantsWatchStateUpdate =
openedRecordInfo.shared.needsWatchStateUpdate;
var wantsWatchStateUpdate =
openedRecordInfo.shared.needsWatchStateUpdate;
// Check if we have reached renewal time for the watch
if (openedRecordInfo.shared.unionWatchState != null &&
openedRecordInfo.shared.unionWatchState!.renewalTime != null &&
now.value >
openedRecordInfo.shared.unionWatchState!.renewalTime!.value) {
wantsWatchStateUpdate = true;
}
// Check if we have reached renewal time for the watch
if (openedRecordInfo.shared.unionWatchState != null &&
openedRecordInfo.shared.unionWatchState!.renewalTime != null &&
now.value >
openedRecordInfo.shared.unionWatchState!.renewalTime!.value) {
wantsWatchStateUpdate = true;
if (wantsWatchStateUpdate) {
// Update union watch state
final unionWatchState =
_collectUnionWatchState(openedRecordInfo.records);
_watchStateProcessors.updateState(
openedRecordKey,
unionWatchState,
(newState) =>
_watchStateChange(openedRecordKey, unionWatchState));
}
}
if (wantsWatchStateUpdate) {
// Update union watch state
final unionWatchState =
_collectUnionWatchState(openedRecordInfo.records);
_watchStateProcessors.updateState(
openedRecordKey,
unionWatchState,
(newState) =>
_watchStateChange(openedRecordKey, unionWatchState));
}
}
});
}
});
//////////////////////////////////////////////////////////////
// AsyncTableDBBacked

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
@ -9,183 +10,32 @@ part of 'dht_record_pool.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
DHTRecordPoolAllocations _$DHTRecordPoolAllocationsFromJson(
Map<String, dynamic> json) {
return _DHTRecordPoolAllocations.fromJson(json);
}
/// @nodoc
mixin _$DHTRecordPoolAllocations {
IMap<String, ISet<Typed<FixedEncodedString43>>> get childrenByParent =>
throw _privateConstructorUsedError;
IMap<String, Typed<FixedEncodedString43>> get parentByChild =>
throw _privateConstructorUsedError;
ISet<Typed<FixedEncodedString43>> get rootRecords =>
throw _privateConstructorUsedError;
IMap<String, String> get debugNames => throw _privateConstructorUsedError;
/// Serializes this DHTRecordPoolAllocations to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
IMap<String, ISet<TypedKey>> get childrenByParent;
IMap<String, TypedKey> get parentByChild;
ISet<TypedKey> get rootRecords;
IMap<String, String> get debugNames;
/// Create a copy of DHTRecordPoolAllocations
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$DHTRecordPoolAllocationsCopyWith<DHTRecordPoolAllocations> get copyWith =>
throw _privateConstructorUsedError;
}
_$DHTRecordPoolAllocationsCopyWithImpl<DHTRecordPoolAllocations>(
this as DHTRecordPoolAllocations, _$identity);
/// @nodoc
abstract class $DHTRecordPoolAllocationsCopyWith<$Res> {
factory $DHTRecordPoolAllocationsCopyWith(DHTRecordPoolAllocations value,
$Res Function(DHTRecordPoolAllocations) then) =
_$DHTRecordPoolAllocationsCopyWithImpl<$Res, DHTRecordPoolAllocations>;
@useResult
$Res call(
{IMap<String, ISet<Typed<FixedEncodedString43>>> childrenByParent,
IMap<String, Typed<FixedEncodedString43>> parentByChild,
ISet<Typed<FixedEncodedString43>> rootRecords,
IMap<String, String> debugNames});
}
/// @nodoc
class _$DHTRecordPoolAllocationsCopyWithImpl<$Res,
$Val extends DHTRecordPoolAllocations>
implements $DHTRecordPoolAllocationsCopyWith<$Res> {
_$DHTRecordPoolAllocationsCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of DHTRecordPoolAllocations
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? childrenByParent = null,
Object? parentByChild = null,
Object? rootRecords = null,
Object? debugNames = null,
}) {
return _then(_value.copyWith(
childrenByParent: null == childrenByParent
? _value.childrenByParent
: childrenByParent // ignore: cast_nullable_to_non_nullable
as IMap<String, ISet<Typed<FixedEncodedString43>>>,
parentByChild: null == parentByChild
? _value.parentByChild
: parentByChild // ignore: cast_nullable_to_non_nullable
as IMap<String, Typed<FixedEncodedString43>>,
rootRecords: null == rootRecords
? _value.rootRecords
: rootRecords // ignore: cast_nullable_to_non_nullable
as ISet<Typed<FixedEncodedString43>>,
debugNames: null == debugNames
? _value.debugNames
: debugNames // ignore: cast_nullable_to_non_nullable
as IMap<String, String>,
) as $Val);
}
}
/// @nodoc
abstract class _$$DHTRecordPoolAllocationsImplCopyWith<$Res>
implements $DHTRecordPoolAllocationsCopyWith<$Res> {
factory _$$DHTRecordPoolAllocationsImplCopyWith(
_$DHTRecordPoolAllocationsImpl value,
$Res Function(_$DHTRecordPoolAllocationsImpl) then) =
__$$DHTRecordPoolAllocationsImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{IMap<String, ISet<Typed<FixedEncodedString43>>> childrenByParent,
IMap<String, Typed<FixedEncodedString43>> parentByChild,
ISet<Typed<FixedEncodedString43>> rootRecords,
IMap<String, String> debugNames});
}
/// @nodoc
class __$$DHTRecordPoolAllocationsImplCopyWithImpl<$Res>
extends _$DHTRecordPoolAllocationsCopyWithImpl<$Res,
_$DHTRecordPoolAllocationsImpl>
implements _$$DHTRecordPoolAllocationsImplCopyWith<$Res> {
__$$DHTRecordPoolAllocationsImplCopyWithImpl(
_$DHTRecordPoolAllocationsImpl _value,
$Res Function(_$DHTRecordPoolAllocationsImpl) _then)
: super(_value, _then);
/// Create a copy of DHTRecordPoolAllocations
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? childrenByParent = null,
Object? parentByChild = null,
Object? rootRecords = null,
Object? debugNames = null,
}) {
return _then(_$DHTRecordPoolAllocationsImpl(
childrenByParent: null == childrenByParent
? _value.childrenByParent
: childrenByParent // ignore: cast_nullable_to_non_nullable
as IMap<String, ISet<Typed<FixedEncodedString43>>>,
parentByChild: null == parentByChild
? _value.parentByChild
: parentByChild // ignore: cast_nullable_to_non_nullable
as IMap<String, Typed<FixedEncodedString43>>,
rootRecords: null == rootRecords
? _value.rootRecords
: rootRecords // ignore: cast_nullable_to_non_nullable
as ISet<Typed<FixedEncodedString43>>,
debugNames: null == debugNames
? _value.debugNames
: debugNames // ignore: cast_nullable_to_non_nullable
as IMap<String, String>,
));
}
}
/// @nodoc
@JsonSerializable()
class _$DHTRecordPoolAllocationsImpl implements _DHTRecordPoolAllocations {
const _$DHTRecordPoolAllocationsImpl(
{this.childrenByParent = const IMapConst<String, ISet<TypedKey>>({}),
this.parentByChild = const IMapConst<String, TypedKey>({}),
this.rootRecords = const ISetConst<TypedKey>({}),
this.debugNames = const IMapConst<String, String>({})});
factory _$DHTRecordPoolAllocationsImpl.fromJson(Map<String, dynamic> json) =>
_$$DHTRecordPoolAllocationsImplFromJson(json);
@override
@JsonKey()
final IMap<String, ISet<Typed<FixedEncodedString43>>> childrenByParent;
@override
@JsonKey()
final IMap<String, Typed<FixedEncodedString43>> parentByChild;
@override
@JsonKey()
final ISet<Typed<FixedEncodedString43>> rootRecords;
@override
@JsonKey()
final IMap<String, String> debugNames;
@override
String toString() {
return 'DHTRecordPoolAllocations(childrenByParent: $childrenByParent, parentByChild: $parentByChild, rootRecords: $rootRecords, debugNames: $debugNames)';
}
/// Serializes this DHTRecordPoolAllocations to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$DHTRecordPoolAllocationsImpl &&
other is DHTRecordPoolAllocations &&
(identical(other.childrenByParent, childrenByParent) ||
other.childrenByParent == childrenByParent) &&
(identical(other.parentByChild, parentByChild) ||
@ -201,178 +51,205 @@ class _$DHTRecordPoolAllocationsImpl implements _DHTRecordPoolAllocations {
int get hashCode => Object.hash(runtimeType, childrenByParent, parentByChild,
const DeepCollectionEquality().hash(rootRecords), debugNames);
/// Create a copy of DHTRecordPoolAllocations
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$DHTRecordPoolAllocationsImplCopyWith<_$DHTRecordPoolAllocationsImpl>
get copyWith => __$$DHTRecordPoolAllocationsImplCopyWithImpl<
_$DHTRecordPoolAllocationsImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$DHTRecordPoolAllocationsImplToJson(
this,
);
}
}
abstract class _DHTRecordPoolAllocations implements DHTRecordPoolAllocations {
const factory _DHTRecordPoolAllocations(
{final IMap<String, ISet<Typed<FixedEncodedString43>>> childrenByParent,
final IMap<String, Typed<FixedEncodedString43>> parentByChild,
final ISet<Typed<FixedEncodedString43>> rootRecords,
final IMap<String, String> debugNames}) = _$DHTRecordPoolAllocationsImpl;
factory _DHTRecordPoolAllocations.fromJson(Map<String, dynamic> json) =
_$DHTRecordPoolAllocationsImpl.fromJson;
@override
IMap<String, ISet<Typed<FixedEncodedString43>>> get childrenByParent;
@override
IMap<String, Typed<FixedEncodedString43>> get parentByChild;
@override
ISet<Typed<FixedEncodedString43>> get rootRecords;
@override
IMap<String, String> get debugNames;
/// Create a copy of DHTRecordPoolAllocations
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$DHTRecordPoolAllocationsImplCopyWith<_$DHTRecordPoolAllocationsImpl>
get copyWith => throw _privateConstructorUsedError;
}
OwnedDHTRecordPointer _$OwnedDHTRecordPointerFromJson(
Map<String, dynamic> json) {
return _OwnedDHTRecordPointer.fromJson(json);
}
/// @nodoc
mixin _$OwnedDHTRecordPointer {
Typed<FixedEncodedString43> get recordKey =>
throw _privateConstructorUsedError;
KeyPair get owner => throw _privateConstructorUsedError;
/// Serializes this OwnedDHTRecordPointer to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of OwnedDHTRecordPointer
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$OwnedDHTRecordPointerCopyWith<OwnedDHTRecordPointer> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $OwnedDHTRecordPointerCopyWith<$Res> {
factory $OwnedDHTRecordPointerCopyWith(OwnedDHTRecordPointer value,
$Res Function(OwnedDHTRecordPointer) then) =
_$OwnedDHTRecordPointerCopyWithImpl<$Res, OwnedDHTRecordPointer>;
@useResult
$Res call({Typed<FixedEncodedString43> recordKey, KeyPair owner});
}
/// @nodoc
class _$OwnedDHTRecordPointerCopyWithImpl<$Res,
$Val extends OwnedDHTRecordPointer>
implements $OwnedDHTRecordPointerCopyWith<$Res> {
_$OwnedDHTRecordPointerCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of OwnedDHTRecordPointer
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? recordKey = null,
Object? owner = null,
}) {
return _then(_value.copyWith(
recordKey: null == recordKey
? _value.recordKey
: recordKey // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>,
owner: null == owner
? _value.owner
: owner // ignore: cast_nullable_to_non_nullable
as KeyPair,
) as $Val);
String toString() {
return 'DHTRecordPoolAllocations(childrenByParent: $childrenByParent, parentByChild: $parentByChild, rootRecords: $rootRecords, debugNames: $debugNames)';
}
}
/// @nodoc
abstract class _$$OwnedDHTRecordPointerImplCopyWith<$Res>
implements $OwnedDHTRecordPointerCopyWith<$Res> {
factory _$$OwnedDHTRecordPointerImplCopyWith(
_$OwnedDHTRecordPointerImpl value,
$Res Function(_$OwnedDHTRecordPointerImpl) then) =
__$$OwnedDHTRecordPointerImplCopyWithImpl<$Res>;
@override
abstract mixin class $DHTRecordPoolAllocationsCopyWith<$Res> {
factory $DHTRecordPoolAllocationsCopyWith(DHTRecordPoolAllocations value,
$Res Function(DHTRecordPoolAllocations) _then) =
_$DHTRecordPoolAllocationsCopyWithImpl;
@useResult
$Res call({Typed<FixedEncodedString43> recordKey, KeyPair owner});
$Res call(
{IMap<String, ISet<Typed<FixedEncodedString43>>> childrenByParent,
IMap<String, Typed<FixedEncodedString43>> parentByChild,
ISet<Typed<FixedEncodedString43>> rootRecords,
IMap<String, String> debugNames});
}
/// @nodoc
class __$$OwnedDHTRecordPointerImplCopyWithImpl<$Res>
extends _$OwnedDHTRecordPointerCopyWithImpl<$Res,
_$OwnedDHTRecordPointerImpl>
implements _$$OwnedDHTRecordPointerImplCopyWith<$Res> {
__$$OwnedDHTRecordPointerImplCopyWithImpl(_$OwnedDHTRecordPointerImpl _value,
$Res Function(_$OwnedDHTRecordPointerImpl) _then)
: super(_value, _then);
class _$DHTRecordPoolAllocationsCopyWithImpl<$Res>
implements $DHTRecordPoolAllocationsCopyWith<$Res> {
_$DHTRecordPoolAllocationsCopyWithImpl(this._self, this._then);
/// Create a copy of OwnedDHTRecordPointer
final DHTRecordPoolAllocations _self;
final $Res Function(DHTRecordPoolAllocations) _then;
/// Create a copy of DHTRecordPoolAllocations
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? recordKey = null,
Object? owner = null,
Object? childrenByParent = null,
Object? parentByChild = null,
Object? rootRecords = null,
Object? debugNames = null,
}) {
return _then(_$OwnedDHTRecordPointerImpl(
recordKey: null == recordKey
? _value.recordKey
: recordKey // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>,
owner: null == owner
? _value.owner
: owner // ignore: cast_nullable_to_non_nullable
as KeyPair,
return _then(_self.copyWith(
childrenByParent: null == childrenByParent
? _self.childrenByParent!
: childrenByParent // ignore: cast_nullable_to_non_nullable
as IMap<String, ISet<Typed<FixedEncodedString43>>>,
parentByChild: null == parentByChild
? _self.parentByChild!
: parentByChild // ignore: cast_nullable_to_non_nullable
as IMap<String, Typed<FixedEncodedString43>>,
rootRecords: null == rootRecords
? _self.rootRecords!
: rootRecords // ignore: cast_nullable_to_non_nullable
as ISet<Typed<FixedEncodedString43>>,
debugNames: null == debugNames
? _self.debugNames
: debugNames // ignore: cast_nullable_to_non_nullable
as IMap<String, String>,
));
}
}
/// @nodoc
@JsonSerializable()
class _$OwnedDHTRecordPointerImpl implements _OwnedDHTRecordPointer {
const _$OwnedDHTRecordPointerImpl(
{required this.recordKey, required this.owner});
factory _$OwnedDHTRecordPointerImpl.fromJson(Map<String, dynamic> json) =>
_$$OwnedDHTRecordPointerImplFromJson(json);
class _DHTRecordPoolAllocations implements DHTRecordPoolAllocations {
const _DHTRecordPoolAllocations(
{this.childrenByParent = const IMapConst<String, ISet<TypedKey>>({}),
this.parentByChild = const IMapConst<String, TypedKey>({}),
this.rootRecords = const ISetConst<TypedKey>({}),
this.debugNames = const IMapConst<String, String>({})});
factory _DHTRecordPoolAllocations.fromJson(Map<String, dynamic> json) =>
_$DHTRecordPoolAllocationsFromJson(json);
@override
final Typed<FixedEncodedString43> recordKey;
@JsonKey()
final IMap<String, ISet<Typed<FixedEncodedString43>>> childrenByParent;
@override
final KeyPair owner;
@JsonKey()
final IMap<String, Typed<FixedEncodedString43>> parentByChild;
@override
@JsonKey()
final ISet<Typed<FixedEncodedString43>> rootRecords;
@override
@JsonKey()
final IMap<String, String> debugNames;
/// Create a copy of DHTRecordPoolAllocations
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$DHTRecordPoolAllocationsCopyWith<_DHTRecordPoolAllocations> get copyWith =>
__$DHTRecordPoolAllocationsCopyWithImpl<_DHTRecordPoolAllocations>(
this, _$identity);
@override
String toString() {
return 'OwnedDHTRecordPointer(recordKey: $recordKey, owner: $owner)';
Map<String, dynamic> toJson() {
return _$DHTRecordPoolAllocationsToJson(
this,
);
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$OwnedDHTRecordPointerImpl &&
other is _DHTRecordPoolAllocations &&
(identical(other.childrenByParent, childrenByParent) ||
other.childrenByParent == childrenByParent) &&
(identical(other.parentByChild, parentByChild) ||
other.parentByChild == parentByChild) &&
const DeepCollectionEquality()
.equals(other.rootRecords, rootRecords) &&
(identical(other.debugNames, debugNames) ||
other.debugNames == debugNames));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, childrenByParent, parentByChild,
const DeepCollectionEquality().hash(rootRecords), debugNames);
@override
String toString() {
return 'DHTRecordPoolAllocations(childrenByParent: $childrenByParent, parentByChild: $parentByChild, rootRecords: $rootRecords, debugNames: $debugNames)';
}
}
/// @nodoc
abstract mixin class _$DHTRecordPoolAllocationsCopyWith<$Res>
implements $DHTRecordPoolAllocationsCopyWith<$Res> {
factory _$DHTRecordPoolAllocationsCopyWith(_DHTRecordPoolAllocations value,
$Res Function(_DHTRecordPoolAllocations) _then) =
__$DHTRecordPoolAllocationsCopyWithImpl;
@override
@useResult
$Res call(
{IMap<String, ISet<Typed<FixedEncodedString43>>> childrenByParent,
IMap<String, Typed<FixedEncodedString43>> parentByChild,
ISet<Typed<FixedEncodedString43>> rootRecords,
IMap<String, String> debugNames});
}
/// @nodoc
class __$DHTRecordPoolAllocationsCopyWithImpl<$Res>
implements _$DHTRecordPoolAllocationsCopyWith<$Res> {
__$DHTRecordPoolAllocationsCopyWithImpl(this._self, this._then);
final _DHTRecordPoolAllocations _self;
final $Res Function(_DHTRecordPoolAllocations) _then;
/// Create a copy of DHTRecordPoolAllocations
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$Res call({
Object? childrenByParent = null,
Object? parentByChild = null,
Object? rootRecords = null,
Object? debugNames = null,
}) {
return _then(_DHTRecordPoolAllocations(
childrenByParent: null == childrenByParent
? _self.childrenByParent
: childrenByParent // ignore: cast_nullable_to_non_nullable
as IMap<String, ISet<Typed<FixedEncodedString43>>>,
parentByChild: null == parentByChild
? _self.parentByChild
: parentByChild // ignore: cast_nullable_to_non_nullable
as IMap<String, Typed<FixedEncodedString43>>,
rootRecords: null == rootRecords
? _self.rootRecords
: rootRecords // ignore: cast_nullable_to_non_nullable
as ISet<Typed<FixedEncodedString43>>,
debugNames: null == debugNames
? _self.debugNames
: debugNames // ignore: cast_nullable_to_non_nullable
as IMap<String, String>,
));
}
}
/// @nodoc
mixin _$OwnedDHTRecordPointer {
TypedKey get recordKey;
KeyPair get owner;
/// Create a copy of OwnedDHTRecordPointer
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$OwnedDHTRecordPointerCopyWith<OwnedDHTRecordPointer> get copyWith =>
_$OwnedDHTRecordPointerCopyWithImpl<OwnedDHTRecordPointer>(
this as OwnedDHTRecordPointer, _$identity);
/// Serializes this OwnedDHTRecordPointer to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is OwnedDHTRecordPointer &&
(identical(other.recordKey, recordKey) ||
other.recordKey == recordKey) &&
(identical(other.owner, owner) || other.owner == owner));
@ -382,40 +259,136 @@ class _$OwnedDHTRecordPointerImpl implements _OwnedDHTRecordPointer {
@override
int get hashCode => Object.hash(runtimeType, recordKey, owner);
/// Create a copy of OwnedDHTRecordPointer
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$OwnedDHTRecordPointerImplCopyWith<_$OwnedDHTRecordPointerImpl>
get copyWith => __$$OwnedDHTRecordPointerImplCopyWithImpl<
_$OwnedDHTRecordPointerImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$OwnedDHTRecordPointerImplToJson(
this,
);
String toString() {
return 'OwnedDHTRecordPointer(recordKey: $recordKey, owner: $owner)';
}
}
abstract class _OwnedDHTRecordPointer implements OwnedDHTRecordPointer {
const factory _OwnedDHTRecordPointer(
{required final Typed<FixedEncodedString43> recordKey,
required final KeyPair owner}) = _$OwnedDHTRecordPointerImpl;
/// @nodoc
abstract mixin class $OwnedDHTRecordPointerCopyWith<$Res> {
factory $OwnedDHTRecordPointerCopyWith(OwnedDHTRecordPointer value,
$Res Function(OwnedDHTRecordPointer) _then) =
_$OwnedDHTRecordPointerCopyWithImpl;
@useResult
$Res call({Typed<FixedEncodedString43> recordKey, KeyPair owner});
}
factory _OwnedDHTRecordPointer.fromJson(Map<String, dynamic> json) =
_$OwnedDHTRecordPointerImpl.fromJson;
/// @nodoc
class _$OwnedDHTRecordPointerCopyWithImpl<$Res>
implements $OwnedDHTRecordPointerCopyWith<$Res> {
_$OwnedDHTRecordPointerCopyWithImpl(this._self, this._then);
final OwnedDHTRecordPointer _self;
final $Res Function(OwnedDHTRecordPointer) _then;
/// Create a copy of OwnedDHTRecordPointer
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? recordKey = null,
Object? owner = null,
}) {
return _then(_self.copyWith(
recordKey: null == recordKey
? _self.recordKey!
: recordKey // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>,
owner: null == owner
? _self.owner
: owner // ignore: cast_nullable_to_non_nullable
as KeyPair,
));
}
}
/// @nodoc
@JsonSerializable()
class _OwnedDHTRecordPointer implements OwnedDHTRecordPointer {
const _OwnedDHTRecordPointer({required this.recordKey, required this.owner});
factory _OwnedDHTRecordPointer.fromJson(Map<String, dynamic> json) =>
_$OwnedDHTRecordPointerFromJson(json);
@override
Typed<FixedEncodedString43> get recordKey;
final Typed<FixedEncodedString43> recordKey;
@override
KeyPair get owner;
final KeyPair owner;
/// Create a copy of OwnedDHTRecordPointer
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$OwnedDHTRecordPointerImplCopyWith<_$OwnedDHTRecordPointerImpl>
get copyWith => throw _privateConstructorUsedError;
@pragma('vm:prefer-inline')
_$OwnedDHTRecordPointerCopyWith<_OwnedDHTRecordPointer> get copyWith =>
__$OwnedDHTRecordPointerCopyWithImpl<_OwnedDHTRecordPointer>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$OwnedDHTRecordPointerToJson(
this,
);
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _OwnedDHTRecordPointer &&
(identical(other.recordKey, recordKey) ||
other.recordKey == recordKey) &&
(identical(other.owner, owner) || other.owner == owner));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, recordKey, owner);
@override
String toString() {
return 'OwnedDHTRecordPointer(recordKey: $recordKey, owner: $owner)';
}
}
/// @nodoc
abstract mixin class _$OwnedDHTRecordPointerCopyWith<$Res>
implements $OwnedDHTRecordPointerCopyWith<$Res> {
factory _$OwnedDHTRecordPointerCopyWith(_OwnedDHTRecordPointer value,
$Res Function(_OwnedDHTRecordPointer) _then) =
__$OwnedDHTRecordPointerCopyWithImpl;
@override
@useResult
$Res call({Typed<FixedEncodedString43> recordKey, KeyPair owner});
}
/// @nodoc
class __$OwnedDHTRecordPointerCopyWithImpl<$Res>
implements _$OwnedDHTRecordPointerCopyWith<$Res> {
__$OwnedDHTRecordPointerCopyWithImpl(this._self, this._then);
final _OwnedDHTRecordPointer _self;
final $Res Function(_OwnedDHTRecordPointer) _then;
/// Create a copy of OwnedDHTRecordPointer
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$Res call({
Object? recordKey = null,
Object? owner = null,
}) {
return _then(_OwnedDHTRecordPointer(
recordKey: null == recordKey
? _self.recordKey
: recordKey // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>,
owner: null == owner
? _self.owner
: owner // ignore: cast_nullable_to_non_nullable
as KeyPair,
));
}
}
// dart format on

View file

@ -6,9 +6,9 @@ part of 'dht_record_pool.dart';
// JsonSerializableGenerator
// **************************************************************************
_$DHTRecordPoolAllocationsImpl _$$DHTRecordPoolAllocationsImplFromJson(
_DHTRecordPoolAllocations _$DHTRecordPoolAllocationsFromJson(
Map<String, dynamic> json) =>
_$DHTRecordPoolAllocationsImpl(
_DHTRecordPoolAllocations(
childrenByParent: json['children_by_parent'] == null
? const IMapConst<String, ISet<TypedKey>>({})
: IMap<String, ISet<Typed<FixedEncodedString43>>>.fromJson(
@ -34,8 +34,8 @@ _$DHTRecordPoolAllocationsImpl _$$DHTRecordPoolAllocationsImplFromJson(
(value) => value as String),
);
Map<String, dynamic> _$$DHTRecordPoolAllocationsImplToJson(
_$DHTRecordPoolAllocationsImpl instance) =>
Map<String, dynamic> _$DHTRecordPoolAllocationsToJson(
_DHTRecordPoolAllocations instance) =>
<String, dynamic>{
'children_by_parent': instance.childrenByParent.toJson(
(value) => value,
@ -56,15 +56,15 @@ Map<String, dynamic> _$$DHTRecordPoolAllocationsImplToJson(
),
};
_$OwnedDHTRecordPointerImpl _$$OwnedDHTRecordPointerImplFromJson(
_OwnedDHTRecordPointer _$OwnedDHTRecordPointerFromJson(
Map<String, dynamic> json) =>
_$OwnedDHTRecordPointerImpl(
_OwnedDHTRecordPointer(
recordKey: Typed<FixedEncodedString43>.fromJson(json['record_key']),
owner: KeyPair.fromJson(json['owner']),
);
Map<String, dynamic> _$$OwnedDHTRecordPointerImplToJson(
_$OwnedDHTRecordPointerImpl instance) =>
Map<String, dynamic> _$OwnedDHTRecordPointerToJson(
_OwnedDHTRecordPointer instance) =>
<String, dynamic>{
'record_key': instance.recordKey.toJson(),
'owner': instance.owner.toJson(),

Some files were not shown because too many files have changed in this diff Show more