From 142249adec209160c70ad2b70a9686ef0298a924 Mon Sep 17 00:00:00 2001 From: dettlaff Date: Thu, 10 Oct 2024 05:30:38 +0400 Subject: [PATCH] feat: add "other" records category --- assets/translations/en.json | 4 +- .../cubit/dns_records/dns_records_cubit.dart | 4 +- lib/ui/pages/dns_details/dns_details.dart | 40 +++++++++++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index c1ca6d74..97dd974e 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -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." } -} +} \ No newline at end of file diff --git a/lib/logic/cubit/dns_records/dns_records_cubit.dart b/lib/logic/cubit/dns_records/dns_records_cubit.dart index 55fa9b5a..b55831ce 100644 --- a/lib/logic/cubit/dns_records/dns_records_cubit.dart +++ b/lib/logic/cubit/dns_records/dns_records_cubit.dart @@ -140,7 +140,9 @@ class DnsRecordsCubit extends ServerConnectionDependentCubit { isSatisfied: foundMatch, category: pendingDnsRecord.type == 'A' ? DnsRecordsCategory.services - : DnsRecordsCategory.email, + : (pendingDnsRecord.type == 'CAA' + ? DnsRecordsCategory.other + : DnsRecordsCategory.email), ), ); } diff --git a/lib/ui/pages/dns_details/dns_details.dart b/lib/ui/pages/dns_details/dns_details.dart index 5efc329e..02ac48ae 100644 --- a/lib/ui/pages/dns_details/dns_details.dart +++ b/lib/ui/pages/dns_details/dns_details.dart @@ -198,6 +198,46 @@ class _DnsDetailsPageState extends State { ], ), ), + 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), + ), + ], + ), + ), ], ); }