mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-05-22 01:34:25 +00:00
Added option to allow and disallow client
This commit is contained in:
parent
806e74ca9f
commit
5fdeaa80b7
3 changed files with 75 additions and 2 deletions
|
@ -784,5 +784,12 @@
|
||||||
"blockThisClientOnly": "Block for this client only",
|
"blockThisClientOnly": "Block for this client only",
|
||||||
"unblockThisClientOnly": "Unblock for this client only",
|
"unblockThisClientOnly": "Unblock for this client only",
|
||||||
"domainBlockedThisClient": "{domain} blocked for this client",
|
"domainBlockedThisClient": "{domain} blocked for this client",
|
||||||
"domainUnblockedThisClient": "{domain} unblocked for this client"
|
"domainUnblockedThisClient": "{domain} unblocked for this client",
|
||||||
|
"disallowThisClient": "Disallow this client",
|
||||||
|
"allowThisClient": "Allow this client",
|
||||||
|
"clientAllowedSuccessfully": "Client allowed successfully",
|
||||||
|
"clientDisallowedSuccessfully": "Client disallowed successfully",
|
||||||
|
"changesNotSaved": "Changes could not be saved",
|
||||||
|
"allowingClient": "Allowing client...",
|
||||||
|
"disallowingClient": "Disallowing client..."
|
||||||
}
|
}
|
|
@ -784,5 +784,12 @@
|
||||||
"blockThisClientOnly": "Bloquear sólo para este cliente",
|
"blockThisClientOnly": "Bloquear sólo para este cliente",
|
||||||
"unblockThisClientOnly": "Desbloquear sólo para este cliente",
|
"unblockThisClientOnly": "Desbloquear sólo para este cliente",
|
||||||
"domainBlockedThisClient": "{domain} bloqueado para este cliente",
|
"domainBlockedThisClient": "{domain} bloqueado para este cliente",
|
||||||
"domainUnblockedThisClient": "{domain} desbloqueado para este cliente"
|
"domainUnblockedThisClient": "{domain} desbloqueado para este cliente",
|
||||||
|
"disallowThisClient": "No permitir este cliente",
|
||||||
|
"allowThisClient": "Permitir este cliente",
|
||||||
|
"clientAllowedSuccessfully": "Cliente permitido correctamente",
|
||||||
|
"clientDisallowedSuccessfully": "Cliente no permitido correctamente",
|
||||||
|
"changesNotSaved": "Los cambios no han podido ser guardados",
|
||||||
|
"allowingClient": "Permitiendo cliente...",
|
||||||
|
"disallowingClient": "No permitiendo cliente..."
|
||||||
}
|
}
|
|
@ -180,6 +180,47 @@ class LogTile extends StatelessWidget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void allowDisallowClient() async {
|
||||||
|
ProcessModal processModal = ProcessModal();
|
||||||
|
processModal.open(
|
||||||
|
log.clientInfo!.disallowed == true
|
||||||
|
? AppLocalizations.of(context)!.allowingClient
|
||||||
|
: AppLocalizations.of(context)!.disallowingClient
|
||||||
|
);
|
||||||
|
|
||||||
|
final result = await clientsProvider.addClientList(
|
||||||
|
log.client,
|
||||||
|
log.clientInfo!.disallowed == true
|
||||||
|
? AccessSettingsList.allowed
|
||||||
|
: AccessSettingsList.disallowed
|
||||||
|
);
|
||||||
|
|
||||||
|
processModal.close();
|
||||||
|
|
||||||
|
if (!context.mounted) return;
|
||||||
|
if (result.successful == true) {
|
||||||
|
showSnacbkar(
|
||||||
|
appConfigProvider: appConfigProvider,
|
||||||
|
label: AppLocalizations.of(context)!.clientAddedSuccessfully,
|
||||||
|
color: Colors.green
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if (result.successful == false && result.content == 'client_another_list') {
|
||||||
|
showSnacbkar(
|
||||||
|
appConfigProvider: appConfigProvider,
|
||||||
|
label: AppLocalizations.of(context)!.clientAnotherList,
|
||||||
|
color: Colors.red
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
showSnacbkar(
|
||||||
|
appConfigProvider: appConfigProvider,
|
||||||
|
label: AppLocalizations.of(context)!.changesNotSaved,
|
||||||
|
color: Colors.red
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void openAddClient() {
|
void openAddClient() {
|
||||||
Future.delayed(
|
Future.delayed(
|
||||||
const Duration(milliseconds: 0),
|
const Duration(milliseconds: 0),
|
||||||
|
@ -229,6 +270,15 @@ class LogTile extends StatelessWidget {
|
||||||
icon: Icons.add_rounded,
|
icon: Icons.add_rounded,
|
||||||
action: openAddClient
|
action: openAddClient
|
||||||
),
|
),
|
||||||
|
MenuOption(
|
||||||
|
title: log.clientInfo!.disallowed == true
|
||||||
|
? AppLocalizations.of(context)!.allowThisClient
|
||||||
|
: AppLocalizations.of(context)!.disallowThisClient,
|
||||||
|
icon: log.clientInfo!.disallowed == true
|
||||||
|
? Icons.check_rounded
|
||||||
|
: Icons.block_rounded,
|
||||||
|
action: allowDisallowClient
|
||||||
|
),
|
||||||
if (log.question.name != null) MenuOption(
|
if (log.question.name != null) MenuOption(
|
||||||
title: AppLocalizations.of(context)!.copyClipboard,
|
title: AppLocalizations.of(context)!.copyClipboard,
|
||||||
icon: Icons.copy_rounded,
|
icon: Icons.copy_rounded,
|
||||||
|
@ -421,6 +471,15 @@ class LogTile extends StatelessWidget {
|
||||||
icon: Icons.add_rounded,
|
icon: Icons.add_rounded,
|
||||||
action: openAddClient
|
action: openAddClient
|
||||||
),
|
),
|
||||||
|
MenuOption(
|
||||||
|
title: log.clientInfo!.disallowed == true
|
||||||
|
? AppLocalizations.of(context)!.allowThisClient
|
||||||
|
: AppLocalizations.of(context)!.disallowThisClient,
|
||||||
|
icon: log.clientInfo!.disallowed == true
|
||||||
|
? Icons.check_rounded
|
||||||
|
: Icons.block_rounded,
|
||||||
|
action: allowDisallowClient
|
||||||
|
),
|
||||||
if (log.question.name != null) MenuOption(
|
if (log.question.name != null) MenuOption(
|
||||||
title: AppLocalizations.of(context)!.copyClipboard,
|
title: AppLocalizations.of(context)!.copyClipboard,
|
||||||
icon: Icons.copy_rounded,
|
icon: Icons.copy_rounded,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue