mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-05-14 14:02:48 +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",
|
||||
"adultSites": "Adult sites",
|
||||
"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",
|
||||
"adultSites": "Sitios de adultos",
|
||||
"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;
|
||||
|
||||
int _hideServerAddress = 0;
|
||||
|
||||
final List<AppLog> _logs = [];
|
||||
|
||||
int _overrideSslCheck = 0;
|
||||
|
@ -162,6 +164,10 @@ class AppConfigProvider with ChangeNotifier {
|
|||
return _homeTopItemsOrder;
|
||||
}
|
||||
|
||||
bool get hideServerAddress {
|
||||
return _hideServerAddress == 1 ? true : false;
|
||||
}
|
||||
|
||||
void setDbInstance(Database 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 {
|
||||
final updated = await updateConfigQuery(
|
||||
db: _dbInstance!,
|
||||
|
@ -400,6 +423,7 @@ class AppConfigProvider with ChangeNotifier {
|
|||
_doNotRememberVersion = dbData['doNotRememberVersion'];
|
||||
_showIpLogs = dbData['showIpLogs'] ?? 0;
|
||||
_combinedChartHome = dbData['combinedChart'] ?? 0;
|
||||
_hideServerAddress = dbData['hideServerAddress'];
|
||||
if (dbData['homeTopItemsOrder'] != null) {
|
||||
try {
|
||||
_homeTopItemsOrder = List<HomeTopItems>.from(
|
||||
|
|
|
@ -90,18 +90,20 @@ class HomeAppBar extends StatelessWidget {
|
|||
if (serversProvider.selectedServer != null) ...[
|
||||
Text(
|
||||
server!.name,
|
||||
style: const TextStyle(
|
||||
style: !appConfigProvider.hideServerAddress ? const TextStyle(
|
||||
fontSize: 20
|
||||
),
|
||||
) : null,
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
"${server.connectionMethod}://${server.domain}${server.path ?? ""}${server.port != null ? ':${server.port}' : ""}",
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Theme.of(context).listTileTheme.textColor
|
||||
),
|
||||
)
|
||||
if (!appConfigProvider.hideServerAddress) ...[
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
"${server.connectionMethod}://${server.domain}${server.path ?? ""}${server.port != null ? ':${server.port}' : ""}",
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Theme.of(context).listTileTheme.textColor
|
||||
),
|
||||
)
|
||||
]
|
||||
],
|
||||
if (serversProvider.selectedServer == null) Text(
|
||||
AppLocalizations.of(context)!.noServerSelected,
|
||||
|
|
|
@ -159,6 +159,28 @@ class _GeneralSettingsState extends State<GeneralSettings> {
|
|||
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),
|
||||
CustomListTile(
|
||||
icon: Icons.timer_rounded,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue