From c5d2892ec2c5f504ea0b137859275277b0f82f93 Mon Sep 17 00:00:00 2001 From: Juan Gilsanz Polo Date: Mon, 17 Jun 2024 13:28:00 +0200 Subject: [PATCH 01/15] Updated libraries --- pubspec.lock | 144 +++++++++++++++++++++------------------------------ pubspec.yaml | 6 +-- 2 files changed, 63 insertions(+), 87 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 4c0330d..b196e63 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -29,10 +29,10 @@ packages: dependency: transitive description: name: archive - sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d" + sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d url: "https://pub.dev" source: hosted - version: "3.4.10" + version: "3.6.1" args: dependency: transitive description: @@ -105,14 +105,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.0" - convert: - dependency: transitive - description: - name: convert - sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" - url: "https://pub.dev" - source: hosted - version: "3.1.1" crypto: dependency: transitive description: @@ -213,10 +205,10 @@ packages: dependency: "direct main" description: name: fl_chart - sha256: "2b7c1f5d867da9a054661641c8f499c55c47c39acccb97b3bc673f5fa9a39e74" + sha256: d0f0d49112f2f4b192481c16d05b6418bd7820e021e265a3c22db98acf7ed7fb url: "https://pub.dev" source: hosted - version: "0.67.0" + version: "0.68.0" flutter: dependency: "direct main" description: flutter @@ -298,10 +290,10 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1" + sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "4.0.0" flutter_localizations: dependency: "direct main" description: flutter @@ -311,10 +303,10 @@ packages: dependency: "direct main" description: name: flutter_markdown - sha256: "9921f9deda326f8a885e202b1e35237eadfc1345239a0f6f0f1ff287e047547f" + sha256: ff76a9300a06ad1f2b394e54c0b4beaaf6a95f95c98540c918b870221499bb10 url: "https://pub.dev" source: hosted - version: "0.7.1" + version: "0.7.2" flutter_native_splash: dependency: "direct dev" description: @@ -377,66 +369,58 @@ packages: dependency: transitive description: name: image - sha256: "4c68bfd5ae83e700b5204c1e74451e7bf3cf750e6843c6e158289cf56bda018e" + sha256: "2237616a36c0d69aef7549ab439b833fb7f9fb9fc861af2cc9ac3eedddd69ca8" url: "https://pub.dev" source: hosted - version: "4.1.7" + version: "4.2.0" intl: dependency: "direct main" description: name: intl - sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf url: "https://pub.dev" source: hosted - version: "0.18.1" - js: - dependency: transitive - description: - name: js - sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf - url: "https://pub.dev" - source: hosted - version: "0.7.1" + version: "0.19.0" json_annotation: dependency: transitive description: name: json_annotation - sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" url: "https://pub.dev" source: hosted - version: "4.8.1" + version: "4.9.0" leak_tracker: dependency: transitive description: name: leak_tracker - sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" url: "https://pub.dev" source: hosted - version: "10.0.0" + version: "10.0.4" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.3" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.1" lints: dependency: transitive description: name: lints - sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 + sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "4.0.0" list_counter: dependency: transitive description: @@ -473,10 +457,10 @@ packages: dependency: transitive description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.12.0" nested: dependency: transitive description: @@ -489,10 +473,10 @@ packages: dependency: "direct main" description: name: package_info_plus - sha256: "2c582551839386fa7ddbc7770658be7c0f87f388a4bff72066478f597c34d17f" + sha256: b93d8b4d624b4ea19b0a5a208b2d6eff06004bc3ce74c06040b120eeadd00ce0 url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "8.0.0" package_info_plus_platform_interface: dependency: transitive description: @@ -569,10 +553,10 @@ packages: dependency: transitive description: name: platform - sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" + sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" url: "https://pub.dev" source: hosted - version: "3.1.4" + version: "3.1.5" plugin_platform_interface: dependency: transitive description: @@ -581,14 +565,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.8" - pointycastle: - dependency: transitive - description: - name: pointycastle - sha256: "79fbafed02cfdbe85ef3fd06c7f4bc2cbcba0177e61b765264853d4253b21744" - url: "https://pub.dev" - source: hosted - version: "3.9.0" provider: dependency: "direct main" description: @@ -617,18 +593,18 @@ packages: dependency: transitive description: name: sentry - sha256: "961630a4dba41cebd692612421fd3805a991ebd8ef4a8d84a6c179e6b89eaf22" + sha256: fd1fbfe860c05f5c52820ec4dbf2b6473789e83ead26cfc18bca4fe80bf3f008 url: "https://pub.dev" source: hosted - version: "8.0.0" + version: "8.2.0" sentry_flutter: dependency: "direct main" description: name: sentry_flutter - sha256: "705da7adfcd1fb23fc8720b6e222f5e03d53f1d020cd635586c319ee323366b4" + sha256: c64f0aec5332bec87083b61514d1b6b29e435b9045d03ce1575861192b9a5680 url: "https://pub.dev" source: hosted - version: "8.0.0" + version: "8.2.0" shared_preferences: dependency: "direct main" description: @@ -641,18 +617,18 @@ packages: dependency: transitive description: name: shared_preferences_android - sha256: "1ee8bf911094a1b592de7ab29add6f826a7331fb854273d55918693d5364a1f2" + sha256: "93d0ec9dd902d85f326068e6a899487d1f65ffcd5798721a95330b26c8131577" url: "https://pub.dev" source: hosted - version: "2.2.2" + version: "2.2.3" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - sha256: "7708d83064f38060c7b39db12aefe449cb8cdc031d6062280087bc4cdb988f5c" + sha256: "0a8a893bf4fd1152f93fec03a415d11c27c74454d96e2318a7ac38dd18683ab7" url: "https://pub.dev" source: hosted - version: "2.3.5" + version: "2.4.0" shared_preferences_linux: dependency: transitive description: @@ -710,10 +686,10 @@ packages: dependency: "direct main" description: name: sqflite - sha256: "5ce2e1a15e822c3b4bfb5400455775e421da7098eed8adc8f26298ada7c9308c" + sha256: a43e5a27235518c03ca238e7b4732cf35eabe863a369ceba6cbefa537a66f16d url: "https://pub.dev" source: hosted - version: "2.3.3" + version: "2.3.3+1" sqflite_common: dependency: transitive description: @@ -734,18 +710,18 @@ packages: dependency: transitive description: name: sqlite3 - sha256: "1abbeb84bf2b1a10e5e1138c913123c8aa9d83cd64e5f9a0dd847b3c83063202" + sha256: b384f598b813b347c5a7e5ffad82cbaff1bec3d1561af267041e66f6f0899295 url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.4.3" sqlite3_flutter_libs: dependency: "direct main" description: name: sqlite3_flutter_libs - sha256: fb2a106a2ea6042fe57de2c47074cc31539a941819c91e105b864744605da3f5 + sha256: "62bbb4073edbcdf53f40c80775f33eea01d301b7b81417e5b3fb7395416258c1" url: "https://pub.dev" source: hosted - version: "0.5.21" + version: "0.5.24" stack_trace: dependency: transitive description: @@ -798,10 +774,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.7.0" timezone: dependency: "direct main" description: @@ -830,26 +806,26 @@ packages: dependency: "direct main" description: name: url_launcher - sha256: "6ce1e04375be4eed30548f10a315826fd933c1e493206eab82eed01f438c8d2e" + sha256: "21b704ce5fa560ea9f3b525b43601c678728ba46725bab9b01187b4831377ed3" url: "https://pub.dev" source: hosted - version: "6.2.6" + version: "6.3.0" url_launcher_android: dependency: transitive description: name: url_launcher_android - sha256: "360a6ed2027f18b73c8d98e159dda67a61b7f2e0f6ec26e86c3ada33b0621775" + sha256: ceb2625f0c24ade6ef6778d1de0b2e44f2db71fded235eb52295247feba8c5cf url: "https://pub.dev" source: hosted - version: "6.3.1" + version: "6.3.3" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - sha256: "9149d493b075ed740901f3ee844a38a00b33116c7c5c10d7fb27df8987fb51d5" + sha256: "7068716403343f6ba4969b4173cbf3b84fc768042124bc2c011e5d782b24fe89" url: "https://pub.dev" source: hosted - version: "6.2.5" + version: "6.3.0" url_launcher_linux: dependency: transitive description: @@ -862,10 +838,10 @@ packages: dependency: transitive description: name: url_launcher_macos - sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234 + sha256: "9a1a42d5d2d95400c795b2914c36fdcb525870c752569438e4ebb09a2b5d90de" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.2.0" url_launcher_platform_interface: dependency: transitive description: @@ -934,10 +910,10 @@ packages: dependency: transitive description: name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" url: "https://pub.dev" source: hosted - version: "13.0.0" + version: "14.2.1" web: dependency: transitive description: @@ -950,10 +926,10 @@ packages: dependency: transitive description: name: win32 - sha256: "0a989dc7ca2bb51eac91e8fd00851297cfffd641aa7538b165c62637ca0eaa4a" + sha256: a79dbe579cb51ecd6d30b17e0cae4e0ea15e2c0e66f69ad4198f22a6789e94f4 url: "https://pub.dev" source: hosted - version: "5.4.0" + version: "5.5.1" win32_registry: dependency: transitive description: @@ -966,10 +942,10 @@ packages: dependency: "direct main" description: name: window_manager - sha256: b3c895bdf936c77b83c5254bec2e6b3f066710c1f89c38b20b8acc382b525494 + sha256: "8699323b30da4cdbe2aa2e7c9de567a6abd8a97d9a5c850a3c86dcd0b34bbfbf" url: "https://pub.dev" source: hosted - version: "0.3.8" + version: "0.3.9" xdg_directories: dependency: transitive description: @@ -995,5 +971,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.3.0 <4.0.0" - flutter: ">=3.19.0" + dart: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0" diff --git a/pubspec.yaml b/pubspec.yaml index c90cb23..f2b0e49 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -41,14 +41,14 @@ dependencies: intl: any provider: ^6.1.1 sqflite: ^2.3.0 - package_info_plus: ^7.0.0 + package_info_plus: ^8.0.0 flutter_displaymode: ^0.6.0 dynamic_color: ^1.6.8 animations: ^2.0.10 device_info_plus: ^10.1.0 uuid: ^4.2.1 expandable: ^5.0.1 - fl_chart: ^0.67.0 + fl_chart: ^0.68.0 flutter_svg: ^2.0.9 percent_indicator: ^4.2.3 store_checker: ^1.4.0 @@ -81,7 +81,7 @@ dev_dependencies: # activated in the `analysis_options.yaml` file located at the root of your # package. See that file for information about deactivating specific lint # rules and activating additional ones. - flutter_lints: ^3.0.1 + flutter_lints: ^4.0.0 flutter_launcher_icons: ^0.13.1 flutter_native_splash: ^2.3.8 From 1dd23906c3203036a325f269695c175d18debf30 Mon Sep 17 00:00:00 2001 From: Juan Gilsanz Polo Date: Mon, 17 Jun 2024 13:28:12 +0200 Subject: [PATCH 02/15] Added options to copy to clipboard on log details --- lib/l10n/app_en.arb | 5 +- lib/l10n/app_es.arb | 5 +- .../logs/details/log_details_screen.dart | 15 ++- lib/screens/logs/details/log_list_tile.dart | 95 ++++++++++--------- 4 files changed, 68 insertions(+), 52 deletions(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 93b08af..3348119 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -791,5 +791,8 @@ "clientDisallowedSuccessfully": "Client disallowed successfully", "changesNotSaved": "Changes could not be saved", "allowingClient": "Allowing client...", - "disallowingClient": "Disallowing client..." + "disallowingClient": "Disallowing client...", + "clientIpCopied": "Client IP copied to the clipboard", + "clientNameCopied": "Client name copied to the clipboard", + "dnsServerAddressCopied": "DNS server address copied to the clipboard" } \ No newline at end of file diff --git a/lib/l10n/app_es.arb b/lib/l10n/app_es.arb index e777f48..811ee22 100644 --- a/lib/l10n/app_es.arb +++ b/lib/l10n/app_es.arb @@ -791,5 +791,8 @@ "clientDisallowedSuccessfully": "Cliente no permitido correctamente", "changesNotSaved": "Los cambios no han podido ser guardados", "allowingClient": "Permitiendo cliente...", - "disallowingClient": "No permitiendo cliente..." + "disallowingClient": "No permitiendo cliente...", + "clientIpCopied": "Dirección IP del cliente copiada al portapapeles", + "clientNameCopied": "Nombre del cliente copiado al portapapeles", + "dnsServerAddressCopied": "Dirección del servidor DNS copiada al portapapeles" } \ No newline at end of file diff --git a/lib/screens/logs/details/log_details_screen.dart b/lib/screens/logs/details/log_details_screen.dart index 0c35f35..5d78823 100644 --- a/lib/screens/logs/details/log_details_screen.dart +++ b/lib/screens/logs/details/log_details_screen.dart @@ -1,5 +1,6 @@ // ignore_for_file: use_build_context_synchronously +import 'package:adguard_home_manager/functions/copy_clipboard.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; @@ -275,10 +276,11 @@ class _Content extends StatelessWidget { subtitle: convertTimestampLocalTimezone(log.time, 'HH:mm:ss') ), SectionLabel(label: AppLocalizations.of(context)!.request), - LogListTile( + if (log.question.name != null) LogListTile( icon: Icons.domain_rounded, title: AppLocalizations.of(context)!.domain, - subtitle: log.question.name + subtitle: log.question.name, + onTap: () => copyToClipboard(value: log.question.name!, successMessage: AppLocalizations.of(context)!.domainCopiedClipboard), ), LogListTile( icon: Icons.category_rounded, @@ -294,7 +296,8 @@ class _Content extends StatelessWidget { if (log.upstream != null && log.upstream != '') LogListTile( icon: Icons.dns_rounded, title: AppLocalizations.of(context)!.dnsServer, - subtitle: log.upstream + subtitle: log.upstream, + onTap: () => copyToClipboard(value: log.upstream!, successMessage: AppLocalizations.of(context)!.dnsServerAddressCopied) ), LogListTile( icon: Icons.timer_rounded, @@ -310,12 +313,14 @@ class _Content extends StatelessWidget { LogListTile( icon: Icons.smartphone_rounded, title: AppLocalizations.of(context)!.deviceIp, - subtitle: log.client + subtitle: log.client, + onTap: () => copyToClipboard(value: log.client, successMessage: AppLocalizations.of(context)!.clientIpCopied), ), if (log.clientInfo != null && log.clientInfo!.name != '') LogListTile( icon: Icons.abc_rounded, title: AppLocalizations.of(context)!.deviceName, - subtitle: log.clientInfo!.name + subtitle: log.clientInfo!.name, + onTap: () => copyToClipboard(value: log.clientInfo!.name, successMessage: AppLocalizations.of(context)!.clientNameCopied), ), if (log.rules.isNotEmpty) ...[ SectionLabel(label: AppLocalizations.of(context)!.rules), diff --git a/lib/screens/logs/details/log_list_tile.dart b/lib/screens/logs/details/log_list_tile.dart index c45f0f8..15edd6b 100644 --- a/lib/screens/logs/details/log_list_tile.dart +++ b/lib/screens/logs/details/log_list_tile.dart @@ -6,63 +6,68 @@ class LogListTile extends StatelessWidget { final String? subtitle; final Widget? subtitleWidget; final Widget? trailing; + final void Function()? onTap; const LogListTile({ - Key? key, + super.key, required this.icon, required this.title, this.subtitle, this.subtitleWidget, this.trailing, - }) : super(key: key); + this.onTap, + }); @override Widget build(BuildContext context) { - return Container( - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Flexible( - child: Row( - children: [ - Icon( - icon, - size: 24, - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), - const SizedBox(width: 16), - Flexible( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - title, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w400, - color: Theme.of(context).colorScheme.onSurface - ), - ), - const SizedBox(height: 3), - subtitleWidget ?? Text( - subtitle!, - style: TextStyle( - fontSize: 14, - color: Theme.of(context).listTileTheme.textColor, - ), - ) - ], + return InkWell( + onTap: onTap, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Flexible( + child: Row( + children: [ + Icon( + icon, + size: 24, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), - ), - ], + const SizedBox(width: 16), + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w400, + color: Theme.of(context).colorScheme.onSurface + ), + ), + const SizedBox(height: 3), + subtitleWidget ?? Text( + subtitle!, + style: TextStyle( + fontSize: 14, + color: Theme.of(context).listTileTheme.textColor, + ), + ) + ], + ), + ), + ], + ), ), - ), - if (trailing != null) ...[ - const SizedBox(width: 16), - trailing! - ] - ], + if (trailing != null) ...[ + const SizedBox(width: 16), + trailing! + ] + ], + ), ), ); } From 8801428167f5bc1c58f395399e1419ad2ed8038a Mon Sep 17 00:00:00 2001 From: Juan Gilsanz Polo Date: Mon, 17 Jun 2024 13:55:54 +0200 Subject: [PATCH 03/15] Fixed missing language --- lib/screens/settings/server_info/server_info.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/screens/settings/server_info/server_info.dart b/lib/screens/settings/server_info/server_info.dart index 9757497..8f5c927 100644 --- a/lib/screens/settings/server_info/server_info.dart +++ b/lib/screens/settings/server_info/server_info.dart @@ -138,7 +138,7 @@ class _ServerInformationState extends State { title: AppLocalizations.of(context)!.serverVersion, subtitle: serverInfo.data!.version, ), - CustomListTile( + if (serverInfo.data!.language != "") CustomListTile( title: AppLocalizations.of(context)!.serverLanguage, subtitle: serverInfo.data!.language, ), From 4dd77a39d8409bfcec3fe4de5663dcd61c59284c Mon Sep 17 00:00:00 2001 From: Juan Gilsanz Polo Date: Mon, 17 Jun 2024 13:56:02 +0200 Subject: [PATCH 04/15] Fixed wrong colors --- lib/config/theme.dart | 12 ++++++++++++ pubspec.yaml | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/config/theme.dart b/lib/config/theme.dart index 8a8aadf..fce953a 100644 --- a/lib/config/theme.dart +++ b/lib/config/theme.dart @@ -15,6 +15,15 @@ ThemeData lightTheme(ColorScheme? dynamicColorScheme) => ThemeData( textColor: dynamicColorScheme != null ? dynamicColorScheme.onSurfaceVariant : const Color.fromRGBO(117, 117, 117, 1), iconColor: dynamicColorScheme != null ? dynamicColorScheme.onSurfaceVariant : const Color.fromRGBO(117, 117, 117, 1), ), + cardTheme: CardTheme( + surfaceTintColor: dynamicColorScheme?.surfaceTint + ), + popupMenuTheme: PopupMenuThemeData( + surfaceTintColor: dynamicColorScheme?.surfaceTint + ), + navigationBarTheme: NavigationBarThemeData( + surfaceTintColor: dynamicColorScheme?.surfaceTint + ) ); ThemeData darkTheme(ColorScheme? dynamicColorScheme) => ThemeData( @@ -33,6 +42,9 @@ ThemeData darkTheme(ColorScheme? dynamicColorScheme) => ThemeData( textColor: dynamicColorScheme != null ? dynamicColorScheme.onSurfaceVariant : const Color.fromRGBO(187, 187, 187, 1), iconColor: dynamicColorScheme != null ? dynamicColorScheme.onSurfaceVariant : const Color.fromRGBO(187, 187, 187, 1), ), + cardTheme: CardTheme( + surfaceTintColor: dynamicColorScheme?.surfaceTint + ) ); ThemeData lightThemeOldVersions(MaterialColor primaryColor) => ThemeData( diff --git a/pubspec.yaml b/pubspec.yaml index f2b0e49..1b1c059 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -43,7 +43,7 @@ dependencies: sqflite: ^2.3.0 package_info_plus: ^8.0.0 flutter_displaymode: ^0.6.0 - dynamic_color: ^1.6.8 + dynamic_color: ^1.7.0 animations: ^2.0.10 device_info_plus: ^10.1.0 uuid: ^4.2.1 From ad6e75b6fbace41231884957c06c4a8e7947fb5d Mon Sep 17 00:00:00 2001 From: Juan Gilsanz Polo Date: Mon, 17 Jun 2024 13:56:59 +0200 Subject: [PATCH 05/15] Fixed on dark theme --- lib/config/theme.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/config/theme.dart b/lib/config/theme.dart index fce953a..fc81165 100644 --- a/lib/config/theme.dart +++ b/lib/config/theme.dart @@ -44,6 +44,12 @@ ThemeData darkTheme(ColorScheme? dynamicColorScheme) => ThemeData( ), cardTheme: CardTheme( surfaceTintColor: dynamicColorScheme?.surfaceTint + ), + popupMenuTheme: PopupMenuThemeData( + surfaceTintColor: dynamicColorScheme?.surfaceTint + ), + navigationBarTheme: NavigationBarThemeData( + surfaceTintColor: dynamicColorScheme?.surfaceTint ) ); From d34d88172202cd6207c25f0110290541622e2bfa Mon Sep 17 00:00:00 2001 From: Juan Gilsanz Polo Date: Mon, 17 Jun 2024 17:16:08 +0200 Subject: [PATCH 06/15] Added predictive navigation --- lib/config/theme.dart | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/config/theme.dart b/lib/config/theme.dart index fc81165..a9ffa71 100644 --- a/lib/config/theme.dart +++ b/lib/config/theme.dart @@ -23,6 +23,11 @@ ThemeData lightTheme(ColorScheme? dynamicColorScheme) => ThemeData( ), navigationBarTheme: NavigationBarThemeData( surfaceTintColor: dynamicColorScheme?.surfaceTint + ), + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: PredictiveBackPageTransitionsBuilder() + } ) ); @@ -50,6 +55,11 @@ ThemeData darkTheme(ColorScheme? dynamicColorScheme) => ThemeData( ), navigationBarTheme: NavigationBarThemeData( surfaceTintColor: dynamicColorScheme?.surfaceTint + ), + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: PredictiveBackPageTransitionsBuilder() + } ) ); @@ -69,6 +79,11 @@ ThemeData lightThemeOldVersions(MaterialColor primaryColor) => ThemeData( iconColor: Color.fromRGBO(117, 117, 117, 1), ), brightness: Brightness.light, + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: PredictiveBackPageTransitionsBuilder() + } + ) ); ThemeData darkThemeOldVersions(MaterialColor primaryColor) => ThemeData( @@ -90,4 +105,9 @@ ThemeData darkThemeOldVersions(MaterialColor primaryColor) => ThemeData( iconColor: Color.fromRGBO(187, 187, 187, 1), ), brightness: Brightness.dark, + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: PredictiveBackPageTransitionsBuilder() + } + ) ); \ No newline at end of file From b981f4a5cb810b7cd2fafd90d42454d8c955fb3e Mon Sep 17 00:00:00 2001 From: Juan Gilsanz Polo Date: Mon, 17 Jun 2024 17:17:13 +0200 Subject: [PATCH 07/15] Updated app version --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 1b1c059..1a8cda0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 2.17.1+137 +version: 2.18.0-beta.1+138 environment: sdk: '>=2.18.1 <3.0.0' From 27b0c3a3a02a17426c956266a96a957587b458f2 Mon Sep 17 00:00:00 2001 From: Juan Gilsanz Polo Date: Tue, 18 Jun 2024 01:30:54 +0200 Subject: [PATCH 08/15] Updated macOS stuff --- macos/Podfile.lock | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/macos/Podfile.lock b/macos/Podfile.lock index ead0b21..96c9ba0 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -8,31 +8,32 @@ PODS: - FlutterMacOS - screen_retriever (0.0.1): - FlutterMacOS - - Sentry/HybridSDK (8.21.0): - - SentryPrivate (= 8.21.0) - - sentry_flutter (8.0.0): + - Sentry/HybridSDK (8.25.2) + - sentry_flutter (8.2.0): - Flutter - FlutterMacOS - - Sentry/HybridSDK (= 8.21.0) - - SentryPrivate (8.21.0) + - Sentry/HybridSDK (= 8.25.2) - shared_preferences_foundation (0.0.1): - Flutter - FlutterMacOS - sqflite (0.0.3): - Flutter - FlutterMacOS - - "sqlite3 (3.45.3+1)": - - "sqlite3/common (= 3.45.3+1)" - - "sqlite3/common (3.45.3+1)" - - "sqlite3/fts5 (3.45.3+1)": + - "sqlite3 (3.46.0+1)": + - "sqlite3/common (= 3.46.0+1)" + - "sqlite3/common (3.46.0+1)" + - "sqlite3/dbstatvtab (3.46.0+1)": - sqlite3/common - - "sqlite3/perf-threadsafe (3.45.3+1)": + - "sqlite3/fts5 (3.46.0+1)": - sqlite3/common - - "sqlite3/rtree (3.45.3+1)": + - "sqlite3/perf-threadsafe (3.46.0+1)": + - sqlite3/common + - "sqlite3/rtree (3.46.0+1)": - sqlite3/common - sqlite3_flutter_libs (0.0.1): - FlutterMacOS - - "sqlite3 (~> 3.45.3+1)" + - "sqlite3 (~> 3.46.0+1)" + - sqlite3/dbstatvtab - sqlite3/fts5 - sqlite3/perf-threadsafe - sqlite3/rtree @@ -57,7 +58,6 @@ DEPENDENCIES: SPEC REPOS: trunk: - Sentry - - SentryPrivate - sqlite3 EXTERNAL SOURCES: @@ -90,14 +90,13 @@ SPEC CHECKSUMS: FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 package_info_plus: fa739dd842b393193c5ca93c26798dff6e3d0e0c screen_retriever: 59634572a57080243dd1bf715e55b6c54f241a38 - Sentry: ebc12276bd17613a114ab359074096b6b3725203 - sentry_flutter: 4ce59806771a82cc2d2a4657b320c9801530db62 - SentryPrivate: d651efb234cf385ec9a1cdd3eff94b5e78a0e0fe - shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695 + Sentry: 51b056d96914a741f63eca774d118678b1eb05a1 + sentry_flutter: e8397d13e297a5d4b6be8a752e33140b21c5cc97 + shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec - sqlite3: 02d1f07eaaa01f80a1c16b4b31dfcbb3345ee01a - sqlite3_flutter_libs: 8d204ef443cf0d5c1c8b058044eab53f3943a9c5 - url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95 + sqlite3: 292c3e1bfe89f64e51ea7fc7dab9182a017c8630 + sqlite3_flutter_libs: 5ca46c1a04eddfbeeb5b16566164aa7ad1616e7b + url_launcher_macos: 5f437abeda8c85500ceb03f5c1938a8c5a705399 window_manager: 3a1844359a6295ab1e47659b1a777e36773cd6e8 PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 From 9a747dd2fb5c49707637024bf4f250d652a27820 Mon Sep 17 00:00:00 2001 From: Juan Gilsanz Polo Date: Tue, 18 Jun 2024 01:31:21 +0200 Subject: [PATCH 09/15] Added added clients list to client filters on logs --- lib/screens/logs/filters/clients_modal.dart | 163 ++++++++++++-------- 1 file changed, 96 insertions(+), 67 deletions(-) diff --git a/lib/screens/logs/filters/clients_modal.dart b/lib/screens/logs/filters/clients_modal.dart index ca15219..5e5dbc6 100644 --- a/lib/screens/logs/filters/clients_modal.dart +++ b/lib/screens/logs/filters/clients_modal.dart @@ -2,6 +2,7 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:segmented_button_slide/segmented_button_slide.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:adguard_home_manager/widgets/custom_checkbox_list_tile.dart'; @@ -14,10 +15,12 @@ import 'package:adguard_home_manager/providers/logs_provider.dart'; class _ClientLog { final String ip; final String? name; + final List? ids; const _ClientLog({ required this.ip, - required this.name + required this.name, + this.ids, }); } @@ -38,6 +41,7 @@ class ClientsModal extends StatefulWidget { class _ClientsModalState extends State { List<_ClientLog> _filteredClients = []; final _searchController = TextEditingController(); + int _selectedList = 0; @override void initState() { @@ -65,22 +69,46 @@ class _ClientsModalState extends State { final logsProvider = Provider.of(context); final statusProvider = Provider.of(context); - void onSearch(String value) { - final filtered = clientsProvider.clients!.autoClients.map((e) { - String? name; - try { - name = statusProvider.serverStatus!.clients.firstWhere((c) => c.ids.contains(e.ip)).name; - } catch (e) { - // ---- // - } - return _ClientLog( - ip: e.ip, - name: name - ); - }).where( - (c) => c.ip.contains(value.toLowerCase()) || (c.name != null && c.name!.toLowerCase().contains(value.toLowerCase())) - ).toList(); - setState(() => _filteredClients = filtered); + void onSearch({required String value, int? selectedList}) { + if ((selectedList ?? _selectedList) == 1) { + final filtered = clientsProvider.clients!.clients.map((e) { + String? name; + try { + name = statusProvider.serverStatus!.clients.firstWhere((c) => c.ids.contains(e.ids[0])).name; + } catch (e) { + // ---- // + } + return _ClientLog( + ip: e.ids[0], + name: name, + ids: e.ids + ); + }).where( + (c) => c.ip.contains(value.toLowerCase()) || (c.name != null && c.name!.toLowerCase().contains(value.toLowerCase())) + ).toList(); + setState(() => _filteredClients = filtered); + } + else { + final filtered = clientsProvider.clients!.autoClients.map((e) { + String? name; + try { + name = statusProvider.serverStatus!.clients.firstWhere((c) => c.ids.contains(e.ip)).name; + } catch (e) { + // ---- // + } + return _ClientLog( + ip: e.ip, + name: name + ); + }).where( + (c) => c.ip.contains(value.toLowerCase()) || (c.name != null && c.name!.toLowerCase().contains(value.toLowerCase())) + ).toList(); + setState(() => _filteredClients = filtered); + } + } + + void onListChange(int list) { + onSearch(value: _searchController.text, selectedList: list); } if (widget.dialog == true) { @@ -115,7 +143,7 @@ class _ClientsModalState extends State { _SearchField( controller: _searchController, onClear: () => setState(() => _searchController.text = ""), - onSearch: onSearch + onSearch: (v) => onSearch(value: v) ), Card( margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), @@ -135,30 +163,34 @@ class _ClientsModalState extends State { ), ), ), - CustomCheckboxListTile( - padding: const EdgeInsets.only( - left: 24, - top: 8, - right: 12, - bottom: 8 + Padding( + padding: const EdgeInsets.all(16), + child: SegmentedButtonSlide( + entries: [ + SegmentedButtonSlideEntry(icon: Icons.devices, label: AppLocalizations.of(context)!.activeClients), + SegmentedButtonSlideEntry(icon: Icons.add_rounded, label: AppLocalizations.of(context)!.added), + ], + selectedEntry: _selectedList, + onChange: (v) { + onListChange(v); + setState(() => _selectedList = v); + }, + colors: SegmentedButtonSlideColors( + barColor: Theme.of(context).colorScheme.primary.withOpacity(0.2), + backgroundSelectedColor: Theme.of(context).colorScheme.primary, + foregroundSelectedColor: Theme.of(context).colorScheme.onPrimary, + foregroundUnselectedColor: Theme.of(context).colorScheme.onSurface, + hoverColor: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), - value: logsProvider.selectedClients.length == clientsProvider.clients!.autoClients.length, - onChanged: (v) { - if (v == true) { - logsProvider.setSelectedClients(clientsProvider.clients!.autoClients.map((e) => e.ip).toList()); - } - else { - logsProvider.setSelectedClients([]); - } - }, - title: AppLocalizations.of(context)!.selectAll ), ListView.builder( primary: false, shrinkWrap: true, itemCount: _filteredClients.length, itemBuilder: (context, index) => _ListItem( - label: _filteredClients[index].ip, + title: _filteredClients[index].ip, + subtitle: _selectedList == 0 ? _filteredClients[index].name : _filteredClients[index].ids?.join(", "), checkboxActive: logsProvider.selectedClients.contains(_filteredClients[index].ip), onChanged: (isSelected) { if (isSelected == true) { @@ -196,7 +228,7 @@ class _ClientsModalState extends State { _SearchField( controller: _searchController, onClear: () => setState(() => _searchController.text = ""), - onSearch: onSearch + onSearch: (v) => onSearch(value: v) ), Card( margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), @@ -216,30 +248,34 @@ class _ClientsModalState extends State { ), ), ), - CustomCheckboxListTile( - padding: const EdgeInsets.only( - left: 24, - top: 8, - right: 12, - bottom: 8 + Padding( + padding: const EdgeInsets.all(16), + child: SegmentedButtonSlide( + entries: [ + SegmentedButtonSlideEntry(icon: Icons.devices, label: AppLocalizations.of(context)!.activeClients), + SegmentedButtonSlideEntry(icon: Icons.add_rounded, label: AppLocalizations.of(context)!.added), + ], + selectedEntry: _selectedList, + onChange: (v) { + onListChange(v); + setState(() => _selectedList = v); + }, + colors: SegmentedButtonSlideColors( + barColor: Theme.of(context).colorScheme.primary.withOpacity(0.2), + backgroundSelectedColor: Theme.of(context).colorScheme.primary, + foregroundSelectedColor: Theme.of(context).colorScheme.onPrimary, + foregroundUnselectedColor: Theme.of(context).colorScheme.onSurface, + hoverColor: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), - value: logsProvider.selectedClients.length == clientsProvider.clients!.autoClients.length, - onChanged: (v) { - if (v == true) { - logsProvider.setSelectedClients(clientsProvider.clients!.autoClients.map((e) => e.ip).toList()); - } - else { - logsProvider.setSelectedClients([]); - } - }, - title: AppLocalizations.of(context)!.selectAll ), ListView.builder( shrinkWrap: true, primary: false, itemCount: _filteredClients.length, itemBuilder: (context, index) => _ListItem( - label: _filteredClients[index].ip, + title: _selectedList == 0 ? _filteredClients[index].ip : _filteredClients[index].name ?? "", + subtitle: _selectedList == 0 ? _filteredClients[index].name : _filteredClients[index].ids?.join(", "), checkboxActive: logsProvider.selectedClients.contains(_filteredClients[index].ip), onChanged: (isSelected) { if (isSelected == true) { @@ -257,7 +293,7 @@ class _ClientsModalState extends State { } } ) - ) + ), ] ), ); @@ -309,32 +345,25 @@ class _SearchField extends StatelessWidget { } class _ListItem extends StatelessWidget { - final String label; + final String title; + final String? subtitle; final bool checkboxActive; final void Function(bool) onChanged; const _ListItem({ - required this.label, + required this.title, + this.subtitle, required this.checkboxActive, required this.onChanged, }); @override Widget build(BuildContext context) { - final statusProvider = Provider.of(context); - - String? name; - try { - name = statusProvider.serverStatus!.clients.firstWhere((c) => c.ids.contains(label)).name; - } catch (e) { - // ---- // - } - return CustomCheckboxListTile( value: checkboxActive, onChanged: (v) => onChanged(v), - title: label, - subtitle: name, + title: title, + subtitle: subtitle, padding: const EdgeInsets.only( left: 24, top: 8, From 4f903d8e4c5718135d5499c604539bd88b569f9e Mon Sep 17 00:00:00 2001 From: Juan Gilsanz Polo Date: Tue, 18 Jun 2024 01:32:04 +0200 Subject: [PATCH 10/15] Updated app version --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 1a8cda0..c9259b7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 2.18.0-beta.1+138 +version: 2.18.0-beta.2+139 environment: sdk: '>=2.18.1 <3.0.0' From cce54c8ba5567a4325744c1deaea86744ed34097 Mon Sep 17 00:00:00 2001 From: Juan Gilsanz Polo Date: Tue, 18 Jun 2024 21:50:38 +0200 Subject: [PATCH 11/15] Check if it's not ip to apply "" --- lib/functions/is_ip.dart | 10 ++++++++++ lib/screens/logs/filters/clients_modal.dart | 5 +++-- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 lib/functions/is_ip.dart diff --git a/lib/functions/is_ip.dart b/lib/functions/is_ip.dart new file mode 100644 index 0000000..667bf0b --- /dev/null +++ b/lib/functions/is_ip.dart @@ -0,0 +1,10 @@ +bool isIpAddress(String value) { + final ipv4Regexp = RegExp(r'^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$'); + final ipv6Regexp = RegExp(r'(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))'); + if (ipv4Regexp.hasMatch(value) || ipv6Regexp.hasMatch(value)) { + return true; + } + else { + return false; + } +} \ No newline at end of file diff --git a/lib/screens/logs/filters/clients_modal.dart b/lib/screens/logs/filters/clients_modal.dart index 5e5dbc6..ea15c41 100644 --- a/lib/screens/logs/filters/clients_modal.dart +++ b/lib/screens/logs/filters/clients_modal.dart @@ -6,6 +6,7 @@ import 'package:segmented_button_slide/segmented_button_slide.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:adguard_home_manager/widgets/custom_checkbox_list_tile.dart'; +import 'package:adguard_home_manager/functions/is_ip.dart'; import 'package:adguard_home_manager/widgets/list_bottom_sheet.dart'; import 'package:adguard_home_manager/providers/status_provider.dart'; @@ -79,9 +80,9 @@ class _ClientsModalState extends State { // ---- // } return _ClientLog( - ip: e.ids[0], + ip: isIpAddress(e.ids[0]) ? e.ids[0] : '"${e.ids[0]}"', name: name, - ids: e.ids + ids: e.ids.map((i) => isIpAddress(i) ? i : '"$i"').toList() ); }).where( (c) => c.ip.contains(value.toLowerCase()) || (c.name != null && c.name!.toLowerCase().contains(value.toLowerCase())) From a8cbed5ca09551c3ee016b5f1160e3a74d76ed70 Mon Sep 17 00:00:00 2001 From: Juan Gilsanz Polo Date: Fri, 21 Jun 2024 02:32:23 +0200 Subject: [PATCH 12/15] Added search button to added clients --- lib/l10n/app_en.arb | 3 +- lib/l10n/app_es.arb | 3 +- lib/screens/logs/filters/clients_modal.dart | 56 +++++++++++++++------ 3 files changed, 46 insertions(+), 16 deletions(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 3348119..39ec621 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -794,5 +794,6 @@ "disallowingClient": "Disallowing client...", "clientIpCopied": "Client IP copied to the clipboard", "clientNameCopied": "Client name copied to the clipboard", - "dnsServerAddressCopied": "DNS server address copied to the clipboard" + "dnsServerAddressCopied": "DNS server address copied to the clipboard", + "select": "Select" } \ No newline at end of file diff --git a/lib/l10n/app_es.arb b/lib/l10n/app_es.arb index 811ee22..399f429 100644 --- a/lib/l10n/app_es.arb +++ b/lib/l10n/app_es.arb @@ -794,5 +794,6 @@ "disallowingClient": "No permitiendo cliente...", "clientIpCopied": "Dirección IP del cliente copiada al portapapeles", "clientNameCopied": "Nombre del cliente copiado al portapapeles", - "dnsServerAddressCopied": "Dirección del servidor DNS copiada al portapapeles" + "dnsServerAddressCopied": "Dirección del servidor DNS copiada al portapapeles", + "select": "Seleccionar" } \ No newline at end of file diff --git a/lib/screens/logs/filters/clients_modal.dart b/lib/screens/logs/filters/clients_modal.dart index ea15c41..ac7b384 100644 --- a/lib/screens/logs/filters/clients_modal.dart +++ b/lib/screens/logs/filters/clients_modal.dart @@ -8,6 +8,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:adguard_home_manager/widgets/custom_checkbox_list_tile.dart'; import 'package:adguard_home_manager/functions/is_ip.dart'; import 'package:adguard_home_manager/widgets/list_bottom_sheet.dart'; +import 'package:adguard_home_manager/widgets/custom_list_tile.dart'; import 'package:adguard_home_manager/providers/status_provider.dart'; import 'package:adguard_home_manager/providers/clients_provider.dart'; @@ -80,9 +81,9 @@ class _ClientsModalState extends State { // ---- // } return _ClientLog( - ip: isIpAddress(e.ids[0]) ? e.ids[0] : '"${e.ids[0]}"', + ip: e.ids[0], name: name, - ids: e.ids.map((i) => isIpAddress(i) ? i : '"$i"').toList() + ids: e.ids ); }).where( (c) => c.ip.contains(value.toLowerCase()) || (c.name != null && c.name!.toLowerCase().contains(value.toLowerCase())) @@ -112,6 +113,13 @@ class _ClientsModalState extends State { onSearch(value: _searchController.text, selectedList: list); } + void searchAddedClient(_ClientLog client) { + final notIps = client.ids?.where((e) => isIpAddress(e) == false).toList(); + if (notIps == null) return; + logsProvider.setSearchText('"${notIps[0]}"'); + Navigator.of(context).pop(); + } + if (widget.dialog == true) { return Dialog( child: ConstrainedBox( @@ -193,6 +201,8 @@ class _ClientsModalState extends State { title: _filteredClients[index].ip, subtitle: _selectedList == 0 ? _filteredClients[index].name : _filteredClients[index].ids?.join(", "), checkboxActive: logsProvider.selectedClients.contains(_filteredClients[index].ip), + isAddedClient: _selectedList == 0, + onSearchAddedClient: () => searchAddedClient(_filteredClients[index]), onChanged: (isSelected) { if (isSelected == true) { logsProvider.setSelectedClients([ @@ -278,6 +288,8 @@ class _ClientsModalState extends State { title: _selectedList == 0 ? _filteredClients[index].ip : _filteredClients[index].name ?? "", subtitle: _selectedList == 0 ? _filteredClients[index].name : _filteredClients[index].ids?.join(", "), checkboxActive: logsProvider.selectedClients.contains(_filteredClients[index].ip), + isAddedClient: _selectedList == 1, + onSearchAddedClient: () => searchAddedClient(_filteredClients[index]), onChanged: (isSelected) { if (isSelected == true) { logsProvider.setSelectedClients([ @@ -350,27 +362,43 @@ class _ListItem extends StatelessWidget { final String? subtitle; final bool checkboxActive; final void Function(bool) onChanged; + final bool isAddedClient; + final void Function() onSearchAddedClient; const _ListItem({ required this.title, this.subtitle, required this.checkboxActive, required this.onChanged, + required this.isAddedClient, + required this.onSearchAddedClient, }); @override Widget build(BuildContext context) { - return CustomCheckboxListTile( - value: checkboxActive, - onChanged: (v) => onChanged(v), - title: title, - subtitle: subtitle, - padding: const EdgeInsets.only( - left: 24, - top: 8, - right: 12, - bottom: 8 - ), - ); + if (isAddedClient == true) { + return CustomListTile( + title: title, + subtitle: subtitle, + trailing: TextButton( + onPressed: onSearchAddedClient, + child: Text(AppLocalizations.of(context)!.select) + ), + ); + } + else { + return CustomCheckboxListTile( + value: checkboxActive, + onChanged: (v) => onChanged(v), + title: title, + subtitle: subtitle, + padding: const EdgeInsets.only( + left: 24, + top: 8, + right: 12, + bottom: 8 + ), + ); + } } } \ No newline at end of file From b685010a03f95545c84d32ffaf15d7b105d8230a Mon Sep 17 00:00:00 2001 From: Juan Gilsanz Polo Date: Fri, 21 Jun 2024 15:31:54 +0200 Subject: [PATCH 13/15] Updated app version --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index c9259b7..9779159 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 2.18.0-beta.2+139 +version: 2.18.0-beta.3+140 environment: sdk: '>=2.18.1 <3.0.0' From f8f18be7230e10ac62b32bff7359f13a283a6f7f Mon Sep 17 00:00:00 2001 From: Juan Gilsanz Polo Date: Mon, 24 Jun 2024 03:00:02 +0200 Subject: [PATCH 14/15] Fix windows installer builder --- windows/innosetup_installer_builder.iss | 1 + 1 file changed, 1 insertion(+) diff --git a/windows/innosetup_installer_builder.iss b/windows/innosetup_installer_builder.iss index 53b8fc7..b2a93ce 100644 --- a/windows/innosetup_installer_builder.iss +++ b/windows/innosetup_installer_builder.iss @@ -40,6 +40,7 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{ Source: "..\build\windows\x64\runner\Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion Source: "..\build\windows\x64\runner\Release\dynamic_color_plugin.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "..\build\windows\x64\runner\Release\flutter_windows.dll"; DestDir: "{app}"; Flags: ignoreversion +Source: "..\build\windows\x64\runner\Release\screen_retriever_plugin.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "..\build\windows\x64\runner\Release\sentry_flutter_plugin.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "..\build\windows\x64\runner\Release\sqlite3.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "..\build\windows\x64\runner\Release\sqlite3_flutter_libs_plugin.dll"; DestDir: "{app}"; Flags: ignoreversion From 0eae951eedae7dd52cfe322c2d6f51a5f5182551 Mon Sep 17 00:00:00 2001 From: Juan Gilsanz Polo Date: Mon, 24 Jun 2024 03:02:33 +0200 Subject: [PATCH 15/15] Updated app version --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 9779159..a12e5aa 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 2.18.0-beta.3+140 +version: 2.18.0+141 environment: sdk: '>=2.18.1 <3.0.0'