mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-30 12:46:52 +00:00
refactor: from review
This commit is contained in:
parent
142249adec
commit
8aacee7c9c
|
@ -10,7 +10,6 @@ class DesiredDnsRecord {
|
|||
required this.content,
|
||||
this.type = 'A',
|
||||
this.description = '',
|
||||
this.category = DnsRecordsCategory.services,
|
||||
this.isSatisfied = false,
|
||||
this.displayName,
|
||||
});
|
||||
|
@ -20,16 +19,25 @@ class DesiredDnsRecord {
|
|||
final String content;
|
||||
final String description;
|
||||
final String? displayName;
|
||||
final DnsRecordsCategory category;
|
||||
final bool isSatisfied;
|
||||
|
||||
DnsRecordsCategory get category {
|
||||
switch (type) {
|
||||
case 'A':
|
||||
return DnsRecordsCategory.services;
|
||||
case 'CAA':
|
||||
return DnsRecordsCategory.other;
|
||||
default:
|
||||
return DnsRecordsCategory.email;
|
||||
}
|
||||
}
|
||||
|
||||
DesiredDnsRecord copyWith({
|
||||
final String? name,
|
||||
final String? type,
|
||||
final String? content,
|
||||
final String? description,
|
||||
final String? displayName,
|
||||
final DnsRecordsCategory? category,
|
||||
final bool? isSatisfied,
|
||||
}) =>
|
||||
DesiredDnsRecord(
|
||||
|
@ -37,7 +45,6 @@ class DesiredDnsRecord {
|
|||
type: type ?? this.type,
|
||||
content: content ?? this.content,
|
||||
description: description ?? this.description,
|
||||
category: category ?? this.category,
|
||||
isSatisfied: isSatisfied ?? this.isSatisfied,
|
||||
displayName: displayName ?? this.displayName,
|
||||
);
|
||||
|
|
|
@ -122,7 +122,6 @@ class DnsRecordsCubit extends ServerConnectionDependentCubit<DnsRecordsState> {
|
|||
content: pendingDnsRecord.content!,
|
||||
isSatisfied: isSatisfied,
|
||||
type: pendingDnsRecord.type,
|
||||
category: DnsRecordsCategory.email,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
|
@ -138,11 +137,7 @@ class DnsRecordsCubit extends ServerConnectionDependentCubit<DnsRecordsState> {
|
|||
displayName: pendingDnsRecord.displayName,
|
||||
content: pendingDnsRecord.content!,
|
||||
isSatisfied: foundMatch,
|
||||
category: pendingDnsRecord.type == 'A'
|
||||
? DnsRecordsCategory.services
|
||||
: (pendingDnsRecord.type == 'CAA'
|
||||
? DnsRecordsCategory.other
|
||||
: DnsRecordsCategory.email),
|
||||
type: pendingDnsRecord.type,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue