mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-06-28 20:09:51 +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",
|
"validPrivateKey": "Valid private key",
|
||||||
"expirationDate": "Expiration date",
|
"expirationDate": "Expiration date",
|
||||||
"keysNotMatch": "Invalid certificate or key: tls: private key does not match public key",
|
"keysNotMatch": "Invalid certificate or key: tls: private key does not match public key",
|
||||||
"nameTimeLogs": "Name and time on logs",
|
"timeLogs": "Time on logs",
|
||||||
"nameTimeLogsDescription": "Show client name and processing time on logs list",
|
"timeLogsDescription": "Show processing time on logs list",
|
||||||
"hostNames": "Host names",
|
"hostNames": "Host names",
|
||||||
"keyType": "Key type",
|
"keyType": "Key type",
|
||||||
"updateAvailable": "Update available",
|
"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.",
|
"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",
|
"iUnderstand": "I understand",
|
||||||
"appUpdates": "Application updates",
|
"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",
|
"validPrivateKey": "Clave privada válida",
|
||||||
"expirationDate": "Fecha de expiración",
|
"expirationDate": "Fecha de expiración",
|
||||||
"keysNotMatch": "Certificado o clave inválido: tls: la clave privada no corresponde con la clave pública",
|
"keysNotMatch": "Certificado o clave inválido: tls: la clave privada no corresponde con la clave pública",
|
||||||
"nameTimeLogs": "Nombre y tiempo en logs",
|
"timeLogs": "Tiempo en logs",
|
||||||
"nameTimeLogsDescription": "Mostrar el nombre del cliente y el tiempo de procesamiento en la lista de logs",
|
"timeLogsDescription": "Mostrar el tiempo de procesamiento en la lista de logs",
|
||||||
"hostNames": "Nombres de host",
|
"hostNames": "Nombres de host",
|
||||||
"keyType": "Tipo de clave",
|
"keyType": "Tipo de clave",
|
||||||
"updateAvailable": "Actualización disponible",
|
"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.",
|
"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",
|
"iUnderstand": "Lo entiendo",
|
||||||
"appUpdates": "Actualizaciones de la app",
|
"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 _hideZeroValues = 0;
|
||||||
|
|
||||||
int _showNameTimeLogs = 0;
|
int _showTimeLogs = 0;
|
||||||
|
|
||||||
|
int _showIpLogs = 0;
|
||||||
|
|
||||||
String? _doNotRememberVersion;
|
String? _doNotRememberVersion;
|
||||||
|
|
||||||
|
@ -119,8 +121,12 @@ class AppConfigProvider with ChangeNotifier {
|
||||||
return _useThemeColorForStatus;
|
return _useThemeColorForStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get showNameTimeLogs {
|
bool get showTimeLogs {
|
||||||
return _showNameTimeLogs == 1 ? true : false;
|
return _showTimeLogs == 1 ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool get showIpLogs {
|
||||||
|
return _showIpLogs == 1 ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
String? get doNotRememberVersion {
|
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(
|
final updated = await updateConfigQuery(
|
||||||
db: _dbInstance!,
|
db: _dbInstance!,
|
||||||
column: 'showNameTimeLogs',
|
column: 'showTimeLogs',
|
||||||
value: status == true ? 1 : 0
|
value: status == true ? 1 : 0
|
||||||
);
|
);
|
||||||
if (updated == true) {
|
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();
|
notifyListeners();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -325,7 +347,7 @@ class AppConfigProvider with ChangeNotifier {
|
||||||
_useDynamicColor = convertFromIntToBool(dbData['useDynamicColor'])!;
|
_useDynamicColor = convertFromIntToBool(dbData['useDynamicColor'])!;
|
||||||
_staticColor = dbData['staticColor'];
|
_staticColor = dbData['staticColor'];
|
||||||
_useThemeColorForStatus = dbData['useThemeColorForStatus'] != null ? convertFromIntToBool(dbData['useThemeColorForStatus'])! : false;
|
_useThemeColorForStatus = dbData['useThemeColorForStatus'] != null ? convertFromIntToBool(dbData['useThemeColorForStatus'])! : false;
|
||||||
_showNameTimeLogs = dbData['showNameTimeLogs'];
|
_showTimeLogs = dbData['showTimeLogs'];
|
||||||
_doNotRememberVersion = dbData['doNotRememberVersion'];
|
_doNotRememberVersion = dbData['doNotRememberVersion'];
|
||||||
|
|
||||||
_dbInstance = dbInstance;
|
_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)) {
|
if (width > 1100 && !(useAlwaysNormalTile == true)) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||||
|
@ -110,7 +122,7 @@ class LogTile extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 5),
|
const SizedBox(height: 5),
|
||||||
if (log.client.length <= 15 && appConfigProvider.showNameTimeLogs == false) Row(
|
if (log.client.length <= 15 && appConfigProvider.showTimeLogs == false) Row(
|
||||||
children: [
|
children: [
|
||||||
...[
|
...[
|
||||||
Icon(
|
Icon(
|
||||||
|
@ -118,10 +130,10 @@ class LogTile extends StatelessWidget {
|
||||||
size: 16,
|
size: 16,
|
||||||
color: Theme.of(context).listTileTheme.textColor,
|
color: Theme.of(context).listTileTheme.textColor,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 5),
|
const SizedBox(width: 8),
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(
|
||||||
log.client,
|
logClient(),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).listTileTheme.textColor,
|
color: Theme.of(context).listTileTheme.textColor,
|
||||||
|
@ -132,14 +144,14 @@ class LogTile extends StatelessWidget {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
const SizedBox(width: 15),
|
const SizedBox(width: 16),
|
||||||
...[
|
...[
|
||||||
Icon(
|
Icon(
|
||||||
Icons.schedule_rounded,
|
Icons.schedule_rounded,
|
||||||
size: 16,
|
size: 16,
|
||||||
color: Theme.of(context).listTileTheme.textColor,
|
color: Theme.of(context).listTileTheme.textColor,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 5),
|
const SizedBox(width: 8),
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(
|
||||||
convertTimestampLocalTimezone(log.time, 'HH:mm:ss'),
|
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: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
|
@ -162,10 +174,10 @@ class LogTile extends StatelessWidget {
|
||||||
size: 16,
|
size: 16,
|
||||||
color: Theme.of(context).listTileTheme.textColor,
|
color: Theme.of(context).listTileTheme.textColor,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 15),
|
const SizedBox(width: 8),
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(
|
||||||
log.client,
|
logClient(),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).listTileTheme.textColor,
|
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),
|
const SizedBox(height: 10),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
|
@ -206,7 +195,7 @@ class LogTile extends StatelessWidget {
|
||||||
size: 16,
|
size: 16,
|
||||||
color: Theme.of(context).listTileTheme.textColor,
|
color: Theme.of(context).listTileTheme.textColor,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 15),
|
const SizedBox(width: 8),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
child: Text(
|
child: Text(
|
||||||
convertTimestampLocalTimezone(log.time, 'HH:mm:ss'),
|
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),
|
const SizedBox(height: 10),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
|
@ -228,7 +217,7 @@ class LogTile extends StatelessWidget {
|
||||||
size: 16,
|
size: 16,
|
||||||
color: Theme.of(context).listTileTheme.textColor,
|
color: Theme.of(context).listTileTheme.textColor,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 15),
|
const SizedBox(width: 8),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
child: Text(
|
child: Text(
|
||||||
"${double.parse(log.elapsedMs).toStringAsFixed(2)} ms",
|
"${double.parse(log.elapsedMs).toStringAsFixed(2)} ms",
|
||||||
|
@ -285,7 +274,7 @@ class LogTile extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 5),
|
const SizedBox(height: 5),
|
||||||
if (log.client.length <= 15 && appConfigProvider.showNameTimeLogs == false) Row(
|
if (log.client.length <= 15 && appConfigProvider.showTimeLogs == false) Row(
|
||||||
children: [
|
children: [
|
||||||
...[
|
...[
|
||||||
Icon(
|
Icon(
|
||||||
|
@ -293,10 +282,10 @@ class LogTile extends StatelessWidget {
|
||||||
size: 16,
|
size: 16,
|
||||||
color: Theme.of(context).listTileTheme.textColor,
|
color: Theme.of(context).listTileTheme.textColor,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 5),
|
const SizedBox(width: 8),
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(
|
||||||
log.client,
|
logClient(),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).listTileTheme.textColor,
|
color: Theme.of(context).listTileTheme.textColor,
|
||||||
|
@ -307,14 +296,14 @@ class LogTile extends StatelessWidget {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
const SizedBox(width: 15),
|
const SizedBox(width: 16),
|
||||||
...[
|
...[
|
||||||
Icon(
|
Icon(
|
||||||
Icons.schedule_rounded,
|
Icons.schedule_rounded,
|
||||||
size: 16,
|
size: 16,
|
||||||
color: Theme.of(context).listTileTheme.textColor,
|
color: Theme.of(context).listTileTheme.textColor,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 5),
|
const SizedBox(width: 8),
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(
|
||||||
convertTimestampLocalTimezone(log.time, 'HH:mm:ss'),
|
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: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
|
@ -337,10 +326,10 @@ class LogTile extends StatelessWidget {
|
||||||
size: 16,
|
size: 16,
|
||||||
color: Theme.of(context).listTileTheme.textColor,
|
color: Theme.of(context).listTileTheme.textColor,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 15),
|
const SizedBox(width: 8),
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(
|
||||||
log.client,
|
logClient(),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).listTileTheme.textColor,
|
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),
|
const SizedBox(height: 10),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Row(
|
||||||
Icons.schedule_rounded,
|
children: [
|
||||||
size: 16,
|
Icon(
|
||||||
color: Theme.of(context).listTileTheme.textColor,
|
Icons.schedule_rounded,
|
||||||
),
|
size: 16,
|
||||||
const SizedBox(width: 15),
|
|
||||||
SizedBox(
|
|
||||||
child: Text(
|
|
||||||
convertTimestampLocalTimezone(log.time, 'HH:mm:ss'),
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).listTileTheme.textColor,
|
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(
|
return LogTile(
|
||||||
log: logsProvider.logsData!.data[index],
|
log: logsProvider.logsData!.data[index],
|
||||||
index: index,
|
index: index,
|
||||||
|
@ -349,6 +349,9 @@ class _LogsWidgetState extends State<LogsWidget> {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
: Center(
|
: Center(
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
import 'dart:io';
|
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:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:store_checker/store_checker.dart';
|
import 'package:store_checker/store_checker.dart';
|
||||||
|
@ -31,42 +33,23 @@ class _GeneralSettingsState extends State<GeneralSettings> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final appConfigProvider = Provider.of<AppConfigProvider>(context);
|
final appConfigProvider = Provider.of<AppConfigProvider>(context);
|
||||||
|
|
||||||
Future updateHideZeroValues(bool newStatus) async {
|
Future updateSettings({
|
||||||
final result = await appConfigProvider.setHideZeroValues(newStatus);
|
required bool newStatus,
|
||||||
|
required Future Function(bool) function
|
||||||
|
}) async {
|
||||||
|
final result = await function(newStatus);
|
||||||
if (result == true) {
|
if (result == true) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
showSnacbkar(
|
||||||
SnackBar(
|
appConfigProvider: appConfigProvider,
|
||||||
content: Text(AppLocalizations.of(context)!.settingsUpdatedSuccessfully),
|
label: AppLocalizations.of(context)!.settingsUpdatedSuccessfully,
|
||||||
backgroundColor: Colors.green,
|
color: Colors.green
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
showSnacbkar(
|
||||||
SnackBar(
|
appConfigProvider: appConfigProvider,
|
||||||
content: Text(AppLocalizations.of(context)!.cannotUpdateSettings),
|
label: AppLocalizations.of(context)!.cannotUpdateSettings,
|
||||||
backgroundColor: Colors.red,
|
color: 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,
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,15 +133,45 @@ class _GeneralSettingsState extends State<GeneralSettings> {
|
||||||
),
|
),
|
||||||
SliverList.list(
|
SliverList.list(
|
||||||
children: [
|
children: [
|
||||||
|
SectionLabel(label: AppLocalizations.of(context)!.home),
|
||||||
CustomListTile(
|
CustomListTile(
|
||||||
icon: Icons.exposure_zero_rounded,
|
icon: Icons.exposure_zero_rounded,
|
||||||
title: AppLocalizations.of(context)!.hideZeroValues,
|
title: AppLocalizations.of(context)!.hideZeroValues,
|
||||||
subtitle: AppLocalizations.of(context)!.hideZeroValuesDescription,
|
subtitle: AppLocalizations.of(context)!.hideZeroValuesDescription,
|
||||||
trailing: Switch(
|
trailing: Switch(
|
||||||
value: appConfigProvider.hideZeroValues,
|
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(
|
padding: const EdgeInsets.only(
|
||||||
top: 10,
|
top: 10,
|
||||||
bottom: 10,
|
bottom: 10,
|
||||||
|
@ -168,13 +181,19 @@ class _GeneralSettingsState extends State<GeneralSettings> {
|
||||||
),
|
),
|
||||||
CustomListTile(
|
CustomListTile(
|
||||||
icon: Icons.more,
|
icon: Icons.more,
|
||||||
title: AppLocalizations.of(context)!.nameTimeLogs,
|
title: AppLocalizations.of(context)!.ipLogs,
|
||||||
subtitle: AppLocalizations.of(context)!.nameTimeLogsDescription,
|
subtitle: AppLocalizations.of(context)!.ipLogsDescription,
|
||||||
trailing: Switch(
|
trailing: Switch(
|
||||||
value: appConfigProvider.showNameTimeLogs,
|
value: appConfigProvider.showIpLogs,
|
||||||
onChanged: updateShowNameTimeLogs,
|
onChanged: (value) => updateSettings(
|
||||||
|
newStatus: value,
|
||||||
|
function: appConfigProvider.setShowIpLogs
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () => updateSettings(
|
||||||
|
newStatus: !appConfigProvider.showIpLogs,
|
||||||
|
function: appConfigProvider.setShowIpLogs
|
||||||
),
|
),
|
||||||
onTap: () => updateShowNameTimeLogs(!appConfigProvider.showNameTimeLogs),
|
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
top: 10,
|
top: 10,
|
||||||
bottom: 10,
|
bottom: 10,
|
||||||
|
@ -188,14 +207,17 @@ class _GeneralSettingsState extends State<GeneralSettings> {
|
||||||
appConfigProvider.installationSource == Source.IS_INSTALLED_FROM_LOCAL_SOURCE) ||
|
appConfigProvider.installationSource == Source.IS_INSTALLED_FROM_LOCAL_SOURCE) ||
|
||||||
appConfigProvider.installationSource == Source.UNKNOWN
|
appConfigProvider.installationSource == Source.UNKNOWN
|
||||||
)
|
)
|
||||||
) CustomListTile(
|
) ...[
|
||||||
icon: Icons.system_update_rounded,
|
SectionLabel(label: AppLocalizations.of(context)!.application),
|
||||||
title: AppLocalizations.of(context)!.appUpdates,
|
CustomListTile(
|
||||||
subtitle: appConfigProvider.appUpdatesAvailable != null
|
icon: Icons.system_update_rounded,
|
||||||
? AppLocalizations.of(context)!.updateAvailable
|
title: AppLocalizations.of(context)!.appUpdates,
|
||||||
: AppLocalizations.of(context)!.usingLatestVersion,
|
subtitle: appConfigProvider.appUpdatesAvailable != null
|
||||||
trailing: generateAppUpdateStatus()
|
? 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(
|
Database db = await openDatabase(
|
||||||
'adguard_home_manager.db',
|
'adguard_home_manager.db',
|
||||||
version: 7,
|
version: 8,
|
||||||
onCreate: (Database db, int version) async {
|
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 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("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, showNameTimeLogs) VALUES (0, 0, 0, ${acceptsDynamicTheme == true ? 1 : 0}, 0, 0, 0)");
|
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 {
|
onUpgrade: (Database db, int oldVersion, int newVersion) async {
|
||||||
if (oldVersion == 1) {
|
if (oldVersion == 1) {
|
||||||
|
@ -87,6 +98,7 @@ Future<Map<String, dynamic>> loadDb(bool acceptsDynamicTheme) async {
|
||||||
await upgradeDbToV5(db);
|
await upgradeDbToV5(db);
|
||||||
await upgradeDbToV6(db);
|
await upgradeDbToV6(db);
|
||||||
await upgradeDbToV7(db);
|
await upgradeDbToV7(db);
|
||||||
|
await upgradeDbToV8(db);
|
||||||
}
|
}
|
||||||
if (oldVersion == 2) {
|
if (oldVersion == 2) {
|
||||||
await upgradeDbToV3(db);
|
await upgradeDbToV3(db);
|
||||||
|
@ -94,24 +106,32 @@ Future<Map<String, dynamic>> loadDb(bool acceptsDynamicTheme) async {
|
||||||
await upgradeDbToV5(db);
|
await upgradeDbToV5(db);
|
||||||
await upgradeDbToV6(db);
|
await upgradeDbToV6(db);
|
||||||
await upgradeDbToV7(db);
|
await upgradeDbToV7(db);
|
||||||
|
await upgradeDbToV8(db);
|
||||||
}
|
}
|
||||||
if (oldVersion == 3) {
|
if (oldVersion == 3) {
|
||||||
await upgradeDbToV4(db);
|
await upgradeDbToV4(db);
|
||||||
await upgradeDbToV5(db);
|
await upgradeDbToV5(db);
|
||||||
await upgradeDbToV6(db);
|
await upgradeDbToV6(db);
|
||||||
await upgradeDbToV7(db);
|
await upgradeDbToV7(db);
|
||||||
|
await upgradeDbToV8(db);
|
||||||
}
|
}
|
||||||
if (oldVersion == 4) {
|
if (oldVersion == 4) {
|
||||||
await upgradeDbToV5(db);
|
await upgradeDbToV5(db);
|
||||||
await upgradeDbToV6(db);
|
await upgradeDbToV6(db);
|
||||||
await upgradeDbToV7(db);
|
await upgradeDbToV7(db);
|
||||||
|
await upgradeDbToV8(db);
|
||||||
}
|
}
|
||||||
if (oldVersion == 5) {
|
if (oldVersion == 5) {
|
||||||
await upgradeDbToV6(db);
|
await upgradeDbToV6(db);
|
||||||
await upgradeDbToV7(db);
|
await upgradeDbToV7(db);
|
||||||
|
await upgradeDbToV8(db);
|
||||||
}
|
}
|
||||||
if (oldVersion == 6) {
|
if (oldVersion == 6) {
|
||||||
await upgradeDbToV7(db);
|
await upgradeDbToV7(db);
|
||||||
|
await upgradeDbToV8(db);
|
||||||
|
}
|
||||||
|
if (oldVersion == 7) {
|
||||||
|
await upgradeDbToV8(db);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onOpen: (Database db) async {
|
onOpen: (Database db) async {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue