mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-02 14:14:23 +00:00
Merge pull request 'feat: add "other" records category' (#588) from def/add_other_category into master
Reviewed-on: https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/pulls/588 Reviewed-by: Inex Code <inex.code@selfprivacy.org>
This commit is contained in:
commit
cd52527b59
|
@ -215,6 +215,8 @@
|
|||
"services_subtitle": "Type “A” records required for each service.",
|
||||
"email_title": "Email",
|
||||
"email_subtitle": "Records necessary for secure email exchange.",
|
||||
"other_title": "Other",
|
||||
"other_subtitle": "Other records needed for the work of the SelfPrivacy",
|
||||
"update_list": "Update list"
|
||||
},
|
||||
"backup": {
|
||||
|
@ -725,4 +727,4 @@
|
|||
"server_provider_unknown": "Unknown server provider",
|
||||
"server_provider_unknown_description": "Your server provider is not supported by this app version."
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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,9 +137,7 @@ class DnsRecordsCubit extends ServerConnectionDependentCubit<DnsRecordsState> {
|
|||
displayName: pendingDnsRecord.displayName,
|
||||
content: pendingDnsRecord.content!,
|
||||
isSatisfied: foundMatch,
|
||||
category: pendingDnsRecord.type == 'A'
|
||||
? DnsRecordsCategory.services
|
||||
: DnsRecordsCategory.email,
|
||||
type: pendingDnsRecord.type,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -198,6 +198,46 @@ class _DnsDetailsPageState extends State<DnsDetailsPage> {
|
|||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16.0),
|
||||
ListTile(
|
||||
title: Text(
|
||||
'domain.other_title'.tr(),
|
||||
style: Theme.of(context).textTheme.headlineSmall!.copyWith(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
'domain.other_subtitle'.tr(),
|
||||
style: Theme.of(context).textTheme.labelMedium,
|
||||
),
|
||||
),
|
||||
...dnsCubit.dnsRecords
|
||||
.where(
|
||||
(final dnsRecord) =>
|
||||
dnsRecord.category == DnsRecordsCategory.other,
|
||||
)
|
||||
.map(
|
||||
(final dnsRecord) => Column(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
dnsRecord.isSatisfied
|
||||
? Icons.check_circle_outline
|
||||
: dnsCubit.dnsState == DnsRecordsStatus.refreshing
|
||||
? Icons.refresh
|
||||
: Icons.error_outline,
|
||||
color: dnsRecord.isSatisfied
|
||||
? goodColor
|
||||
: dnsCubit.dnsState == DnsRecordsStatus.refreshing
|
||||
? neutralColor
|
||||
: errorColor,
|
||||
),
|
||||
title: Text(dnsRecord.displayName ?? dnsRecord.name),
|
||||
subtitle: Text(dnsRecord.content),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue