debugging work

This commit is contained in:
Christien Rioux 2025-03-22 21:43:37 -04:00
parent 739df7c427
commit d6b1c20906
71 changed files with 4155 additions and 3616 deletions

View file

@ -13,7 +13,7 @@ enum AccountInfoStatus {
} }
@immutable @immutable
class AccountInfo extends Equatable { class AccountInfo extends Equatable implements ToDebugMap {
const AccountInfo({ const AccountInfo({
required this.status, required this.status,
required this.localAccount, required this.localAccount,
@ -30,6 +30,13 @@ class AccountInfo extends Equatable {
localAccount, localAccount,
userLogin, userLogin,
]; ];
@override
Map<String, dynamic> toDebugMap() => {
'status': status,
'localAccount': localAccount,
'userLogin': userLogin,
};
} }
extension AccountInfoExt on AccountInfo { 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 // This is the root of the account information tree for VeilidChat
// //
@freezed @freezed
class LocalAccount with _$LocalAccount { sealed class LocalAccount with _$LocalAccount {
const factory LocalAccount({ const factory LocalAccount({
// The super identity key record for the account, // The super identity key record for the account,
// containing the publicKey in the currentIdentity // containing the publicKey in the currentIdentity

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint // ignore_for_file: type=lint
@ -9,238 +10,43 @@ part of 'local_account.dart';
// FreezedGenerator // FreezedGenerator
// ************************************************************************** // **************************************************************************
// dart format off
T _$identity<T>(T value) => value; 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 /// @nodoc
mixin _$LocalAccount { mixin _$LocalAccount {
// The super identity key record for the account, // The super identity key record for the account,
// containing the publicKey in the currentIdentity // containing the publicKey in the currentIdentity
SuperIdentity get superIdentity => SuperIdentity
throw _privateConstructorUsedError; // The encrypted currentIdentity secret that goes with get superIdentity; // The encrypted currentIdentity secret that goes with
// the identityPublicKey with appended salt // the identityPublicKey with appended salt
@Uint8ListJsonConverter() @Uint8ListJsonConverter()
Uint8List get identitySecretBytes => Uint8List
throw _privateConstructorUsedError; // The kind of encryption input used on the account get identitySecretBytes; // The kind of encryption input used on the account
EncryptionKeyType get encryptionKeyType => EncryptionKeyType
throw _privateConstructorUsedError; // If account is not hidden, password can be retrieved via get encryptionKeyType; // If account is not hidden, password can be retrieved via
bool get biometricsEnabled => bool
throw _privateConstructorUsedError; // Keep account hidden unless account password is entered get biometricsEnabled; // Keep account hidden unless account password is entered
// (tries all hidden accounts with auth method (no biometrics)) // (tries all hidden accounts with auth method (no biometrics))
bool get hiddenAccount => bool get hiddenAccount; // Display name for account until it is unlocked
throw _privateConstructorUsedError; // Display name for account until it is unlocked String get name;
String get name => throw _privateConstructorUsedError;
/// Serializes this LocalAccount to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of LocalAccount /// Create a copy of LocalAccount
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$LocalAccountCopyWith<LocalAccount> get copyWith => $LocalAccountCopyWith<LocalAccount> get copyWith =>
throw _privateConstructorUsedError; _$LocalAccountCopyWithImpl<LocalAccount>(
} this as LocalAccount, _$identity);
/// @nodoc /// Serializes this LocalAccount to a JSON map.
abstract class $LocalAccountCopyWith<$Res> { Map<String, dynamic> toJson();
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)';
}
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$LocalAccountImpl && other is LocalAccount &&
(identical(other.superIdentity, superIdentity) || (identical(other.superIdentity, superIdentity) ||
other.superIdentity == superIdentity) && other.superIdentity == superIdentity) &&
const DeepCollectionEquality() const DeepCollectionEquality()
@ -265,60 +71,250 @@ class _$LocalAccountImpl implements _LocalAccount {
hiddenAccount, hiddenAccount,
name); name);
@override
String toString() {
return 'LocalAccount(superIdentity: $superIdentity, identitySecretBytes: $identitySecretBytes, encryptionKeyType: $encryptionKeyType, biometricsEnabled: $biometricsEnabled, hiddenAccount: $hiddenAccount, name: $name)';
}
}
/// @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});
$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 /// Create a copy of LocalAccount
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override @override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$$LocalAccountImplCopyWith<_$LocalAccountImpl> get copyWith => $SuperIdentityCopyWith<$Res> get superIdentity {
__$$LocalAccountImplCopyWithImpl<_$LocalAccountImpl>(this, _$identity); return $SuperIdentityCopyWith<$Res>(_self.superIdentity, (value) {
return _then(_self.copyWith(superIdentity: value));
@override });
Map<String, dynamic> toJson() {
return _$$LocalAccountImplToJson(
this,
);
} }
} }
abstract class _LocalAccount implements LocalAccount { /// @nodoc
const factory _LocalAccount( @JsonSerializable()
{required final SuperIdentity superIdentity, class _LocalAccount implements LocalAccount {
@Uint8ListJsonConverter() required final Uint8List identitySecretBytes, const _LocalAccount(
required final EncryptionKeyType encryptionKeyType, {required this.superIdentity,
required final bool biometricsEnabled, @Uint8ListJsonConverter() required this.identitySecretBytes,
required final bool hiddenAccount, required this.encryptionKeyType,
required final String name}) = _$LocalAccountImpl; required this.biometricsEnabled,
required this.hiddenAccount,
factory _LocalAccount.fromJson(Map<String, dynamic> json) = required this.name});
_$LocalAccountImpl.fromJson; factory _LocalAccount.fromJson(Map<String, dynamic> json) =>
_$LocalAccountFromJson(json);
// The super identity key record for the account, // The super identity key record for the account,
// containing the publicKey in the currentIdentity // containing the publicKey in the currentIdentity
@override @override
SuperIdentity final SuperIdentity superIdentity;
get superIdentity; // The encrypted currentIdentity secret that goes with // The encrypted currentIdentity secret that goes with
// the identityPublicKey with appended salt // the identityPublicKey with appended salt
@override @override
@Uint8ListJsonConverter() @Uint8ListJsonConverter()
Uint8List final Uint8List identitySecretBytes;
get identitySecretBytes; // The kind of encryption input used on the account // The kind of encryption input used on the account
@override @override
EncryptionKeyType final EncryptionKeyType encryptionKeyType;
get encryptionKeyType; // If account is not hidden, password can be retrieved via // If account is not hidden, password can be retrieved via
@override @override
bool final bool biometricsEnabled;
get biometricsEnabled; // Keep account hidden unless account password is entered // Keep account hidden unless account password is entered
// (tries all hidden accounts with auth method (no biometrics)) // (tries all hidden accounts with auth method (no biometrics))
@override @override
bool get hiddenAccount; // Display name for account until it is unlocked final bool hiddenAccount;
// Display name for account until it is unlocked
@override @override
String get name; final String name;
/// Create a copy of LocalAccount /// Create a copy of LocalAccount
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
_$$LocalAccountImplCopyWith<_$LocalAccountImpl> get copyWith => @pragma('vm:prefer-inline')
throw _privateConstructorUsedError; _$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 // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
_$LocalAccountImpl _$$LocalAccountImplFromJson(Map<String, dynamic> json) => _LocalAccount _$LocalAccountFromJson(Map<String, dynamic> json) =>
_$LocalAccountImpl( _LocalAccount(
superIdentity: SuperIdentity.fromJson(json['super_identity']), superIdentity: SuperIdentity.fromJson(json['super_identity']),
identitySecretBytes: const Uint8ListJsonConverter() identitySecretBytes: const Uint8ListJsonConverter()
.fromJson(json['identity_secret_bytes']), .fromJson(json['identity_secret_bytes']),
@ -18,7 +18,7 @@ _$LocalAccountImpl _$$LocalAccountImplFromJson(Map<String, dynamic> json) =>
name: json['name'] as String, name: json['name'] as String,
); );
Map<String, dynamic> _$$LocalAccountImplToJson(_$LocalAccountImpl instance) => Map<String, dynamic> _$LocalAccountToJson(_LocalAccount instance) =>
<String, dynamic>{ <String, dynamic>{
'super_identity': instance.superIdentity.toJson(), 'super_identity': instance.superIdentity.toJson(),
'identity_secret_bytes': 'identity_secret_bytes':

View file

@ -2,6 +2,7 @@ import 'package:async_tools/async_tools.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:veilid_support/veilid_support.dart';
import '../../../chat/chat.dart'; import '../../../chat/chat.dart';
import '../../../chat_list/chat_list.dart'; import '../../../chat_list/chat_list.dart';
@ -14,7 +15,9 @@ import '../../account_manager.dart';
part 'per_account_collection_state.freezed.dart'; part 'per_account_collection_state.freezed.dart';
@freezed @freezed
class PerAccountCollectionState with _$PerAccountCollectionState { sealed class PerAccountCollectionState
with _$PerAccountCollectionState
implements ToDebugMap {
const factory PerAccountCollectionState({ const factory PerAccountCollectionState({
required AccountInfo accountInfo, required AccountInfo accountInfo,
required AsyncValue<AccountRecordState>? avAccountRecordState, required AsyncValue<AccountRecordState>? avAccountRecordState,
@ -29,6 +32,23 @@ class PerAccountCollectionState with _$PerAccountCollectionState {
required ActiveSingleContactChatBlocMapCubit? required ActiveSingleContactChatBlocMapCubit?
activeSingleContactChatBlocMapCubit, activeSingleContactChatBlocMapCubit,
}) = _PerAccountCollectionState; }) = _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 { extension PerAccountCollectionStateExt on PerAccountCollectionState {

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint // ignore_for_file: type=lint
@ -9,311 +10,36 @@ part of 'per_account_collection_state.dart';
// FreezedGenerator // FreezedGenerator
// ************************************************************************** // **************************************************************************
// dart format off
T _$identity<T>(T value) => value; 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 /// @nodoc
mixin _$PerAccountCollectionState { mixin _$PerAccountCollectionState {
AccountInfo get accountInfo => throw _privateConstructorUsedError; AccountInfo get accountInfo;
AsyncValue<Account>? get avAccountRecordState => AsyncValue<AccountRecordState>? get avAccountRecordState;
throw _privateConstructorUsedError; AccountInfoCubit? get accountInfoCubit;
AccountInfoCubit? get accountInfoCubit => throw _privateConstructorUsedError; AccountRecordCubit? get accountRecordCubit;
AccountRecordCubit? get accountRecordCubit => ContactInvitationListCubit? get contactInvitationListCubit;
throw _privateConstructorUsedError; ContactListCubit? get contactListCubit;
ContactInvitationListCubit? get contactInvitationListCubit => WaitingInvitationsBlocMapCubit? get waitingInvitationsBlocMapCubit;
throw _privateConstructorUsedError; ActiveChatCubit? get activeChatCubit;
ContactListCubit? get contactListCubit => throw _privateConstructorUsedError; ChatListCubit? get chatListCubit;
WaitingInvitationsBlocMapCubit? get waitingInvitationsBlocMapCubit => ActiveConversationsBlocMapCubit? get activeConversationsBlocMapCubit;
throw _privateConstructorUsedError; ActiveSingleContactChatBlocMapCubit? get activeSingleContactChatBlocMapCubit;
ActiveChatCubit? get activeChatCubit => throw _privateConstructorUsedError;
ChatListCubit? get chatListCubit => throw _privateConstructorUsedError;
ActiveConversationsBlocMapCubit? get activeConversationsBlocMapCubit =>
throw _privateConstructorUsedError;
ActiveSingleContactChatBlocMapCubit?
get activeSingleContactChatBlocMapCubit =>
throw _privateConstructorUsedError;
/// Create a copy of PerAccountCollectionState /// Create a copy of PerAccountCollectionState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$PerAccountCollectionStateCopyWith<PerAccountCollectionState> get copyWith => $PerAccountCollectionStateCopyWith<PerAccountCollectionState> get copyWith =>
throw _privateConstructorUsedError; _$PerAccountCollectionStateCopyWithImpl<PerAccountCollectionState>(
} this as PerAccountCollectionState, _$identity);
/// @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)';
}
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$PerAccountCollectionStateImpl && other is PerAccountCollectionState &&
(identical(other.accountInfo, accountInfo) || (identical(other.accountInfo, accountInfo) ||
other.accountInfo == accountInfo) && other.accountInfo == accountInfo) &&
(identical(other.avAccountRecordState, avAccountRecordState) || (identical(other.avAccountRecordState, avAccountRecordState) ||
@ -361,61 +87,350 @@ class _$PerAccountCollectionStateImpl implements _PerAccountCollectionState {
activeConversationsBlocMapCubit, activeConversationsBlocMapCubit,
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)';
}
}
/// @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 /// Create a copy of PerAccountCollectionState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override @override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$$PerAccountCollectionStateImplCopyWith<_$PerAccountCollectionStateImpl> $AsyncValueCopyWith<Account, $Res>? get avAccountRecordState {
get copyWith => __$$PerAccountCollectionStateImplCopyWithImpl< if (_self.avAccountRecordState == null) {
_$PerAccountCollectionStateImpl>(this, _$identity); return null;
} }
abstract class _PerAccountCollectionState implements PerAccountCollectionState { return $AsyncValueCopyWith<Account, $Res>(_self.avAccountRecordState!,
const factory _PerAccountCollectionState( (value) {
{required final AccountInfo accountInfo, return _then(_self.copyWith(avAccountRecordState: value));
required final AsyncValue<Account>? avAccountRecordState, });
required final AccountInfoCubit? accountInfoCubit, }
required final AccountRecordCubit? accountRecordCubit, }
required final ContactInvitationListCubit? contactInvitationListCubit,
required final ContactListCubit? contactListCubit, /// @nodoc
required final WaitingInvitationsBlocMapCubit?
waitingInvitationsBlocMapCubit, class _PerAccountCollectionState extends PerAccountCollectionState {
required final ActiveChatCubit? activeChatCubit, const _PerAccountCollectionState(
required final ChatListCubit? chatListCubit, {required this.accountInfo,
required final ActiveConversationsBlocMapCubit? required this.avAccountRecordState,
activeConversationsBlocMapCubit, required this.accountInfoCubit,
required final ActiveSingleContactChatBlocMapCubit? required this.accountRecordCubit,
activeSingleContactChatBlocMapCubit}) = required this.contactInvitationListCubit,
_$PerAccountCollectionStateImpl; required this.contactListCubit,
required this.waitingInvitationsBlocMapCubit,
required this.activeChatCubit,
required this.chatListCubit,
required this.activeConversationsBlocMapCubit,
required this.activeSingleContactChatBlocMapCubit})
: super._();
@override @override
AccountInfo get accountInfo; final AccountInfo accountInfo;
@override @override
AsyncValue<Account>? get avAccountRecordState; final AsyncValue<Account>? avAccountRecordState;
@override @override
AccountInfoCubit? get accountInfoCubit; final AccountInfoCubit? accountInfoCubit;
@override @override
AccountRecordCubit? get accountRecordCubit; final AccountRecordCubit? accountRecordCubit;
@override @override
ContactInvitationListCubit? get contactInvitationListCubit; final ContactInvitationListCubit? contactInvitationListCubit;
@override @override
ContactListCubit? get contactListCubit; final ContactListCubit? contactListCubit;
@override @override
WaitingInvitationsBlocMapCubit? get waitingInvitationsBlocMapCubit; final WaitingInvitationsBlocMapCubit? waitingInvitationsBlocMapCubit;
@override @override
ActiveChatCubit? get activeChatCubit; final ActiveChatCubit? activeChatCubit;
@override @override
ChatListCubit? get chatListCubit; final ChatListCubit? chatListCubit;
@override @override
ActiveConversationsBlocMapCubit? get activeConversationsBlocMapCubit; final ActiveConversationsBlocMapCubit? activeConversationsBlocMapCubit;
@override @override
ActiveSingleContactChatBlocMapCubit? get activeSingleContactChatBlocMapCubit; final ActiveSingleContactChatBlocMapCubit?
activeSingleContactChatBlocMapCubit;
/// Create a copy of PerAccountCollectionState /// Create a copy of PerAccountCollectionState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
_$$PerAccountCollectionStateImplCopyWith<_$PerAccountCollectionStateImpl> @pragma('vm:prefer-inline')
get copyWith => throw _privateConstructorUsedError; _$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 // User logins are stored in the user_logins tablestore table
// indexed by the accountSuperIdentityRecordKey // indexed by the accountSuperIdentityRecordKey
@freezed @freezed
class UserLogin with _$UserLogin { sealed class UserLogin with _$UserLogin {
const factory UserLogin({ const factory UserLogin({
// SuperIdentity record key for the user // SuperIdentity record key for the user
// used to index the local accounts table // used to index the local accounts table

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint // ignore_for_file: type=lint
@ -9,195 +10,36 @@ part of 'user_login.dart';
// FreezedGenerator // FreezedGenerator
// ************************************************************************** // **************************************************************************
// dart format off
T _$identity<T>(T value) => value; 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 /// @nodoc
mixin _$UserLogin { mixin _$UserLogin {
// SuperIdentity record key for the user // SuperIdentity record key for the user
// used to index the local accounts table // used to index the local accounts table
Typed<FixedEncodedString43> get superIdentityRecordKey => TypedKey
throw _privateConstructorUsedError; // The identity secret as unlocked from the local accounts table get superIdentityRecordKey; // The identity secret as unlocked from the local accounts table
Typed<FixedEncodedString43> get identitySecret => TypedSecret
throw _privateConstructorUsedError; // The account record key, owner key and secret pulled from the identity get identitySecret; // The account record key, owner key and secret pulled from the identity
AccountRecordInfo get accountRecordInfo => AccountRecordInfo
throw _privateConstructorUsedError; // The time this login was most recently used get accountRecordInfo; // The time this login was most recently used
Timestamp get lastActive => throw _privateConstructorUsedError; Timestamp get lastActive;
/// Serializes this UserLogin to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of UserLogin /// Create a copy of UserLogin
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$UserLoginCopyWith<UserLogin> get copyWith => $UserLoginCopyWith<UserLogin> get copyWith =>
throw _privateConstructorUsedError; _$UserLoginCopyWithImpl<UserLogin>(this as UserLogin, _$identity);
}
/// @nodoc /// Serializes this UserLogin to a JSON map.
abstract class $UserLoginCopyWith<$Res> { Map<String, dynamic> toJson();
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)';
}
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$UserLoginImpl && other is UserLogin &&
(identical(other.superIdentityRecordKey, superIdentityRecordKey) || (identical(other.superIdentityRecordKey, superIdentityRecordKey) ||
other.superIdentityRecordKey == superIdentityRecordKey) && other.superIdentityRecordKey == superIdentityRecordKey) &&
(identical(other.identitySecret, identitySecret) || (identical(other.identitySecret, identitySecret) ||
@ -213,50 +55,204 @@ class _$UserLoginImpl implements _UserLogin {
int get hashCode => Object.hash(runtimeType, superIdentityRecordKey, int get hashCode => Object.hash(runtimeType, superIdentityRecordKey,
identitySecret, accountRecordInfo, lastActive); identitySecret, accountRecordInfo, lastActive);
@override
String toString() {
return 'UserLogin(superIdentityRecordKey: $superIdentityRecordKey, identitySecret: $identitySecret, accountRecordInfo: $accountRecordInfo, lastActive: $lastActive)';
}
}
/// @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});
$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 /// Create a copy of UserLogin
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override @override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$$UserLoginImplCopyWith<_$UserLoginImpl> get copyWith => $AccountRecordInfoCopyWith<$Res> get accountRecordInfo {
__$$UserLoginImplCopyWithImpl<_$UserLoginImpl>(this, _$identity); return $AccountRecordInfoCopyWith<$Res>(_self.accountRecordInfo, (value) {
return _then(_self.copyWith(accountRecordInfo: value));
@override });
Map<String, dynamic> toJson() {
return _$$UserLoginImplToJson(
this,
);
} }
} }
abstract class _UserLogin implements UserLogin { /// @nodoc
const factory _UserLogin( @JsonSerializable()
{required final Typed<FixedEncodedString43> superIdentityRecordKey, class _UserLogin implements UserLogin {
required final Typed<FixedEncodedString43> identitySecret, const _UserLogin(
required final AccountRecordInfo accountRecordInfo, {required this.superIdentityRecordKey,
required final Timestamp lastActive}) = _$UserLoginImpl; required this.identitySecret,
required this.accountRecordInfo,
factory _UserLogin.fromJson(Map<String, dynamic> json) = required this.lastActive});
_$UserLoginImpl.fromJson; factory _UserLogin.fromJson(Map<String, dynamic> json) =>
_$UserLoginFromJson(json);
// SuperIdentity record key for the user // SuperIdentity record key for the user
// used to index the local accounts table // used to index the local accounts table
@override @override
Typed<FixedEncodedString43> final Typed<FixedEncodedString43> superIdentityRecordKey;
get superIdentityRecordKey; // The identity secret as unlocked from the local accounts table // The identity secret as unlocked from the local accounts table
@override @override
Typed<FixedEncodedString43> final Typed<FixedEncodedString43> identitySecret;
get identitySecret; // The account record key, owner key and secret pulled from the identity // The account record key, owner key and secret pulled from the identity
@override @override
AccountRecordInfo final AccountRecordInfo accountRecordInfo;
get accountRecordInfo; // The time this login was most recently used // The time this login was most recently used
@override @override
Timestamp get lastActive; final Timestamp lastActive;
/// Create a copy of UserLogin /// Create a copy of UserLogin
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
_$$UserLoginImplCopyWith<_$UserLoginImpl> get copyWith => @pragma('vm:prefer-inline')
throw _privateConstructorUsedError; _$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 // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
_$UserLoginImpl _$$UserLoginImplFromJson(Map<String, dynamic> json) => _UserLogin _$UserLoginFromJson(Map<String, dynamic> json) => _UserLogin(
_$UserLoginImpl(
superIdentityRecordKey: Typed<FixedEncodedString43>.fromJson( superIdentityRecordKey: Typed<FixedEncodedString43>.fromJson(
json['super_identity_record_key']), json['super_identity_record_key']),
identitySecret: identitySecret:
@ -17,7 +16,7 @@ _$UserLoginImpl _$$UserLoginImplFromJson(Map<String, dynamic> json) =>
lastActive: Timestamp.fromJson(json['last_active']), lastActive: Timestamp.fromJson(json['last_active']),
); );
Map<String, dynamic> _$$UserLoginImplToJson(_$UserLoginImpl instance) => Map<String, dynamic> _$UserLoginToJson(_UserLogin instance) =>
<String, dynamic>{ <String, dynamic>{
'super_identity_record_key': instance.superIdentityRecordKey.toJson(), 'super_identity_record_key': instance.superIdentityRecordKey.toJson(),
'identity_secret': instance.identitySecret.toJson(), 'identity_secret': instance.identitySecret.toJson(),

View file

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

View file

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

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint // ignore_for_file: type=lint
@ -9,44 +10,78 @@ part of 'chat_component_state.dart';
// FreezedGenerator // FreezedGenerator
// ************************************************************************** // **************************************************************************
// dart format off
T _$identity<T>(T value) => value; 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 /// @nodoc
mixin _$ChatComponentState { mixin _$ChatComponentState {
// GlobalKey for the chat // GlobalKey for the chat
GlobalKey<ChatState> get chatKey => GlobalKey<ChatState> get chatKey; // ScrollController for the chat
throw _privateConstructorUsedError; // ScrollController for the chat AutoScrollController
AutoScrollController get scrollController => get scrollController; // TextEditingController for the chat
throw _privateConstructorUsedError; // TextEditingController for the chat InputTextFieldController get textEditingController; // Local user
InputTextFieldController get textEditingController => User? get localUser; // Active remote users
throw _privateConstructorUsedError; // Local user IMap<TypedKey, User> get remoteUsers; // Historical remote users
User? get localUser => IMap<TypedKey, User> get historicalRemoteUsers; // Unknown users
throw _privateConstructorUsedError; // Active remote users IMap<TypedKey, User> get unknownUsers; // Messages state
IMap<Typed<FixedEncodedString43>, User> get remoteUsers => AsyncValue<WindowState<Message>> get messageWindow; // Title of the chat
throw _privateConstructorUsedError; // Historical remote users String get title;
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;
/// Create a copy of ChatComponentState /// Create a copy of ChatComponentState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$ChatComponentStateCopyWith<ChatComponentState> get copyWith => $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 /// @nodoc
abstract class $ChatComponentStateCopyWith<$Res> { abstract mixin class $ChatComponentStateCopyWith<$Res> {
factory $ChatComponentStateCopyWith( factory $ChatComponentStateCopyWith(
ChatComponentState value, $Res Function(ChatComponentState) then) = ChatComponentState value, $Res Function(ChatComponentState) _then) =
_$ChatComponentStateCopyWithImpl<$Res, ChatComponentState>; _$ChatComponentStateCopyWithImpl;
@useResult @useResult
$Res call( $Res call(
{GlobalKey<ChatState> chatKey, {GlobalKey<ChatState> chatKey,
@ -63,14 +98,12 @@ abstract class $ChatComponentStateCopyWith<$Res> {
} }
/// @nodoc /// @nodoc
class _$ChatComponentStateCopyWithImpl<$Res, $Val extends ChatComponentState> class _$ChatComponentStateCopyWithImpl<$Res>
implements $ChatComponentStateCopyWith<$Res> { implements $ChatComponentStateCopyWith<$Res> {
_$ChatComponentStateCopyWithImpl(this._value, this._then); _$ChatComponentStateCopyWithImpl(this._self, this._then);
// ignore: unused_field final ChatComponentState _self;
final $Val _value; final $Res Function(ChatComponentState) _then;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ChatComponentState /// Create a copy of ChatComponentState
/// with the given fields replaced by the non-null parameter values. /// 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? messageWindow = null,
Object? title = null, Object? title = null,
}) { }) {
return _then(_value.copyWith( return _then(_self.copyWith(
chatKey: null == chatKey chatKey: null == chatKey
? _value.chatKey ? _self.chatKey
: chatKey // ignore: cast_nullable_to_non_nullable : chatKey // ignore: cast_nullable_to_non_nullable
as GlobalKey<ChatState>, as GlobalKey<ChatState>,
scrollController: null == scrollController scrollController: null == scrollController
? _value.scrollController ? _self.scrollController
: scrollController // ignore: cast_nullable_to_non_nullable : scrollController // ignore: cast_nullable_to_non_nullable
as AutoScrollController, as AutoScrollController,
textEditingController: null == textEditingController textEditingController: null == textEditingController
? _value.textEditingController ? _self.textEditingController
: textEditingController // ignore: cast_nullable_to_non_nullable : textEditingController // ignore: cast_nullable_to_non_nullable
as InputTextFieldController, as InputTextFieldController,
localUser: freezed == localUser localUser: freezed == localUser
? _value.localUser ? _self.localUser
: localUser // ignore: cast_nullable_to_non_nullable : localUser // ignore: cast_nullable_to_non_nullable
as User?, as User?,
remoteUsers: null == remoteUsers remoteUsers: null == remoteUsers
? _value.remoteUsers ? _self.remoteUsers!
: remoteUsers // ignore: cast_nullable_to_non_nullable : remoteUsers // ignore: cast_nullable_to_non_nullable
as IMap<Typed<FixedEncodedString43>, User>, as IMap<Typed<FixedEncodedString43>, User>,
historicalRemoteUsers: null == historicalRemoteUsers historicalRemoteUsers: null == historicalRemoteUsers
? _value.historicalRemoteUsers ? _self.historicalRemoteUsers!
: historicalRemoteUsers // ignore: cast_nullable_to_non_nullable : historicalRemoteUsers // ignore: cast_nullable_to_non_nullable
as IMap<Typed<FixedEncodedString43>, User>, as IMap<Typed<FixedEncodedString43>, User>,
unknownUsers: null == unknownUsers unknownUsers: null == unknownUsers
? _value.unknownUsers ? _self.unknownUsers!
: unknownUsers // ignore: cast_nullable_to_non_nullable : unknownUsers // ignore: cast_nullable_to_non_nullable
as IMap<Typed<FixedEncodedString43>, User>, as IMap<Typed<FixedEncodedString43>, User>,
messageWindow: null == messageWindow messageWindow: null == messageWindow
? _value.messageWindow ? _self.messageWindow
: messageWindow // ignore: cast_nullable_to_non_nullable : messageWindow // ignore: cast_nullable_to_non_nullable
as AsyncValue<WindowState<Message>>, as AsyncValue<WindowState<Message>>,
title: null == title title: null == title
? _value.title ? _self.title
: title // ignore: cast_nullable_to_non_nullable : title // ignore: cast_nullable_to_non_nullable
as String, as String,
) as $Val); ));
} }
/// Create a copy of ChatComponentState /// Create a copy of ChatComponentState
@ -132,104 +165,17 @@ class _$ChatComponentStateCopyWithImpl<$Res, $Val extends ChatComponentState>
@override @override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
$AsyncValueCopyWith<WindowState<Message>, $Res> get messageWindow { $AsyncValueCopyWith<WindowState<Message>, $Res> get messageWindow {
return $AsyncValueCopyWith<WindowState<Message>, $Res>(_value.messageWindow, return $AsyncValueCopyWith<WindowState<Message>, $Res>(_self.messageWindow,
(value) { (value) {
return _then(_value.copyWith(messageWindow: value) as $Val); return _then(_self.copyWith(messageWindow: value));
}); });
} }
} }
/// @nodoc /// @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 class _ChatComponentState implements ChatComponentState {
$AsyncValueCopyWith<WindowState<Message>, $Res> get messageWindow; const _ChatComponentState(
}
/// @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(
{required this.chatKey, {required this.chatKey,
required this.scrollController, required this.scrollController,
required this.textEditingController, required this.textEditingController,
@ -268,16 +214,19 @@ class _$ChatComponentStateImpl implements _ChatComponentState {
@override @override
final String title; final String title;
/// Create a copy of ChatComponentState
/// with the given fields replaced by the non-null parameter values.
@override @override
String toString() { @JsonKey(includeFromJson: false, includeToJson: false)
return 'ChatComponentState(chatKey: $chatKey, scrollController: $scrollController, textEditingController: $textEditingController, localUser: $localUser, remoteUsers: $remoteUsers, historicalRemoteUsers: $historicalRemoteUsers, unknownUsers: $unknownUsers, messageWindow: $messageWindow, title: $title)'; @pragma('vm:prefer-inline')
} _$ChatComponentStateCopyWith<_ChatComponentState> get copyWith =>
__$ChatComponentStateCopyWithImpl<_ChatComponentState>(this, _$identity);
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$ChatComponentStateImpl && other is _ChatComponentState &&
(identical(other.chatKey, chatKey) || other.chatKey == chatKey) && (identical(other.chatKey, chatKey) || other.chatKey == chatKey) &&
(identical(other.scrollController, scrollController) || (identical(other.scrollController, scrollController) ||
other.scrollController == scrollController) && other.scrollController == scrollController) &&
@ -309,56 +258,108 @@ class _$ChatComponentStateImpl implements _ChatComponentState {
messageWindow, messageWindow,
title); 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 /// Create a copy of ChatComponentState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override @override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$$ChatComponentStateImplCopyWith<_$ChatComponentStateImpl> get copyWith => $Res call({
__$$ChatComponentStateImplCopyWithImpl<_$ChatComponentStateImpl>( Object? chatKey = null,
this, _$identity); 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,
));
} }
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;
/// Create a copy of ChatComponentState /// Create a copy of ChatComponentState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override
@JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline')
_$$ChatComponentStateImplCopyWith<_$ChatComponentStateImpl> get copyWith => $AsyncValueCopyWith<WindowState<Message>, $Res> get messageWindow {
throw _privateConstructorUsedError; 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 @freezed
class MessageState with _$MessageState { sealed class MessageState with _$MessageState {
const factory MessageState({ const factory MessageState({
// Content of the message // Content of the message
@JsonKey(fromJson: messageFromJson, toJson: messageToJson) @JsonKey(fromJson: messageFromJson, toJson: messageToJson)

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint // ignore_for_file: type=lint
@ -9,42 +10,69 @@ part of 'message_state.dart';
// FreezedGenerator // FreezedGenerator
// ************************************************************************** // **************************************************************************
// dart format off
T _$identity<T>(T value) => value; 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 /// @nodoc
mixin _$MessageState { mixin _$MessageState implements DiagnosticableTreeMixin {
// Content of the message // Content of the message
@JsonKey(fromJson: messageFromJson, toJson: messageToJson) @JsonKey(fromJson: messageFromJson, toJson: messageToJson)
proto.Message get content => proto.Message get content; // Sent timestamp
throw _privateConstructorUsedError; // Sent timestamp Timestamp get sentTimestamp; // Reconciled timestamp
Timestamp get sentTimestamp => Timestamp? get reconciledTimestamp; // The state of the message
throw _privateConstructorUsedError; // Reconciled timestamp MessageSendState? get sendState;
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;
/// Create a copy of MessageState /// Create a copy of MessageState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$MessageStateCopyWith<MessageState> get copyWith => $MessageStateCopyWith<MessageState> get copyWith =>
throw _privateConstructorUsedError; _$MessageStateCopyWithImpl<MessageState>(
this as MessageState, _$identity);
/// Serializes this MessageState to a JSON map.
Map<String, dynamic> toJson();
@override
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 /// @nodoc
abstract class $MessageStateCopyWith<$Res> { abstract mixin class $MessageStateCopyWith<$Res> {
factory $MessageStateCopyWith( factory $MessageStateCopyWith(
MessageState value, $Res Function(MessageState) then) = MessageState value, $Res Function(MessageState) _then) =
_$MessageStateCopyWithImpl<$Res, MessageState>; _$MessageStateCopyWithImpl;
@useResult @useResult
$Res call( $Res call(
{@JsonKey(fromJson: messageFromJson, toJson: messageToJson) {@JsonKey(fromJson: messageFromJson, toJson: messageToJson)
@ -55,14 +83,11 @@ abstract class $MessageStateCopyWith<$Res> {
} }
/// @nodoc /// @nodoc
class _$MessageStateCopyWithImpl<$Res, $Val extends MessageState> class _$MessageStateCopyWithImpl<$Res> implements $MessageStateCopyWith<$Res> {
implements $MessageStateCopyWith<$Res> { _$MessageStateCopyWithImpl(this._self, this._then);
_$MessageStateCopyWithImpl(this._value, this._then);
// ignore: unused_field final MessageState _self;
final $Val _value; final $Res Function(MessageState) _then;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of MessageState /// Create a copy of MessageState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@ -74,76 +99,21 @@ class _$MessageStateCopyWithImpl<$Res, $Val extends MessageState>
Object? reconciledTimestamp = freezed, Object? reconciledTimestamp = freezed,
Object? sendState = freezed, Object? sendState = freezed,
}) { }) {
return _then(_value.copyWith( return _then(_self.copyWith(
content: null == content content: null == content
? _value.content ? _self.content
: content // ignore: cast_nullable_to_non_nullable : content // ignore: cast_nullable_to_non_nullable
as proto.Message, as proto.Message,
sentTimestamp: null == sentTimestamp sentTimestamp: null == sentTimestamp
? _value.sentTimestamp ? _self.sentTimestamp
: sentTimestamp // ignore: cast_nullable_to_non_nullable : sentTimestamp // ignore: cast_nullable_to_non_nullable
as Timestamp, as Timestamp,
reconciledTimestamp: freezed == reconciledTimestamp reconciledTimestamp: freezed == reconciledTimestamp
? _value.reconciledTimestamp ? _self.reconciledTimestamp
: reconciledTimestamp // ignore: cast_nullable_to_non_nullable : reconciledTimestamp // ignore: cast_nullable_to_non_nullable
as Timestamp?, as Timestamp?,
sendState: freezed == sendState sendState: freezed == sendState
? _value.sendState ? _self.sendState
: sendState // ignore: cast_nullable_to_non_nullable
as MessageSendState?,
) as $Val);
}
}
/// @nodoc
abstract class _$$MessageStateImplCopyWith<$Res>
implements $MessageStateCopyWith<$Res> {
factory _$$MessageStateImplCopyWith(
_$MessageStateImpl value, $Res Function(_$MessageStateImpl) then) =
__$$MessageStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{@JsonKey(fromJson: messageFromJson, toJson: messageToJson)
proto.Message content,
Timestamp sentTimestamp,
Timestamp? reconciledTimestamp,
MessageSendState? sendState});
}
/// @nodoc
class __$$MessageStateImplCopyWithImpl<$Res>
extends _$MessageStateCopyWithImpl<$Res, _$MessageStateImpl>
implements _$$MessageStateImplCopyWith<$Res> {
__$$MessageStateImplCopyWithImpl(
_$MessageStateImpl _value, $Res Function(_$MessageStateImpl) _then)
: super(_value, _then);
/// Create a copy of MessageState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? content = null,
Object? sentTimestamp = null,
Object? reconciledTimestamp = freezed,
Object? sendState = freezed,
}) {
return _then(_$MessageStateImpl(
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 : sendState // ignore: cast_nullable_to_non_nullable
as MessageSendState?, as MessageSendState?,
)); ));
@ -152,16 +122,15 @@ class __$$MessageStateImplCopyWithImpl<$Res>
/// @nodoc /// @nodoc
@JsonSerializable() @JsonSerializable()
class _$MessageStateImpl with DiagnosticableTreeMixin implements _MessageState { class _MessageState with DiagnosticableTreeMixin implements MessageState {
const _$MessageStateImpl( const _MessageState(
{@JsonKey(fromJson: messageFromJson, toJson: messageToJson) {@JsonKey(fromJson: messageFromJson, toJson: messageToJson)
required this.content, required this.content,
required this.sentTimestamp, required this.sentTimestamp,
required this.reconciledTimestamp, required this.reconciledTimestamp,
required this.sendState}); required this.sendState});
factory _MessageState.fromJson(Map<String, dynamic> json) =>
factory _$MessageStateImpl.fromJson(Map<String, dynamic> json) => _$MessageStateFromJson(json);
_$$MessageStateImplFromJson(json);
// Content of the message // Content of the message
@override @override
@ -177,14 +146,23 @@ class _$MessageStateImpl with DiagnosticableTreeMixin implements _MessageState {
@override @override
final MessageSendState? sendState; final MessageSendState? sendState;
/// Create a copy of MessageState
/// with the given fields replaced by the non-null parameter values.
@override @override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { @JsonKey(includeFromJson: false, includeToJson: false)
return 'MessageState(content: $content, sentTimestamp: $sentTimestamp, reconciledTimestamp: $reconciledTimestamp, sendState: $sendState)'; @pragma('vm:prefer-inline')
_$MessageStateCopyWith<_MessageState> get copyWith =>
__$MessageStateCopyWithImpl<_MessageState>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$MessageStateToJson(
this,
);
} }
@override @override
void debugFillProperties(DiagnosticPropertiesBuilder properties) { void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties properties
..add(DiagnosticsProperty('type', 'MessageState')) ..add(DiagnosticsProperty('type', 'MessageState'))
..add(DiagnosticsProperty('content', content)) ..add(DiagnosticsProperty('content', content))
@ -197,7 +175,7 @@ class _$MessageStateImpl with DiagnosticableTreeMixin implements _MessageState {
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$MessageStateImpl && other is _MessageState &&
(identical(other.content, content) || other.content == content) && (identical(other.content, content) || other.content == content) &&
(identical(other.sentTimestamp, sentTimestamp) || (identical(other.sentTimestamp, sentTimestamp) ||
other.sentTimestamp == sentTimestamp) && other.sentTimestamp == sentTimestamp) &&
@ -212,48 +190,65 @@ class _$MessageStateImpl with DiagnosticableTreeMixin implements _MessageState {
int get hashCode => Object.hash( int get hashCode => Object.hash(
runtimeType, content, sentTimestamp, reconciledTimestamp, sendState); runtimeType, content, sentTimestamp, reconciledTimestamp, sendState);
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'MessageState(content: $content, sentTimestamp: $sentTimestamp, reconciledTimestamp: $reconciledTimestamp, sendState: $sendState)';
}
}
/// @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)
proto.Message content,
Timestamp sentTimestamp,
Timestamp? reconciledTimestamp,
MessageSendState? sendState});
}
/// @nodoc
class __$MessageStateCopyWithImpl<$Res>
implements _$MessageStateCopyWith<$Res> {
__$MessageStateCopyWithImpl(this._self, this._then);
final _MessageState _self;
final $Res Function(_MessageState) _then;
/// Create a copy of MessageState /// Create a copy of MessageState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override @override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$$MessageStateImplCopyWith<_$MessageStateImpl> get copyWith => $Res call({
__$$MessageStateImplCopyWithImpl<_$MessageStateImpl>(this, _$identity); Object? content = null,
Object? sentTimestamp = null,
@override Object? reconciledTimestamp = freezed,
Map<String, dynamic> toJson() { Object? sendState = freezed,
return _$$MessageStateImplToJson( }) {
this, 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?,
));
} }
} }
abstract class _MessageState implements MessageState { // dart format on
const factory _MessageState(
{@JsonKey(fromJson: messageFromJson, toJson: messageToJson)
required final proto.Message content,
required final Timestamp sentTimestamp,
required final Timestamp? reconciledTimestamp,
required final MessageSendState? sendState}) = _$MessageStateImpl;
factory _MessageState.fromJson(Map<String, dynamic> json) =
_$MessageStateImpl.fromJson;
// 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;
/// 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;
}

View file

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

View file

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

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint // ignore_for_file: type=lint
@ -9,36 +10,71 @@ part of 'window_state.dart';
// FreezedGenerator // FreezedGenerator
// ************************************************************************** // **************************************************************************
// dart format off
T _$identity<T>(T value) => value; 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 /// @nodoc
mixin _$WindowState<T> { mixin _$WindowState<T> implements DiagnosticableTreeMixin {
// List of objects in the window // List of objects in the window
IList<T> get window => IList<T> get window; // Total number of objects (windowTail max)
throw _privateConstructorUsedError; // Total number of objects (windowTail max) int get length; // One past the end of the last element
int get length => int get windowTail; // The total number of elements to try to keep in the window
throw _privateConstructorUsedError; // One past the end of the last element int get windowCount; // If we should have the tail following the array
int get windowTail => bool get follow;
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;
/// Create a copy of WindowState /// Create a copy of WindowState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$WindowStateCopyWith<T, WindowState<T>> get copyWith => $WindowStateCopyWith<T, WindowState<T>> get copyWith =>
throw _privateConstructorUsedError; _$WindowStateCopyWithImpl<T, WindowState<T>>(
this as WindowState<T>, _$identity);
@override
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 /// @nodoc
abstract class $WindowStateCopyWith<T, $Res> { abstract mixin class $WindowStateCopyWith<T, $Res> {
factory $WindowStateCopyWith( factory $WindowStateCopyWith(
WindowState<T> value, $Res Function(WindowState<T>) then) = WindowState<T> value, $Res Function(WindowState<T>) _then) =
_$WindowStateCopyWithImpl<T, $Res, WindowState<T>>; _$WindowStateCopyWithImpl;
@useResult @useResult
$Res call( $Res call(
{IList<T> window, {IList<T> window,
@ -49,14 +85,12 @@ abstract class $WindowStateCopyWith<T, $Res> {
} }
/// @nodoc /// @nodoc
class _$WindowStateCopyWithImpl<T, $Res, $Val extends WindowState<T>> class _$WindowStateCopyWithImpl<T, $Res>
implements $WindowStateCopyWith<T, $Res> { implements $WindowStateCopyWith<T, $Res> {
_$WindowStateCopyWithImpl(this._value, this._then); _$WindowStateCopyWithImpl(this._self, this._then);
// ignore: unused_field final WindowState<T> _self;
final $Val _value; final $Res Function(WindowState<T>) _then;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of WindowState /// Create a copy of WindowState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@ -69,85 +103,25 @@ class _$WindowStateCopyWithImpl<T, $Res, $Val extends WindowState<T>>
Object? windowCount = null, Object? windowCount = null,
Object? follow = null, Object? follow = null,
}) { }) {
return _then(_value.copyWith( return _then(_self.copyWith(
window: null == window window: null == window
? _value.window ? _self.window
: window // ignore: cast_nullable_to_non_nullable : window // ignore: cast_nullable_to_non_nullable
as IList<T>, as IList<T>,
length: null == length length: null == length
? _value.length ? _self.length
: length // ignore: cast_nullable_to_non_nullable : length // ignore: cast_nullable_to_non_nullable
as int, as int,
windowTail: null == windowTail windowTail: null == windowTail
? _value.windowTail ? _self.windowTail
: windowTail // ignore: cast_nullable_to_non_nullable : windowTail // ignore: cast_nullable_to_non_nullable
as int, as int,
windowCount: null == windowCount windowCount: null == windowCount
? _value.windowCount ? _self.windowCount
: windowCount // ignore: cast_nullable_to_non_nullable : windowCount // ignore: cast_nullable_to_non_nullable
as int, as int,
follow: null == follow follow: null == follow
? _value.follow ? _self.follow
: follow // ignore: cast_nullable_to_non_nullable
as bool,
) as $Val);
}
}
/// @nodoc
abstract class _$$WindowStateImplCopyWith<T, $Res>
implements $WindowStateCopyWith<T, $Res> {
factory _$$WindowStateImplCopyWith(_$WindowStateImpl<T> value,
$Res Function(_$WindowStateImpl<T>) then) =
__$$WindowStateImplCopyWithImpl<T, $Res>;
@override
@useResult
$Res call(
{IList<T> window,
int length,
int windowTail,
int windowCount,
bool follow});
}
/// @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);
/// Create a copy of WindowState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? window = null,
Object? length = null,
Object? windowTail = null,
Object? windowCount = null,
Object? follow = null,
}) {
return _then(_$WindowStateImpl<T>(
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 : follow // ignore: cast_nullable_to_non_nullable
as bool, as bool,
)); ));
@ -156,10 +130,8 @@ class __$$WindowStateImplCopyWithImpl<T, $Res>
/// @nodoc /// @nodoc
class _$WindowStateImpl<T> class _WindowState<T> with DiagnosticableTreeMixin implements WindowState<T> {
with DiagnosticableTreeMixin const _WindowState(
implements _WindowState<T> {
const _$WindowStateImpl(
{required this.window, {required this.window,
required this.length, required this.length,
required this.windowTail, required this.windowTail,
@ -182,14 +154,16 @@ class _$WindowStateImpl<T>
@override @override
final bool follow; final bool follow;
/// Create a copy of WindowState
/// with the given fields replaced by the non-null parameter values.
@override @override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { @JsonKey(includeFromJson: false, includeToJson: false)
return 'WindowState<$T>(window: $window, length: $length, windowTail: $windowTail, windowCount: $windowCount, follow: $follow)'; @pragma('vm:prefer-inline')
} _$WindowStateCopyWith<T, _WindowState<T>> get copyWith =>
__$WindowStateCopyWithImpl<T, _WindowState<T>>(this, _$identity);
@override @override
void debugFillProperties(DiagnosticPropertiesBuilder properties) { void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties properties
..add(DiagnosticsProperty('type', 'WindowState<$T>')) ..add(DiagnosticsProperty('type', 'WindowState<$T>'))
..add(DiagnosticsProperty('window', window)) ..add(DiagnosticsProperty('window', window))
@ -203,7 +177,7 @@ class _$WindowStateImpl<T>
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$WindowStateImpl<T> && other is _WindowState<T> &&
const DeepCollectionEquality().equals(other.window, window) && const DeepCollectionEquality().equals(other.window, window) &&
(identical(other.length, length) || other.length == length) && (identical(other.length, length) || other.length == length) &&
(identical(other.windowTail, windowTail) || (identical(other.windowTail, windowTail) ||
@ -222,40 +196,70 @@ class _$WindowStateImpl<T>
windowCount, windowCount,
follow); 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 /// Create a copy of WindowState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override @override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$$WindowStateImplCopyWith<T, _$WindowStateImpl<T>> get copyWith => $Res call({
__$$WindowStateImplCopyWithImpl<T, _$WindowStateImpl<T>>( Object? window = null,
this, _$identity); 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> { // dart format on
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;
}

View file

@ -13,7 +13,7 @@ import '../../proto/proto.dart' as proto;
////////////////////////////////////////////////// //////////////////////////////////////////////////
// Mutable state for per-account chat list // Mutable state for per-account chat list
typedef ChatListCubitState = DHTShortArrayBusyState<proto.Chat>; typedef ChatListCubitState = DHTShortArrayCubitState<proto.Chat>;
class ChatListCubit extends DHTShortArrayCubit<proto.Chat> class ChatListCubit extends DHTShortArrayCubit<proto.Chat>
with StateMapFollowable<ChatListCubitState, TypedKey, proto.Chat> { with StateMapFollowable<ChatListCubitState, TypedKey, proto.Chat> {

View file

@ -8,7 +8,6 @@ import 'package:veilid_support/veilid_support.dart';
import '../../contacts/contacts.dart'; import '../../contacts/contacts.dart';
import '../../proto/proto.dart' as proto; import '../../proto/proto.dart' as proto;
import '../../proto/proto.dart';
import '../../theme/theme.dart'; import '../../theme/theme.dart';
import '../chat_list.dart'; import '../chat_list.dart';
@ -26,7 +25,7 @@ class ChatListWidget extends StatelessWidget {
} }
List<proto.Chat> _itemFilter(IMap<proto.TypedKey, proto.Contact> contactMap, 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(); final lowerValue = filter.toLowerCase();
return chatList.map((x) => x.value).where((c) { return chatList.map((x) => x.value).where((c) {
switch (c.whichKind()) { switch (c.whichKind()) {
@ -48,7 +47,6 @@ class ChatListWidget extends StatelessWidget {
} }
@override @override
// ignore: prefer_expression_function_bodies
Widget build(BuildContext context) { Widget build(BuildContext context) {
final contactListV = context.watch<ContactListCubit>().state; final contactListV = context.watch<ContactListCubit>().state;

View file

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

View file

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

View file

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

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint // ignore_for_file: type=lint
@ -9,270 +10,37 @@ part of 'notifications_preference.dart';
// FreezedGenerator // FreezedGenerator
// ************************************************************************** // **************************************************************************
// dart format off
T _$identity<T>(T value) => value; 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 /// @nodoc
mixin _$NotificationsPreference { mixin _$NotificationsPreference {
bool get displayBetaWarning => throw _privateConstructorUsedError; bool get displayBetaWarning;
bool get enableBadge => throw _privateConstructorUsedError; bool get enableBadge;
bool get enableNotifications => throw _privateConstructorUsedError; bool get enableNotifications;
MessageNotificationContent get messageNotificationContent => MessageNotificationContent get messageNotificationContent;
throw _privateConstructorUsedError; NotificationMode get onInvitationAcceptedMode;
NotificationMode get onInvitationAcceptedMode => SoundEffect get onInvitationAcceptedSound;
throw _privateConstructorUsedError; NotificationMode get onMessageReceivedMode;
SoundEffect get onInvitationAcceptedSound => SoundEffect get onMessageReceivedSound;
throw _privateConstructorUsedError; SoundEffect get onMessageSentSound;
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;
/// Create a copy of NotificationsPreference /// Create a copy of NotificationsPreference
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$NotificationsPreferenceCopyWith<NotificationsPreference> get copyWith => $NotificationsPreferenceCopyWith<NotificationsPreference> get copyWith =>
throw _privateConstructorUsedError; _$NotificationsPreferenceCopyWithImpl<NotificationsPreference>(
} this as NotificationsPreference, _$identity);
/// @nodoc /// Serializes this NotificationsPreference to a JSON map.
abstract class $NotificationsPreferenceCopyWith<$Res> { Map<String, dynamic> toJson();
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)';
}
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$NotificationsPreferenceImpl && other is NotificationsPreference &&
(identical(other.displayBetaWarning, displayBetaWarning) || (identical(other.displayBetaWarning, displayBetaWarning) ||
other.displayBetaWarning == displayBetaWarning) && other.displayBetaWarning == displayBetaWarning) &&
(identical(other.enableBadge, enableBadge) || (identical(other.enableBadge, enableBadge) ||
@ -311,61 +79,286 @@ class _$NotificationsPreferenceImpl implements _NotificationsPreference {
onMessageReceivedSound, onMessageReceivedSound,
onMessageSentSound); 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> {
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});
}
/// @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 /// Create a copy of NotificationsPreference
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$$NotificationsPreferenceImplCopyWith<_$NotificationsPreferenceImpl> @override
get copyWith => __$$NotificationsPreferenceImplCopyWithImpl< $Res call({
_$NotificationsPreferenceImpl>(this, _$identity); 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
@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;
/// Create a copy of NotificationsPreference
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$NotificationsPreferenceCopyWith<_NotificationsPreference> get copyWith =>
__$NotificationsPreferenceCopyWithImpl<_NotificationsPreference>(
this, _$identity);
@override @override
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return _$$NotificationsPreferenceImplToJson( return _$NotificationsPreferenceToJson(
this, 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));
} }
abstract class _NotificationsPreference implements NotificationsPreference { @JsonKey(includeFromJson: false, includeToJson: false)
const factory _NotificationsPreference( @override
{final bool displayBetaWarning, int get hashCode => Object.hash(
final bool enableBadge, runtimeType,
final bool enableNotifications, displayBetaWarning,
final MessageNotificationContent messageNotificationContent, enableBadge,
final NotificationMode onInvitationAcceptedMode, enableNotifications,
final SoundEffect onInvitationAcceptedSound, messageNotificationContent,
final NotificationMode onMessageReceivedMode, onInvitationAcceptedMode,
final SoundEffect onMessageReceivedSound, onInvitationAcceptedSound,
final SoundEffect onMessageSentSound}) = _$NotificationsPreferenceImpl; onMessageReceivedMode,
onMessageReceivedSound,
factory _NotificationsPreference.fromJson(Map<String, dynamic> json) = onMessageSentSound);
_$NotificationsPreferenceImpl.fromJson;
@override @override
bool get displayBetaWarning; 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 @override
bool get enableBadge; @useResult
@override $Res call(
bool get enableNotifications; {bool displayBetaWarning,
@override bool enableBadge,
MessageNotificationContent get messageNotificationContent; bool enableNotifications,
@override MessageNotificationContent messageNotificationContent,
NotificationMode get onInvitationAcceptedMode; NotificationMode onInvitationAcceptedMode,
@override SoundEffect onInvitationAcceptedSound,
SoundEffect get onInvitationAcceptedSound; NotificationMode onMessageReceivedMode,
@override SoundEffect onMessageReceivedSound,
NotificationMode get onMessageReceivedMode; SoundEffect onMessageSentSound});
@override }
SoundEffect get onMessageReceivedSound;
@override /// @nodoc
SoundEffect get onMessageSentSound; class __$NotificationsPreferenceCopyWithImpl<$Res>
implements _$NotificationsPreferenceCopyWith<$Res> {
__$NotificationsPreferenceCopyWithImpl(this._self, this._then);
final _NotificationsPreference _self;
final $Res Function(_NotificationsPreference) _then;
/// Create a copy of NotificationsPreference /// Create a copy of NotificationsPreference
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override
@JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline')
_$$NotificationsPreferenceImplCopyWith<_$NotificationsPreferenceImpl> $Res call({
get copyWith => throw _privateConstructorUsedError; 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 // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
_$NotificationsPreferenceImpl _$$NotificationsPreferenceImplFromJson( _NotificationsPreference _$NotificationsPreferenceFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json) =>
_$NotificationsPreferenceImpl( _NotificationsPreference(
displayBetaWarning: json['display_beta_warning'] as bool? ?? true, displayBetaWarning: json['display_beta_warning'] as bool? ?? true,
enableBadge: json['enable_badge'] as bool? ?? true, enableBadge: json['enable_badge'] as bool? ?? true,
enableNotifications: json['enable_notifications'] as bool? ?? true, enableNotifications: json['enable_notifications'] as bool? ?? true,
@ -33,8 +33,8 @@ _$NotificationsPreferenceImpl _$$NotificationsPreferenceImplFromJson(
: SoundEffect.fromJson(json['on_message_sent_sound']), : SoundEffect.fromJson(json['on_message_sent_sound']),
); );
Map<String, dynamic> _$$NotificationsPreferenceImplToJson( Map<String, dynamic> _$NotificationsPreferenceToJson(
_$NotificationsPreferenceImpl instance) => _NotificationsPreference instance) =>
<String, dynamic>{ <String, dynamic>{
'display_beta_warning': instance.displayBetaWarning, 'display_beta_warning': instance.displayBetaWarning,
'enable_badge': instance.enableBadge, 'enable_badge': instance.enableBadge,

View file

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

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint // ignore_for_file: type=lint
@ -9,137 +10,28 @@ part of 'notifications_state.dart';
// FreezedGenerator // FreezedGenerator
// ************************************************************************** // **************************************************************************
// dart format off
T _$identity<T>(T value) => value; 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 /// @nodoc
mixin _$NotificationItem { mixin _$NotificationItem {
NotificationType get type => throw _privateConstructorUsedError; NotificationType get type;
String get text => throw _privateConstructorUsedError; String get text;
String? get title => throw _privateConstructorUsedError; String? get title;
/// Create a copy of NotificationItem /// Create a copy of NotificationItem
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$NotificationItemCopyWith<NotificationItem> get copyWith => $NotificationItemCopyWith<NotificationItem> get copyWith =>
throw _privateConstructorUsedError; _$NotificationItemCopyWithImpl<NotificationItem>(
} this as NotificationItem, _$identity);
/// @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)';
}
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$NotificationItemImpl && other is NotificationItem &&
(identical(other.type, type) || other.type == type) && (identical(other.type, type) || other.type == type) &&
(identical(other.text, text) || other.text == text) && (identical(other.text, text) || other.text == text) &&
(identical(other.title, title) || other.title == title)); (identical(other.title, title) || other.title == title));
@ -148,66 +40,185 @@ class _$NotificationItemImpl implements _NotificationItem {
@override @override
int get hashCode => Object.hash(runtimeType, type, text, title); 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 @override
@pragma('vm:prefer-inline') String toString() {
_$$NotificationItemImplCopyWith<_$NotificationItemImpl> get copyWith => return 'NotificationItem(type: $type, text: $text, title: $title)';
__$$NotificationItemImplCopyWithImpl<_$NotificationItemImpl>( }
this, _$identity);
} }
abstract class _NotificationItem implements NotificationItem { /// @nodoc
const factory _NotificationItem( abstract mixin class $NotificationItemCopyWith<$Res> {
{required final NotificationType type, factory $NotificationItemCopyWith(
required final String text, NotificationItem value, $Res Function(NotificationItem) _then) =
final String? title}) = _$NotificationItemImpl; _$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 @override
NotificationType get type; final NotificationType type;
@override @override
String get text; final String text;
@override @override
String? get title; final String? title;
/// Create a copy of NotificationItem /// Create a copy of NotificationItem
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
_$$NotificationItemImplCopyWith<_$NotificationItemImpl> get copyWith => @pragma('vm:prefer-inline')
throw _privateConstructorUsedError; _$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 /// @nodoc
mixin _$NotificationsState { mixin _$NotificationsState {
IList<NotificationItem> get queue => throw _privateConstructorUsedError; IList<NotificationItem> get queue;
/// Create a copy of NotificationsState /// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$NotificationsStateCopyWith<NotificationsState> get copyWith => $NotificationsStateCopyWith<NotificationsState> get copyWith =>
throw _privateConstructorUsedError; _$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 /// @nodoc
abstract class $NotificationsStateCopyWith<$Res> { abstract mixin class $NotificationsStateCopyWith<$Res> {
factory $NotificationsStateCopyWith( factory $NotificationsStateCopyWith(
NotificationsState value, $Res Function(NotificationsState) then) = NotificationsState value, $Res Function(NotificationsState) _then) =
_$NotificationsStateCopyWithImpl<$Res, NotificationsState>; _$NotificationsStateCopyWithImpl;
@useResult @useResult
$Res call({IList<NotificationItem> queue}); $Res call({IList<NotificationItem> queue});
} }
/// @nodoc /// @nodoc
class _$NotificationsStateCopyWithImpl<$Res, $Val extends NotificationsState> class _$NotificationsStateCopyWithImpl<$Res>
implements $NotificationsStateCopyWith<$Res> { implements $NotificationsStateCopyWith<$Res> {
_$NotificationsStateCopyWithImpl(this._value, this._then); _$NotificationsStateCopyWithImpl(this._self, this._then);
// ignore: unused_field final NotificationsState _self;
final $Val _value; final $Res Function(NotificationsState) _then;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of NotificationsState /// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@ -216,44 +227,9 @@ class _$NotificationsStateCopyWithImpl<$Res, $Val extends NotificationsState>
$Res call({ $Res call({
Object? queue = null, Object? queue = null,
}) { }) {
return _then(_value.copyWith( return _then(_self.copyWith(
queue: null == queue queue: null == queue
? _value.queue ? _self.queue
: queue // ignore: cast_nullable_to_non_nullable
as IList<NotificationItem>,
) as $Val);
}
}
/// @nodoc
abstract class _$$NotificationsStateImplCopyWith<$Res>
implements $NotificationsStateCopyWith<$Res> {
factory _$$NotificationsStateImplCopyWith(_$NotificationsStateImpl value,
$Res Function(_$NotificationsStateImpl) then) =
__$$NotificationsStateImplCopyWithImpl<$Res>;
@override
@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);
/// 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(_$NotificationsStateImpl(
queue: null == queue
? _value.queue
: queue // ignore: cast_nullable_to_non_nullable : queue // ignore: cast_nullable_to_non_nullable
as IList<NotificationItem>, as IList<NotificationItem>,
)); ));
@ -262,22 +238,25 @@ class __$$NotificationsStateImplCopyWithImpl<$Res>
/// @nodoc /// @nodoc
class _$NotificationsStateImpl implements _NotificationsState { class _NotificationsState implements NotificationsState {
const _$NotificationsStateImpl({required this.queue}); const _NotificationsState({required this.queue});
@override @override
final IList<NotificationItem> queue; final IList<NotificationItem> queue;
/// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values.
@override @override
String toString() { @JsonKey(includeFromJson: false, includeToJson: false)
return 'NotificationsState(queue: $queue)'; @pragma('vm:prefer-inline')
} _$NotificationsStateCopyWith<_NotificationsState> get copyWith =>
__$NotificationsStateCopyWithImpl<_NotificationsState>(this, _$identity);
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$NotificationsStateImpl && other is _NotificationsState &&
const DeepCollectionEquality().equals(other.queue, queue)); const DeepCollectionEquality().equals(other.queue, queue));
} }
@ -285,28 +264,45 @@ class _$NotificationsStateImpl implements _NotificationsState {
int get hashCode => int get hashCode =>
Object.hash(runtimeType, const DeepCollectionEquality().hash(queue)); 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 /// Create a copy of NotificationsState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override @override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$$NotificationsStateImplCopyWith<_$NotificationsStateImpl> get copyWith => $Res call({
__$$NotificationsStateImplCopyWithImpl<_$NotificationsStateImpl>( Object? queue = null,
this, _$identity); }) {
return _then(_NotificationsState(
queue: null == queue
? _self.queue
: queue // ignore: cast_nullable_to_non_nullable
as IList<NotificationItem>,
));
}
} }
abstract class _NotificationsState implements NotificationsState { // dart format on
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;
}

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/dht_support/proto/proto.dart';
export 'package:veilid_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.pbenum.dart';
export 'veilidchat.pbjson.dart'; export 'veilidchat.pbjson.dart';
export 'veilidchat.pbserver.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, permissions,
membership, membership,
moderation, moderation,
readReceipt,
notSet notSet
} }
@ -1234,6 +1235,7 @@ class Message extends $pb.GeneratedMessage {
Message_ControlMembership? membership, Message_ControlMembership? membership,
Message_ControlModeration? moderation, Message_ControlModeration? moderation,
$0.Signature? signature, $0.Signature? signature,
Message_ControlReadReceipt? readReceipt,
}) { }) {
final $result = create(); final $result = create();
if (id != null) { if (id != null) {
@ -1272,6 +1274,9 @@ class Message extends $pb.GeneratedMessage {
if (signature != null) { if (signature != null) {
$result.signature = signature; $result.signature = signature;
} }
if (readReceipt != null) {
$result.readReceipt = readReceipt;
}
return $result; return $result;
} }
Message._() : super(); Message._() : super();
@ -1287,10 +1292,11 @@ class Message extends $pb.GeneratedMessage {
9 : Message_Kind.permissions, 9 : Message_Kind.permissions,
10 : Message_Kind.membership, 10 : Message_Kind.membership,
11 : Message_Kind.moderation, 11 : Message_Kind.moderation,
13 : Message_Kind.readReceipt,
0 : Message_Kind.notSet 0 : Message_Kind.notSet
}; };
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Message', package: const $pb.PackageName(_omitMessageNames ? '' : 'veilidchat'), createEmptyInstance: create) 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) ..a<$core.List<$core.int>>(1, _omitFieldNames ? '' : 'id', $pb.PbFieldType.OY)
..aOM<$0.TypedKey>(2, _omitFieldNames ? '' : 'author', subBuilder: $0.TypedKey.create) ..aOM<$0.TypedKey>(2, _omitFieldNames ? '' : 'author', subBuilder: $0.TypedKey.create)
..a<$fixnum.Int64>(3, _omitFieldNames ? '' : 'timestamp', $pb.PbFieldType.OU6, defaultOrMaker: $fixnum.Int64.ZERO) ..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_ControlMembership>(10, _omitFieldNames ? '' : 'membership', subBuilder: Message_ControlMembership.create)
..aOM<Message_ControlModeration>(11, _omitFieldNames ? '' : 'moderation', subBuilder: Message_ControlModeration.create) ..aOM<Message_ControlModeration>(11, _omitFieldNames ? '' : 'moderation', subBuilder: Message_ControlModeration.create)
..aOM<$0.Signature>(12, _omitFieldNames ? '' : 'signature', subBuilder: $0.Signature.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 ..hasRequiredFields = false
; ;
@ -1462,6 +1469,17 @@ class Message extends $pb.GeneratedMessage {
void clearSignature() => clearField(12); void clearSignature() => clearField(12);
@$pb.TagNumber(12) @$pb.TagNumber(12)
$0.Signature ensureSignature() => $_ensure(11); $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 /// 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': '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': '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': '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'}, {'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], '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' 'twZXJtaXNzaW9ucxgJIAEoCzImLnZlaWxpZGNoYXQuTWVzc2FnZS5Db250cm9sUGVybWlzc2lv'
'bnNIAFILcGVybWlzc2lvbnMSRwoKbWVtYmVyc2hpcBgKIAEoCzIlLnZlaWxpZGNoYXQuTWVzc2' 'bnNIAFILcGVybWlzc2lvbnMSRwoKbWVtYmVyc2hpcBgKIAEoCzIlLnZlaWxpZGNoYXQuTWVzc2'
'FnZS5Db250cm9sTWVtYmVyc2hpcEgAUgptZW1iZXJzaGlwEkcKCm1vZGVyYXRpb24YCyABKAsy' 'FnZS5Db250cm9sTWVtYmVyc2hpcEgAUgptZW1iZXJzaGlwEkcKCm1vZGVyYXRpb24YCyABKAsy'
'JS52ZWlsaWRjaGF0Lk1lc3NhZ2UuQ29udHJvbE1vZGVyYXRpb25IAFIKbW9kZXJhdGlvbhIvCg' 'JS52ZWlsaWRjaGF0Lk1lc3NhZ2UuQ29udHJvbE1vZGVyYXRpb25IAFIKbW9kZXJhdGlvbhJKCg'
'lzaWduYXR1cmUYDCABKAsyES52ZWlsaWQuU2lnbmF0dXJlUglzaWduYXR1cmUa5QEKBFRleHQS' 'tyZWFkUmVjZWlwdBgNIAEoCzImLnZlaWxpZGNoYXQuTWVzc2FnZS5Db250cm9sUmVhZFJlY2Vp'
'EgoEdGV4dBgBIAEoCVIEdGV4dBIZCgV0b3BpYxgCIAEoCUgAUgV0b3BpY4gBARIeCghyZXBseV' 'cHRIAFILcmVhZFJlY2VpcHQSLwoJc2lnbmF0dXJlGAwgASgLMhEudmVpbGlkLlNpZ25hdHVyZV'
'9pZBgDIAEoDEgBUgdyZXBseUlkiAEBEh4KCmV4cGlyYXRpb24YBCABKARSCmV4cGlyYXRpb24S' 'IJc2lnbmF0dXJlGuUBCgRUZXh0EhIKBHRleHQYASABKAlSBHRleHQSGQoFdG9waWMYAiABKAlI'
'HQoKdmlld19saW1pdBgFIAEoDVIJdmlld0xpbWl0EjgKC2F0dGFjaG1lbnRzGAYgAygLMhYudm' 'AFIFdG9waWOIAQESHgoIcmVwbHlfaWQYAyABKAxIAVIHcmVwbHlJZIgBARIeCgpleHBpcmF0aW'
'VpbGlkY2hhdC5BdHRhY2htZW50UgthdHRhY2htZW50c0IICgZfdG9waWNCCwoJX3JlcGx5X2lk' '9uGAQgASgEUgpleHBpcmF0aW9uEh0KCnZpZXdfbGltaXQYBSABKA1SCXZpZXdMaW1pdBI4Cgth'
'GkgKBlNlY3JldBIeCgpjaXBoZXJ0ZXh0GAEgASgMUgpjaXBoZXJ0ZXh0Eh4KCmV4cGlyYXRpb2' 'dHRhY2htZW50cxgGIAMoCzIWLnZlaWxpZGNoYXQuQXR0YWNobWVudFILYXR0YWNobWVudHNCCA'
'4YAiABKARSCmV4cGlyYXRpb24aIQoNQ29udHJvbERlbGV0ZRIQCgNpZHMYASADKAxSA2lkcxos' 'oGX3RvcGljQgsKCV9yZXBseV9pZBpICgZTZWNyZXQSHgoKY2lwaGVydGV4dBgBIAEoDFIKY2lw'
'CgxDb250cm9sRXJhc2USHAoJdGltZXN0YW1wGAEgASgEUgl0aW1lc3RhbXAaRwoPQ29udHJvbF' 'aGVydGV4dBIeCgpleHBpcmF0aW9uGAIgASgEUgpleHBpcmF0aW9uGiEKDUNvbnRyb2xEZWxldG'
'NldHRpbmdzEjQKCHNldHRpbmdzGAEgASgLMhgudmVpbGlkY2hhdC5DaGF0U2V0dGluZ3NSCHNl' 'USEAoDaWRzGAEgAygMUgNpZHMaLAoMQ29udHJvbEVyYXNlEhwKCXRpbWVzdGFtcBgBIAEoBFIJ'
'dHRpbmdzGk8KEkNvbnRyb2xQZXJtaXNzaW9ucxI5CgtwZXJtaXNzaW9ucxgBIAEoCzIXLnZlaW' 'dGltZXN0YW1wGkcKD0NvbnRyb2xTZXR0aW5ncxI0CghzZXR0aW5ncxgBIAEoCzIYLnZlaWxpZG'
'xpZGNoYXQuUGVybWlzc2lvbnNSC3Blcm1pc3Npb25zGksKEUNvbnRyb2xNZW1iZXJzaGlwEjYK' 'NoYXQuQ2hhdFNldHRpbmdzUghzZXR0aW5ncxpPChJDb250cm9sUGVybWlzc2lvbnMSOQoLcGVy'
'Cm1lbWJlcnNoaXAYASABKAsyFi52ZWlsaWRjaGF0Lk1lbWJlcnNoaXBSCm1lbWJlcnNoaXAaWQ' 'bWlzc2lvbnMYASABKAsyFy52ZWlsaWRjaGF0LlBlcm1pc3Npb25zUgtwZXJtaXNzaW9ucxpLCh'
'oRQ29udHJvbE1vZGVyYXRpb24SIQoMYWNjZXB0ZWRfaWRzGAEgAygMUgthY2NlcHRlZElkcxIh' 'FDb250cm9sTWVtYmVyc2hpcBI2CgptZW1iZXJzaGlwGAEgASgLMhYudmVpbGlkY2hhdC5NZW1i'
'CgxyZWplY3RlZF9pZHMYAiADKAxSC3JlamVjdGVkSWRzGi8KEkNvbnRyb2xSZWFkUmVjZWlwdB' 'ZXJzaGlwUgptZW1iZXJzaGlwGlkKEUNvbnRyb2xNb2RlcmF0aW9uEiEKDGFjY2VwdGVkX2lkcx'
'IZCghyZWFkX2lkcxgBIAMoDFIHcmVhZElkc0IGCgRraW5k'); 'gBIAMoDFILYWNjZXB0ZWRJZHMSIQoMcmVqZWN0ZWRfaWRzGAIgAygMUgtyZWplY3RlZElkcxov'
'ChJDb250cm9sUmVhZFJlY2VpcHQSGQoIcmVhZF9pZHMYASADKAxSB3JlYWRJZHNCBgoEa2luZA'
'==');
@$core.Deprecated('Use reconciledMessageDescriptor instead') @$core.Deprecated('Use reconciledMessageDescriptor instead')
const ReconciledMessage$json = { const ReconciledMessage$json = {

View file

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

View file

@ -22,7 +22,7 @@ part 'router_cubit.g.dart';
final _rootNavKey = GlobalKey<NavigatorState>(debugLabel: 'rootNavKey'); final _rootNavKey = GlobalKey<NavigatorState>(debugLabel: 'rootNavKey');
@freezed @freezed
class RouterState with _$RouterState { sealed class RouterState with _$RouterState {
const factory RouterState({ const factory RouterState({
required bool hasAnyAccount, required bool hasAnyAccount,
}) = _RouterState; }) = _RouterState;

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint // ignore_for_file: type=lint
@ -9,118 +10,25 @@ part of 'router_cubit.dart';
// FreezedGenerator // FreezedGenerator
// ************************************************************************** // **************************************************************************
// dart format off
T _$identity<T>(T value) => value; 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 /// @nodoc
mixin _$RouterState { mixin _$RouterState implements DiagnosticableTreeMixin {
bool get hasAnyAccount => throw _privateConstructorUsedError; bool get hasAnyAccount;
/// Serializes this RouterState to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of RouterState /// Create a copy of RouterState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$RouterStateCopyWith<RouterState> get copyWith => $RouterStateCopyWith<RouterState> get copyWith =>
throw _privateConstructorUsedError; _$RouterStateCopyWithImpl<RouterState>(this as RouterState, _$identity);
}
/// @nodoc /// Serializes this RouterState to a JSON map.
abstract class $RouterStateCopyWith<$Res> { Map<String, dynamic> toJson();
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)';
}
@override @override
void debugFillProperties(DiagnosticPropertiesBuilder properties) { void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties properties
..add(DiagnosticsProperty('type', 'RouterState')) ..add(DiagnosticsProperty('type', 'RouterState'))
..add(DiagnosticsProperty('hasAnyAccount', hasAnyAccount)); ..add(DiagnosticsProperty('hasAnyAccount', hasAnyAccount));
@ -130,7 +38,7 @@ class _$RouterStateImpl with DiagnosticableTreeMixin implements _RouterState {
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$RouterStateImpl && other is RouterState &&
(identical(other.hasAnyAccount, hasAnyAccount) || (identical(other.hasAnyAccount, hasAnyAccount) ||
other.hasAnyAccount == hasAnyAccount)); other.hasAnyAccount == hasAnyAccount));
} }
@ -139,36 +47,127 @@ class _$RouterStateImpl with DiagnosticableTreeMixin implements _RouterState {
@override @override
int get hashCode => Object.hash(runtimeType, hasAnyAccount); int get hashCode => Object.hash(runtimeType, hasAnyAccount);
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'RouterState(hasAnyAccount: $hasAnyAccount)';
}
}
/// @nodoc
abstract mixin class $RouterStateCopyWith<$Res> {
factory $RouterStateCopyWith(
RouterState value, $Res Function(RouterState) _then) =
_$RouterStateCopyWithImpl;
@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 /// Create a copy of RouterState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$$RouterStateImplCopyWith<_$RouterStateImpl> get copyWith => @override
__$$RouterStateImplCopyWithImpl<_$RouterStateImpl>(this, _$identity); $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
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)
@pragma('vm:prefer-inline')
_$RouterStateCopyWith<_RouterState> get copyWith =>
__$RouterStateCopyWithImpl<_RouterState>(this, _$identity);
@override @override
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return _$$RouterStateImplToJson( return _$RouterStateToJson(
this, this,
); );
} }
}
abstract class _RouterState implements RouterState {
const factory _RouterState({required final bool hasAnyAccount}) =
_$RouterStateImpl;
factory _RouterState.fromJson(Map<String, dynamic> json) =
_$RouterStateImpl.fromJson;
@override @override
bool get hasAnyAccount; 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 /// Create a copy of RouterState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override
@JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline')
_$$RouterStateImplCopyWith<_$RouterStateImpl> get copyWith => $Res call({
throw _privateConstructorUsedError; 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 // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
_$RouterStateImpl _$$RouterStateImplFromJson(Map<String, dynamic> json) => _RouterState _$RouterStateFromJson(Map<String, dynamic> json) => _RouterState(
_$RouterStateImpl(
hasAnyAccount: json['has_any_account'] as bool, hasAnyAccount: json['has_any_account'] as bool,
); );
Map<String, dynamic> _$$RouterStateImplToJson(_$RouterStateImpl instance) => Map<String, dynamic> _$RouterStateToJson(_RouterState instance) =>
<String, dynamic>{ <String, dynamic>{
'has_any_account': instance.hasAnyAccount, 'has_any_account': instance.hasAnyAccount,
}; };

View file

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

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint // ignore_for_file: type=lint
@ -9,158 +10,31 @@ part of 'preferences.dart';
// FreezedGenerator // FreezedGenerator
// ************************************************************************** // **************************************************************************
// dart format off
T _$identity<T>(T value) => value; 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 /// @nodoc
mixin _$LockPreference { mixin _$LockPreference {
int get inactivityLockSecs => throw _privateConstructorUsedError; int get inactivityLockSecs;
bool get lockWhenSwitching => throw _privateConstructorUsedError; bool get lockWhenSwitching;
bool get lockWithSystemLock => throw _privateConstructorUsedError; bool get lockWithSystemLock;
/// Serializes this LockPreference to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of LockPreference /// Create a copy of LockPreference
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$LockPreferenceCopyWith<LockPreference> get copyWith => $LockPreferenceCopyWith<LockPreference> get copyWith =>
throw _privateConstructorUsedError; _$LockPreferenceCopyWithImpl<LockPreference>(
} this as LockPreference, _$identity);
/// @nodoc /// Serializes this LockPreference to a JSON map.
abstract class $LockPreferenceCopyWith<$Res> { Map<String, dynamic> toJson();
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)';
}
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$LockPreferenceImpl && other is LockPreference &&
(identical(other.inactivityLockSecs, inactivityLockSecs) || (identical(other.inactivityLockSecs, inactivityLockSecs) ||
other.inactivityLockSecs == inactivityLockSecs) && other.inactivityLockSecs == inactivityLockSecs) &&
(identical(other.lockWhenSwitching, lockWhenSwitching) || (identical(other.lockWhenSwitching, lockWhenSwitching) ||
@ -174,255 +48,187 @@ class _$LockPreferenceImpl implements _LockPreference {
int get hashCode => Object.hash( int get hashCode => Object.hash(
runtimeType, inactivityLockSecs, lockWhenSwitching, lockWithSystemLock); 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 @override
@pragma('vm:prefer-inline') String toString() {
_$$LockPreferenceImplCopyWith<_$LockPreferenceImpl> get copyWith => return 'LockPreference(inactivityLockSecs: $inactivityLockSecs, lockWhenSwitching: $lockWhenSwitching, lockWithSystemLock: $lockWithSystemLock)';
__$$LockPreferenceImplCopyWithImpl<_$LockPreferenceImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$LockPreferenceImplToJson(
this,
);
} }
} }
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 /// @nodoc
mixin _$Preferences { abstract mixin class $LockPreferenceCopyWith<$Res> {
ThemePreferences get themePreference => throw _privateConstructorUsedError; factory $LockPreferenceCopyWith(
LanguagePreference get languagePreference => LockPreference value, $Res Function(LockPreference) _then) =
throw _privateConstructorUsedError; _$LockPreferenceCopyWithImpl;
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>;
@useResult @useResult
$Res call( $Res call(
{ThemePreferences themePreference, {int inactivityLockSecs,
LanguagePreference languagePreference, bool lockWhenSwitching,
LockPreference lockPreference, bool lockWithSystemLock});
NotificationsPreference notificationsPreference});
$ThemePreferencesCopyWith<$Res> get themePreference;
$LockPreferenceCopyWith<$Res> get lockPreference;
$NotificationsPreferenceCopyWith<$Res> get notificationsPreference;
} }
/// @nodoc /// @nodoc
class _$PreferencesCopyWithImpl<$Res, $Val extends Preferences> class _$LockPreferenceCopyWithImpl<$Res>
implements $PreferencesCopyWith<$Res> { implements $LockPreferenceCopyWith<$Res> {
_$PreferencesCopyWithImpl(this._value, this._then); _$LockPreferenceCopyWithImpl(this._self, this._then);
// ignore: unused_field final LockPreference _self;
final $Val _value; final $Res Function(LockPreference) _then;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Preferences /// Create a copy of LockPreference
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
@override @override
$Res call({ $Res call({
Object? themePreference = null, Object? inactivityLockSecs = null,
Object? languagePreference = null, Object? lockWhenSwitching = null,
Object? lockPreference = null, Object? lockWithSystemLock = null,
Object? notificationsPreference = null,
}) { }) {
return _then(_value.copyWith( return _then(_self.copyWith(
themePreference: null == themePreference inactivityLockSecs: null == inactivityLockSecs
? _value.themePreference ? _self.inactivityLockSecs
: themePreference // ignore: cast_nullable_to_non_nullable : inactivityLockSecs // ignore: cast_nullable_to_non_nullable
as ThemePreferences, as int,
languagePreference: null == languagePreference lockWhenSwitching: null == lockWhenSwitching
? _value.languagePreference ? _self.lockWhenSwitching
: languagePreference // ignore: cast_nullable_to_non_nullable : lockWhenSwitching // ignore: cast_nullable_to_non_nullable
as LanguagePreference, as bool,
lockPreference: null == lockPreference lockWithSystemLock: null == lockWithSystemLock
? _value.lockPreference ? _self.lockWithSystemLock
: lockPreference // ignore: cast_nullable_to_non_nullable : lockWithSystemLock // ignore: cast_nullable_to_non_nullable
as LockPreference, as bool,
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,
)); ));
} }
} }
/// @nodoc /// @nodoc
@JsonSerializable() @JsonSerializable()
class _$PreferencesImpl implements _Preferences { class _LockPreference implements LockPreference {
const _$PreferencesImpl( const _LockPreference(
{this.themePreference = ThemePreferences.defaults, {this.inactivityLockSecs = 0,
this.languagePreference = LanguagePreference.defaults, this.lockWhenSwitching = false,
this.lockPreference = LockPreference.defaults, this.lockWithSystemLock = false});
this.notificationsPreference = NotificationsPreference.defaults}); factory _LockPreference.fromJson(Map<String, dynamic> json) =>
_$LockPreferenceFromJson(json);
factory _$PreferencesImpl.fromJson(Map<String, dynamic> json) =>
_$$PreferencesImplFromJson(json);
@override @override
@JsonKey() @JsonKey()
final ThemePreferences themePreference; final int inactivityLockSecs;
@override @override
@JsonKey() @JsonKey()
final LanguagePreference languagePreference; final bool lockWhenSwitching;
@override @override
@JsonKey() @JsonKey()
final LockPreference lockPreference; final bool lockWithSystemLock;
/// Create a copy of LockPreference
/// with the given fields replaced by the non-null parameter values.
@override @override
@JsonKey() @JsonKey(includeFromJson: false, includeToJson: false)
final NotificationsPreference notificationsPreference; @pragma('vm:prefer-inline')
_$LockPreferenceCopyWith<_LockPreference> get copyWith =>
__$LockPreferenceCopyWithImpl<_LockPreference>(this, _$identity);
@override @override
String toString() { Map<String, dynamic> toJson() {
return 'Preferences(themePreference: $themePreference, languagePreference: $languagePreference, lockPreference: $lockPreference, notificationsPreference: $notificationsPreference)'; return _$LockPreferenceToJson(
this,
);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (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) || (identical(other.themePreference, themePreference) ||
other.themePreference == themePreference) && other.themePreference == themePreference) &&
(identical(other.languagePreference, languagePreference) || (identical(other.languagePreference, languagePreference) ||
@ -439,46 +245,253 @@ class _$PreferencesImpl implements _Preferences {
int get hashCode => Object.hash(runtimeType, themePreference, int get hashCode => Object.hash(runtimeType, themePreference,
languagePreference, lockPreference, notificationsPreference); languagePreference, lockPreference, notificationsPreference);
@override
String toString() {
return 'Preferences(themePreference: $themePreference, languagePreference: $languagePreference, lockPreference: $lockPreference, notificationsPreference: $notificationsPreference)';
}
}
/// @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});
$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 /// Create a copy of Preferences
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override @override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$$PreferencesImplCopyWith<_$PreferencesImpl> get copyWith => $ThemePreferencesCopyWith<$Res> get themePreference {
__$$PreferencesImplCopyWithImpl<_$PreferencesImpl>(this, _$identity); 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
@JsonKey()
final ThemePreferences themePreference;
@override
@JsonKey()
final LanguagePreference languagePreference;
@override
@JsonKey()
final LockPreference lockPreference;
@override
@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)
@pragma('vm:prefer-inline')
_$PreferencesCopyWith<_Preferences> get copyWith =>
__$PreferencesCopyWithImpl<_Preferences>(this, _$identity);
@override @override
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return _$$PreferencesImplToJson( return _$PreferencesToJson(
this, 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));
} }
abstract class _Preferences implements Preferences { @JsonKey(includeFromJson: false, includeToJson: false)
const factory _Preferences( @override
{final ThemePreferences themePreference, int get hashCode => Object.hash(runtimeType, themePreference,
final LanguagePreference languagePreference, languagePreference, lockPreference, notificationsPreference);
final LockPreference lockPreference,
final NotificationsPreference notificationsPreference}) =
_$PreferencesImpl;
factory _Preferences.fromJson(Map<String, dynamic> json) =
_$PreferencesImpl.fromJson;
@override @override
ThemePreferences get themePreference; 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 @override
LanguagePreference get languagePreference; @useResult
$Res call(
{ThemePreferences themePreference,
LanguagePreference languagePreference,
LockPreference lockPreference,
NotificationsPreference notificationsPreference});
@override @override
LockPreference get lockPreference; $ThemePreferencesCopyWith<$Res> get themePreference;
@override @override
NotificationsPreference get notificationsPreference; $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 /// Create a copy of Preferences
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override
@JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline')
_$$PreferencesImplCopyWith<_$PreferencesImpl> get copyWith => $Res call({
throw _privateConstructorUsedError; 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 // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
_$LockPreferenceImpl _$$LockPreferenceImplFromJson(Map<String, dynamic> json) => _LockPreference _$LockPreferenceFromJson(Map<String, dynamic> json) =>
_$LockPreferenceImpl( _LockPreference(
inactivityLockSecs: (json['inactivity_lock_secs'] as num?)?.toInt() ?? 0, inactivityLockSecs: (json['inactivity_lock_secs'] as num?)?.toInt() ?? 0,
lockWhenSwitching: json['lock_when_switching'] as bool? ?? false, lockWhenSwitching: json['lock_when_switching'] as bool? ?? false,
lockWithSystemLock: json['lock_with_system_lock'] as bool? ?? false, lockWithSystemLock: json['lock_with_system_lock'] as bool? ?? false,
); );
Map<String, dynamic> _$$LockPreferenceImplToJson( Map<String, dynamic> _$LockPreferenceToJson(_LockPreference instance) =>
_$LockPreferenceImpl instance) =>
<String, dynamic>{ <String, dynamic>{
'inactivity_lock_secs': instance.inactivityLockSecs, 'inactivity_lock_secs': instance.inactivityLockSecs,
'lock_when_switching': instance.lockWhenSwitching, 'lock_when_switching': instance.lockWhenSwitching,
'lock_with_system_lock': instance.lockWithSystemLock, 'lock_with_system_lock': instance.lockWithSystemLock,
}; };
_$PreferencesImpl _$$PreferencesImplFromJson(Map<String, dynamic> json) => _Preferences _$PreferencesFromJson(Map<String, dynamic> json) => _Preferences(
_$PreferencesImpl(
themePreference: json['theme_preference'] == null themePreference: json['theme_preference'] == null
? ThemePreferences.defaults ? ThemePreferences.defaults
: ThemePreferences.fromJson(json['theme_preference']), : ThemePreferences.fromJson(json['theme_preference']),
@ -37,7 +35,7 @@ _$PreferencesImpl _$$PreferencesImplFromJson(Map<String, dynamic> json) =>
: NotificationsPreference.fromJson(json['notifications_preference']), : NotificationsPreference.fromJson(json['notifications_preference']),
); );
Map<String, dynamic> _$$PreferencesImplToJson(_$PreferencesImpl instance) => Map<String, dynamic> _$PreferencesToJson(_Preferences instance) =>
<String, dynamic>{ <String, dynamic>{
'theme_preference': instance.themePreference.toJson(), 'theme_preference': instance.themePreference.toJson(),
'language_preference': instance.languagePreference.toJson(), 'language_preference': instance.languagePreference.toJson(),

View file

@ -49,7 +49,7 @@ enum ColorPreference {
} }
@freezed @freezed
class ThemePreferences with _$ThemePreferences { sealed class ThemePreferences with _$ThemePreferences {
const factory ThemePreferences({ const factory ThemePreferences({
@Default(BrightnessPreference.system) @Default(BrightnessPreference.system)
BrightnessPreference brightnessPreference, BrightnessPreference brightnessPreference,

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint // ignore_for_file: type=lint
@ -9,176 +10,32 @@ part of 'theme_preference.dart';
// FreezedGenerator // FreezedGenerator
// ************************************************************************** // **************************************************************************
// dart format off
T _$identity<T>(T value) => value; 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 /// @nodoc
mixin _$ThemePreferences { mixin _$ThemePreferences {
BrightnessPreference get brightnessPreference => BrightnessPreference get brightnessPreference;
throw _privateConstructorUsedError; ColorPreference get colorPreference;
ColorPreference get colorPreference => throw _privateConstructorUsedError; double get displayScale;
double get displayScale => throw _privateConstructorUsedError; bool get enableWallpaper;
bool get enableWallpaper => throw _privateConstructorUsedError;
/// Serializes this ThemePreferences to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of ThemePreferences /// Create a copy of ThemePreferences
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$ThemePreferencesCopyWith<ThemePreferences> get copyWith => $ThemePreferencesCopyWith<ThemePreferences> get copyWith =>
throw _privateConstructorUsedError; _$ThemePreferencesCopyWithImpl<ThemePreferences>(
} this as ThemePreferences, _$identity);
/// @nodoc /// Serializes this ThemePreferences to a JSON map.
abstract class $ThemePreferencesCopyWith<$Res> { Map<String, dynamic> toJson();
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)';
}
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$ThemePreferencesImpl && other is ThemePreferences &&
(identical(other.brightnessPreference, brightnessPreference) || (identical(other.brightnessPreference, brightnessPreference) ||
other.brightnessPreference == brightnessPreference) && other.brightnessPreference == brightnessPreference) &&
(identical(other.colorPreference, colorPreference) || (identical(other.colorPreference, colorPreference) ||
@ -194,46 +51,181 @@ class _$ThemePreferencesImpl implements _ThemePreferences {
int get hashCode => Object.hash(runtimeType, brightnessPreference, int get hashCode => Object.hash(runtimeType, brightnessPreference,
colorPreference, displayScale, enableWallpaper); colorPreference, displayScale, enableWallpaper);
@override
String toString() {
return 'ThemePreferences(brightnessPreference: $brightnessPreference, colorPreference: $colorPreference, displayScale: $displayScale, enableWallpaper: $enableWallpaper)';
}
}
/// @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});
}
/// @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 /// Create a copy of ThemePreferences
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$$ThemePreferencesImplCopyWith<_$ThemePreferencesImpl> get copyWith => @override
__$$ThemePreferencesImplCopyWithImpl<_$ThemePreferencesImpl>( $Res call({
this, _$identity); 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
@JsonKey()
final BrightnessPreference brightnessPreference;
@override
@JsonKey()
final ColorPreference colorPreference;
@override
@JsonKey()
final double displayScale;
@override
@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)
@pragma('vm:prefer-inline')
_$ThemePreferencesCopyWith<_ThemePreferences> get copyWith =>
__$ThemePreferencesCopyWithImpl<_ThemePreferences>(this, _$identity);
@override @override
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return _$$ThemePreferencesImplToJson( return _$ThemePreferencesToJson(
this, 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));
} }
abstract class _ThemePreferences implements ThemePreferences { @JsonKey(includeFromJson: false, includeToJson: false)
const factory _ThemePreferences( @override
{final BrightnessPreference brightnessPreference, int get hashCode => Object.hash(runtimeType, brightnessPreference,
final ColorPreference colorPreference, colorPreference, displayScale, enableWallpaper);
final double displayScale,
final bool enableWallpaper}) = _$ThemePreferencesImpl;
factory _ThemePreferences.fromJson(Map<String, dynamic> json) =
_$ThemePreferencesImpl.fromJson;
@override @override
BrightnessPreference get brightnessPreference; 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 @override
ColorPreference get colorPreference; @useResult
@override $Res call(
double get displayScale; {BrightnessPreference brightnessPreference,
@override ColorPreference colorPreference,
bool get enableWallpaper; 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 /// Create a copy of ThemePreferences
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override
@JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline')
_$$ThemePreferencesImplCopyWith<_$ThemePreferencesImpl> get copyWith => $Res call({
throw _privateConstructorUsedError; 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 // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
_$ThemePreferencesImpl _$$ThemePreferencesImplFromJson( _ThemePreferences _$ThemePreferencesFromJson(Map<String, dynamic> json) =>
Map<String, dynamic> json) => _ThemePreferences(
_$ThemePreferencesImpl(
brightnessPreference: json['brightness_preference'] == null brightnessPreference: json['brightness_preference'] == null
? BrightnessPreference.system ? BrightnessPreference.system
: BrightnessPreference.fromJson(json['brightness_preference']), : BrightnessPreference.fromJson(json['brightness_preference']),
@ -19,8 +18,7 @@ _$ThemePreferencesImpl _$$ThemePreferencesImplFromJson(
enableWallpaper: json['enable_wallpaper'] as bool? ?? true, enableWallpaper: json['enable_wallpaper'] as bool? ?? true,
); );
Map<String, dynamic> _$$ThemePreferencesImplToJson( Map<String, dynamic> _$ThemePreferencesToJson(_ThemePreferences instance) =>
_$ThemePreferencesImpl instance) =>
<String, dynamic>{ <String, dynamic>{
'brightness_preference': instance.brightnessPreference.toJson(), 'brightness_preference': instance.brightnessPreference.toJson(),
'color_preference': instance.colorPreference.toJson(), 'color_preference': instance.colorPreference.toJson(),

View file

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

View file

@ -1,5 +1,8 @@
import 'dart:convert';
import 'package:bloc/bloc.dart'; import 'package:bloc/bloc.dart';
import 'package:loggy/loggy.dart'; import 'package:loggy/loggy.dart';
import 'package:veilid_support/veilid_support.dart';
import 'loggy.dart'; import 'loggy.dart';
const Map<String, LogLevel> _blocChangeLogLevels = { const Map<String, LogLevel> _blocChangeLogLevels = {
@ -38,7 +41,12 @@ class StateLogger extends BlocObserver {
void onChange(BlocBase<dynamic> bloc, Change<dynamic> change) { void onChange(BlocBase<dynamic> bloc, Change<dynamic> change) {
super.onChange(bloc, change); super.onChange(bloc, change);
_checkLogLevel(_blocChangeLogLevels, LogLevel.debug, bloc, (logLevel) { _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'; part 'processor_connection_state.freezed.dart';
@freezed @freezed
class ProcessorConnectionState with _$ProcessorConnectionState { sealed class ProcessorConnectionState with _$ProcessorConnectionState {
const factory ProcessorConnectionState({ const factory ProcessorConnectionState({
required VeilidStateAttachment attachment, required VeilidStateAttachment attachment,
required VeilidStateNetwork network, required VeilidStateNetwork network,

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint // ignore_for_file: type=lint
@ -9,157 +10,27 @@ part of 'processor_connection_state.dart';
// FreezedGenerator // FreezedGenerator
// ************************************************************************** // **************************************************************************
// dart format off
T _$identity<T>(T value) => value; 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 /// @nodoc
mixin _$ProcessorConnectionState { mixin _$ProcessorConnectionState {
VeilidStateAttachment get attachment => throw _privateConstructorUsedError; VeilidStateAttachment get attachment;
VeilidStateNetwork get network => throw _privateConstructorUsedError; VeilidStateNetwork get network;
/// Create a copy of ProcessorConnectionState /// Create a copy of ProcessorConnectionState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$ProcessorConnectionStateCopyWith<ProcessorConnectionState> get copyWith => $ProcessorConnectionStateCopyWith<ProcessorConnectionState> get copyWith =>
throw _privateConstructorUsedError; _$ProcessorConnectionStateCopyWithImpl<ProcessorConnectionState>(
} this as ProcessorConnectionState, _$identity);
/// @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)';
}
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$ProcessorConnectionStateImpl && other is ProcessorConnectionState &&
(identical(other.attachment, attachment) || (identical(other.attachment, attachment) ||
other.attachment == attachment) && other.attachment == attachment) &&
(identical(other.network, network) || other.network == network)); (identical(other.network, network) || other.network == network));
@ -168,32 +39,176 @@ class _$ProcessorConnectionStateImpl extends _ProcessorConnectionState {
@override @override
int get hashCode => Object.hash(runtimeType, attachment, network); 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 /// Create a copy of ProcessorConnectionState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override @override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$$ProcessorConnectionStateImplCopyWith<_$ProcessorConnectionStateImpl> $VeilidStateAttachmentCopyWith<$Res> get attachment {
get copyWith => __$$ProcessorConnectionStateImplCopyWithImpl< return $VeilidStateAttachmentCopyWith<$Res>(_self.attachment, (value) {
_$ProcessorConnectionStateImpl>(this, _$identity); return _then(_self.copyWith(attachment: value));
});
} }
abstract class _ProcessorConnectionState extends ProcessorConnectionState { /// Create a copy of ProcessorConnectionState
const factory _ProcessorConnectionState( /// with the given fields replaced by the non-null parameter values.
{required final VeilidStateAttachment attachment, @override
required final VeilidStateNetwork network}) = @pragma('vm:prefer-inline')
_$ProcessorConnectionStateImpl; $VeilidStateNetworkCopyWith<$Res> get network {
const _ProcessorConnectionState._() : super._(); return $VeilidStateNetworkCopyWith<$Res>(_self.network, (value) {
return _then(_self.copyWith(network: value));
});
}
}
/// @nodoc
class _ProcessorConnectionState extends ProcessorConnectionState {
const _ProcessorConnectionState(
{required this.attachment, required this.network})
: super._();
@override @override
VeilidStateAttachment get attachment; final VeilidStateAttachment attachment;
@override @override
VeilidStateNetwork get network; final VeilidStateNetwork network;
/// Create a copy of ProcessorConnectionState /// Create a copy of ProcessorConnectionState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
_$$ProcessorConnectionStateImplCopyWith<_$ProcessorConnectionStateImpl> @pragma('vm:prefer-inline')
get copyWith => throw _privateConstructorUsedError; _$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

@ -1,5 +1,6 @@
import '../../proto/dht.pb.dart' as dhtproto; import '../../proto/dht.pb.dart' as dhtproto;
import '../../proto/proto.dart' as veilidproto; import '../../proto/proto.dart' as veilidproto;
import '../../src/dynamic_debug.dart';
import '../dht_support.dart'; import '../dht_support.dart';
export '../../proto/dht.pb.dart'; export '../../proto/dht.pb.dart';
@ -23,3 +24,44 @@ extension ProtoOwnedDHTRecordPointer on dhtproto.OwnedDHTRecordPointer {
OwnedDHTRecordPointer toVeilid() => OwnedDHTRecordPointer( OwnedDHTRecordPointer toVeilid() => OwnedDHTRecordPointer(
recordKey: recordKey.toVeilid(), owner: owner.toVeilid()); 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

@ -31,6 +31,14 @@ class DHTLogStateData<T> extends Equatable {
@override @override
List<Object?> get props => [length, window, windowTail, windowSize, follow]; 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>>; typedef DHTLogState<T> = AsyncValue<DHTLogStateData<T>>;

View file

@ -126,10 +126,7 @@ class _DHTLogSpine {
Future<bool> delete() async => _spineMutex.protect(_spineRecord.delete); Future<bool> delete() async => _spineMutex.protect(_spineRecord.delete);
Future<T> operate<T>(Future<T> Function(_DHTLogSpine) closure) async => Future<T> operate<T>(Future<T> Function(_DHTLogSpine) closure) async =>
// ignore: prefer_expression_function_bodies _spineMutex.protect(() async => closure(this));
_spineMutex.protect(() async {
return closure(this);
});
Future<T> operateAppend<T>(Future<T> Function(_DHTLogSpine) closure) async => Future<T> operateAppend<T>(Future<T> Function(_DHTLogSpine) closure) async =>
_spineMutex.protect(() async { _spineMutex.protect(() async {

View file

@ -511,7 +511,7 @@ class DHTRecord implements DHTDeleteable<DHTRecord> {
key, key,
subkeys: [ValueSubkeyRange.single(subkey)], subkeys: [ValueSubkeyRange.single(subkey)],
); );
return rr.localSeqs.firstOrNull ?? 0xFFFFFFFF; return rr.localSeqs.firstOrNull ?? emptySeq;
} }
void _addValueChange( void _addValueChange(
@ -566,4 +566,6 @@ class DHTRecord implements DHTDeleteable<DHTRecord> {
int _openCount; int _openCount;
StreamController<DHTRecordWatchChange>? _watchController; StreamController<DHTRecordWatchChange>? _watchController;
_WatchState? _watchState; _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 'package:protobuf/protobuf.dart';
import '../../../../veilid_support.dart'; import '../../../../veilid_support.dart';
import 'extensions.dart';
export 'package:fast_immutable_collections/fast_immutable_collections.dart' export 'package:fast_immutable_collections/fast_immutable_collections.dart'
show Output; show Output;
@ -32,7 +33,7 @@ typedef DHTRecordPoolLogger = void Function(String message);
/// Record pool that managed DHTRecords and allows for tagged deletion /// Record pool that managed DHTRecords and allows for tagged deletion
/// String versions of keys due to IMap<> json unsupported in key /// String versions of keys due to IMap<> json unsupported in key
@freezed @freezed
class DHTRecordPoolAllocations with _$DHTRecordPoolAllocations { sealed class DHTRecordPoolAllocations with _$DHTRecordPoolAllocations {
const factory DHTRecordPoolAllocations({ const factory DHTRecordPoolAllocations({
@Default(IMapConst<String, ISet<TypedKey>>({})) @Default(IMapConst<String, ISet<TypedKey>>({}))
IMap<String, ISet<TypedKey>> childrenByParent, 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 /// Pointer to an owned record, with key, owner key and owner secret
/// Ensure that these are only serialized encrypted /// Ensure that these are only serialized encrypted
@freezed @freezed
class OwnedDHTRecordPointer with _$OwnedDHTRecordPointer { sealed class OwnedDHTRecordPointer with _$OwnedDHTRecordPointer {
const factory OwnedDHTRecordPointer({ const factory OwnedDHTRecordPointer({
required TypedKey recordKey, required TypedKey recordKey,
required KeyPair owner, required KeyPair owner,
@ -843,8 +844,12 @@ class DHTRecordPool with TableDBBackedJson<DHTRecordPoolAllocations> {
log('Timeout in watch cancel for key=$openedRecordKey'); log('Timeout in watch cancel for key=$openedRecordKey');
} on VeilidAPIException catch (e) { } on VeilidAPIException catch (e) {
// Failed to cancel DHT watch, try again next tick // 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; return;
} }
@ -887,7 +892,10 @@ class DHTRecordPool with TableDBBackedJson<DHTRecordPoolAllocations> {
log('Timeout in watch update for key=$openedRecordKey'); log('Timeout in watch update for key=$openedRecordKey');
} on VeilidAPIException catch (e) { } on VeilidAPIException catch (e) {
// Failed to update DHT watch, try again next tick // 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 // If we still need a state update after this then do a poll instead
@ -904,28 +912,29 @@ class DHTRecordPool with TableDBBackedJson<DHTRecordPoolAllocations> {
singleFuture((this, _sfPollWatch, openedRecordKey), () async { singleFuture((this, _sfPollWatch, openedRecordKey), () async {
final dhtctx = openedRecordInfo.shared.defaultRoutingContext; final dhtctx = openedRecordInfo.shared.defaultRoutingContext;
// Get single subkey to poll final currentReport = await dhtctx.inspectDHTRecord(openedRecordKey,
// XXX: veilid api limits this for now until everyone supports subkeys: unionWatchState.subkeys, scope: DHTReportScope.syncGet);
// inspectDHTRecord
final pollSubkey = unionWatchState.subkeys?.firstSubkey; final fsc = currentReport.firstSeqChange;
if (pollSubkey == null) { if (fsc == null) {
return; return null;
} }
final pollSubkeys = [ValueSubkeyRange.single(pollSubkey)]; final newerSubkeys = currentReport.newerSubkeys;
final currentReport = final valueData = await dhtctx.getDHTValue(openedRecordKey, fsc.subkey,
await dhtctx.inspectDHTRecord(openedRecordKey, subkeys: pollSubkeys);
final currentSeq = currentReport.localSeqs.firstOrNull ?? -1;
final valueData = await dhtctx.getDHTValue(openedRecordKey, pollSubkey,
forceRefresh: true); forceRefresh: true);
if (valueData == null) { if (valueData == null) {
return; 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( processRemoteValueChange(VeilidUpdateValueChange(
key: openedRecordKey, key: openedRecordKey,
subkeys: pollSubkeys, subkeys: newerSubkeys,
count: 0xFFFFFFFF, count: 0xFFFFFFFF,
value: valueData)); value: valueData));
} }

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint // ignore_for_file: type=lint
@ -9,183 +10,32 @@ part of 'dht_record_pool.dart';
// FreezedGenerator // FreezedGenerator
// ************************************************************************** // **************************************************************************
// dart format off
T _$identity<T>(T value) => value; 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 /// @nodoc
mixin _$DHTRecordPoolAllocations { mixin _$DHTRecordPoolAllocations {
IMap<String, ISet<Typed<FixedEncodedString43>>> get childrenByParent => IMap<String, ISet<TypedKey>> get childrenByParent;
throw _privateConstructorUsedError; IMap<String, TypedKey> get parentByChild;
IMap<String, Typed<FixedEncodedString43>> get parentByChild => ISet<TypedKey> get rootRecords;
throw _privateConstructorUsedError; IMap<String, String> get debugNames;
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;
/// Create a copy of DHTRecordPoolAllocations /// Create a copy of DHTRecordPoolAllocations
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$DHTRecordPoolAllocationsCopyWith<DHTRecordPoolAllocations> get copyWith => $DHTRecordPoolAllocationsCopyWith<DHTRecordPoolAllocations> get copyWith =>
throw _privateConstructorUsedError; _$DHTRecordPoolAllocationsCopyWithImpl<DHTRecordPoolAllocations>(
} this as DHTRecordPoolAllocations, _$identity);
/// @nodoc /// Serializes this DHTRecordPoolAllocations to a JSON map.
abstract class $DHTRecordPoolAllocationsCopyWith<$Res> { Map<String, dynamic> toJson();
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)';
}
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$DHTRecordPoolAllocationsImpl && other is DHTRecordPoolAllocations &&
(identical(other.childrenByParent, childrenByParent) || (identical(other.childrenByParent, childrenByParent) ||
other.childrenByParent == childrenByParent) && other.childrenByParent == childrenByParent) &&
(identical(other.parentByChild, parentByChild) || (identical(other.parentByChild, parentByChild) ||
@ -201,178 +51,205 @@ class _$DHTRecordPoolAllocationsImpl implements _DHTRecordPoolAllocations {
int get hashCode => Object.hash(runtimeType, childrenByParent, parentByChild, int get hashCode => Object.hash(runtimeType, childrenByParent, parentByChild,
const DeepCollectionEquality().hash(rootRecords), debugNames); 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 @override
@pragma('vm:prefer-inline') String toString() {
_$$DHTRecordPoolAllocationsImplCopyWith<_$DHTRecordPoolAllocationsImpl> return 'DHTRecordPoolAllocations(childrenByParent: $childrenByParent, parentByChild: $parentByChild, rootRecords: $rootRecords, debugNames: $debugNames)';
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 /// @nodoc
mixin _$OwnedDHTRecordPointer { abstract mixin class $DHTRecordPoolAllocationsCopyWith<$Res> {
Typed<FixedEncodedString43> get recordKey => factory $DHTRecordPoolAllocationsCopyWith(DHTRecordPoolAllocations value,
throw _privateConstructorUsedError; $Res Function(DHTRecordPoolAllocations) _then) =
KeyPair get owner => throw _privateConstructorUsedError; _$DHTRecordPoolAllocationsCopyWithImpl;
/// 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 @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 /// @nodoc
class _$OwnedDHTRecordPointerCopyWithImpl<$Res, class _$DHTRecordPoolAllocationsCopyWithImpl<$Res>
$Val extends OwnedDHTRecordPointer> implements $DHTRecordPoolAllocationsCopyWith<$Res> {
implements $OwnedDHTRecordPointerCopyWith<$Res> { _$DHTRecordPoolAllocationsCopyWithImpl(this._self, this._then);
_$OwnedDHTRecordPointerCopyWithImpl(this._value, this._then);
// ignore: unused_field final DHTRecordPoolAllocations _self;
final $Val _value; final $Res Function(DHTRecordPoolAllocations) _then;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of OwnedDHTRecordPointer /// Create a copy of DHTRecordPoolAllocations
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
@override @override
$Res call({ $Res call({
Object? recordKey = null, Object? childrenByParent = null,
Object? owner = null, Object? parentByChild = null,
Object? rootRecords = null,
Object? debugNames = null,
}) { }) {
return _then(_value.copyWith( return _then(_self.copyWith(
recordKey: null == recordKey childrenByParent: null == childrenByParent
? _value.recordKey ? _self.childrenByParent!
: recordKey // ignore: cast_nullable_to_non_nullable : childrenByParent // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>, as IMap<String, ISet<Typed<FixedEncodedString43>>>,
owner: null == owner parentByChild: null == parentByChild
? _value.owner ? _self.parentByChild!
: owner // ignore: cast_nullable_to_non_nullable : parentByChild // ignore: cast_nullable_to_non_nullable
as KeyPair, as IMap<String, Typed<FixedEncodedString43>>,
) as $Val); rootRecords: null == rootRecords
} ? _self.rootRecords!
} : rootRecords // ignore: cast_nullable_to_non_nullable
as ISet<Typed<FixedEncodedString43>>,
/// @nodoc debugNames: null == debugNames
abstract class _$$OwnedDHTRecordPointerImplCopyWith<$Res> ? _self.debugNames
implements $OwnedDHTRecordPointerCopyWith<$Res> { : debugNames // ignore: cast_nullable_to_non_nullable
factory _$$OwnedDHTRecordPointerImplCopyWith( as IMap<String, String>,
_$OwnedDHTRecordPointerImpl value,
$Res Function(_$OwnedDHTRecordPointerImpl) then) =
__$$OwnedDHTRecordPointerImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({Typed<FixedEncodedString43> recordKey, KeyPair owner});
}
/// @nodoc
class __$$OwnedDHTRecordPointerImplCopyWithImpl<$Res>
extends _$OwnedDHTRecordPointerCopyWithImpl<$Res,
_$OwnedDHTRecordPointerImpl>
implements _$$OwnedDHTRecordPointerImplCopyWith<$Res> {
__$$OwnedDHTRecordPointerImplCopyWithImpl(_$OwnedDHTRecordPointerImpl _value,
$Res Function(_$OwnedDHTRecordPointerImpl) _then)
: super(_value, _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(_$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,
)); ));
} }
} }
/// @nodoc /// @nodoc
@JsonSerializable() @JsonSerializable()
class _$OwnedDHTRecordPointerImpl implements _OwnedDHTRecordPointer { class _DHTRecordPoolAllocations implements DHTRecordPoolAllocations {
const _$OwnedDHTRecordPointerImpl( const _DHTRecordPoolAllocations(
{required this.recordKey, required this.owner}); {this.childrenByParent = const IMapConst<String, ISet<TypedKey>>({}),
this.parentByChild = const IMapConst<String, TypedKey>({}),
factory _$OwnedDHTRecordPointerImpl.fromJson(Map<String, dynamic> json) => this.rootRecords = const ISetConst<TypedKey>({}),
_$$OwnedDHTRecordPointerImplFromJson(json); this.debugNames = const IMapConst<String, String>({})});
factory _DHTRecordPoolAllocations.fromJson(Map<String, dynamic> json) =>
_$DHTRecordPoolAllocationsFromJson(json);
@override @override
final Typed<FixedEncodedString43> recordKey; @JsonKey()
final IMap<String, ISet<Typed<FixedEncodedString43>>> childrenByParent;
@override @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 @override
String toString() { Map<String, dynamic> toJson() {
return 'OwnedDHTRecordPointer(recordKey: $recordKey, owner: $owner)'; return _$DHTRecordPoolAllocationsToJson(
this,
);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (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) || (identical(other.recordKey, recordKey) ||
other.recordKey == recordKey) && other.recordKey == recordKey) &&
(identical(other.owner, owner) || other.owner == owner)); (identical(other.owner, owner) || other.owner == owner));
@ -382,40 +259,136 @@ class _$OwnedDHTRecordPointerImpl implements _OwnedDHTRecordPointer {
@override @override
int get hashCode => Object.hash(runtimeType, recordKey, owner); int get hashCode => Object.hash(runtimeType, recordKey, owner);
@override
String toString() {
return 'OwnedDHTRecordPointer(recordKey: $recordKey, owner: $owner)';
}
}
/// @nodoc
abstract mixin class $OwnedDHTRecordPointerCopyWith<$Res> {
factory $OwnedDHTRecordPointerCopyWith(OwnedDHTRecordPointer value,
$Res Function(OwnedDHTRecordPointer) _then) =
_$OwnedDHTRecordPointerCopyWithImpl;
@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 /// Create a copy of OwnedDHTRecordPointer
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$$OwnedDHTRecordPointerImplCopyWith<_$OwnedDHTRecordPointerImpl> @override
get copyWith => __$$OwnedDHTRecordPointerImplCopyWithImpl< $Res call({
_$OwnedDHTRecordPointerImpl>(this, _$identity); 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
final Typed<FixedEncodedString43> recordKey;
@override
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)
@pragma('vm:prefer-inline')
_$OwnedDHTRecordPointerCopyWith<_OwnedDHTRecordPointer> get copyWith =>
__$OwnedDHTRecordPointerCopyWithImpl<_OwnedDHTRecordPointer>(
this, _$identity);
@override @override
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return _$$OwnedDHTRecordPointerImplToJson( return _$OwnedDHTRecordPointerToJson(
this, 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));
} }
abstract class _OwnedDHTRecordPointer implements OwnedDHTRecordPointer { @JsonKey(includeFromJson: false, includeToJson: false)
const factory _OwnedDHTRecordPointer( @override
{required final Typed<FixedEncodedString43> recordKey, int get hashCode => Object.hash(runtimeType, recordKey, owner);
required final KeyPair owner}) = _$OwnedDHTRecordPointerImpl;
factory _OwnedDHTRecordPointer.fromJson(Map<String, dynamic> json) =
_$OwnedDHTRecordPointerImpl.fromJson;
@override @override
Typed<FixedEncodedString43> get recordKey; 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 @override
KeyPair get owner; @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 /// Create a copy of OwnedDHTRecordPointer
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override
@JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline')
_$$OwnedDHTRecordPointerImplCopyWith<_$OwnedDHTRecordPointerImpl> $Res call({
get copyWith => throw _privateConstructorUsedError; 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 // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
_$DHTRecordPoolAllocationsImpl _$$DHTRecordPoolAllocationsImplFromJson( _DHTRecordPoolAllocations _$DHTRecordPoolAllocationsFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json) =>
_$DHTRecordPoolAllocationsImpl( _DHTRecordPoolAllocations(
childrenByParent: json['children_by_parent'] == null childrenByParent: json['children_by_parent'] == null
? const IMapConst<String, ISet<TypedKey>>({}) ? const IMapConst<String, ISet<TypedKey>>({})
: IMap<String, ISet<Typed<FixedEncodedString43>>>.fromJson( : IMap<String, ISet<Typed<FixedEncodedString43>>>.fromJson(
@ -34,8 +34,8 @@ _$DHTRecordPoolAllocationsImpl _$$DHTRecordPoolAllocationsImplFromJson(
(value) => value as String), (value) => value as String),
); );
Map<String, dynamic> _$$DHTRecordPoolAllocationsImplToJson( Map<String, dynamic> _$DHTRecordPoolAllocationsToJson(
_$DHTRecordPoolAllocationsImpl instance) => _DHTRecordPoolAllocations instance) =>
<String, dynamic>{ <String, dynamic>{
'children_by_parent': instance.childrenByParent.toJson( 'children_by_parent': instance.childrenByParent.toJson(
(value) => value, (value) => value,
@ -56,15 +56,15 @@ Map<String, dynamic> _$$DHTRecordPoolAllocationsImplToJson(
), ),
}; };
_$OwnedDHTRecordPointerImpl _$$OwnedDHTRecordPointerImplFromJson( _OwnedDHTRecordPointer _$OwnedDHTRecordPointerFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json) =>
_$OwnedDHTRecordPointerImpl( _OwnedDHTRecordPointer(
recordKey: Typed<FixedEncodedString43>.fromJson(json['record_key']), recordKey: Typed<FixedEncodedString43>.fromJson(json['record_key']),
owner: KeyPair.fromJson(json['owner']), owner: KeyPair.fromJson(json['owner']),
); );
Map<String, dynamic> _$$OwnedDHTRecordPointerImplToJson( Map<String, dynamic> _$OwnedDHTRecordPointerToJson(
_$OwnedDHTRecordPointerImpl instance) => _OwnedDHTRecordPointer instance) =>
<String, dynamic>{ <String, dynamic>{
'record_key': instance.recordKey.toJson(), 'record_key': instance.recordKey.toJson(),
'owner': instance.owner.toJson(), 'owner': instance.owner.toJson(),

View file

@ -0,0 +1,57 @@
import 'package:veilid/veilid.dart';
import 'dht_record_pool.dart';
class DHTSeqChange {
const DHTSeqChange(this.subkey, this.oldSeq, this.newSeq);
final int subkey;
final int oldSeq;
final int newSeq;
}
extension DHTReportReportExt on DHTRecordReport {
List<ValueSubkeyRange> get newerSubkeys {
if (networkSeqs.isEmpty || localSeqs.isEmpty || subkeys.isEmpty) {
return [];
}
final currentSubkeys = <ValueSubkeyRange>[];
var i = 0;
for (final skr in subkeys) {
for (var sk = skr.low; sk <= skr.high; sk++) {
if (networkSeqs[i] > localSeqs[i] &&
networkSeqs[i] != DHTRecord.emptySeq) {
if (currentSubkeys.isNotEmpty &&
currentSubkeys.last.high == (sk - 1)) {
currentSubkeys.add(ValueSubkeyRange(
low: currentSubkeys.removeLast().low, high: sk));
} else {
currentSubkeys.add(ValueSubkeyRange.single(sk));
}
}
i++;
}
}
return currentSubkeys;
}
DHTSeqChange? get firstSeqChange {
if (networkSeqs.isEmpty || localSeqs.isEmpty || subkeys.isEmpty) {
return null;
}
var i = 0;
for (final skr in subkeys) {
for (var sk = skr.low; sk <= skr.high; sk++) {
if (networkSeqs[i] > localSeqs[i] &&
networkSeqs[i] != DHTRecord.emptySeq) {
return DHTSeqChange(sk, localSeqs[i], networkSeqs[i]);
}
i++;
}
}
return null;
}
}

View file

@ -3,27 +3,14 @@ import 'dart:async';
import 'package:async_tools/async_tools.dart'; import 'package:async_tools/async_tools.dart';
import 'package:bloc/bloc.dart'; import 'package:bloc/bloc.dart';
import 'package:bloc_advanced_tools/bloc_advanced_tools.dart'; import 'package:bloc_advanced_tools/bloc_advanced_tools.dart';
import 'package:equatable/equatable.dart';
import 'package:fast_immutable_collections/fast_immutable_collections.dart'; import 'package:fast_immutable_collections/fast_immutable_collections.dart';
import 'package:meta/meta.dart';
import '../../../veilid_support.dart'; import '../../../veilid_support.dart';
@immutable typedef DHTShortArrayState<T> = AsyncValue<IList<OnlineElementState<T>>>;
class DHTShortArrayElementState<T> extends Equatable { typedef DHTShortArrayCubitState<T> = BlocBusyState<DHTShortArrayState<T>>;
const DHTShortArrayElementState(
{required this.value, required this.isOffline});
final T value;
final bool isOffline;
@override class DHTShortArrayCubit<T> extends Cubit<DHTShortArrayCubitState<T>>
List<Object?> get props => [value, isOffline];
}
typedef DHTShortArrayState<T> = AsyncValue<IList<DHTShortArrayElementState<T>>>;
typedef DHTShortArrayBusyState<T> = BlocBusyState<DHTShortArrayState<T>>;
class DHTShortArrayCubit<T> extends Cubit<DHTShortArrayBusyState<T>>
with BlocBusyWrapper<DHTShortArrayState<T>>, RefreshableCubit { with BlocBusyWrapper<DHTShortArrayState<T>>, RefreshableCubit {
DHTShortArrayCubit({ DHTShortArrayCubit({
required Future<DHTShortArray> Function() open, required Future<DHTShortArray> Function() open,
@ -46,7 +33,7 @@ class DHTShortArrayCubit<T> extends Cubit<DHTShortArrayBusyState<T>>
} }
} on Exception catch (e, st) { } on Exception catch (e, st) {
addError(e, st); addError(e, st);
emit(DHTShortArrayBusyState<T>(AsyncValue.error(e, st))); emit(DHTShortArrayCubitState<T>(AsyncValue.error(e, st)));
return; return;
} }
@ -83,7 +70,7 @@ class DHTShortArrayCubit<T> extends Cubit<DHTShortArrayBusyState<T>>
// Get the items // Get the items
final allItems = (await reader.getRange(0, forceRefresh: forceRefresh)) final allItems = (await reader.getRange(0, forceRefresh: forceRefresh))
?.indexed ?.indexed
.map((x) => DHTShortArrayElementState( .map((x) => OnlineElementState(
value: _decodeElement(x.$2), value: _decodeElement(x.$2),
isOffline: offlinePositions?.contains(x.$1) ?? false)) isOffline: offlinePositions?.contains(x.$1) ?? false))
.toIList(); .toIList();

View file

@ -333,7 +333,7 @@ class _DHTShortArrayHead {
} }
Future<DHTShortArrayHeadLookup> lookupIndex(int idx, bool allowCreate) async { Future<DHTShortArrayHeadLookup> lookupIndex(int idx, bool allowCreate) async {
final seq = idx < _seqs.length ? _seqs[idx] : 0xFFFFFFFF; final seq = idx < _seqs.length ? _seqs[idx] : DHTRecord.emptySeq;
final recordNumber = idx ~/ _stride; final recordNumber = idx ~/ _stride;
final record = await _getOrCreateLinkedRecord(recordNumber, allowCreate); final record = await _getOrCreateLinkedRecord(recordNumber, allowCreate);
final recordSubkey = (idx % _stride) + ((recordNumber == 0) ? 1 : 0); final recordSubkey = (idx % _stride) + ((recordNumber == 0) ? 1 : 0);
@ -427,14 +427,14 @@ class _DHTShortArrayHead {
// If our local sequence number is unknown or hasnt been written yet // If our local sequence number is unknown or hasnt been written yet
// then a normal DHT operation is going to pull from the network anyway // then a normal DHT operation is going to pull from the network anyway
if (_localSeqs.length < idx || _localSeqs[idx] == 0xFFFFFFFF) { if (_localSeqs.length < idx || _localSeqs[idx] == DHTRecord.emptySeq) {
return false; return false;
} }
// If the remote sequence number record is unknown or hasnt been written // If the remote sequence number record is unknown or hasnt been written
// at this index yet, then we also do not refresh at this time as it // at this index yet, then we also do not refresh at this time as it
// is the first time the index is being written to // is the first time the index is being written to
if (_seqs.length < idx || _seqs[idx] == 0xFFFFFFFF) { if (_seqs.length < idx || _seqs[idx] == DHTRecord.emptySeq) {
return false; return false;
} }
@ -448,12 +448,12 @@ class _DHTShortArrayHead {
final idx = _index[pos]; final idx = _index[pos];
while (_localSeqs.length <= idx) { while (_localSeqs.length <= idx) {
_localSeqs.add(0xFFFFFFFF); _localSeqs.add(DHTRecord.emptySeq);
} }
_localSeqs[idx] = newSeq; _localSeqs[idx] = newSeq;
if (write) { if (write) {
while (_seqs.length <= idx) { while (_seqs.length <= idx) {
_seqs.add(0xFFFFFFFF); _seqs.add(DHTRecord.emptySeq);
} }
_seqs[idx] = newSeq; _seqs[idx] = newSeq;
} }

View file

@ -122,7 +122,7 @@ class _DHTShortArrayWrite extends _DHTShortArrayRead
final outSeqNum = Output<int>(); final outSeqNum = Output<int>();
final result = lookup.seq == 0xFFFFFFFF final result = lookup.seq == DHTRecord.emptySeq
? null ? null
: await lookup.record.get(subkey: lookup.recordSubkey); : await lookup.record.get(subkey: lookup.recordSubkey);
@ -151,7 +151,7 @@ class _DHTShortArrayWrite extends _DHTShortArrayRead
final lookup = await _head.lookupPosition(pos, true); final lookup = await _head.lookupPosition(pos, true);
final outSeqNumRead = Output<int>(); final outSeqNumRead = Output<int>();
final oldValue = lookup.seq == 0xFFFFFFFF final oldValue = lookup.seq == DHTRecord.emptySeq
? null ? null
: await lookup.record : await lookup.record
.get(subkey: lookup.recordSubkey, outSeqNum: outSeqNumRead); .get(subkey: lookup.recordSubkey, outSeqNum: outSeqNumRead);

View file

@ -8,7 +8,7 @@ part 'account_record_info.g.dart';
/// AccountRecordInfo is the key and owner info for the account dht record that /// AccountRecordInfo is the key and owner info for the account dht record that
/// is stored in the identity instance record /// is stored in the identity instance record
@freezed @freezed
class AccountRecordInfo with _$AccountRecordInfo { sealed class AccountRecordInfo with _$AccountRecordInfo {
const factory AccountRecordInfo({ const factory AccountRecordInfo({
// Top level account keys and secrets // Top level account keys and secrets
required OwnedDHTRecordPointer accountRecord, required OwnedDHTRecordPointer accountRecord,

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint // ignore_for_file: type=lint
@ -9,137 +10,30 @@ part of 'account_record_info.dart';
// FreezedGenerator // FreezedGenerator
// ************************************************************************** // **************************************************************************
// dart format off
T _$identity<T>(T value) => value; 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');
AccountRecordInfo _$AccountRecordInfoFromJson(Map<String, dynamic> json) {
return _AccountRecordInfo.fromJson(json);
}
/// @nodoc /// @nodoc
mixin _$AccountRecordInfo { mixin _$AccountRecordInfo {
// Top level account keys and secrets // Top level account keys and secrets
OwnedDHTRecordPointer get accountRecord => throw _privateConstructorUsedError; OwnedDHTRecordPointer get accountRecord;
/// Serializes this AccountRecordInfo to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of AccountRecordInfo /// Create a copy of AccountRecordInfo
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$AccountRecordInfoCopyWith<AccountRecordInfo> get copyWith => $AccountRecordInfoCopyWith<AccountRecordInfo> get copyWith =>
throw _privateConstructorUsedError; _$AccountRecordInfoCopyWithImpl<AccountRecordInfo>(
} this as AccountRecordInfo, _$identity);
/// @nodoc /// Serializes this AccountRecordInfo to a JSON map.
abstract class $AccountRecordInfoCopyWith<$Res> { Map<String, dynamic> toJson();
factory $AccountRecordInfoCopyWith(
AccountRecordInfo value, $Res Function(AccountRecordInfo) then) =
_$AccountRecordInfoCopyWithImpl<$Res, AccountRecordInfo>;
@useResult
$Res call({OwnedDHTRecordPointer accountRecord});
$OwnedDHTRecordPointerCopyWith<$Res> get accountRecord;
}
/// @nodoc
class _$AccountRecordInfoCopyWithImpl<$Res, $Val extends AccountRecordInfo>
implements $AccountRecordInfoCopyWith<$Res> {
_$AccountRecordInfoCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of AccountRecordInfo
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? accountRecord = null,
}) {
return _then(_value.copyWith(
accountRecord: null == accountRecord
? _value.accountRecord
: accountRecord // ignore: cast_nullable_to_non_nullable
as OwnedDHTRecordPointer,
) as $Val);
}
/// Create a copy of AccountRecordInfo
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$OwnedDHTRecordPointerCopyWith<$Res> get accountRecord {
return $OwnedDHTRecordPointerCopyWith<$Res>(_value.accountRecord, (value) {
return _then(_value.copyWith(accountRecord: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$AccountRecordInfoImplCopyWith<$Res>
implements $AccountRecordInfoCopyWith<$Res> {
factory _$$AccountRecordInfoImplCopyWith(_$AccountRecordInfoImpl value,
$Res Function(_$AccountRecordInfoImpl) then) =
__$$AccountRecordInfoImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({OwnedDHTRecordPointer accountRecord});
@override
$OwnedDHTRecordPointerCopyWith<$Res> get accountRecord;
}
/// @nodoc
class __$$AccountRecordInfoImplCopyWithImpl<$Res>
extends _$AccountRecordInfoCopyWithImpl<$Res, _$AccountRecordInfoImpl>
implements _$$AccountRecordInfoImplCopyWith<$Res> {
__$$AccountRecordInfoImplCopyWithImpl(_$AccountRecordInfoImpl _value,
$Res Function(_$AccountRecordInfoImpl) _then)
: super(_value, _then);
/// Create a copy of AccountRecordInfo
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? accountRecord = null,
}) {
return _then(_$AccountRecordInfoImpl(
accountRecord: null == accountRecord
? _value.accountRecord
: accountRecord // ignore: cast_nullable_to_non_nullable
as OwnedDHTRecordPointer,
));
}
}
/// @nodoc
@JsonSerializable()
class _$AccountRecordInfoImpl implements _AccountRecordInfo {
const _$AccountRecordInfoImpl({required this.accountRecord});
factory _$AccountRecordInfoImpl.fromJson(Map<String, dynamic> json) =>
_$$AccountRecordInfoImplFromJson(json);
// Top level account keys and secrets
@override
final OwnedDHTRecordPointer accountRecord;
@override
String toString() {
return 'AccountRecordInfo(accountRecord: $accountRecord)';
}
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$AccountRecordInfoImpl && other is AccountRecordInfo &&
(identical(other.accountRecord, accountRecord) || (identical(other.accountRecord, accountRecord) ||
other.accountRecord == accountRecord)); other.accountRecord == accountRecord));
} }
@ -148,39 +42,148 @@ class _$AccountRecordInfoImpl implements _AccountRecordInfo {
@override @override
int get hashCode => Object.hash(runtimeType, accountRecord); int get hashCode => Object.hash(runtimeType, accountRecord);
@override
String toString() {
return 'AccountRecordInfo(accountRecord: $accountRecord)';
}
}
/// @nodoc
abstract mixin class $AccountRecordInfoCopyWith<$Res> {
factory $AccountRecordInfoCopyWith(
AccountRecordInfo value, $Res Function(AccountRecordInfo) _then) =
_$AccountRecordInfoCopyWithImpl;
@useResult
$Res call({OwnedDHTRecordPointer accountRecord});
$OwnedDHTRecordPointerCopyWith<$Res> get accountRecord;
}
/// @nodoc
class _$AccountRecordInfoCopyWithImpl<$Res>
implements $AccountRecordInfoCopyWith<$Res> {
_$AccountRecordInfoCopyWithImpl(this._self, this._then);
final AccountRecordInfo _self;
final $Res Function(AccountRecordInfo) _then;
/// Create a copy of AccountRecordInfo
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? accountRecord = null,
}) {
return _then(_self.copyWith(
accountRecord: null == accountRecord
? _self.accountRecord
: accountRecord // ignore: cast_nullable_to_non_nullable
as OwnedDHTRecordPointer,
));
}
/// Create a copy of AccountRecordInfo /// Create a copy of AccountRecordInfo
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override @override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$$AccountRecordInfoImplCopyWith<_$AccountRecordInfoImpl> get copyWith => $OwnedDHTRecordPointerCopyWith<$Res> get accountRecord {
__$$AccountRecordInfoImplCopyWithImpl<_$AccountRecordInfoImpl>( return $OwnedDHTRecordPointerCopyWith<$Res>(_self.accountRecord, (value) {
this, _$identity); return _then(_self.copyWith(accountRecord: value));
});
@override
Map<String, dynamic> toJson() {
return _$$AccountRecordInfoImplToJson(
this,
);
} }
} }
abstract class _AccountRecordInfo implements AccountRecordInfo { /// @nodoc
const factory _AccountRecordInfo( @JsonSerializable()
{required final OwnedDHTRecordPointer accountRecord}) = class _AccountRecordInfo implements AccountRecordInfo {
_$AccountRecordInfoImpl; const _AccountRecordInfo({required this.accountRecord});
factory _AccountRecordInfo.fromJson(Map<String, dynamic> json) =>
factory _AccountRecordInfo.fromJson(Map<String, dynamic> json) = _$AccountRecordInfoFromJson(json);
_$AccountRecordInfoImpl.fromJson;
// Top level account keys and secrets // Top level account keys and secrets
@override @override
OwnedDHTRecordPointer get accountRecord; final OwnedDHTRecordPointer accountRecord;
/// Create a copy of AccountRecordInfo /// Create a copy of AccountRecordInfo
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
_$$AccountRecordInfoImplCopyWith<_$AccountRecordInfoImpl> get copyWith => @pragma('vm:prefer-inline')
throw _privateConstructorUsedError; _$AccountRecordInfoCopyWith<_AccountRecordInfo> get copyWith =>
__$AccountRecordInfoCopyWithImpl<_AccountRecordInfo>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$AccountRecordInfoToJson(
this,
);
} }
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _AccountRecordInfo &&
(identical(other.accountRecord, accountRecord) ||
other.accountRecord == accountRecord));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, accountRecord);
@override
String toString() {
return 'AccountRecordInfo(accountRecord: $accountRecord)';
}
}
/// @nodoc
abstract mixin class _$AccountRecordInfoCopyWith<$Res>
implements $AccountRecordInfoCopyWith<$Res> {
factory _$AccountRecordInfoCopyWith(
_AccountRecordInfo value, $Res Function(_AccountRecordInfo) _then) =
__$AccountRecordInfoCopyWithImpl;
@override
@useResult
$Res call({OwnedDHTRecordPointer accountRecord});
@override
$OwnedDHTRecordPointerCopyWith<$Res> get accountRecord;
}
/// @nodoc
class __$AccountRecordInfoCopyWithImpl<$Res>
implements _$AccountRecordInfoCopyWith<$Res> {
__$AccountRecordInfoCopyWithImpl(this._self, this._then);
final _AccountRecordInfo _self;
final $Res Function(_AccountRecordInfo) _then;
/// Create a copy of AccountRecordInfo
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$Res call({
Object? accountRecord = null,
}) {
return _then(_AccountRecordInfo(
accountRecord: null == accountRecord
? _self.accountRecord
: accountRecord // ignore: cast_nullable_to_non_nullable
as OwnedDHTRecordPointer,
));
}
/// Create a copy of AccountRecordInfo
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$OwnedDHTRecordPointerCopyWith<$Res> get accountRecord {
return $OwnedDHTRecordPointerCopyWith<$Res>(_self.accountRecord, (value) {
return _then(_self.copyWith(accountRecord: value));
});
}
}
// dart format on

View file

@ -6,14 +6,12 @@ part of 'account_record_info.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
_$AccountRecordInfoImpl _$$AccountRecordInfoImplFromJson( _AccountRecordInfo _$AccountRecordInfoFromJson(Map<String, dynamic> json) =>
Map<String, dynamic> json) => _AccountRecordInfo(
_$AccountRecordInfoImpl(
accountRecord: OwnedDHTRecordPointer.fromJson(json['account_record']), accountRecord: OwnedDHTRecordPointer.fromJson(json['account_record']),
); );
Map<String, dynamic> _$$AccountRecordInfoImplToJson( Map<String, dynamic> _$AccountRecordInfoToJson(_AccountRecordInfo instance) =>
_$AccountRecordInfoImpl instance) =>
<String, dynamic>{ <String, dynamic>{
'account_record': instance.accountRecord.toJson(), 'account_record': instance.accountRecord.toJson(),
}; };

View file

@ -14,7 +14,7 @@ part 'identity.g.dart';
/// DHT Secret: IdentityInstance Secret Key (stored encrypted with unlock code /// DHT Secret: IdentityInstance Secret Key (stored encrypted with unlock code
/// in local table store) /// in local table store)
@freezed @freezed
class Identity with _$Identity { sealed class Identity with _$Identity {
const factory Identity({ const factory Identity({
// Top level account keys and secrets // Top level account keys and secrets
required IMap<String, ISet<AccountRecordInfo>> accountRecords, required IMap<String, ISet<AccountRecordInfo>> accountRecords,

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint // ignore_for_file: type=lint
@ -9,122 +10,29 @@ part of 'identity.dart';
// FreezedGenerator // FreezedGenerator
// ************************************************************************** // **************************************************************************
// dart format off
T _$identity<T>(T value) => value; 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');
Identity _$IdentityFromJson(Map<String, dynamic> json) {
return _Identity.fromJson(json);
}
/// @nodoc /// @nodoc
mixin _$Identity { mixin _$Identity {
// Top level account keys and secrets // Top level account keys and secrets
IMap<String, ISet<AccountRecordInfo>> get accountRecords => IMap<String, ISet<AccountRecordInfo>> get accountRecords;
throw _privateConstructorUsedError;
/// Serializes this Identity to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Identity /// Create a copy of Identity
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$IdentityCopyWith<Identity> get copyWith => $IdentityCopyWith<Identity> get copyWith =>
throw _privateConstructorUsedError; _$IdentityCopyWithImpl<Identity>(this as Identity, _$identity);
}
/// @nodoc /// Serializes this Identity to a JSON map.
abstract class $IdentityCopyWith<$Res> { Map<String, dynamic> toJson();
factory $IdentityCopyWith(Identity value, $Res Function(Identity) then) =
_$IdentityCopyWithImpl<$Res, Identity>;
@useResult
$Res call({IMap<String, ISet<AccountRecordInfo>> accountRecords});
}
/// @nodoc
class _$IdentityCopyWithImpl<$Res, $Val extends Identity>
implements $IdentityCopyWith<$Res> {
_$IdentityCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Identity
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? accountRecords = null,
}) {
return _then(_value.copyWith(
accountRecords: null == accountRecords
? _value.accountRecords
: accountRecords // ignore: cast_nullable_to_non_nullable
as IMap<String, ISet<AccountRecordInfo>>,
) as $Val);
}
}
/// @nodoc
abstract class _$$IdentityImplCopyWith<$Res>
implements $IdentityCopyWith<$Res> {
factory _$$IdentityImplCopyWith(
_$IdentityImpl value, $Res Function(_$IdentityImpl) then) =
__$$IdentityImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({IMap<String, ISet<AccountRecordInfo>> accountRecords});
}
/// @nodoc
class __$$IdentityImplCopyWithImpl<$Res>
extends _$IdentityCopyWithImpl<$Res, _$IdentityImpl>
implements _$$IdentityImplCopyWith<$Res> {
__$$IdentityImplCopyWithImpl(
_$IdentityImpl _value, $Res Function(_$IdentityImpl) _then)
: super(_value, _then);
/// Create a copy of Identity
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? accountRecords = null,
}) {
return _then(_$IdentityImpl(
accountRecords: null == accountRecords
? _value.accountRecords
: accountRecords // ignore: cast_nullable_to_non_nullable
as IMap<String, ISet<AccountRecordInfo>>,
));
}
}
/// @nodoc
@JsonSerializable()
class _$IdentityImpl implements _Identity {
const _$IdentityImpl({required this.accountRecords});
factory _$IdentityImpl.fromJson(Map<String, dynamic> json) =>
_$$IdentityImplFromJson(json);
// Top level account keys and secrets
@override
final IMap<String, ISet<AccountRecordInfo>> accountRecords;
@override
String toString() {
return 'Identity(accountRecords: $accountRecords)';
}
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$IdentityImpl && other is Identity &&
(identical(other.accountRecords, accountRecords) || (identical(other.accountRecords, accountRecords) ||
other.accountRecords == accountRecords)); other.accountRecords == accountRecords));
} }
@ -133,38 +41,119 @@ class _$IdentityImpl implements _Identity {
@override @override
int get hashCode => Object.hash(runtimeType, accountRecords); int get hashCode => Object.hash(runtimeType, accountRecords);
@override
String toString() {
return 'Identity(accountRecords: $accountRecords)';
}
}
/// @nodoc
abstract mixin class $IdentityCopyWith<$Res> {
factory $IdentityCopyWith(Identity value, $Res Function(Identity) _then) =
_$IdentityCopyWithImpl;
@useResult
$Res call({IMap<String, ISet<AccountRecordInfo>> accountRecords});
}
/// @nodoc
class _$IdentityCopyWithImpl<$Res> implements $IdentityCopyWith<$Res> {
_$IdentityCopyWithImpl(this._self, this._then);
final Identity _self;
final $Res Function(Identity) _then;
/// Create a copy of Identity /// Create a copy of Identity
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$$IdentityImplCopyWith<_$IdentityImpl> get copyWith =>
__$$IdentityImplCopyWithImpl<_$IdentityImpl>(this, _$identity);
@override @override
Map<String, dynamic> toJson() { $Res call({
return _$$IdentityImplToJson( Object? accountRecords = null,
this, }) {
); return _then(_self.copyWith(
accountRecords: null == accountRecords
? _self.accountRecords
: accountRecords // ignore: cast_nullable_to_non_nullable
as IMap<String, ISet<AccountRecordInfo>>,
));
} }
} }
abstract class _Identity implements Identity { /// @nodoc
const factory _Identity( @JsonSerializable()
{required final IMap<String, ISet<AccountRecordInfo>> class _Identity implements Identity {
accountRecords}) = _$IdentityImpl; const _Identity({required this.accountRecords});
factory _Identity.fromJson(Map<String, dynamic> json) =>
factory _Identity.fromJson(Map<String, dynamic> json) = _$IdentityFromJson(json);
_$IdentityImpl.fromJson;
// Top level account keys and secrets // Top level account keys and secrets
@override @override
IMap<String, ISet<AccountRecordInfo>> get accountRecords; final IMap<String, ISet<AccountRecordInfo>> accountRecords;
/// Create a copy of Identity /// Create a copy of Identity
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
_$$IdentityImplCopyWith<_$IdentityImpl> get copyWith => @pragma('vm:prefer-inline')
throw _privateConstructorUsedError; _$IdentityCopyWith<_Identity> get copyWith =>
__$IdentityCopyWithImpl<_Identity>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$IdentityToJson(
this,
);
} }
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _Identity &&
(identical(other.accountRecords, accountRecords) ||
other.accountRecords == accountRecords));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, accountRecords);
@override
String toString() {
return 'Identity(accountRecords: $accountRecords)';
}
}
/// @nodoc
abstract mixin class _$IdentityCopyWith<$Res>
implements $IdentityCopyWith<$Res> {
factory _$IdentityCopyWith(_Identity value, $Res Function(_Identity) _then) =
__$IdentityCopyWithImpl;
@override
@useResult
$Res call({IMap<String, ISet<AccountRecordInfo>> accountRecords});
}
/// @nodoc
class __$IdentityCopyWithImpl<$Res> implements _$IdentityCopyWith<$Res> {
__$IdentityCopyWithImpl(this._self, this._then);
final _Identity _self;
final $Res Function(_Identity) _then;
/// Create a copy of Identity
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$Res call({
Object? accountRecords = null,
}) {
return _then(_Identity(
accountRecords: null == accountRecords
? _self.accountRecords
: accountRecords // ignore: cast_nullable_to_non_nullable
as IMap<String, ISet<AccountRecordInfo>>,
));
}
}
// dart format on

View file

@ -6,8 +6,7 @@ part of 'identity.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
_$IdentityImpl _$$IdentityImplFromJson(Map<String, dynamic> json) => _Identity _$IdentityFromJson(Map<String, dynamic> json) => _Identity(
_$IdentityImpl(
accountRecords: IMap<String, ISet<AccountRecordInfo>>.fromJson( accountRecords: IMap<String, ISet<AccountRecordInfo>>.fromJson(
json['account_records'] as Map<String, dynamic>, json['account_records'] as Map<String, dynamic>,
(value) => value as String, (value) => value as String,
@ -15,8 +14,7 @@ _$IdentityImpl _$$IdentityImplFromJson(Map<String, dynamic> json) =>
value, (value) => AccountRecordInfo.fromJson(value))), value, (value) => AccountRecordInfo.fromJson(value))),
); );
Map<String, dynamic> _$$IdentityImplToJson(_$IdentityImpl instance) => Map<String, dynamic> _$IdentityToJson(_Identity instance) => <String, dynamic>{
<String, dynamic>{
'account_records': instance.accountRecords.toJson( 'account_records': instance.accountRecords.toJson(
(value) => value, (value) => value,
(value) => value.toJson( (value) => value.toJson(

View file

@ -10,7 +10,7 @@ part 'identity_instance.freezed.dart';
part 'identity_instance.g.dart'; part 'identity_instance.g.dart';
@freezed @freezed
class IdentityInstance with _$IdentityInstance { sealed class IdentityInstance with _$IdentityInstance {
const factory IdentityInstance({ const factory IdentityInstance({
// Private DHT record storing identity account mapping // Private DHT record storing identity account mapping
required TypedKey recordKey, required TypedKey recordKey,

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint // ignore_for_file: type=lint
@ -9,50 +10,76 @@ part of 'identity_instance.dart';
// FreezedGenerator // FreezedGenerator
// ************************************************************************** // **************************************************************************
// dart format off
T _$identity<T>(T value) => value; 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');
IdentityInstance _$IdentityInstanceFromJson(Map<String, dynamic> json) {
return _IdentityInstance.fromJson(json);
}
/// @nodoc /// @nodoc
mixin _$IdentityInstance { mixin _$IdentityInstance {
// Private DHT record storing identity account mapping // Private DHT record storing identity account mapping
Typed<FixedEncodedString43> get recordKey => TypedKey get recordKey; // Public key of identity instance
throw _privateConstructorUsedError; // Public key of identity instance PublicKey get publicKey; // Secret key of identity instance
FixedEncodedString43 get publicKey =>
throw _privateConstructorUsedError; // Secret key of identity instance
// Encrypted with appended salt, key is DeriveSharedSecret( // Encrypted with appended salt, key is DeriveSharedSecret(
// password = SuperIdentity.secret, // password = SuperIdentity.secret,
// salt = publicKey) // salt = publicKey)
// Used to recover accounts without generating a new instance // Used to recover accounts without generating a new instance
@Uint8ListJsonConverter() @Uint8ListJsonConverter()
Uint8List get encryptedSecretKey => Uint8List
throw _privateConstructorUsedError; // Signature of SuperInstance recordKey and SuperInstance publicKey get encryptedSecretKey; // Signature of SuperInstance recordKey and SuperInstance publicKey
// by publicKey // by publicKey
FixedEncodedString86 get superSignature => Signature
throw _privateConstructorUsedError; // Signature of recordKey, publicKey, encryptedSecretKey, and superSignature get superSignature; // Signature of recordKey, publicKey, encryptedSecretKey, and superSignature
// by SuperIdentity publicKey // by SuperIdentity publicKey
FixedEncodedString86 get signature => throw _privateConstructorUsedError; Signature get signature;
/// Serializes this IdentityInstance to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of IdentityInstance /// Create a copy of IdentityInstance
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$IdentityInstanceCopyWith<IdentityInstance> get copyWith => $IdentityInstanceCopyWith<IdentityInstance> get copyWith =>
throw _privateConstructorUsedError; _$IdentityInstanceCopyWithImpl<IdentityInstance>(
this as IdentityInstance, _$identity);
/// Serializes this IdentityInstance to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is IdentityInstance &&
(identical(other.recordKey, recordKey) ||
other.recordKey == recordKey) &&
(identical(other.publicKey, publicKey) ||
other.publicKey == publicKey) &&
const DeepCollectionEquality()
.equals(other.encryptedSecretKey, encryptedSecretKey) &&
(identical(other.superSignature, superSignature) ||
other.superSignature == superSignature) &&
(identical(other.signature, signature) ||
other.signature == signature));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
recordKey,
publicKey,
const DeepCollectionEquality().hash(encryptedSecretKey),
superSignature,
signature);
@override
String toString() {
return 'IdentityInstance(recordKey: $recordKey, publicKey: $publicKey, encryptedSecretKey: $encryptedSecretKey, superSignature: $superSignature, signature: $signature)';
}
} }
/// @nodoc /// @nodoc
abstract class $IdentityInstanceCopyWith<$Res> { abstract mixin class $IdentityInstanceCopyWith<$Res> {
factory $IdentityInstanceCopyWith( factory $IdentityInstanceCopyWith(
IdentityInstance value, $Res Function(IdentityInstance) then) = IdentityInstance value, $Res Function(IdentityInstance) _then) =
_$IdentityInstanceCopyWithImpl<$Res, IdentityInstance>; _$IdentityInstanceCopyWithImpl;
@useResult @useResult
$Res call( $Res call(
{Typed<FixedEncodedString43> recordKey, {Typed<FixedEncodedString43> recordKey,
@ -63,14 +90,12 @@ abstract class $IdentityInstanceCopyWith<$Res> {
} }
/// @nodoc /// @nodoc
class _$IdentityInstanceCopyWithImpl<$Res, $Val extends IdentityInstance> class _$IdentityInstanceCopyWithImpl<$Res>
implements $IdentityInstanceCopyWith<$Res> { implements $IdentityInstanceCopyWith<$Res> {
_$IdentityInstanceCopyWithImpl(this._value, this._then); _$IdentityInstanceCopyWithImpl(this._self, this._then);
// ignore: unused_field final IdentityInstance _self;
final $Val _value; final $Res Function(IdentityInstance) _then;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of IdentityInstance /// Create a copy of IdentityInstance
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@ -83,85 +108,25 @@ class _$IdentityInstanceCopyWithImpl<$Res, $Val extends IdentityInstance>
Object? superSignature = null, Object? superSignature = null,
Object? signature = null, Object? signature = null,
}) { }) {
return _then(_value.copyWith( return _then(_self.copyWith(
recordKey: null == recordKey recordKey: null == recordKey
? _value.recordKey ? _self.recordKey!
: recordKey // ignore: cast_nullable_to_non_nullable : recordKey // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>, as Typed<FixedEncodedString43>,
publicKey: null == publicKey publicKey: null == publicKey
? _value.publicKey ? _self.publicKey!
: publicKey // ignore: cast_nullable_to_non_nullable : publicKey // ignore: cast_nullable_to_non_nullable
as FixedEncodedString43, as FixedEncodedString43,
encryptedSecretKey: null == encryptedSecretKey encryptedSecretKey: null == encryptedSecretKey
? _value.encryptedSecretKey ? _self.encryptedSecretKey
: encryptedSecretKey // ignore: cast_nullable_to_non_nullable : encryptedSecretKey // ignore: cast_nullable_to_non_nullable
as Uint8List, as Uint8List,
superSignature: null == superSignature superSignature: null == superSignature
? _value.superSignature ? _self.superSignature!
: superSignature // ignore: cast_nullable_to_non_nullable : superSignature // ignore: cast_nullable_to_non_nullable
as FixedEncodedString86, as FixedEncodedString86,
signature: null == signature signature: null == signature
? _value.signature ? _self.signature!
: signature // ignore: cast_nullable_to_non_nullable
as FixedEncodedString86,
) as $Val);
}
}
/// @nodoc
abstract class _$$IdentityInstanceImplCopyWith<$Res>
implements $IdentityInstanceCopyWith<$Res> {
factory _$$IdentityInstanceImplCopyWith(_$IdentityInstanceImpl value,
$Res Function(_$IdentityInstanceImpl) then) =
__$$IdentityInstanceImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{Typed<FixedEncodedString43> recordKey,
FixedEncodedString43 publicKey,
@Uint8ListJsonConverter() Uint8List encryptedSecretKey,
FixedEncodedString86 superSignature,
FixedEncodedString86 signature});
}
/// @nodoc
class __$$IdentityInstanceImplCopyWithImpl<$Res>
extends _$IdentityInstanceCopyWithImpl<$Res, _$IdentityInstanceImpl>
implements _$$IdentityInstanceImplCopyWith<$Res> {
__$$IdentityInstanceImplCopyWithImpl(_$IdentityInstanceImpl _value,
$Res Function(_$IdentityInstanceImpl) _then)
: super(_value, _then);
/// Create a copy of IdentityInstance
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? recordKey = null,
Object? publicKey = null,
Object? encryptedSecretKey = null,
Object? superSignature = null,
Object? signature = null,
}) {
return _then(_$IdentityInstanceImpl(
recordKey: null == recordKey
? _value.recordKey
: recordKey // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>,
publicKey: null == publicKey
? _value.publicKey
: publicKey // ignore: cast_nullable_to_non_nullable
as FixedEncodedString43,
encryptedSecretKey: null == encryptedSecretKey
? _value.encryptedSecretKey
: encryptedSecretKey // ignore: cast_nullable_to_non_nullable
as Uint8List,
superSignature: null == superSignature
? _value.superSignature
: superSignature // ignore: cast_nullable_to_non_nullable
as FixedEncodedString86,
signature: null == signature
? _value.signature
: signature // ignore: cast_nullable_to_non_nullable : signature // ignore: cast_nullable_to_non_nullable
as FixedEncodedString86, as FixedEncodedString86,
)); ));
@ -170,17 +135,16 @@ class __$$IdentityInstanceImplCopyWithImpl<$Res>
/// @nodoc /// @nodoc
@JsonSerializable() @JsonSerializable()
class _$IdentityInstanceImpl extends _IdentityInstance { class _IdentityInstance extends IdentityInstance {
const _$IdentityInstanceImpl( const _IdentityInstance(
{required this.recordKey, {required this.recordKey,
required this.publicKey, required this.publicKey,
@Uint8ListJsonConverter() required this.encryptedSecretKey, @Uint8ListJsonConverter() required this.encryptedSecretKey,
required this.superSignature, required this.superSignature,
required this.signature}) required this.signature})
: super._(); : super._();
factory _IdentityInstance.fromJson(Map<String, dynamic> json) =>
factory _$IdentityInstanceImpl.fromJson(Map<String, dynamic> json) => _$IdentityInstanceFromJson(json);
_$$IdentityInstanceImplFromJson(json);
// Private DHT record storing identity account mapping // Private DHT record storing identity account mapping
@override @override
@ -205,16 +169,26 @@ class _$IdentityInstanceImpl extends _IdentityInstance {
@override @override
final FixedEncodedString86 signature; final FixedEncodedString86 signature;
/// Create a copy of IdentityInstance
/// with the given fields replaced by the non-null parameter values.
@override @override
String toString() { @JsonKey(includeFromJson: false, includeToJson: false)
return 'IdentityInstance(recordKey: $recordKey, publicKey: $publicKey, encryptedSecretKey: $encryptedSecretKey, superSignature: $superSignature, signature: $signature)'; @pragma('vm:prefer-inline')
_$IdentityInstanceCopyWith<_IdentityInstance> get copyWith =>
__$IdentityInstanceCopyWithImpl<_IdentityInstance>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$IdentityInstanceToJson(
this,
);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$IdentityInstanceImpl && other is _IdentityInstance &&
(identical(other.recordKey, recordKey) || (identical(other.recordKey, recordKey) ||
other.recordKey == recordKey) && other.recordKey == recordKey) &&
(identical(other.publicKey, publicKey) || (identical(other.publicKey, publicKey) ||
@ -237,60 +211,70 @@ class _$IdentityInstanceImpl extends _IdentityInstance {
superSignature, superSignature,
signature); signature);
@override
String toString() {
return 'IdentityInstance(recordKey: $recordKey, publicKey: $publicKey, encryptedSecretKey: $encryptedSecretKey, superSignature: $superSignature, signature: $signature)';
}
}
/// @nodoc
abstract mixin class _$IdentityInstanceCopyWith<$Res>
implements $IdentityInstanceCopyWith<$Res> {
factory _$IdentityInstanceCopyWith(
_IdentityInstance value, $Res Function(_IdentityInstance) _then) =
__$IdentityInstanceCopyWithImpl;
@override
@useResult
$Res call(
{Typed<FixedEncodedString43> recordKey,
FixedEncodedString43 publicKey,
@Uint8ListJsonConverter() Uint8List encryptedSecretKey,
FixedEncodedString86 superSignature,
FixedEncodedString86 signature});
}
/// @nodoc
class __$IdentityInstanceCopyWithImpl<$Res>
implements _$IdentityInstanceCopyWith<$Res> {
__$IdentityInstanceCopyWithImpl(this._self, this._then);
final _IdentityInstance _self;
final $Res Function(_IdentityInstance) _then;
/// Create a copy of IdentityInstance /// Create a copy of IdentityInstance
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override @override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$$IdentityInstanceImplCopyWith<_$IdentityInstanceImpl> get copyWith => $Res call({
__$$IdentityInstanceImplCopyWithImpl<_$IdentityInstanceImpl>( Object? recordKey = null,
this, _$identity); Object? publicKey = null,
Object? encryptedSecretKey = null,
@override Object? superSignature = null,
Map<String, dynamic> toJson() { Object? signature = null,
return _$$IdentityInstanceImplToJson( }) {
this, return _then(_IdentityInstance(
); recordKey: null == recordKey
? _self.recordKey
: recordKey // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>,
publicKey: null == publicKey
? _self.publicKey
: publicKey // ignore: cast_nullable_to_non_nullable
as FixedEncodedString43,
encryptedSecretKey: null == encryptedSecretKey
? _self.encryptedSecretKey
: encryptedSecretKey // ignore: cast_nullable_to_non_nullable
as Uint8List,
superSignature: null == superSignature
? _self.superSignature
: superSignature // ignore: cast_nullable_to_non_nullable
as FixedEncodedString86,
signature: null == signature
? _self.signature
: signature // ignore: cast_nullable_to_non_nullable
as FixedEncodedString86,
));
} }
} }
abstract class _IdentityInstance extends IdentityInstance { // dart format on
const factory _IdentityInstance(
{required final Typed<FixedEncodedString43> recordKey,
required final FixedEncodedString43 publicKey,
@Uint8ListJsonConverter() required final Uint8List encryptedSecretKey,
required final FixedEncodedString86 superSignature,
required final FixedEncodedString86 signature}) = _$IdentityInstanceImpl;
const _IdentityInstance._() : super._();
factory _IdentityInstance.fromJson(Map<String, dynamic> json) =
_$IdentityInstanceImpl.fromJson;
// Private DHT record storing identity account mapping
@override
Typed<FixedEncodedString43> get recordKey; // Public key of identity instance
@override
FixedEncodedString43 get publicKey; // Secret key of identity instance
// Encrypted with appended salt, key is DeriveSharedSecret(
// password = SuperIdentity.secret,
// salt = publicKey)
// Used to recover accounts without generating a new instance
@override
@Uint8ListJsonConverter()
Uint8List
get encryptedSecretKey; // Signature of SuperInstance recordKey and SuperInstance publicKey
// by publicKey
@override
FixedEncodedString86
get superSignature; // Signature of recordKey, publicKey, encryptedSecretKey, and superSignature
// by SuperIdentity publicKey
@override
FixedEncodedString86 get signature;
/// Create a copy of IdentityInstance
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$IdentityInstanceImplCopyWith<_$IdentityInstanceImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View file

@ -6,9 +6,8 @@ part of 'identity_instance.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
_$IdentityInstanceImpl _$$IdentityInstanceImplFromJson( _IdentityInstance _$IdentityInstanceFromJson(Map<String, dynamic> json) =>
Map<String, dynamic> json) => _IdentityInstance(
_$IdentityInstanceImpl(
recordKey: Typed<FixedEncodedString43>.fromJson(json['record_key']), recordKey: Typed<FixedEncodedString43>.fromJson(json['record_key']),
publicKey: FixedEncodedString43.fromJson(json['public_key']), publicKey: FixedEncodedString43.fromJson(json['public_key']),
encryptedSecretKey: encryptedSecretKey:
@ -17,8 +16,7 @@ _$IdentityInstanceImpl _$$IdentityInstanceImplFromJson(
signature: FixedEncodedString86.fromJson(json['signature']), signature: FixedEncodedString86.fromJson(json['signature']),
); );
Map<String, dynamic> _$$IdentityInstanceImplToJson( Map<String, dynamic> _$IdentityInstanceToJson(_IdentityInstance instance) =>
_$IdentityInstanceImpl instance) =>
<String, dynamic>{ <String, dynamic>{
'record_key': instance.recordKey.toJson(), 'record_key': instance.recordKey.toJson(),
'public_key': instance.publicKey.toJson(), 'public_key': instance.publicKey.toJson(),

View file

@ -22,7 +22,7 @@ part 'super_identity.g.dart';
/// DHT Owner Secret: SuperIdentity Secret Key (kept offline) /// DHT Owner Secret: SuperIdentity Secret Key (kept offline)
/// Encryption: None /// Encryption: None
@freezed @freezed
class SuperIdentity with _$SuperIdentity { sealed class SuperIdentity with _$SuperIdentity {
const factory SuperIdentity({ const factory SuperIdentity({
/// Public DHT record storing this structure for account recovery /// Public DHT record storing this structure for account recovery
/// changing this can migrate/forward the SuperIdentity to a new DHT record /// changing this can migrate/forward the SuperIdentity to a new DHT record

View file

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file // coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND // GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint // ignore_for_file: type=lint
@ -9,65 +10,93 @@ part of 'super_identity.dart';
// FreezedGenerator // FreezedGenerator
// ************************************************************************** // **************************************************************************
// dart format off
T _$identity<T>(T value) => value; 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');
SuperIdentity _$SuperIdentityFromJson(Map<String, dynamic> json) {
return _SuperIdentity.fromJson(json);
}
/// @nodoc /// @nodoc
mixin _$SuperIdentity { mixin _$SuperIdentity {
/// Public DHT record storing this structure for account recovery /// Public DHT record storing this structure for account recovery
/// changing this can migrate/forward the SuperIdentity to a new DHT record /// changing this can migrate/forward the SuperIdentity to a new DHT record
/// Instances should not hash this recordKey, rather the actual record /// Instances should not hash this recordKey, rather the actual record
/// key used to store the superIdentity, as this may change. /// key used to store the superIdentity, as this may change.
Typed<FixedEncodedString43> get recordKey => TypedKey get recordKey;
throw _privateConstructorUsedError;
/// Public key of the SuperIdentity used to sign identity keys for recovery /// Public key of the SuperIdentity used to sign identity keys for recovery
/// This must match the owner of the superRecord DHT record and can not be /// This must match the owner of the superRecord DHT record and can not be
/// changed without changing the record /// changed without changing the record
FixedEncodedString43 get publicKey => throw _privateConstructorUsedError; PublicKey get publicKey;
/// Current identity instance /// Current identity instance
/// The most recently generated identity instance for this SuperIdentity /// The most recently generated identity instance for this SuperIdentity
IdentityInstance get currentInstance => throw _privateConstructorUsedError; IdentityInstance get currentInstance;
/// Deprecated identity instances /// Deprecated identity instances
/// These may be compromised and should not be considered valid for /// These may be compromised and should not be considered valid for
/// new signatures, but may be used to validate old signatures /// new signatures, but may be used to validate old signatures
List<IdentityInstance> get deprecatedInstances => List<IdentityInstance> get deprecatedInstances;
throw _privateConstructorUsedError;
/// Deprecated superRecords /// Deprecated superRecords
/// These may be compromised and should not be considered valid for /// These may be compromised and should not be considered valid for
/// new signatures, but may be used to validate old signatures /// new signatures, but may be used to validate old signatures
List<Typed<FixedEncodedString43>> get deprecatedSuperRecordKeys => List<TypedKey> get deprecatedSuperRecordKeys;
throw _privateConstructorUsedError;
/// Signature of recordKey, currentInstance signature, /// Signature of recordKey, currentInstance signature,
/// signatures of deprecatedInstances, and deprecatedSuperRecordKeys /// signatures of deprecatedInstances, and deprecatedSuperRecordKeys
/// by publicKey /// by publicKey
FixedEncodedString86 get signature => throw _privateConstructorUsedError; Signature get signature;
/// Serializes this SuperIdentity to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of SuperIdentity /// Create a copy of SuperIdentity
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$SuperIdentityCopyWith<SuperIdentity> get copyWith => $SuperIdentityCopyWith<SuperIdentity> get copyWith =>
throw _privateConstructorUsedError; _$SuperIdentityCopyWithImpl<SuperIdentity>(
this as SuperIdentity, _$identity);
/// Serializes this SuperIdentity to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is SuperIdentity &&
(identical(other.recordKey, recordKey) ||
other.recordKey == recordKey) &&
(identical(other.publicKey, publicKey) ||
other.publicKey == publicKey) &&
(identical(other.currentInstance, currentInstance) ||
other.currentInstance == currentInstance) &&
const DeepCollectionEquality()
.equals(other.deprecatedInstances, deprecatedInstances) &&
const DeepCollectionEquality().equals(
other.deprecatedSuperRecordKeys, deprecatedSuperRecordKeys) &&
(identical(other.signature, signature) ||
other.signature == signature));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
recordKey,
publicKey,
currentInstance,
const DeepCollectionEquality().hash(deprecatedInstances),
const DeepCollectionEquality().hash(deprecatedSuperRecordKeys),
signature);
@override
String toString() {
return 'SuperIdentity(recordKey: $recordKey, publicKey: $publicKey, currentInstance: $currentInstance, deprecatedInstances: $deprecatedInstances, deprecatedSuperRecordKeys: $deprecatedSuperRecordKeys, signature: $signature)';
}
} }
/// @nodoc /// @nodoc
abstract class $SuperIdentityCopyWith<$Res> { abstract mixin class $SuperIdentityCopyWith<$Res> {
factory $SuperIdentityCopyWith( factory $SuperIdentityCopyWith(
SuperIdentity value, $Res Function(SuperIdentity) then) = SuperIdentity value, $Res Function(SuperIdentity) _then) =
_$SuperIdentityCopyWithImpl<$Res, SuperIdentity>; _$SuperIdentityCopyWithImpl;
@useResult @useResult
$Res call( $Res call(
{Typed<FixedEncodedString43> recordKey, {Typed<FixedEncodedString43> recordKey,
@ -81,14 +110,12 @@ abstract class $SuperIdentityCopyWith<$Res> {
} }
/// @nodoc /// @nodoc
class _$SuperIdentityCopyWithImpl<$Res, $Val extends SuperIdentity> class _$SuperIdentityCopyWithImpl<$Res>
implements $SuperIdentityCopyWith<$Res> { implements $SuperIdentityCopyWith<$Res> {
_$SuperIdentityCopyWithImpl(this._value, this._then); _$SuperIdentityCopyWithImpl(this._self, this._then);
// ignore: unused_field final SuperIdentity _self;
final $Val _value; final $Res Function(SuperIdentity) _then;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of SuperIdentity /// Create a copy of SuperIdentity
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@ -102,32 +129,32 @@ class _$SuperIdentityCopyWithImpl<$Res, $Val extends SuperIdentity>
Object? deprecatedSuperRecordKeys = null, Object? deprecatedSuperRecordKeys = null,
Object? signature = null, Object? signature = null,
}) { }) {
return _then(_value.copyWith( return _then(_self.copyWith(
recordKey: null == recordKey recordKey: null == recordKey
? _value.recordKey ? _self.recordKey!
: recordKey // ignore: cast_nullable_to_non_nullable : recordKey // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>, as Typed<FixedEncodedString43>,
publicKey: null == publicKey publicKey: null == publicKey
? _value.publicKey ? _self.publicKey!
: publicKey // ignore: cast_nullable_to_non_nullable : publicKey // ignore: cast_nullable_to_non_nullable
as FixedEncodedString43, as FixedEncodedString43,
currentInstance: null == currentInstance currentInstance: null == currentInstance
? _value.currentInstance ? _self.currentInstance
: currentInstance // ignore: cast_nullable_to_non_nullable : currentInstance // ignore: cast_nullable_to_non_nullable
as IdentityInstance, as IdentityInstance,
deprecatedInstances: null == deprecatedInstances deprecatedInstances: null == deprecatedInstances
? _value.deprecatedInstances ? _self.deprecatedInstances
: deprecatedInstances // ignore: cast_nullable_to_non_nullable : deprecatedInstances // ignore: cast_nullable_to_non_nullable
as List<IdentityInstance>, as List<IdentityInstance>,
deprecatedSuperRecordKeys: null == deprecatedSuperRecordKeys deprecatedSuperRecordKeys: null == deprecatedSuperRecordKeys
? _value.deprecatedSuperRecordKeys ? _self.deprecatedSuperRecordKeys!
: deprecatedSuperRecordKeys // ignore: cast_nullable_to_non_nullable : deprecatedSuperRecordKeys // ignore: cast_nullable_to_non_nullable
as List<Typed<FixedEncodedString43>>, as List<Typed<FixedEncodedString43>>,
signature: null == signature signature: null == signature
? _value.signature ? _self.signature!
: signature // ignore: cast_nullable_to_non_nullable : signature // ignore: cast_nullable_to_non_nullable
as FixedEncodedString86, as FixedEncodedString86,
) as $Val); ));
} }
/// Create a copy of SuperIdentity /// Create a copy of SuperIdentity
@ -135,85 +162,16 @@ class _$SuperIdentityCopyWithImpl<$Res, $Val extends SuperIdentity>
@override @override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
$IdentityInstanceCopyWith<$Res> get currentInstance { $IdentityInstanceCopyWith<$Res> get currentInstance {
return $IdentityInstanceCopyWith<$Res>(_value.currentInstance, (value) { return $IdentityInstanceCopyWith<$Res>(_self.currentInstance, (value) {
return _then(_value.copyWith(currentInstance: value) as $Val); return _then(_self.copyWith(currentInstance: value));
}); });
} }
} }
/// @nodoc
abstract class _$$SuperIdentityImplCopyWith<$Res>
implements $SuperIdentityCopyWith<$Res> {
factory _$$SuperIdentityImplCopyWith(
_$SuperIdentityImpl value, $Res Function(_$SuperIdentityImpl) then) =
__$$SuperIdentityImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{Typed<FixedEncodedString43> recordKey,
FixedEncodedString43 publicKey,
IdentityInstance currentInstance,
List<IdentityInstance> deprecatedInstances,
List<Typed<FixedEncodedString43>> deprecatedSuperRecordKeys,
FixedEncodedString86 signature});
@override
$IdentityInstanceCopyWith<$Res> get currentInstance;
}
/// @nodoc
class __$$SuperIdentityImplCopyWithImpl<$Res>
extends _$SuperIdentityCopyWithImpl<$Res, _$SuperIdentityImpl>
implements _$$SuperIdentityImplCopyWith<$Res> {
__$$SuperIdentityImplCopyWithImpl(
_$SuperIdentityImpl _value, $Res Function(_$SuperIdentityImpl) _then)
: super(_value, _then);
/// Create a copy of SuperIdentity
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? recordKey = null,
Object? publicKey = null,
Object? currentInstance = null,
Object? deprecatedInstances = null,
Object? deprecatedSuperRecordKeys = null,
Object? signature = null,
}) {
return _then(_$SuperIdentityImpl(
recordKey: null == recordKey
? _value.recordKey
: recordKey // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>,
publicKey: null == publicKey
? _value.publicKey
: publicKey // ignore: cast_nullable_to_non_nullable
as FixedEncodedString43,
currentInstance: null == currentInstance
? _value.currentInstance
: currentInstance // ignore: cast_nullable_to_non_nullable
as IdentityInstance,
deprecatedInstances: null == deprecatedInstances
? _value._deprecatedInstances
: deprecatedInstances // ignore: cast_nullable_to_non_nullable
as List<IdentityInstance>,
deprecatedSuperRecordKeys: null == deprecatedSuperRecordKeys
? _value._deprecatedSuperRecordKeys
: deprecatedSuperRecordKeys // ignore: cast_nullable_to_non_nullable
as List<Typed<FixedEncodedString43>>,
signature: null == signature
? _value.signature
: signature // ignore: cast_nullable_to_non_nullable
as FixedEncodedString86,
));
}
}
/// @nodoc /// @nodoc
@JsonSerializable() @JsonSerializable()
class _$SuperIdentityImpl extends _SuperIdentity { class _SuperIdentity extends SuperIdentity {
const _$SuperIdentityImpl( const _SuperIdentity(
{required this.recordKey, {required this.recordKey,
required this.publicKey, required this.publicKey,
required this.currentInstance, required this.currentInstance,
@ -224,9 +182,8 @@ class _$SuperIdentityImpl extends _SuperIdentity {
: _deprecatedInstances = deprecatedInstances, : _deprecatedInstances = deprecatedInstances,
_deprecatedSuperRecordKeys = deprecatedSuperRecordKeys, _deprecatedSuperRecordKeys = deprecatedSuperRecordKeys,
super._(); super._();
factory _SuperIdentity.fromJson(Map<String, dynamic> json) =>
factory _$SuperIdentityImpl.fromJson(Map<String, dynamic> json) => _$SuperIdentityFromJson(json);
_$$SuperIdentityImplFromJson(json);
/// Public DHT record storing this structure for account recovery /// Public DHT record storing this structure for account recovery
/// changing this can migrate/forward the SuperIdentity to a new DHT record /// changing this can migrate/forward the SuperIdentity to a new DHT record
@ -284,16 +241,26 @@ class _$SuperIdentityImpl extends _SuperIdentity {
@override @override
final FixedEncodedString86 signature; final FixedEncodedString86 signature;
/// Create a copy of SuperIdentity
/// with the given fields replaced by the non-null parameter values.
@override @override
String toString() { @JsonKey(includeFromJson: false, includeToJson: false)
return 'SuperIdentity(recordKey: $recordKey, publicKey: $publicKey, currentInstance: $currentInstance, deprecatedInstances: $deprecatedInstances, deprecatedSuperRecordKeys: $deprecatedSuperRecordKeys, signature: $signature)'; @pragma('vm:prefer-inline')
_$SuperIdentityCopyWith<_SuperIdentity> get copyWith =>
__$SuperIdentityCopyWithImpl<_SuperIdentity>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$SuperIdentityToJson(
this,
);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$SuperIdentityImpl && other is _SuperIdentity &&
(identical(other.recordKey, recordKey) || (identical(other.recordKey, recordKey) ||
other.recordKey == recordKey) && other.recordKey == recordKey) &&
(identical(other.publicKey, publicKey) || (identical(other.publicKey, publicKey) ||
@ -319,76 +286,89 @@ class _$SuperIdentityImpl extends _SuperIdentity {
const DeepCollectionEquality().hash(_deprecatedSuperRecordKeys), const DeepCollectionEquality().hash(_deprecatedSuperRecordKeys),
signature); signature);
@override
String toString() {
return 'SuperIdentity(recordKey: $recordKey, publicKey: $publicKey, currentInstance: $currentInstance, deprecatedInstances: $deprecatedInstances, deprecatedSuperRecordKeys: $deprecatedSuperRecordKeys, signature: $signature)';
}
}
/// @nodoc
abstract mixin class _$SuperIdentityCopyWith<$Res>
implements $SuperIdentityCopyWith<$Res> {
factory _$SuperIdentityCopyWith(
_SuperIdentity value, $Res Function(_SuperIdentity) _then) =
__$SuperIdentityCopyWithImpl;
@override
@useResult
$Res call(
{Typed<FixedEncodedString43> recordKey,
FixedEncodedString43 publicKey,
IdentityInstance currentInstance,
List<IdentityInstance> deprecatedInstances,
List<Typed<FixedEncodedString43>> deprecatedSuperRecordKeys,
FixedEncodedString86 signature});
@override
$IdentityInstanceCopyWith<$Res> get currentInstance;
}
/// @nodoc
class __$SuperIdentityCopyWithImpl<$Res>
implements _$SuperIdentityCopyWith<$Res> {
__$SuperIdentityCopyWithImpl(this._self, this._then);
final _SuperIdentity _self;
final $Res Function(_SuperIdentity) _then;
/// Create a copy of SuperIdentity /// Create a copy of SuperIdentity
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override @override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$$SuperIdentityImplCopyWith<_$SuperIdentityImpl> get copyWith => $Res call({
__$$SuperIdentityImplCopyWithImpl<_$SuperIdentityImpl>(this, _$identity); Object? recordKey = null,
Object? publicKey = null,
@override Object? currentInstance = null,
Map<String, dynamic> toJson() { Object? deprecatedInstances = null,
return _$$SuperIdentityImplToJson( Object? deprecatedSuperRecordKeys = null,
this, Object? signature = null,
); }) {
return _then(_SuperIdentity(
recordKey: null == recordKey
? _self.recordKey
: recordKey // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>,
publicKey: null == publicKey
? _self.publicKey
: publicKey // ignore: cast_nullable_to_non_nullable
as FixedEncodedString43,
currentInstance: null == currentInstance
? _self.currentInstance
: currentInstance // ignore: cast_nullable_to_non_nullable
as IdentityInstance,
deprecatedInstances: null == deprecatedInstances
? _self._deprecatedInstances
: deprecatedInstances // ignore: cast_nullable_to_non_nullable
as List<IdentityInstance>,
deprecatedSuperRecordKeys: null == deprecatedSuperRecordKeys
? _self._deprecatedSuperRecordKeys
: deprecatedSuperRecordKeys // ignore: cast_nullable_to_non_nullable
as List<Typed<FixedEncodedString43>>,
signature: null == signature
? _self.signature
: signature // ignore: cast_nullable_to_non_nullable
as FixedEncodedString86,
));
} }
}
abstract class _SuperIdentity extends SuperIdentity {
const factory _SuperIdentity(
{required final Typed<FixedEncodedString43> recordKey,
required final FixedEncodedString43 publicKey,
required final IdentityInstance currentInstance,
required final List<IdentityInstance> deprecatedInstances,
required final List<Typed<FixedEncodedString43>>
deprecatedSuperRecordKeys,
required final FixedEncodedString86 signature}) = _$SuperIdentityImpl;
const _SuperIdentity._() : super._();
factory _SuperIdentity.fromJson(Map<String, dynamic> json) =
_$SuperIdentityImpl.fromJson;
/// Public DHT record storing this structure for account recovery
/// changing this can migrate/forward the SuperIdentity to a new DHT record
/// Instances should not hash this recordKey, rather the actual record
/// key used to store the superIdentity, as this may change.
@override
Typed<FixedEncodedString43> get recordKey;
/// Public key of the SuperIdentity used to sign identity keys for recovery
/// This must match the owner of the superRecord DHT record and can not be
/// changed without changing the record
@override
FixedEncodedString43 get publicKey;
/// Current identity instance
/// The most recently generated identity instance for this SuperIdentity
@override
IdentityInstance get currentInstance;
/// Deprecated identity instances
/// These may be compromised and should not be considered valid for
/// new signatures, but may be used to validate old signatures
@override
List<IdentityInstance> get deprecatedInstances;
/// Deprecated superRecords
/// These may be compromised and should not be considered valid for
/// new signatures, but may be used to validate old signatures
@override
List<Typed<FixedEncodedString43>> get deprecatedSuperRecordKeys;
/// Signature of recordKey, currentInstance signature,
/// signatures of deprecatedInstances, and deprecatedSuperRecordKeys
/// by publicKey
@override
FixedEncodedString86 get signature;
/// Create a copy of SuperIdentity /// Create a copy of SuperIdentity
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override
@JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline')
_$$SuperIdentityImplCopyWith<_$SuperIdentityImpl> get copyWith => $IdentityInstanceCopyWith<$Res> get currentInstance {
throw _privateConstructorUsedError; return $IdentityInstanceCopyWith<$Res>(_self.currentInstance, (value) {
return _then(_self.copyWith(currentInstance: value));
});
} }
}
// dart format on

View file

@ -6,8 +6,8 @@ part of 'super_identity.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
_$SuperIdentityImpl _$$SuperIdentityImplFromJson(Map<String, dynamic> json) => _SuperIdentity _$SuperIdentityFromJson(Map<String, dynamic> json) =>
_$SuperIdentityImpl( _SuperIdentity(
recordKey: Typed<FixedEncodedString43>.fromJson(json['record_key']), recordKey: Typed<FixedEncodedString43>.fromJson(json['record_key']),
publicKey: FixedEncodedString43.fromJson(json['public_key']), publicKey: FixedEncodedString43.fromJson(json['public_key']),
currentInstance: IdentityInstance.fromJson(json['current_instance']), currentInstance: IdentityInstance.fromJson(json['current_instance']),
@ -21,7 +21,7 @@ _$SuperIdentityImpl _$$SuperIdentityImplFromJson(Map<String, dynamic> json) =>
signature: FixedEncodedString86.fromJson(json['signature']), signature: FixedEncodedString86.fromJson(json['signature']),
); );
Map<String, dynamic> _$$SuperIdentityImplToJson(_$SuperIdentityImpl instance) => Map<String, dynamic> _$SuperIdentityToJson(_SuperIdentity instance) =>
<String, dynamic>{ <String, dynamic>{
'record_key': instance.recordKey.toJson(), 'record_key': instance.recordKey.toJson(),
'public_key': instance.publicKey.toJson(), 'public_key': instance.publicKey.toJson(),

View file

@ -1,5 +1,6 @@
import 'dart:typed_data'; import 'dart:typed_data';
import '../src/dynamic_debug.dart';
import '../veilid_support.dart' as veilid; import '../veilid_support.dart' as veilid;
import 'veilid.pb.dart' as proto; import 'veilid.pb.dart' as proto;
@ -150,3 +151,26 @@ extension ProtoKeyPair on proto.KeyPair {
veilid.KeyPair toVeilid() => veilid.KeyPair toVeilid() =>
veilid.KeyPair(key: key.toVeilid(), secret: secret.toVeilid()); veilid.KeyPair(key: key.toVeilid(), secret: secret.toVeilid());
} }
void registerVeilidProtoToDebug() {
dynamic toDebug(dynamic protoObj) {
if (protoObj is proto.CryptoKey) {
return protoObj.toVeilid();
}
if (protoObj is proto.Signature) {
return protoObj.toVeilid();
}
if (protoObj is proto.Nonce) {
return protoObj.toVeilid();
}
if (protoObj is proto.TypedKey) {
return protoObj.toVeilid();
}
if (protoObj is proto.KeyPair) {
return protoObj.toVeilid();
}
return protoObj;
}
DynamicDebug.registerToDebug(toDebug);
}

View file

@ -0,0 +1,130 @@
import 'package:async_tools/async_tools.dart';
import 'package:bloc_advanced_tools/bloc_advanced_tools.dart';
import 'package:convert/convert.dart';
import 'package:fast_immutable_collections/fast_immutable_collections.dart';
import 'online_element_state.dart';
typedef ToDebugFunction = dynamic Function(dynamic protoObj);
// This should be implemented to add toDebug capability
// ignore: one_member_abstracts
abstract class ToDebugMap {
Map<String, dynamic> toDebugMap();
}
// We explicitly want this class to avoid having a global function 'toDebug'
// ignore: avoid_classes_with_only_static_members
class DynamicDebug {
/// Add a 'toDebug' handler to the chain
static void registerToDebug(ToDebugFunction toDebugFunction) {
final _oldToDebug = _toDebug;
_toDebug = (obj) => _oldToDebug(toDebugFunction(obj));
}
/// Convert a type to a debug version of the same type that
/// has a better `toString` representation and possibly other extra debug
/// information
static dynamic toDebug(dynamic obj) {
try {
return _toDebug(obj);
// In this case we watch to catch everything
// because toDebug need to never fail
// ignore: avoid_catches_without_on_clauses
} catch (e) {
// Ensure this gets printed, but continue
// ignore: avoid_print
print('Exception in toDebug: $e');
return obj.toString();
}
}
//////////////////////////////////////////////////////////////
static dynamic _baseToDebug(dynamic obj) {
if (obj is AsyncValue<dynamic>) {
if (obj.isLoading) {
return {r'$runtimeType': obj.runtimeType, 'loading': null};
}
if (obj.isError) {
return {
r'$runtimeType': obj.runtimeType,
'error': toDebug(obj.asError!.error),
'stackTrace': toDebug(obj.asError!.stackTrace),
};
}
if (obj.isData) {
return {
r'$runtimeType': obj.runtimeType,
'data': toDebug(obj.asData!.value),
};
}
return obj.toString();
}
if (obj is IMap<dynamic, dynamic>) {
// Handled by Map
return _baseToDebug(obj.unlockView);
}
if (obj is IMapOfSets<dynamic, dynamic>) {
// Handled by Map
return _baseToDebug(obj.unlock);
}
if (obj is ISet<dynamic>) {
// Handled by Iterable
return _baseToDebug(obj.unlockView);
}
if (obj is IList<dynamic>) {
return _baseToDebug(obj.unlockView);
}
if (obj is BlocBusyState<dynamic>) {
return {
r'$runtimeType': obj.runtimeType,
'busy': obj.busy,
'state': toDebug(obj.state),
};
}
if (obj is OnlineElementState<dynamic>) {
return {
r'$runtimeType': obj.runtimeType,
'isOffline': obj.isOffline,
'value': toDebug(obj.value),
};
}
if (obj is List<int>) {
try {
// Do bytes as a hex string for brevity and clarity
return 'List<int>: ${hex.encode(obj)}';
// One has to be able to catch this
// ignore: avoid_catching_errors
} on RangeError {
// Otherwise directly convert as list of integers
return obj.toString();
}
}
if (obj is Map<dynamic, dynamic>) {
return obj.map((k, v) => MapEntry(toDebug(k), toDebug(v)));
}
if (obj is Iterable<dynamic>) {
return obj.map(toDebug).toList();
}
if (obj is String || obj is bool || obj is num || obj == null) {
return obj;
}
if (obj is ToDebugMap) {
// Handled by Map
return _baseToDebug(obj.toDebugMap());
}
try {
// Let's try convering to a json object
// ignore: avoid_dynamic_calls
return obj.toJson();
// No matter how this fails, we shouldn't throw
// ignore: avoid_catches_without_on_clauses
} catch (_) {}
return obj.toString();
}
static ToDebugFunction _toDebug = _baseToDebug;
}

View file

@ -1,13 +1,14 @@
/// Dart Veilid Support Library /// Dart Veilid Support Library
/// Common functionality for interfacing with Veilid /// Common functionality for interfacing with Veilid
library veilid_support; library;
export 'package:veilid/veilid.dart'; export 'package:veilid/veilid.dart';
export 'dht_support/dht_support.dart'; export 'dht_support/dht_support.dart';
export 'identity_support/identity_support.dart'; export 'identity_support/identity_support.dart';
export 'src/config.dart'; export 'src/config.dart';
export 'src/dynamic_debug.dart';
export 'src/json_tools.dart'; export 'src/json_tools.dart';
export 'src/memory_tools.dart'; export 'src/memory_tools.dart';
export 'src/online_element_state.dart'; export 'src/online_element_state.dart';

View file

@ -178,7 +178,7 @@ packages:
source: hosted source: hosted
version: "1.19.1" version: "1.19.1"
convert: convert:
dependency: transitive dependency: "direct main"
description: description:
name: convert name: convert
sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68

View file

@ -12,6 +12,7 @@ dependencies:
bloc_advanced_tools: ^0.1.10 bloc_advanced_tools: ^0.1.10
charcode: ^1.4.0 charcode: ^1.4.0
collection: ^1.19.1 collection: ^1.19.1
convert: ^3.1.2
equatable: ^2.0.7 equatable: ^2.0.7
fast_immutable_collections: ^11.0.3 fast_immutable_collections: ^11.0.3
freezed_annotation: ^3.0.0 freezed_annotation: ^3.0.0