diff --git a/lib/functions/check_app_updates.dart b/lib/functions/check_app_updates.dart index e002556..dc08f29 100644 --- a/lib/functions/check_app_updates.dart +++ b/lib/functions/check_app_updates.dart @@ -30,7 +30,7 @@ Future checkAppUpdates({ gitHubRelease: gitHubRelease, isBeta: isBeta ); -print(update); + if (update == true) { setUpdateAvailable(gitHubRelease); diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 1869104..9df4e41 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -774,5 +774,6 @@ "showHide": "Show/hide", "noElementsReorderMessage": "Enable some elements on the show/hide tab to reorder them here.", "enablePlainDns": "Enable plain DNS", - "enablePlainDnsDescription": "Plain DNS is enabled by default. You can disable it to force all devices to use encrypted DNS. To do this, you must enable at least one encrypted DNS protocol." + "enablePlainDnsDescription": "Plain DNS is enabled by default. You can disable it to force all devices to use encrypted DNS. To do this, you must enable at least one encrypted DNS protocol.", + "date": "Date" } \ No newline at end of file diff --git a/lib/l10n/app_es.arb b/lib/l10n/app_es.arb index 7070fea..eed494f 100644 --- a/lib/l10n/app_es.arb +++ b/lib/l10n/app_es.arb @@ -774,5 +774,6 @@ "showHide": "Mostrar/ocultar", "noElementsReorderMessage": "Activa algunos elementos en la pestaña de mostrar/ocultar para reordenarlos aquí.", "enablePlainDns": "Activar DNS simple (sin cifrado)", - "enablePlainDnsDescription": "El DNS simple (sin cifrado) está activado de forma predeterminada. Puedes desactivarlo para obligar a todos los dispositivos a utilizar DNS cifrado. Para ello, debes habilitar al menos un protocolo DNS cifrado." + "enablePlainDnsDescription": "El DNS simple (sin cifrado) está activado de forma predeterminada. Puedes desactivarlo para obligar a todos los dispositivos a utilizar DNS cifrado. Para ello, debes habilitar al menos un protocolo DNS cifrado.", + "date": "Fecha" } \ No newline at end of file diff --git a/lib/providers/filtering_provider.dart b/lib/providers/filtering_provider.dart index d43a1b5..9947233 100644 --- a/lib/providers/filtering_provider.dart +++ b/lib/providers/filtering_provider.dart @@ -133,7 +133,6 @@ class FilteringProvider with ChangeNotifier { if (result2.successful == true) { _filtering = result2.content as Filtering; notifyListeners(); - print(result.content); return { "success": true, "data": result.content diff --git a/lib/screens/logs/details/log_details_screen.dart b/lib/screens/logs/details/log_details_screen.dart index 42918dd..0c35f35 100644 --- a/lib/screens/logs/details/log_details_screen.dart +++ b/lib/screens/logs/details/log_details_screen.dart @@ -37,27 +37,6 @@ class LogDetailsScreen extends StatelessWidget { final width = MediaQuery.of(context).size.width; - Filter? getList(int id) { - try { - return statusProvider.filteringStatus!.filters.firstWhere((filter) => filter.id == id, orElse: () { - return statusProvider.filteringStatus!.whitelistFilters.firstWhere((filter) => filter.id == id); - }); - } catch (_) { - return null; - } - } - - Widget getResult() { - final filter = getFilteredStatus(context, appConfigProvider, log.reason, true); - return Text( - filter['label'], - style: TextStyle( - color: filter['color'], - fontWeight: FontWeight.w500 - ), - ); - } - void blockUnblock(String domain, String newStatus) async { final ProcessModal processModal = ProcessModal(); processModal.open(AppLocalizations.of(context)!.savingUserFilters); @@ -85,8 +64,175 @@ class LogDetailsScreen extends StatelessWidget { } } - List content() { - return [ + if (dialog) { + return Dialog( + child: ConstrainedBox( + constraints: const BoxConstraints( + maxWidth: 500 + ), + child: Column( + children: [ + Padding( + padding: const EdgeInsets.all(16), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + IconButton( + onPressed: () => Navigator.pop(context), + icon: const Icon(Icons.clear_rounded) + ), + const SizedBox(width: 16), + Text( + AppLocalizations.of(context)!.logDetails, + style: const TextStyle( + fontSize: 22 + ), + ), + ], + ), + Row( + children: [ + IconButton( + onPressed: () => openUrl("${Urls.googleSearchUrl}?q=${log.question.name}"), + icon: const Icon(Icons.travel_explore_rounded), + tooltip: AppLocalizations.of(context)!.searchDomainInternet + ), + IconButton( + onPressed: log.question.name != null + ? () => blockUnblock( + log.question.name!, + getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true ? 'unblock' : 'block' + ) + : null, + icon: Icon( + getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true + ? Icons.check_circle_rounded + : Icons.block + ), + tooltip: getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true + ? AppLocalizations.of(context)!.unblockDomain + : AppLocalizations.of(context)!.blockDomain, + ), + ], + ) + ], + ), + ), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: ListView( + children: [ + _Content(log: log) + ] + ) + ), + ) + ], + ), + ), + ); + } + else { + return Scaffold( + body: NestedScrollView( + headerSliverBuilder: (context, innerBoxIsScrolled) => [ + SliverOverlapAbsorber( + handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), + sliver: SliverAppBar.large( + pinned: true, + floating: true, + centerTitle: false, + forceElevated: innerBoxIsScrolled, + surfaceTintColor: isDesktop(width) ? Colors.transparent : null, + title: Text(AppLocalizations.of(context)!.logDetails), + actions: [ + IconButton( + onPressed: () => openUrl("${Urls.googleSearchUrl}?q=${log.question.name}"), + icon: const Icon(Icons.travel_explore_rounded), + tooltip: AppLocalizations.of(context)!.searchDomainInternet + ), + if (statusProvider.filteringStatus != null) IconButton( + onPressed: log.question.name != null + ? () => blockUnblock( + log.question.name!, + getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true ? 'unblock' : 'block' + ) + : null, + icon: Icon( + getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true + ? Icons.check_circle_rounded + : Icons.block + ), + tooltip: getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true + ? AppLocalizations.of(context)!.unblockDomain + : AppLocalizations.of(context)!.blockDomain, + ), + const SizedBox(width: 10) + ], + ), + ) + ], + body: SafeArea( + top: false, + child: Builder( + builder: (context) => CustomScrollView( + slivers: [ + SliverOverlapInjector( + handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), + ), + SliverList.list( + children: [ + _Content(log: log) + ] + ) + ], + ), + ) + ) + ), + ); + } + } +} + +class _Content extends StatelessWidget { + final Log log; + + const _Content({ + required this.log, + }); + + @override + Widget build(BuildContext context) { + final appConfigProvider = Provider.of(context); + final statusProvider = Provider.of(context); + + Widget getResult() { + final filter = getFilteredStatus(context, appConfigProvider, log.reason, true); + return Text( + filter['label'], + style: TextStyle( + color: filter['color'], + fontWeight: FontWeight.w500 + ), + ); + } + + Filter? getList(int id) { + try { + return statusProvider.filteringStatus!.filters.firstWhere((filter) => filter.id == id, orElse: () { + return statusProvider.filteringStatus!.whitelistFilters.firstWhere((filter) => filter.id == id); + }); + } catch (_) { + return null; + } + } + + return Column( + children: [ SectionLabel(label: AppLocalizations.of(context)!.status), LogListTile( icon: Icons.shield_rounded, @@ -118,6 +264,11 @@ class LogDetailsScreen extends StatelessWidget { title: AppLocalizations.of(context)!.blockingRule, subtitle: log.rule ), + LogListTile( + icon: Icons.calendar_month_rounded, + title: AppLocalizations.of(context)!.date, + subtitle: convertTimestampLocalTimezone(log.time, 'dd-MM-yyyy') + ), LogListTile( icon: Icons.schedule, title: AppLocalizations.of(context)!.time, @@ -180,7 +331,7 @@ class LogDetailsScreen extends StatelessWidget { else { return const SizedBox(); } - }).toList() + }) ], if (log.answer.isNotEmpty) ...[ SectionLabel(label: AppLocalizations.of(context)!.answers), @@ -206,137 +357,9 @@ class LogDetailsScreen extends StatelessWidget { ), ), ) - )).toList() + )) ] - ]; - } - - if (dialog) { - return Dialog( - child: ConstrainedBox( - constraints: const BoxConstraints( - maxWidth: 500 - ), - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(16), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - IconButton( - onPressed: () => Navigator.pop(context), - icon: const Icon(Icons.clear_rounded) - ), - const SizedBox(width: 16), - Text( - AppLocalizations.of(context)!.logDetails, - style: const TextStyle( - fontSize: 22 - ), - ), - ], - ), - Row( - children: [ - IconButton( - onPressed: () => openUrl("${Urls.googleSearchUrl}?q=${log.question.name}"), - icon: const Icon(Icons.travel_explore_rounded), - tooltip: AppLocalizations.of(context)!.searchDomainInternet - ), - IconButton( - onPressed: log.question.name != null - ? () => blockUnblock( - log.question.name!, - getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true ? 'unblock' : 'block' - ) - : null, - icon: Icon( - getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true - ? Icons.check_circle_rounded - : Icons.block - ), - tooltip: getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true - ? AppLocalizations.of(context)!.unblockDomain - : AppLocalizations.of(context)!.blockDomain, - ), - ], - ) - ], - ), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 8), - child: ListView( - children: content(), - ) - ), - ) - ], - ), - ), - ); - } - else { - return Scaffold( - body: NestedScrollView( - headerSliverBuilder: (context, innerBoxIsScrolled) => [ - SliverOverlapAbsorber( - handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), - sliver: SliverAppBar.large( - pinned: true, - floating: true, - centerTitle: false, - forceElevated: innerBoxIsScrolled, - surfaceTintColor: isDesktop(width) ? Colors.transparent : null, - title: Text(AppLocalizations.of(context)!.logDetails), - actions: [ - IconButton( - onPressed: () => openUrl("${Urls.googleSearchUrl}?q=${log.question.name}"), - icon: const Icon(Icons.travel_explore_rounded), - tooltip: AppLocalizations.of(context)!.searchDomainInternet - ), - if (statusProvider.filteringStatus != null) IconButton( - onPressed: log.question.name != null - ? () => blockUnblock( - log.question.name!, - getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true ? 'unblock' : 'block' - ) - : null, - icon: Icon( - getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true - ? Icons.check_circle_rounded - : Icons.block - ), - tooltip: getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true - ? AppLocalizations.of(context)!.unblockDomain - : AppLocalizations.of(context)!.blockDomain, - ), - const SizedBox(width: 10) - ], - ), - ) - ], - body: SafeArea( - top: false, - child: Builder( - builder: (context) => CustomScrollView( - slivers: [ - SliverOverlapInjector( - handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), - ), - SliverList.list( - children: content() - ) - ], - ), - ) - ) - ), - ); - } + ], + ); } } \ No newline at end of file diff --git a/lib/screens/logs/logs_list_appbar.dart b/lib/screens/logs/logs_list_appbar.dart index e4bf2ed..9b5ab3b 100644 --- a/lib/screens/logs/logs_list_appbar.dart +++ b/lib/screens/logs/logs_list_appbar.dart @@ -62,7 +62,7 @@ class LogsListAppBar extends StatelessWidget { "blocked_parental": AppLocalizations.of(context)!.blockedParentalRow, "safe_search": AppLocalizations.of(context)!.safeSearch, }; -print(MediaQuery.of(context).viewPadding.top); + return SliverAppBar.large( pinned: true, floating: true, diff --git a/lib/services/api_client.dart b/lib/services/api_client.dart index 4f8ba90..9bc283e 100644 --- a/lib/services/api_client.dart +++ b/lib/services/api_client.dart @@ -913,7 +913,6 @@ class ApiClientV2 { server: server, body: body ); - print(result.body); return ApiResponse(successful: result.successful); } } \ No newline at end of file