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