mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-05-14 22:12:53 +00:00
Added hide server address feature
This commit is contained in:
parent
a38c9bf4b0
commit
d967399b64
5 changed files with 64 additions and 12 deletions
|
@ -653,5 +653,7 @@
|
||||||
"queries": "Queries",
|
"queries": "Queries",
|
||||||
"adultSites": "Adult sites",
|
"adultSites": "Adult sites",
|
||||||
"quickFilters": "Quick filters",
|
"quickFilters": "Quick filters",
|
||||||
"searchDomainInternet": "Search domain on the Internet"
|
"searchDomainInternet": "Search domain on the Internet",
|
||||||
|
"hideServerAddress": "Hide server address",
|
||||||
|
"hideServerAddressDescription": "Hides the server address on the home screen"
|
||||||
}
|
}
|
|
@ -653,5 +653,7 @@
|
||||||
"queries": "Peticiones",
|
"queries": "Peticiones",
|
||||||
"adultSites": "Sitios de adultos",
|
"adultSites": "Sitios de adultos",
|
||||||
"quickFilters": "Filtros rápidos",
|
"quickFilters": "Filtros rápidos",
|
||||||
"searchDomainInternet": "Buscar dominio en internet"
|
"searchDomainInternet": "Buscar dominio en internet",
|
||||||
|
"hideServerAddress": "Ocultar dirección del servidor",
|
||||||
|
"hideServerAddressDescription": "Oculta la dirección del servidor en la pantalla de inicio"
|
||||||
}
|
}
|
|
@ -38,6 +38,8 @@ class AppConfigProvider with ChangeNotifier {
|
||||||
|
|
||||||
List<HomeTopItems> _homeTopItemsOrder = homeTopItemsDefaultOrder;
|
List<HomeTopItems> _homeTopItemsOrder = homeTopItemsDefaultOrder;
|
||||||
|
|
||||||
|
int _hideServerAddress = 0;
|
||||||
|
|
||||||
final List<AppLog> _logs = [];
|
final List<AppLog> _logs = [];
|
||||||
|
|
||||||
int _overrideSslCheck = 0;
|
int _overrideSslCheck = 0;
|
||||||
|
@ -162,6 +164,10 @@ class AppConfigProvider with ChangeNotifier {
|
||||||
return _homeTopItemsOrder;
|
return _homeTopItemsOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool get hideServerAddress {
|
||||||
|
return _hideServerAddress == 1 ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
void setDbInstance(Database db) {
|
void setDbInstance(Database db) {
|
||||||
_dbInstance = db;
|
_dbInstance = db;
|
||||||
}
|
}
|
||||||
|
@ -380,6 +386,23 @@ class AppConfigProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> setHideServerAddress(bool value) async {
|
||||||
|
final updated = await updateConfigQuery(
|
||||||
|
db: _dbInstance!,
|
||||||
|
column: 'hideServerAddress',
|
||||||
|
value: value == true ? 1 : 0
|
||||||
|
);
|
||||||
|
if (updated == true) {
|
||||||
|
_hideServerAddress = value == true ? 1 : 0;
|
||||||
|
notifyListeners();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Future<bool> setDoNotRememberVersion(String value) async {
|
Future<bool> setDoNotRememberVersion(String value) async {
|
||||||
final updated = await updateConfigQuery(
|
final updated = await updateConfigQuery(
|
||||||
db: _dbInstance!,
|
db: _dbInstance!,
|
||||||
|
@ -400,6 +423,7 @@ class AppConfigProvider with ChangeNotifier {
|
||||||
_doNotRememberVersion = dbData['doNotRememberVersion'];
|
_doNotRememberVersion = dbData['doNotRememberVersion'];
|
||||||
_showIpLogs = dbData['showIpLogs'] ?? 0;
|
_showIpLogs = dbData['showIpLogs'] ?? 0;
|
||||||
_combinedChartHome = dbData['combinedChart'] ?? 0;
|
_combinedChartHome = dbData['combinedChart'] ?? 0;
|
||||||
|
_hideServerAddress = dbData['hideServerAddress'];
|
||||||
if (dbData['homeTopItemsOrder'] != null) {
|
if (dbData['homeTopItemsOrder'] != null) {
|
||||||
try {
|
try {
|
||||||
_homeTopItemsOrder = List<HomeTopItems>.from(
|
_homeTopItemsOrder = List<HomeTopItems>.from(
|
||||||
|
|
|
@ -90,10 +90,11 @@ class HomeAppBar extends StatelessWidget {
|
||||||
if (serversProvider.selectedServer != null) ...[
|
if (serversProvider.selectedServer != null) ...[
|
||||||
Text(
|
Text(
|
||||||
server!.name,
|
server!.name,
|
||||||
style: const TextStyle(
|
style: !appConfigProvider.hideServerAddress ? const TextStyle(
|
||||||
fontSize: 20
|
fontSize: 20
|
||||||
|
) : null,
|
||||||
),
|
),
|
||||||
),
|
if (!appConfigProvider.hideServerAddress) ...[
|
||||||
const SizedBox(height: 5),
|
const SizedBox(height: 5),
|
||||||
Text(
|
Text(
|
||||||
"${server.connectionMethod}://${server.domain}${server.path ?? ""}${server.port != null ? ':${server.port}' : ""}",
|
"${server.connectionMethod}://${server.domain}${server.path ?? ""}${server.port != null ? ':${server.port}' : ""}",
|
||||||
|
@ -102,6 +103,7 @@ class HomeAppBar extends StatelessWidget {
|
||||||
color: Theme.of(context).listTileTheme.textColor
|
color: Theme.of(context).listTileTheme.textColor
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
]
|
||||||
],
|
],
|
||||||
if (serversProvider.selectedServer == null) Text(
|
if (serversProvider.selectedServer == null) Text(
|
||||||
AppLocalizations.of(context)!.noServerSelected,
|
AppLocalizations.of(context)!.noServerSelected,
|
||||||
|
|
|
@ -159,6 +159,28 @@ class _GeneralSettingsState extends State<GeneralSettings> {
|
||||||
right: 10
|
right: 10
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
CustomListTile(
|
||||||
|
icon: Icons.remove_red_eye_rounded,
|
||||||
|
title: AppLocalizations.of(context)!.hideServerAddress,
|
||||||
|
subtitle: AppLocalizations.of(context)!.hideServerAddressDescription,
|
||||||
|
trailing: Switch(
|
||||||
|
value: appConfigProvider.hideServerAddress,
|
||||||
|
onChanged: (value) => updateSettings(
|
||||||
|
newStatus: value,
|
||||||
|
function: appConfigProvider.setHideServerAddress
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () => updateSettings(
|
||||||
|
newStatus: !appConfigProvider.hideServerAddress,
|
||||||
|
function: appConfigProvider.setHideServerAddress
|
||||||
|
),
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
top: 10,
|
||||||
|
bottom: 10,
|
||||||
|
left: 16,
|
||||||
|
right: 10
|
||||||
|
)
|
||||||
|
),
|
||||||
SectionLabel(label: AppLocalizations.of(context)!.logs),
|
SectionLabel(label: AppLocalizations.of(context)!.logs),
|
||||||
CustomListTile(
|
CustomListTile(
|
||||||
icon: Icons.timer_rounded,
|
icon: Icons.timer_rounded,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue