Skip to content

Commit

Permalink
Add privacy policy link and app detail modal in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
tsutsu3 committed Dec 16, 2024
1 parent 7e352af commit 72c587e
Show file tree
Hide file tree
Showing 9 changed files with 216 additions and 149 deletions.
3 changes: 3 additions & 0 deletions lib/constants/urls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ const issueUrl = 'https://github.com/tsutsu3/pi-hole-client/issues';

const supportUrl =
'https://docs.google.com/forms/d/e/1FAIpQLSdNm7H2iDUaQ0q-JA6hvrUSsGe50_iL5NVK6fR_2hkCsyrA-A/viewform?hl=en';

const privacyPolicyUrl =
'https://github.com/tsutsu3/pi-hole-client/wiki/Privacy-policy';
6 changes: 6 additions & 0 deletions lib/l10n/app_de.arb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"about": "Über diese App",
"aboutThisApp": "Hilfe erhalten und mehr über diese App erfahren",
"accept": "Akzeptieren",
"add": "Hinzufügen",
"addAsWildcard": "Als Wildcard hinzufügen",
Expand Down Expand Up @@ -32,6 +33,8 @@
"appUnlockDisabled": "App Sperre inaktiv",
"appUnlockEnabled": "App Sperre aktiv ",
"appVersion": "App Version",
"application": "Anwendung",
"applicationDetail": "Anwendungsdetails",
"apply": "Speichern",
"areSureRemovePasscode": "Sind Sie sicher, dass Sie das Passwort entfernen möchten? Dadurch wird die App-Sperre deaktiviert.",
"authentication": "Authentifizierung",
Expand Down Expand Up @@ -220,6 +223,7 @@
"olderVersion": "Wenn Sie eine ältere Version haben, aktualisieren Sie bitte Ihr Pi-Hole, um diese App weiterhin verwenden zu können.",
"oneColumnLegend": "Einspalt-Legende",
"oneColumnLegendDescription": "Nur eine Spalte für die Legende verwenden",
"openExternalUrl": "Öffnet einen externen Link",
"openIssueGitHub": "Issue auf GitHub eröffnen",
"openWebPanel": "Web-Panel öffnen",
"others": "Andere",
Expand All @@ -233,6 +237,8 @@
"pieChartDescription": "Zeigt die Daten in einem Tortendiagramm mit einer Legende.",
"port": "Port",
"portCannotEmpty": "Port Feld darf nicht leer sein",
"privacyPolicy": "Datenschutzrichtlinie",
"privacyPolicyDescription": "Datenschutzrichtlinie ansehen",
"qrScanner": "QR-Code Scanner",
"queriesBlocked": "Blockierte Abfragen",
"queriesServers": "Abfragen & Server",
Expand Down
6 changes: 6 additions & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"about": "About",
"aboutThisApp": "Get help and learn about this app",
"accept": "Accept",
"add": "Add",
"addAsWildcard": "Add as wildcard",
Expand Down Expand Up @@ -32,6 +33,8 @@
"appUnlockDisabled": "App unlock disabled",
"appUnlockEnabled": "App unlock enabled",
"appVersion": "App version",
"application": "Application",
"applicationDetail": "Application Detail",
"apply": "Apply",
"areSureRemovePasscode": "Are you sure you want to remove the passcode? This will disable the app unlock protection.",
"authentication": "Authentication",
Expand Down Expand Up @@ -220,6 +223,7 @@
"olderVersion": "If you have an older version, please update your Pi-hole to continue using this app.",
"oneColumnLegend": "One column legend",
"oneColumnLegendDescription": "Use only one column for the legend",
"openExternalUrl": "Opens an external link",
"openIssueGitHub": "Open an issue on GitHub",
"openWebPanel": "Open web panel",
"others": "Others",
Expand All @@ -233,6 +237,8 @@
"pieChartDescription": "Displays the data on a pie chart with the legend under it.",
"port": "Port",
"portCannotEmpty": "Port field cannot be empty",
"privacyPolicy": "Privacy Policy",
"privacyPolicyDescription": "View Privacy Policy",
"qrScanner": "QR scanner",
"queriesBlocked": "Queries blocked",
"queriesServers": "Queries & servers",
Expand Down
6 changes: 6 additions & 0 deletions lib/l10n/app_es.arb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"about": "Sobre la app",
"aboutThisApp": "Obtén ayuda y aprende sobre esta aplicación",
"accept": "Aceptar",
"add": "Añadir",
"addAsWildcard": "Añadir como wildcard",
Expand Down Expand Up @@ -32,6 +33,8 @@
"appUnlockDisabled": "Desbloqueo de app desactivado",
"appUnlockEnabled": "Desbloqueo de app activado",
"appVersion": "Versión de la aplicación",
"application": "Aplicación",
"applicationDetail": "Detalle de la Aplicación",
"apply": "Aplicar",
"areSureRemovePasscode": "Estás seguro que deseas eliminar el código? Esto desactivará la protección de desbloqueo de la app.",
"authentication": "Autenticación",
Expand Down Expand Up @@ -222,6 +225,7 @@
"olderVersion": "Si tienes una versión más antigua, por favor, actualiza tu Pi-hole para seguir usando esta app.",
"oneColumnLegend": "Leyenda de una columna",
"oneColumnLegendDescription": "Usar solo una columna para la leyenda",
"openExternalUrl": "Abre un enlace externo",
"openIssueGitHub": "Abre un issue en GitHub",
"openWebPanel": "Abrir panel web",
"others": "Otros",
Expand All @@ -235,6 +239,8 @@
"pieChartDescription": "Muestra los datos en un gráfico circular con la leyenda debajo.",
"port": "Puerto",
"portCannotEmpty": "Puerto no puede estar vacío",
"privacyPolicy": "Política de Privacidad",
"privacyPolicyDescription": "Ver Política de Privacidad",
"qrScanner": "Escáner QR",
"queriesBlocked": "Peticiones bloqueadas",
"queriesServers": "Peticiones y servidores",
Expand Down
6 changes: 6 additions & 0 deletions lib/l10n/app_ja.arb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"about": "概要",
"aboutThisApp": "サポートとこのアプリについての詳細",
"accept": "受け入れる",
"add": "追加",
"addAsWildcard": "ワイルドカードとして追加",
Expand Down Expand Up @@ -32,6 +33,8 @@
"appUnlockDisabled": "アプリのロック解除が無効になりました",
"appUnlockEnabled": "アプリのロック解除が有効になりました",
"appVersion": "アプリバージョン",
"application": "アプリケーション",
"applicationDetail": "アプリケーションの詳細",
"apply": "適用",
"areSureRemovePasscode": "パスコードを削除してもよろしいですか?これによりアプリのロック解除保護が無効になります。",
"authentication": "認証",
Expand Down Expand Up @@ -220,6 +223,7 @@
"olderVersion": "古いバージョンの場合、このアプリを引き続き使用するためにPi-holeを更新してください。",
"oneColumnLegend": "1列の凡例",
"oneColumnLegendDescription": "凡例を1列だけ使用する",
"openExternalUrl": "外部リンクを開きます",
"openIssueGitHub": "GitHubで問題を開く",
"openWebPanel": "ウェブパネルを開く",
"others": "その他",
Expand All @@ -233,6 +237,8 @@
"pieChartDescription": "円グラフでデータを表示し、その下に凡例を表示します。",
"port": "ポート",
"portCannotEmpty": "ポートフィールドを空にすることはできません",
"privacyPolicy": "プライバシーポリシー",
"privacyPolicyDescription": "プライバシーポリシーを見る",
"qrScanner": "QRスキャナー",
"queriesBlocked": "ブロックされたクエリ",
"queriesServers": "クエリ&サーバー",
Expand Down
6 changes: 6 additions & 0 deletions lib/l10n/app_pl.arb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"about": "O aplikacji",
"aboutThisApp": "Uzyskaj pomoc i dowiedz się więcej o tej aplika",
"accept": "Akceptuj",
"add": "Dodawaj",
"addAsWildcard": "Dodaj jako symbol zastępczy",
Expand Down Expand Up @@ -32,6 +33,8 @@
"appUnlockDisabled": "Odblokowywanie aplikacji wyłączone",
"appUnlockEnabled": "Odblokowywanie aplikacji włączone",
"appVersion": "Wersja aplikacji",
"application": "Aplikacja",
"applicationDetail": "\tSzczegóły aplikacji",
"apply": "Zastosuj",
"areSureRemovePasscode": "Czy na pewno chcesz usunąć kod dostępu? Spowoduje to wyłączenie ochrony przed odblokowaniem aplikacji.",
"authentication": "Uwierzytelnianie",
Expand Down Expand Up @@ -218,6 +221,7 @@
"olderVersion": "Jeśli masz starszą wersję, zaktualizuj Pi-hole, aby nadal korzystać z tej aplikacji.",
"oneColumnLegend": "Legenda w jednej kolumnie",
"oneColumnLegendDescription": "Używanie tylko jednej kolumny dla legendy",
"openExternalUrl": "Otwiera zewnętrzny link",
"openIssueGitHub": "Otwórz problem w serwisie GitHub",
"openWebPanel": "Otwórz panel WWW",
"others": "Inne",
Expand All @@ -231,6 +235,8 @@
"pieChartDescription": "Wyświetla dane na wykresie kołowym z legendą pod nimi.",
"port": "Port",
"portCannotEmpty": "Pole portu nie może być puste",
"privacyPolicy": "Polityka Prywatności",
"privacyPolicyDescription": "Zobacz Politykę Prywatności",
"qrScanner": "Skaner QR",
"queriesBlocked": "Zapytania zablokowane",
"queriesServers": "Zapytania i serwery",
Expand Down
173 changes: 173 additions & 0 deletions lib/screens/settings/app_detail_modal.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
import 'package:flutter/material.dart';
import 'package:expandable/expandable.dart';
import 'package:flutter_svg/svg.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:pi_hole_client/constants/urls.dart';
import 'package:pi_hole_client/functions/open_url.dart';

class AppDetailModal extends StatefulWidget {
final String? _appVersion;

const AppDetailModal({super.key, String? appVersion})
: _appVersion = appVersion;

@override
State<AppDetailModal> createState() => _AppDetailModalState();
}

class _AppDetailModalState extends State<AppDetailModal> {
final expandableController = ExpandableController();

String get _appVersion => widget._appVersion ?? "";

@override
Widget build(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;

return AlertDialog(
scrollable: true,
contentPadding: const EdgeInsets.all(0),
title: Column(
children: [
Icon(
Icons.contact_page_rounded,
size: 24,
color: colorScheme.secondary,
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 20),
child: Text(
AppLocalizations.of(context)!.applicationDetail,
style: const TextStyle(fontSize: 24),
),
),
],
),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
_appDetailLine(
url: issueUrl,
icon: SvgPicture.asset(
'assets/resources/github.svg',
colorFilter:
ColorFilter.mode(colorScheme.onSurface, BlendMode.srcIn),
width: 25,
height: 25,
),
title: "GitHub",
subtitle: AppLocalizations.of(context)!.openIssueGitHub,
colorScheme: colorScheme,
),
_appDetailLine(
url: supportUrl,
icon:
Icon(Icons.question_mark_rounded, color: colorScheme.onSurface),
title: AppLocalizations.of(context)!.supportForm,
subtitle: AppLocalizations.of(context)!.supportFormDescription,
colorScheme: colorScheme,
),
_appDetailLine(
url: privacyPolicyUrl,
icon: Icon(Icons.security_rounded, color: colorScheme.onSurface),
title: AppLocalizations.of(context)!.privacyPolicy,
subtitle: AppLocalizations.of(context)!.privacyPolicyDescription,
colorScheme: colorScheme,
),
Padding(padding: const EdgeInsets.symmetric(vertical: 10)),
Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: _appDetailLine(
title: AppLocalizations.of(context)!.appVersion,
subtitle: _appVersion,
colorScheme: colorScheme,
showWebViewIcon: false,
),
),
Expanded(
child: _appDetailLine(
title: AppLocalizations.of(context)!.createdBy,
subtitle: "tsutsu3",
colorScheme: colorScheme,
showWebViewIcon: false,
),
),
],
),
],
),
Padding(padding: const EdgeInsets.symmetric(vertical: 10)),
],
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: Text(AppLocalizations.of(context)!.close),
),
],
);
}

Widget _appDetailLine({
String? url,
Widget? icon,
required String title,
required String subtitle,
required ColorScheme colorScheme,
bool showWebViewIcon = true,
}) {
return Material(
color: Colors.transparent,
child: InkWell(
onTap: url != null ? () => openUrl(url) : null,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 20),
child: Row(
children: [
icon ?? const SizedBox(width: 0),
const SizedBox(width: 20),
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
title,
style: TextStyle(
fontSize: 16, color: colorScheme.onSurface),
),
if (showWebViewIcon) ...[
const SizedBox(width: 8),
Tooltip(
message:
AppLocalizations.of(context)!.openExternalUrl,
child: Icon(
Icons.open_in_browser_rounded,
size: 16,
color:
colorScheme.onSurfaceVariant.withOpacity(0.6),
),
),
],
],
),
const SizedBox(height: 5),
Text(
subtitle,
style: TextStyle(color: colorScheme.onSurfaceVariant),
),
],
),
),
],
),
),
),
);
}
}
Loading

0 comments on commit 72c587e

Please sign in to comment.