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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -511,7 +511,7 @@ class DHTRecord implements DHTDeleteable<DHTRecord> {
key,
subkeys: [ValueSubkeyRange.single(subkey)],
);
return rr.localSeqs.firstOrNull ?? 0xFFFFFFFF;
return rr.localSeqs.firstOrNull ?? emptySeq;
}
void _addValueChange(
@ -566,4 +566,6 @@ class DHTRecord implements DHTDeleteable<DHTRecord> {
int _openCount;
StreamController<DHTRecordWatchChange>? _watchController;
_WatchState? _watchState;
static const int emptySeq = 0xFFFFFFFF;
}

View File

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

View File

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

View File

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

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

View File

@ -333,7 +333,7 @@ class _DHTShortArrayHead {
}
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 record = await _getOrCreateLinkedRecord(recordNumber, allowCreate);
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
// 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;
}
// 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
// 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;
}
@ -448,12 +448,12 @@ class _DHTShortArrayHead {
final idx = _index[pos];
while (_localSeqs.length <= idx) {
_localSeqs.add(0xFFFFFFFF);
_localSeqs.add(DHTRecord.emptySeq);
}
_localSeqs[idx] = newSeq;
if (write) {
while (_seqs.length <= idx) {
_seqs.add(0xFFFFFFFF);
_seqs.add(DHTRecord.emptySeq);
}
_seqs[idx] = newSeq;
}

View File

@ -122,7 +122,7 @@ class _DHTShortArrayWrite extends _DHTShortArrayRead
final outSeqNum = Output<int>();
final result = lookup.seq == 0xFFFFFFFF
final result = lookup.seq == DHTRecord.emptySeq
? null
: await lookup.record.get(subkey: lookup.recordSubkey);
@ -151,7 +151,7 @@ class _DHTShortArrayWrite extends _DHTShortArrayRead
final lookup = await _head.lookupPosition(pos, true);
final outSeqNumRead = Output<int>();
final oldValue = lookup.seq == 0xFFFFFFFF
final oldValue = lookup.seq == DHTRecord.emptySeq
? null
: await lookup.record
.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
/// is stored in the identity instance record
@freezed
class AccountRecordInfo with _$AccountRecordInfo {
sealed class AccountRecordInfo with _$AccountRecordInfo {
const factory AccountRecordInfo({
// Top level account keys and secrets
required OwnedDHTRecordPointer accountRecord,

View File

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
@ -9,137 +10,30 @@ part of 'account_record_info.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
AccountRecordInfo _$AccountRecordInfoFromJson(Map<String, dynamic> json) {
return _AccountRecordInfo.fromJson(json);
}
/// @nodoc
mixin _$AccountRecordInfo {
// Top level account keys and secrets
OwnedDHTRecordPointer get accountRecord => throw _privateConstructorUsedError;
/// Serializes this AccountRecordInfo to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
OwnedDHTRecordPointer get accountRecord;
/// Create a copy of AccountRecordInfo
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$AccountRecordInfoCopyWith<AccountRecordInfo> get copyWith =>
throw _privateConstructorUsedError;
}
_$AccountRecordInfoCopyWithImpl<AccountRecordInfo>(
this as AccountRecordInfo, _$identity);
/// @nodoc
abstract class $AccountRecordInfoCopyWith<$Res> {
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)';
}
/// Serializes this AccountRecordInfo to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$AccountRecordInfoImpl &&
other is AccountRecordInfo &&
(identical(other.accountRecord, accountRecord) ||
other.accountRecord == accountRecord));
}
@ -148,39 +42,148 @@ class _$AccountRecordInfoImpl implements _AccountRecordInfo {
@override
int get hashCode => Object.hash(runtimeType, accountRecord);
/// Create a copy of AccountRecordInfo
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$AccountRecordInfoImplCopyWith<_$AccountRecordInfoImpl> get copyWith =>
__$$AccountRecordInfoImplCopyWithImpl<_$AccountRecordInfoImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$AccountRecordInfoImplToJson(
this,
);
String toString() {
return 'AccountRecordInfo(accountRecord: $accountRecord)';
}
}
abstract class _AccountRecordInfo implements AccountRecordInfo {
const factory _AccountRecordInfo(
{required final OwnedDHTRecordPointer accountRecord}) =
_$AccountRecordInfoImpl;
/// @nodoc
abstract mixin class $AccountRecordInfoCopyWith<$Res> {
factory $AccountRecordInfoCopyWith(
AccountRecordInfo value, $Res Function(AccountRecordInfo) _then) =
_$AccountRecordInfoCopyWithImpl;
@useResult
$Res call({OwnedDHTRecordPointer accountRecord});
factory _AccountRecordInfo.fromJson(Map<String, dynamic> json) =
_$AccountRecordInfoImpl.fromJson;
$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
/// 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));
});
}
}
/// @nodoc
@JsonSerializable()
class _AccountRecordInfo implements AccountRecordInfo {
const _AccountRecordInfo({required this.accountRecord});
factory _AccountRecordInfo.fromJson(Map<String, dynamic> json) =>
_$AccountRecordInfoFromJson(json);
// Top level account keys and secrets
@override
OwnedDHTRecordPointer get accountRecord;
final OwnedDHTRecordPointer accountRecord;
/// Create a copy of AccountRecordInfo
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$AccountRecordInfoImplCopyWith<_$AccountRecordInfoImpl> get copyWith =>
throw _privateConstructorUsedError;
@pragma('vm:prefer-inline')
_$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
// **************************************************************************
_$AccountRecordInfoImpl _$$AccountRecordInfoImplFromJson(
Map<String, dynamic> json) =>
_$AccountRecordInfoImpl(
_AccountRecordInfo _$AccountRecordInfoFromJson(Map<String, dynamic> json) =>
_AccountRecordInfo(
accountRecord: OwnedDHTRecordPointer.fromJson(json['account_record']),
);
Map<String, dynamic> _$$AccountRecordInfoImplToJson(
_$AccountRecordInfoImpl instance) =>
Map<String, dynamic> _$AccountRecordInfoToJson(_AccountRecordInfo instance) =>
<String, dynamic>{
'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
/// in local table store)
@freezed
class Identity with _$Identity {
sealed class Identity with _$Identity {
const factory Identity({
// Top level account keys and secrets
required IMap<String, ISet<AccountRecordInfo>> accountRecords,

View File

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
@ -9,122 +10,29 @@ part of 'identity.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
Identity _$IdentityFromJson(Map<String, dynamic> json) {
return _Identity.fromJson(json);
}
/// @nodoc
mixin _$Identity {
// Top level account keys and secrets
IMap<String, ISet<AccountRecordInfo>> get accountRecords =>
throw _privateConstructorUsedError;
/// Serializes this Identity to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
IMap<String, ISet<AccountRecordInfo>> get accountRecords;
/// Create a copy of Identity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$IdentityCopyWith<Identity> get copyWith =>
throw _privateConstructorUsedError;
}
_$IdentityCopyWithImpl<Identity>(this as Identity, _$identity);
/// @nodoc
abstract class $IdentityCopyWith<$Res> {
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)';
}
/// Serializes this Identity to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$IdentityImpl &&
other is Identity &&
(identical(other.accountRecords, accountRecords) ||
other.accountRecords == accountRecords));
}
@ -133,38 +41,119 @@ class _$IdentityImpl implements _Identity {
@override
int get hashCode => Object.hash(runtimeType, accountRecords);
/// Create a copy of Identity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$IdentityImplCopyWith<_$IdentityImpl> get copyWith =>
__$$IdentityImplCopyWithImpl<_$IdentityImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$IdentityImplToJson(
this,
);
String toString() {
return 'Identity(accountRecords: $accountRecords)';
}
}
abstract class _Identity implements Identity {
const factory _Identity(
{required final IMap<String, ISet<AccountRecordInfo>>
accountRecords}) = _$IdentityImpl;
/// @nodoc
abstract mixin class $IdentityCopyWith<$Res> {
factory $IdentityCopyWith(Identity value, $Res Function(Identity) _then) =
_$IdentityCopyWithImpl;
@useResult
$Res call({IMap<String, ISet<AccountRecordInfo>> accountRecords});
}
factory _Identity.fromJson(Map<String, dynamic> json) =
_$IdentityImpl.fromJson;
/// @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.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? accountRecords = null,
}) {
return _then(_self.copyWith(
accountRecords: null == accountRecords
? _self.accountRecords
: accountRecords // ignore: cast_nullable_to_non_nullable
as IMap<String, ISet<AccountRecordInfo>>,
));
}
}
/// @nodoc
@JsonSerializable()
class _Identity implements Identity {
const _Identity({required this.accountRecords});
factory _Identity.fromJson(Map<String, dynamic> json) =>
_$IdentityFromJson(json);
// Top level account keys and secrets
@override
IMap<String, ISet<AccountRecordInfo>> get accountRecords;
final IMap<String, ISet<AccountRecordInfo>> accountRecords;
/// Create a copy of Identity
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$IdentityImplCopyWith<_$IdentityImpl> get copyWith =>
throw _privateConstructorUsedError;
@pragma('vm:prefer-inline')
_$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
// **************************************************************************
_$IdentityImpl _$$IdentityImplFromJson(Map<String, dynamic> json) =>
_$IdentityImpl(
_Identity _$IdentityFromJson(Map<String, dynamic> json) => _Identity(
accountRecords: IMap<String, ISet<AccountRecordInfo>>.fromJson(
json['account_records'] as Map<String, dynamic>,
(value) => value as String,
@ -15,8 +14,7 @@ _$IdentityImpl _$$IdentityImplFromJson(Map<String, dynamic> json) =>
value, (value) => AccountRecordInfo.fromJson(value))),
);
Map<String, dynamic> _$$IdentityImplToJson(_$IdentityImpl instance) =>
<String, dynamic>{
Map<String, dynamic> _$IdentityToJson(_Identity instance) => <String, dynamic>{
'account_records': instance.accountRecords.toJson(
(value) => value,
(value) => value.toJson(

View File

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

View File

@ -1,3 +1,4 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
@ -9,112 +10,76 @@ part of 'identity_instance.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
IdentityInstance _$IdentityInstanceFromJson(Map<String, dynamic> json) {
return _IdentityInstance.fromJson(json);
}
/// @nodoc
mixin _$IdentityInstance {
// Private DHT record storing identity account mapping
Typed<FixedEncodedString43> get recordKey =>
throw _privateConstructorUsedError; // Public key of identity instance
FixedEncodedString43 get publicKey =>
throw _privateConstructorUsedError; // Secret key of identity instance
TypedKey get recordKey; // Public key of identity instance
PublicKey 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
@Uint8ListJsonConverter()
Uint8List get encryptedSecretKey =>
throw _privateConstructorUsedError; // Signature of SuperInstance recordKey and SuperInstance publicKey
Uint8List
get encryptedSecretKey; // Signature of SuperInstance recordKey and SuperInstance publicKey
// by publicKey
FixedEncodedString86 get superSignature =>
throw _privateConstructorUsedError; // Signature of recordKey, publicKey, encryptedSecretKey, and superSignature
Signature
get superSignature; // Signature of recordKey, publicKey, encryptedSecretKey, and superSignature
// by SuperIdentity publicKey
FixedEncodedString86 get signature => throw _privateConstructorUsedError;
/// Serializes this IdentityInstance to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
Signature get signature;
/// Create a copy of IdentityInstance
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$IdentityInstanceCopyWith<IdentityInstance> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $IdentityInstanceCopyWith<$Res> {
factory $IdentityInstanceCopyWith(
IdentityInstance value, $Res Function(IdentityInstance) then) =
_$IdentityInstanceCopyWithImpl<$Res, IdentityInstance>;
@useResult
$Res call(
{Typed<FixedEncodedString43> recordKey,
FixedEncodedString43 publicKey,
@Uint8ListJsonConverter() Uint8List encryptedSecretKey,
FixedEncodedString86 superSignature,
FixedEncodedString86 signature});
}
/// @nodoc
class _$IdentityInstanceCopyWithImpl<$Res, $Val extends IdentityInstance>
implements $IdentityInstanceCopyWith<$Res> {
_$IdentityInstanceCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of IdentityInstance
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
$IdentityInstanceCopyWith<IdentityInstance> get copyWith =>
_$IdentityInstanceCopyWithImpl<IdentityInstance>(
this as IdentityInstance, _$identity);
/// Serializes this IdentityInstance to a JSON map.
Map<String, dynamic> toJson();
@override
$Res call({
Object? recordKey = null,
Object? publicKey = null,
Object? encryptedSecretKey = null,
Object? superSignature = null,
Object? signature = null,
}) {
return _then(_value.copyWith(
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
as FixedEncodedString86,
) as $Val);
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
abstract class _$$IdentityInstanceImplCopyWith<$Res>
implements $IdentityInstanceCopyWith<$Res> {
factory _$$IdentityInstanceImplCopyWith(_$IdentityInstanceImpl value,
$Res Function(_$IdentityInstanceImpl) then) =
__$$IdentityInstanceImplCopyWithImpl<$Res>;
@override
abstract mixin class $IdentityInstanceCopyWith<$Res> {
factory $IdentityInstanceCopyWith(
IdentityInstance value, $Res Function(IdentityInstance) _then) =
_$IdentityInstanceCopyWithImpl;
@useResult
$Res call(
{Typed<FixedEncodedString43> recordKey,
@ -125,12 +90,12 @@ abstract class _$$IdentityInstanceImplCopyWith<$Res>
}
/// @nodoc
class __$$IdentityInstanceImplCopyWithImpl<$Res>
extends _$IdentityInstanceCopyWithImpl<$Res, _$IdentityInstanceImpl>
implements _$$IdentityInstanceImplCopyWith<$Res> {
__$$IdentityInstanceImplCopyWithImpl(_$IdentityInstanceImpl _value,
$Res Function(_$IdentityInstanceImpl) _then)
: super(_value, _then);
class _$IdentityInstanceCopyWithImpl<$Res>
implements $IdentityInstanceCopyWith<$Res> {
_$IdentityInstanceCopyWithImpl(this._self, this._then);
final IdentityInstance _self;
final $Res Function(IdentityInstance) _then;
/// Create a copy of IdentityInstance
/// with the given fields replaced by the non-null parameter values.
@ -143,25 +108,25 @@ class __$$IdentityInstanceImplCopyWithImpl<$Res>
Object? superSignature = null,
Object? signature = null,
}) {
return _then(_$IdentityInstanceImpl(
return _then(_self.copyWith(
recordKey: null == recordKey
? _value.recordKey
? _self.recordKey!
: recordKey // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>,
publicKey: null == publicKey
? _value.publicKey
? _self.publicKey!
: publicKey // ignore: cast_nullable_to_non_nullable
as FixedEncodedString43,
encryptedSecretKey: null == encryptedSecretKey
? _value.encryptedSecretKey
? _self.encryptedSecretKey
: encryptedSecretKey // ignore: cast_nullable_to_non_nullable
as Uint8List,
superSignature: null == superSignature
? _value.superSignature
? _self.superSignature!
: superSignature // ignore: cast_nullable_to_non_nullable
as FixedEncodedString86,
signature: null == signature
? _value.signature
? _self.signature!
: signature // ignore: cast_nullable_to_non_nullable
as FixedEncodedString86,
));
@ -170,17 +135,16 @@ class __$$IdentityInstanceImplCopyWithImpl<$Res>
/// @nodoc
@JsonSerializable()
class _$IdentityInstanceImpl extends _IdentityInstance {
const _$IdentityInstanceImpl(
class _IdentityInstance extends IdentityInstance {
const _IdentityInstance(
{required this.recordKey,
required this.publicKey,
@Uint8ListJsonConverter() required this.encryptedSecretKey,
required this.superSignature,
required this.signature})
: super._();
factory _$IdentityInstanceImpl.fromJson(Map<String, dynamic> json) =>
_$$IdentityInstanceImplFromJson(json);
factory _IdentityInstance.fromJson(Map<String, dynamic> json) =>
_$IdentityInstanceFromJson(json);
// Private DHT record storing identity account mapping
@override
@ -205,16 +169,26 @@ class _$IdentityInstanceImpl extends _IdentityInstance {
@override
final FixedEncodedString86 signature;
/// Create a copy of IdentityInstance
/// with the given fields replaced by the non-null parameter values.
@override
String toString() {
return 'IdentityInstance(recordKey: $recordKey, publicKey: $publicKey, encryptedSecretKey: $encryptedSecretKey, superSignature: $superSignature, signature: $signature)';
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$IdentityInstanceCopyWith<_IdentityInstance> get copyWith =>
__$IdentityInstanceCopyWithImpl<_IdentityInstance>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$IdentityInstanceToJson(
this,
);
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$IdentityInstanceImpl &&
other is _IdentityInstance &&
(identical(other.recordKey, recordKey) ||
other.recordKey == recordKey) &&
(identical(other.publicKey, publicKey) ||
@ -237,60 +211,70 @@ class _$IdentityInstanceImpl extends _IdentityInstance {
superSignature,
signature);
/// Create a copy of IdentityInstance
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$IdentityInstanceImplCopyWith<_$IdentityInstanceImpl> get copyWith =>
__$$IdentityInstanceImplCopyWithImpl<_$IdentityInstanceImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$IdentityInstanceImplToJson(
this,
);
String toString() {
return 'IdentityInstance(recordKey: $recordKey, publicKey: $publicKey, encryptedSecretKey: $encryptedSecretKey, superSignature: $superSignature, signature: $signature)';
}
}
abstract class _IdentityInstance extends IdentityInstance {
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._();
/// @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});
}
factory _IdentityInstance.fromJson(Map<String, dynamic> json) =
_$IdentityInstanceImpl.fromJson;
/// @nodoc
class __$IdentityInstanceCopyWithImpl<$Res>
implements _$IdentityInstanceCopyWith<$Res> {
__$IdentityInstanceCopyWithImpl(this._self, this._then);
// 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;
final _IdentityInstance _self;
final $Res Function(_IdentityInstance) _then;
/// 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;
@pragma('vm:prefer-inline')
$Res call({
Object? recordKey = null,
Object? publicKey = null,
Object? encryptedSecretKey = null,
Object? superSignature = null,
Object? signature = null,
}) {
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,
));
}
}
// dart format on

View File

@ -6,9 +6,8 @@ part of 'identity_instance.dart';
// JsonSerializableGenerator
// **************************************************************************
_$IdentityInstanceImpl _$$IdentityInstanceImplFromJson(
Map<String, dynamic> json) =>
_$IdentityInstanceImpl(
_IdentityInstance _$IdentityInstanceFromJson(Map<String, dynamic> json) =>
_IdentityInstance(
recordKey: Typed<FixedEncodedString43>.fromJson(json['record_key']),
publicKey: FixedEncodedString43.fromJson(json['public_key']),
encryptedSecretKey:
@ -17,8 +16,7 @@ _$IdentityInstanceImpl _$$IdentityInstanceImplFromJson(
signature: FixedEncodedString86.fromJson(json['signature']),
);
Map<String, dynamic> _$$IdentityInstanceImplToJson(
_$IdentityInstanceImpl instance) =>
Map<String, dynamic> _$IdentityInstanceToJson(_IdentityInstance instance) =>
<String, dynamic>{
'record_key': instance.recordKey.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)
/// Encryption: None
@freezed
class SuperIdentity with _$SuperIdentity {
sealed class SuperIdentity with _$SuperIdentity {
const factory SuperIdentity({
/// Public DHT record storing this structure for account recovery
/// 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
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
@ -9,65 +10,93 @@ part of 'super_identity.dart';
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
SuperIdentity _$SuperIdentityFromJson(Map<String, dynamic> json) {
return _SuperIdentity.fromJson(json);
}
/// @nodoc
mixin _$SuperIdentity {
/// 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.
Typed<FixedEncodedString43> get recordKey =>
throw _privateConstructorUsedError;
TypedKey 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
FixedEncodedString43 get publicKey => throw _privateConstructorUsedError;
PublicKey get publicKey;
/// Current identity instance
/// The most recently generated identity instance for this SuperIdentity
IdentityInstance get currentInstance => throw _privateConstructorUsedError;
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
List<IdentityInstance> get deprecatedInstances =>
throw _privateConstructorUsedError;
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
List<Typed<FixedEncodedString43>> get deprecatedSuperRecordKeys =>
throw _privateConstructorUsedError;
List<TypedKey> get deprecatedSuperRecordKeys;
/// Signature of recordKey, currentInstance signature,
/// signatures of deprecatedInstances, and deprecatedSuperRecordKeys
/// by publicKey
FixedEncodedString86 get signature => throw _privateConstructorUsedError;
/// Serializes this SuperIdentity to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
Signature get signature;
/// Create a copy of SuperIdentity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$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
abstract class $SuperIdentityCopyWith<$Res> {
abstract mixin class $SuperIdentityCopyWith<$Res> {
factory $SuperIdentityCopyWith(
SuperIdentity value, $Res Function(SuperIdentity) then) =
_$SuperIdentityCopyWithImpl<$Res, SuperIdentity>;
SuperIdentity value, $Res Function(SuperIdentity) _then) =
_$SuperIdentityCopyWithImpl;
@useResult
$Res call(
{Typed<FixedEncodedString43> recordKey,
@ -81,14 +110,12 @@ abstract class $SuperIdentityCopyWith<$Res> {
}
/// @nodoc
class _$SuperIdentityCopyWithImpl<$Res, $Val extends SuperIdentity>
class _$SuperIdentityCopyWithImpl<$Res>
implements $SuperIdentityCopyWith<$Res> {
_$SuperIdentityCopyWithImpl(this._value, this._then);
_$SuperIdentityCopyWithImpl(this._self, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
final SuperIdentity _self;
final $Res Function(SuperIdentity) _then;
/// Create a copy of SuperIdentity
/// 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? signature = null,
}) {
return _then(_value.copyWith(
return _then(_self.copyWith(
recordKey: null == recordKey
? _value.recordKey
? _self.recordKey!
: recordKey // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>,
publicKey: null == publicKey
? _value.publicKey
? _self.publicKey!
: publicKey // ignore: cast_nullable_to_non_nullable
as FixedEncodedString43,
currentInstance: null == currentInstance
? _value.currentInstance
? _self.currentInstance
: currentInstance // ignore: cast_nullable_to_non_nullable
as IdentityInstance,
deprecatedInstances: null == deprecatedInstances
? _value.deprecatedInstances
? _self.deprecatedInstances
: deprecatedInstances // ignore: cast_nullable_to_non_nullable
as List<IdentityInstance>,
deprecatedSuperRecordKeys: null == deprecatedSuperRecordKeys
? _value.deprecatedSuperRecordKeys
? _self.deprecatedSuperRecordKeys!
: deprecatedSuperRecordKeys // ignore: cast_nullable_to_non_nullable
as List<Typed<FixedEncodedString43>>,
signature: null == signature
? _value.signature
? _self.signature!
: signature // ignore: cast_nullable_to_non_nullable
as FixedEncodedString86,
) as $Val);
));
}
/// Create a copy of SuperIdentity
@ -135,85 +162,16 @@ class _$SuperIdentityCopyWithImpl<$Res, $Val extends SuperIdentity>
@override
@pragma('vm:prefer-inline')
$IdentityInstanceCopyWith<$Res> get currentInstance {
return $IdentityInstanceCopyWith<$Res>(_value.currentInstance, (value) {
return _then(_value.copyWith(currentInstance: value) as $Val);
return $IdentityInstanceCopyWith<$Res>(_self.currentInstance, (value) {
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
@JsonSerializable()
class _$SuperIdentityImpl extends _SuperIdentity {
const _$SuperIdentityImpl(
class _SuperIdentity extends SuperIdentity {
const _SuperIdentity(
{required this.recordKey,
required this.publicKey,
required this.currentInstance,
@ -224,9 +182,8 @@ class _$SuperIdentityImpl extends _SuperIdentity {
: _deprecatedInstances = deprecatedInstances,
_deprecatedSuperRecordKeys = deprecatedSuperRecordKeys,
super._();
factory _$SuperIdentityImpl.fromJson(Map<String, dynamic> json) =>
_$$SuperIdentityImplFromJson(json);
factory _SuperIdentity.fromJson(Map<String, dynamic> json) =>
_$SuperIdentityFromJson(json);
/// Public DHT record storing this structure for account recovery
/// changing this can migrate/forward the SuperIdentity to a new DHT record
@ -284,16 +241,26 @@ class _$SuperIdentityImpl extends _SuperIdentity {
@override
final FixedEncodedString86 signature;
/// Create a copy of SuperIdentity
/// with the given fields replaced by the non-null parameter values.
@override
String toString() {
return 'SuperIdentity(recordKey: $recordKey, publicKey: $publicKey, currentInstance: $currentInstance, deprecatedInstances: $deprecatedInstances, deprecatedSuperRecordKeys: $deprecatedSuperRecordKeys, signature: $signature)';
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$SuperIdentityCopyWith<_SuperIdentity> get copyWith =>
__$SuperIdentityCopyWithImpl<_SuperIdentity>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$SuperIdentityToJson(
this,
);
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$SuperIdentityImpl &&
other is _SuperIdentity &&
(identical(other.recordKey, recordKey) ||
other.recordKey == recordKey) &&
(identical(other.publicKey, publicKey) ||
@ -319,76 +286,89 @@ class _$SuperIdentityImpl extends _SuperIdentity {
const DeepCollectionEquality().hash(_deprecatedSuperRecordKeys),
signature);
/// Create a copy of SuperIdentity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$SuperIdentityImplCopyWith<_$SuperIdentityImpl> get copyWith =>
__$$SuperIdentityImplCopyWithImpl<_$SuperIdentityImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$SuperIdentityImplToJson(
this,
);
String toString() {
return 'SuperIdentity(recordKey: $recordKey, publicKey: $publicKey, currentInstance: $currentInstance, deprecatedInstances: $deprecatedInstances, deprecatedSuperRecordKeys: $deprecatedSuperRecordKeys, signature: $signature)';
}
}
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.
/// @nodoc
abstract mixin class _$SuperIdentityCopyWith<$Res>
implements $SuperIdentityCopyWith<$Res> {
factory _$SuperIdentityCopyWith(
_SuperIdentity value, $Res Function(_SuperIdentity) _then) =
__$SuperIdentityCopyWithImpl;
@override
Typed<FixedEncodedString43> get recordKey;
@useResult
$Res call(
{Typed<FixedEncodedString43> recordKey,
FixedEncodedString43 publicKey,
IdentityInstance currentInstance,
List<IdentityInstance> deprecatedInstances,
List<Typed<FixedEncodedString43>> deprecatedSuperRecordKeys,
FixedEncodedString86 signature});
/// 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;
$IdentityInstanceCopyWith<$Res> get currentInstance;
}
/// Current identity instance
/// The most recently generated identity instance for this SuperIdentity
@override
IdentityInstance get currentInstance;
/// @nodoc
class __$SuperIdentityCopyWithImpl<$Res>
implements _$SuperIdentityCopyWith<$Res> {
__$SuperIdentityCopyWithImpl(this._self, this._then);
/// 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;
final _SuperIdentity _self;
final $Res Function(_SuperIdentity) _then;
/// Create a copy of SuperIdentity
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$SuperIdentityImplCopyWith<_$SuperIdentityImpl> get copyWith =>
throw _privateConstructorUsedError;
@pragma('vm:prefer-inline')
$Res call({
Object? recordKey = null,
Object? publicKey = null,
Object? currentInstance = null,
Object? deprecatedInstances = null,
Object? deprecatedSuperRecordKeys = null,
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,
));
}
/// Create a copy of SuperIdentity
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$IdentityInstanceCopyWith<$Res> get currentInstance {
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
// **************************************************************************
_$SuperIdentityImpl _$$SuperIdentityImplFromJson(Map<String, dynamic> json) =>
_$SuperIdentityImpl(
_SuperIdentity _$SuperIdentityFromJson(Map<String, dynamic> json) =>
_SuperIdentity(
recordKey: Typed<FixedEncodedString43>.fromJson(json['record_key']),
publicKey: FixedEncodedString43.fromJson(json['public_key']),
currentInstance: IdentityInstance.fromJson(json['current_instance']),
@ -21,7 +21,7 @@ _$SuperIdentityImpl _$$SuperIdentityImplFromJson(Map<String, dynamic> json) =>
signature: FixedEncodedString86.fromJson(json['signature']),
);
Map<String, dynamic> _$$SuperIdentityImplToJson(_$SuperIdentityImpl instance) =>
Map<String, dynamic> _$SuperIdentityToJson(_SuperIdentity instance) =>
<String, dynamic>{
'record_key': instance.recordKey.toJson(),
'public_key': instance.publicKey.toJson(),

View File

@ -1,5 +1,6 @@
import 'dart:typed_data';
import '../src/dynamic_debug.dart';
import '../veilid_support.dart' as veilid;
import 'veilid.pb.dart' as proto;
@ -150,3 +151,26 @@ extension ProtoKeyPair on proto.KeyPair {
veilid.KeyPair 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
/// Common functionality for interfacing with Veilid
library veilid_support;
library;
export 'package:veilid/veilid.dart';
export 'dht_support/dht_support.dart';
export 'identity_support/identity_support.dart';
export 'src/config.dart';
export 'src/dynamic_debug.dart';
export 'src/json_tools.dart';
export 'src/memory_tools.dart';
export 'src/online_element_state.dart';

View File

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

View File

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