mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-04-20 22:09:11 +00:00
Show name logs when available
This commit is contained in:
parent
d02a859412
commit
8ca59d26c7
7 changed files with 208 additions and 165 deletions
|
@ -558,8 +558,8 @@
|
|||
"validPrivateKey": "Valid private key",
|
||||
"expirationDate": "Expiration date",
|
||||
"keysNotMatch": "Invalid certificate or key: tls: private key does not match public key",
|
||||
"nameTimeLogs": "Name and time on logs",
|
||||
"nameTimeLogsDescription": "Show client name and processing time on logs list",
|
||||
"timeLogs": "Time on logs",
|
||||
"timeLogsDescription": "Show processing time on logs list",
|
||||
"hostNames": "Host names",
|
||||
"keyType": "Key type",
|
||||
"updateAvailable": "Update available",
|
||||
|
@ -622,5 +622,8 @@
|
|||
"unsupprtedVersionMessage": "The support for your server version {version} is not guaranteed. This application may have some issues working with that server version.\n\nAdGuard Home Manager is designed to work with the stable releases of the AdGuard Home server. It may work with alpha and beta releases, but the compatibility is not guaranteed and the app may have some issues working with that versions.",
|
||||
"iUnderstand": "I understand",
|
||||
"appUpdates": "Application updates",
|
||||
"usingLatestVersion": "You are using the latest version"
|
||||
"usingLatestVersion": "You are using the latest version",
|
||||
"ipLogs": "IP on logs",
|
||||
"ipLogsDescription": "Show always IP address on logs instead of client name",
|
||||
"application": "Application"
|
||||
}
|
|
@ -558,8 +558,8 @@
|
|||
"validPrivateKey": "Clave privada válida",
|
||||
"expirationDate": "Fecha de expiración",
|
||||
"keysNotMatch": "Certificado o clave inválido: tls: la clave privada no corresponde con la clave pública",
|
||||
"nameTimeLogs": "Nombre y tiempo en logs",
|
||||
"nameTimeLogsDescription": "Mostrar el nombre del cliente y el tiempo de procesamiento en la lista de logs",
|
||||
"timeLogs": "Tiempo en logs",
|
||||
"timeLogsDescription": "Mostrar el tiempo de procesamiento en la lista de logs",
|
||||
"hostNames": "Nombres de host",
|
||||
"keyType": "Tipo de clave",
|
||||
"updateAvailable": "Actualización disponible",
|
||||
|
@ -622,5 +622,8 @@
|
|||
"unsupprtedVersionMessage": "El soporte para la versión del servidor {version} no está garantizada. Esta aplicación puede tener problemas al trabajar con esa versión del servidor.\n\nAdGuard Home Manager está diseñado para trabajar con las versiones estables del servidor AdGuard Home. Puede funcionar con versiones alpha y beta, pero la compatibilidad no está asegurada y la aplicación puede tener problemas para trabajar con esas versiones.",
|
||||
"iUnderstand": "Lo entiendo",
|
||||
"appUpdates": "Actualizaciones de la app",
|
||||
"usingLatestVersion": "Estás usando la última versión"
|
||||
"usingLatestVersion": "Estás usando la última versión",
|
||||
"ipLogs": "IP en registros",
|
||||
"ipLogsDescription": "Mostrar siempre dirección IP en vez del nombre del cliente",
|
||||
"application": "Aplicación"
|
||||
}
|
|
@ -37,7 +37,9 @@ class AppConfigProvider with ChangeNotifier {
|
|||
|
||||
int _hideZeroValues = 0;
|
||||
|
||||
int _showNameTimeLogs = 0;
|
||||
int _showTimeLogs = 0;
|
||||
|
||||
int _showIpLogs = 0;
|
||||
|
||||
String? _doNotRememberVersion;
|
||||
|
||||
|
@ -119,8 +121,12 @@ class AppConfigProvider with ChangeNotifier {
|
|||
return _useThemeColorForStatus;
|
||||
}
|
||||
|
||||
bool get showNameTimeLogs {
|
||||
return _showNameTimeLogs == 1 ? true : false;
|
||||
bool get showTimeLogs {
|
||||
return _showTimeLogs == 1 ? true : false;
|
||||
}
|
||||
|
||||
bool get showIpLogs {
|
||||
return _showIpLogs == 1 ? true : false;
|
||||
}
|
||||
|
||||
String? get doNotRememberVersion {
|
||||
|
@ -229,14 +235,30 @@ class AppConfigProvider with ChangeNotifier {
|
|||
}
|
||||
}
|
||||
|
||||
Future<bool> setShowNameTimeLogs(bool status) async {
|
||||
Future<bool> setshowTimeLogs(bool status) async {
|
||||
final updated = await updateConfigQuery(
|
||||
db: _dbInstance!,
|
||||
column: 'showNameTimeLogs',
|
||||
column: 'showTimeLogs',
|
||||
value: status == true ? 1 : 0
|
||||
);
|
||||
if (updated == true) {
|
||||
_showNameTimeLogs = status == true ? 1 : 0;
|
||||
_showTimeLogs = status == true ? 1 : 0;
|
||||
notifyListeners();
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> setShowIpLogs(bool status) async {
|
||||
final updated = await updateConfigQuery(
|
||||
db: _dbInstance!,
|
||||
column: 'showIpLogs',
|
||||
value: status == true ? 1 : 0
|
||||
);
|
||||
if (updated == true) {
|
||||
_showIpLogs = status == true ? 1 : 0;
|
||||
notifyListeners();
|
||||
return true;
|
||||
}
|
||||
|
@ -325,7 +347,7 @@ class AppConfigProvider with ChangeNotifier {
|
|||
_useDynamicColor = convertFromIntToBool(dbData['useDynamicColor'])!;
|
||||
_staticColor = dbData['staticColor'];
|
||||
_useThemeColorForStatus = dbData['useThemeColorForStatus'] != null ? convertFromIntToBool(dbData['useThemeColorForStatus'])! : false;
|
||||
_showNameTimeLogs = dbData['showNameTimeLogs'];
|
||||
_showTimeLogs = dbData['showTimeLogs'];
|
||||
_doNotRememberVersion = dbData['doNotRememberVersion'];
|
||||
|
||||
_dbInstance = dbInstance;
|
||||
|
|
|
@ -71,6 +71,18 @@ class LogTile extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
|
||||
String logClient() {
|
||||
if (appConfigProvider.showIpLogs == true) {
|
||||
return log.client;
|
||||
}
|
||||
else if (log.clientInfo != null && log.clientInfo!.name != "") {
|
||||
return log.clientInfo!.name;
|
||||
}
|
||||
else {
|
||||
return log.client;
|
||||
}
|
||||
}
|
||||
|
||||
if (width > 1100 && !(useAlwaysNormalTile == true)) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
|
@ -110,7 +122,7 @@ class LogTile extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
if (log.client.length <= 15 && appConfigProvider.showNameTimeLogs == false) Row(
|
||||
if (log.client.length <= 15 && appConfigProvider.showTimeLogs == false) Row(
|
||||
children: [
|
||||
...[
|
||||
Icon(
|
||||
|
@ -118,10 +130,10 @@ class LogTile extends StatelessWidget {
|
|||
size: 16,
|
||||
color: Theme.of(context).listTileTheme.textColor,
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
const SizedBox(width: 8),
|
||||
Flexible(
|
||||
child: Text(
|
||||
log.client,
|
||||
logClient(),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).listTileTheme.textColor,
|
||||
|
@ -132,14 +144,14 @@ class LogTile extends StatelessWidget {
|
|||
),
|
||||
)
|
||||
],
|
||||
const SizedBox(width: 15),
|
||||
const SizedBox(width: 16),
|
||||
...[
|
||||
Icon(
|
||||
Icons.schedule_rounded,
|
||||
size: 16,
|
||||
color: Theme.of(context).listTileTheme.textColor,
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
const SizedBox(width: 8),
|
||||
Flexible(
|
||||
child: Text(
|
||||
convertTimestampLocalTimezone(log.time, 'HH:mm:ss'),
|
||||
|
@ -153,7 +165,7 @@ class LogTile extends StatelessWidget {
|
|||
],
|
||||
],
|
||||
),
|
||||
if (log.client.length > 15 || appConfigProvider.showNameTimeLogs == true) Column(
|
||||
if (log.client.length > 15 || appConfigProvider.showTimeLogs == true) Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
|
@ -162,10 +174,10 @@ class LogTile extends StatelessWidget {
|
|||
size: 16,
|
||||
color: Theme.of(context).listTileTheme.textColor,
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
const SizedBox(width: 8),
|
||||
Flexible(
|
||||
child: Text(
|
||||
log.client,
|
||||
logClient(),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).listTileTheme.textColor,
|
||||
|
@ -175,29 +187,6 @@ class LogTile extends StatelessWidget {
|
|||
)
|
||||
],
|
||||
),
|
||||
if (appConfigProvider.showNameTimeLogs == true && log.clientInfo != null && log.clientInfo!.name != '') ...[
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.badge_rounded,
|
||||
size: 16,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
Flexible(
|
||||
child: Text(
|
||||
log.clientInfo!.name,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).listTileTheme.textColor,
|
||||
fontSize: 13
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
|
@ -206,7 +195,7 @@ class LogTile extends StatelessWidget {
|
|||
size: 16,
|
||||
color: Theme.of(context).listTileTheme.textColor,
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
const SizedBox(width: 8),
|
||||
SizedBox(
|
||||
child: Text(
|
||||
convertTimestampLocalTimezone(log.time, 'HH:mm:ss'),
|
||||
|
@ -219,7 +208,7 @@ class LogTile extends StatelessWidget {
|
|||
)
|
||||
],
|
||||
),
|
||||
if (appConfigProvider.showNameTimeLogs == true && log.elapsedMs != '') ...[
|
||||
if (appConfigProvider.showTimeLogs == true && log.elapsedMs != '') ...[
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
|
@ -228,7 +217,7 @@ class LogTile extends StatelessWidget {
|
|||
size: 16,
|
||||
color: Theme.of(context).listTileTheme.textColor,
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
const SizedBox(width: 8),
|
||||
SizedBox(
|
||||
child: Text(
|
||||
"${double.parse(log.elapsedMs).toStringAsFixed(2)} ms",
|
||||
|
@ -285,7 +274,7 @@ class LogTile extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
if (log.client.length <= 15 && appConfigProvider.showNameTimeLogs == false) Row(
|
||||
if (log.client.length <= 15 && appConfigProvider.showTimeLogs == false) Row(
|
||||
children: [
|
||||
...[
|
||||
Icon(
|
||||
|
@ -293,10 +282,10 @@ class LogTile extends StatelessWidget {
|
|||
size: 16,
|
||||
color: Theme.of(context).listTileTheme.textColor,
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
const SizedBox(width: 8),
|
||||
Flexible(
|
||||
child: Text(
|
||||
log.client,
|
||||
logClient(),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).listTileTheme.textColor,
|
||||
|
@ -307,14 +296,14 @@ class LogTile extends StatelessWidget {
|
|||
),
|
||||
)
|
||||
],
|
||||
const SizedBox(width: 15),
|
||||
const SizedBox(width: 16),
|
||||
...[
|
||||
Icon(
|
||||
Icons.schedule_rounded,
|
||||
size: 16,
|
||||
color: Theme.of(context).listTileTheme.textColor,
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
const SizedBox(width: 8),
|
||||
Flexible(
|
||||
child: Text(
|
||||
convertTimestampLocalTimezone(log.time, 'HH:mm:ss'),
|
||||
|
@ -328,7 +317,7 @@ class LogTile extends StatelessWidget {
|
|||
],
|
||||
],
|
||||
),
|
||||
if (log.client.length > 15 || appConfigProvider.showNameTimeLogs == true) Column(
|
||||
if (log.client.length > 15 || appConfigProvider.showTimeLogs == true) Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
|
@ -337,10 +326,10 @@ class LogTile extends StatelessWidget {
|
|||
size: 16,
|
||||
color: Theme.of(context).listTileTheme.textColor,
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
const SizedBox(width: 8),
|
||||
Flexible(
|
||||
child: Text(
|
||||
log.client,
|
||||
logClient(),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).listTileTheme.textColor,
|
||||
|
@ -350,73 +339,54 @@ class LogTile extends StatelessWidget {
|
|||
)
|
||||
],
|
||||
),
|
||||
if (appConfigProvider.showNameTimeLogs == true && log.clientInfo != null && log.clientInfo!.name != '') ...[
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.badge_rounded,
|
||||
size: 16,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
Flexible(
|
||||
child: Text(
|
||||
log.clientInfo!.name,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).listTileTheme.textColor,
|
||||
fontSize: 13
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.schedule_rounded,
|
||||
size: 16,
|
||||
color: Theme.of(context).listTileTheme.textColor,
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
SizedBox(
|
||||
child: Text(
|
||||
convertTimestampLocalTimezone(log.time, 'HH:mm:ss'),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.schedule_rounded,
|
||||
size: 16,
|
||||
color: Theme.of(context).listTileTheme.textColor,
|
||||
fontSize: 13
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
SizedBox(
|
||||
child: Text(
|
||||
convertTimestampLocalTimezone(log.time, 'HH:mm:ss'),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).listTileTheme.textColor,
|
||||
fontSize: 13
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
if (appConfigProvider.showTimeLogs == true && log.elapsedMs != '') ...[
|
||||
const SizedBox(width: 16),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.timer,
|
||||
size: 16,
|
||||
color: Theme.of(context).listTileTheme.textColor,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
SizedBox(
|
||||
child: Text(
|
||||
"${double.parse(log.elapsedMs).toStringAsFixed(2)} ms",
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).listTileTheme.textColor,
|
||||
fontSize: 13
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
),
|
||||
if (appConfigProvider.showNameTimeLogs == true && log.elapsedMs != '') ...[
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.timer,
|
||||
size: 16,
|
||||
color: Theme.of(context).listTileTheme.textColor,
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
SizedBox(
|
||||
child: Text(
|
||||
"${double.parse(log.elapsedMs).toStringAsFixed(2)} ms",
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).listTileTheme.textColor,
|
||||
fontSize: 13
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
],
|
||||
|
|
|
@ -330,7 +330,7 @@ class _LogsWidgetState extends State<LogsWidget> {
|
|||
),
|
||||
);
|
||||
}
|
||||
else {
|
||||
else if (logsProvider.logsData!.data[index].question.name != null) {
|
||||
return LogTile(
|
||||
log: logsProvider.logsData!.data[index],
|
||||
index: index,
|
||||
|
@ -349,6 +349,9 @@ class _LogsWidgetState extends State<LogsWidget> {
|
|||
}
|
||||
);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
)
|
||||
: Center(
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:adguard_home_manager/functions/snackbar.dart';
|
||||
import 'package:adguard_home_manager/widgets/section_label.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:store_checker/store_checker.dart';
|
||||
|
@ -31,42 +33,23 @@ class _GeneralSettingsState extends State<GeneralSettings> {
|
|||
Widget build(BuildContext context) {
|
||||
final appConfigProvider = Provider.of<AppConfigProvider>(context);
|
||||
|
||||
Future updateHideZeroValues(bool newStatus) async {
|
||||
final result = await appConfigProvider.setHideZeroValues(newStatus);
|
||||
Future updateSettings({
|
||||
required bool newStatus,
|
||||
required Future Function(bool) function
|
||||
}) async {
|
||||
final result = await function(newStatus);
|
||||
if (result == true) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(AppLocalizations.of(context)!.settingsUpdatedSuccessfully),
|
||||
backgroundColor: Colors.green,
|
||||
)
|
||||
showSnacbkar(
|
||||
appConfigProvider: appConfigProvider,
|
||||
label: AppLocalizations.of(context)!.settingsUpdatedSuccessfully,
|
||||
color: Colors.green
|
||||
);
|
||||
}
|
||||
else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(AppLocalizations.of(context)!.cannotUpdateSettings),
|
||||
backgroundColor: Colors.red,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future updateShowNameTimeLogs(bool newStatus) async {
|
||||
final result = await appConfigProvider.setShowNameTimeLogs(newStatus);
|
||||
if (result == true) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(AppLocalizations.of(context)!.settingsUpdatedSuccessfully),
|
||||
backgroundColor: Colors.green,
|
||||
)
|
||||
);
|
||||
}
|
||||
else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(AppLocalizations.of(context)!.cannotUpdateSettings),
|
||||
backgroundColor: Colors.red,
|
||||
)
|
||||
showSnacbkar(
|
||||
appConfigProvider: appConfigProvider,
|
||||
label: AppLocalizations.of(context)!.cannotUpdateSettings,
|
||||
color: Colors.red
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -150,15 +133,45 @@ class _GeneralSettingsState extends State<GeneralSettings> {
|
|||
),
|
||||
SliverList.list(
|
||||
children: [
|
||||
SectionLabel(label: AppLocalizations.of(context)!.home),
|
||||
CustomListTile(
|
||||
icon: Icons.exposure_zero_rounded,
|
||||
title: AppLocalizations.of(context)!.hideZeroValues,
|
||||
subtitle: AppLocalizations.of(context)!.hideZeroValuesDescription,
|
||||
trailing: Switch(
|
||||
value: appConfigProvider.hideZeroValues,
|
||||
onChanged: updateHideZeroValues,
|
||||
onChanged: (value) => updateSettings(
|
||||
newStatus: value,
|
||||
function: appConfigProvider.setHideZeroValues
|
||||
),
|
||||
),
|
||||
onTap: () => updateSettings(
|
||||
newStatus: !appConfigProvider.hideZeroValues,
|
||||
function: appConfigProvider.setHideZeroValues
|
||||
),
|
||||
padding: const EdgeInsets.only(
|
||||
top: 10,
|
||||
bottom: 10,
|
||||
left: 16,
|
||||
right: 10
|
||||
)
|
||||
),
|
||||
SectionLabel(label: AppLocalizations.of(context)!.logs),
|
||||
CustomListTile(
|
||||
icon: Icons.timer_rounded,
|
||||
title: AppLocalizations.of(context)!.timeLogs,
|
||||
subtitle: AppLocalizations.of(context)!.timeLogsDescription,
|
||||
trailing: Switch(
|
||||
value: appConfigProvider.showTimeLogs,
|
||||
onChanged: (value) => updateSettings(
|
||||
newStatus: value,
|
||||
function: appConfigProvider.setshowTimeLogs
|
||||
),
|
||||
),
|
||||
onTap: () => updateSettings(
|
||||
newStatus: !appConfigProvider.showTimeLogs,
|
||||
function: appConfigProvider.setshowTimeLogs
|
||||
),
|
||||
onTap: () => updateHideZeroValues(!appConfigProvider.hideZeroValues),
|
||||
padding: const EdgeInsets.only(
|
||||
top: 10,
|
||||
bottom: 10,
|
||||
|
@ -168,13 +181,19 @@ class _GeneralSettingsState extends State<GeneralSettings> {
|
|||
),
|
||||
CustomListTile(
|
||||
icon: Icons.more,
|
||||
title: AppLocalizations.of(context)!.nameTimeLogs,
|
||||
subtitle: AppLocalizations.of(context)!.nameTimeLogsDescription,
|
||||
title: AppLocalizations.of(context)!.ipLogs,
|
||||
subtitle: AppLocalizations.of(context)!.ipLogsDescription,
|
||||
trailing: Switch(
|
||||
value: appConfigProvider.showNameTimeLogs,
|
||||
onChanged: updateShowNameTimeLogs,
|
||||
value: appConfigProvider.showIpLogs,
|
||||
onChanged: (value) => updateSettings(
|
||||
newStatus: value,
|
||||
function: appConfigProvider.setShowIpLogs
|
||||
),
|
||||
),
|
||||
onTap: () => updateSettings(
|
||||
newStatus: !appConfigProvider.showIpLogs,
|
||||
function: appConfigProvider.setShowIpLogs
|
||||
),
|
||||
onTap: () => updateShowNameTimeLogs(!appConfigProvider.showNameTimeLogs),
|
||||
padding: const EdgeInsets.only(
|
||||
top: 10,
|
||||
bottom: 10,
|
||||
|
@ -188,14 +207,17 @@ class _GeneralSettingsState extends State<GeneralSettings> {
|
|||
appConfigProvider.installationSource == Source.IS_INSTALLED_FROM_LOCAL_SOURCE) ||
|
||||
appConfigProvider.installationSource == Source.UNKNOWN
|
||||
)
|
||||
) CustomListTile(
|
||||
icon: Icons.system_update_rounded,
|
||||
title: AppLocalizations.of(context)!.appUpdates,
|
||||
subtitle: appConfigProvider.appUpdatesAvailable != null
|
||||
? AppLocalizations.of(context)!.updateAvailable
|
||||
: AppLocalizations.of(context)!.usingLatestVersion,
|
||||
trailing: generateAppUpdateStatus()
|
||||
)
|
||||
) ...[
|
||||
SectionLabel(label: AppLocalizations.of(context)!.application),
|
||||
CustomListTile(
|
||||
icon: Icons.system_update_rounded,
|
||||
title: AppLocalizations.of(context)!.appUpdates,
|
||||
subtitle: appConfigProvider.appUpdatesAvailable != null
|
||||
? AppLocalizations.of(context)!.updateAvailable
|
||||
: AppLocalizations.of(context)!.usingLatestVersion,
|
||||
trailing: generateAppUpdateStatus()
|
||||
)
|
||||
]
|
||||
],
|
||||
)
|
||||
],
|
||||
|
|
|
@ -71,13 +71,24 @@ Future<Map<String, dynamic>> loadDb(bool acceptsDynamicTheme) async {
|
|||
});
|
||||
}
|
||||
|
||||
Future upgradeDbToV8(Database db) async {
|
||||
await db.execute("ALTER TABLE appConfig RENAME COLUMN showNameTimeLogs TO showTimeLogs");
|
||||
await db.execute("ALTER TABLE appConfig ADD COLUMN showIpLogs NUMERIC");
|
||||
|
||||
await db.transaction((txn) async{
|
||||
await txn.rawQuery(
|
||||
'SELECT * FROM appConfig',
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Database db = await openDatabase(
|
||||
'adguard_home_manager.db',
|
||||
version: 7,
|
||||
version: 8,
|
||||
onCreate: (Database db, int version) async {
|
||||
await db.execute("CREATE TABLE servers (id TEXT PRIMARY KEY, name TEXT, connectionMethod TEXT, domain TEXT, path TEXT, port INTEGER, user TEXT, password TEXT, defaultServer INTEGER, authToken TEXT, runningOnHa INTEGER)");
|
||||
await db.execute("CREATE TABLE appConfig (theme NUMERIC, overrideSslCheck NUMERIC, hideZeroValues NUMERIC, useDynamicColor NUMERIC, staticColor NUMERIC, useThemeColorForStatus NUMERIC, showNameTimeLogs NUMERIC, doNotRememberVersion TEXT)");
|
||||
await db.execute("INSERT INTO appConfig (theme, overrideSslCheck, hideZeroValues, useDynamicColor, staticColor, useThemeColorForStatus, showNameTimeLogs) VALUES (0, 0, 0, ${acceptsDynamicTheme == true ? 1 : 0}, 0, 0, 0)");
|
||||
await db.execute("CREATE TABLE appConfig (theme NUMERIC, overrideSslCheck NUMERIC, hideZeroValues NUMERIC, useDynamicColor NUMERIC, staticColor NUMERIC, useThemeColorForStatus NUMERIC, showTimeLogs NUMERIC, showIpLogs, doNotRememberVersion TEXT)");
|
||||
await db.execute("INSERT INTO appConfig (theme, overrideSslCheck, hideZeroValues, useDynamicColor, staticColor, useThemeColorForStatus, showTimeLogs, showIpLogs) VALUES (0, 0, 0, ${acceptsDynamicTheme == true ? 1 : 0}, 0, 0, 0, 0)");
|
||||
},
|
||||
onUpgrade: (Database db, int oldVersion, int newVersion) async {
|
||||
if (oldVersion == 1) {
|
||||
|
@ -87,6 +98,7 @@ Future<Map<String, dynamic>> loadDb(bool acceptsDynamicTheme) async {
|
|||
await upgradeDbToV5(db);
|
||||
await upgradeDbToV6(db);
|
||||
await upgradeDbToV7(db);
|
||||
await upgradeDbToV8(db);
|
||||
}
|
||||
if (oldVersion == 2) {
|
||||
await upgradeDbToV3(db);
|
||||
|
@ -94,24 +106,32 @@ Future<Map<String, dynamic>> loadDb(bool acceptsDynamicTheme) async {
|
|||
await upgradeDbToV5(db);
|
||||
await upgradeDbToV6(db);
|
||||
await upgradeDbToV7(db);
|
||||
await upgradeDbToV8(db);
|
||||
}
|
||||
if (oldVersion == 3) {
|
||||
await upgradeDbToV4(db);
|
||||
await upgradeDbToV5(db);
|
||||
await upgradeDbToV6(db);
|
||||
await upgradeDbToV7(db);
|
||||
await upgradeDbToV8(db);
|
||||
}
|
||||
if (oldVersion == 4) {
|
||||
await upgradeDbToV5(db);
|
||||
await upgradeDbToV6(db);
|
||||
await upgradeDbToV7(db);
|
||||
await upgradeDbToV8(db);
|
||||
}
|
||||
if (oldVersion == 5) {
|
||||
await upgradeDbToV6(db);
|
||||
await upgradeDbToV7(db);
|
||||
await upgradeDbToV8(db);
|
||||
}
|
||||
if (oldVersion == 6) {
|
||||
await upgradeDbToV7(db);
|
||||
await upgradeDbToV8(db);
|
||||
}
|
||||
if (oldVersion == 7) {
|
||||
await upgradeDbToV8(db);
|
||||
}
|
||||
},
|
||||
onOpen: (Database db) async {
|
||||
|
|
Loading…
Add table
Reference in a new issue