mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-23 00:57:26 +03:00
Merge PR #209
This commit is contained in:
commit
05d01bb99b
@ -3,6 +3,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
@ -47,9 +48,9 @@ class AboutPage extends ConsumerWidget {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextButton(
|
||||
child: const Text(
|
||||
'Terms of use',
|
||||
style: TextStyle(decoration: TextDecoration.underline),
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.general_terms_of_use,
|
||||
style: const TextStyle(decoration: TextDecoration.underline),
|
||||
),
|
||||
onPressed: () {
|
||||
launchUrl(
|
||||
@ -60,9 +61,9 @@ class AboutPage extends ConsumerWidget {
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: const Text(
|
||||
'Privacy policy',
|
||||
style: TextStyle(decoration: TextDecoration.underline),
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.general_privacy_policy,
|
||||
style: const TextStyle(decoration: TextDecoration.underline),
|
||||
),
|
||||
onPressed: () {
|
||||
launchUrl(
|
||||
@ -75,9 +76,9 @@ class AboutPage extends ConsumerWidget {
|
||||
],
|
||||
),
|
||||
TextButton(
|
||||
child: const Text(
|
||||
'Open source licenses',
|
||||
style: TextStyle(decoration: TextDecoration.underline),
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.general_open_src_licenses,
|
||||
style: const TextStyle(decoration: TextDecoration.underline),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).push(MaterialPageRoute<void>(
|
||||
@ -95,7 +96,7 @@ class AboutPage extends ConsumerWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
child: Text(
|
||||
'Help and feedback',
|
||||
AppLocalizations.of(context)!.general_help_and_feedback,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
@ -103,9 +104,9 @@ class AboutPage extends ConsumerWidget {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextButton(
|
||||
child: const Text(
|
||||
'Send us feedback',
|
||||
style: TextStyle(decoration: TextDecoration.underline),
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.general_send_feedback,
|
||||
style: const TextStyle(decoration: TextDecoration.underline),
|
||||
),
|
||||
onPressed: () {
|
||||
launchUrl(
|
||||
@ -115,9 +116,9 @@ class AboutPage extends ConsumerWidget {
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: const Text(
|
||||
'I need help',
|
||||
style: TextStyle(decoration: TextDecoration.underline),
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.general_i_need_help,
|
||||
style: const TextStyle(decoration: TextDecoration.underline),
|
||||
),
|
||||
onPressed: () {
|
||||
launchUrl(
|
||||
@ -135,7 +136,7 @@ class AboutPage extends ConsumerWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
child: Text(
|
||||
'Troubleshooting',
|
||||
AppLocalizations.of(context)!.general_troubleshooting,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
@ -144,7 +145,8 @@ class AboutPage extends ConsumerWidget {
|
||||
const SizedBox(height: 12.0),
|
||||
ActionChip(
|
||||
avatar: const Icon(Icons.bug_report_outlined),
|
||||
label: const Text('Run diagnostics'),
|
||||
label:
|
||||
Text(AppLocalizations.of(context)!.general_run_diagnostics),
|
||||
onPressed: () async {
|
||||
_log.info('Running diagnostics...');
|
||||
final response =
|
||||
@ -158,7 +160,10 @@ class AboutPage extends ConsumerWidget {
|
||||
await Clipboard.setData(ClipboardData(text: text));
|
||||
await ref.read(withContextProvider)(
|
||||
(context) async {
|
||||
showMessage(context, 'Diagnostic data copied to clipboard');
|
||||
showMessage(
|
||||
context,
|
||||
AppLocalizations.of(context)!
|
||||
.general_diagnostics_copied);
|
||||
},
|
||||
);
|
||||
},
|
||||
@ -190,25 +195,27 @@ class LoggingPanel extends ConsumerWidget {
|
||||
items: Levels.LEVELS,
|
||||
selected: logLevel != Level.INFO,
|
||||
labelBuilder: (value) => Text(
|
||||
'Log level: ${value.name[0]}${value.name.substring(1).toLowerCase()}'),
|
||||
'${AppLocalizations.of(context)!.general_log_level}: ${value.name[0]}${value.name.substring(1).toLowerCase()}'),
|
||||
itemBuilder: (value) =>
|
||||
Text('${value.name[0]}${value.name.substring(1).toLowerCase()}'),
|
||||
onChanged: (level) {
|
||||
ref.read(logLevelProvider.notifier).setLogLevel(level);
|
||||
_log.debug('Log level set to $level');
|
||||
showMessage(context, 'Log level set to $level');
|
||||
showMessage(context,
|
||||
'${AppLocalizations.of(context)!.general_log_level_set_to} $level');
|
||||
},
|
||||
),
|
||||
ActionChip(
|
||||
avatar: const Icon(Icons.copy),
|
||||
label: const Text('Copy log'),
|
||||
label: Text(AppLocalizations.of(context)!.general_copy_log),
|
||||
onPressed: () async {
|
||||
_log.info('Copying log to clipboard ($version)...');
|
||||
final logs = await ref.read(logLevelProvider.notifier).getLogs();
|
||||
await Clipboard.setData(ClipboardData(text: logs.join('\n')));
|
||||
await ref.read(withContextProvider)(
|
||||
(context) async {
|
||||
showMessage(context, 'Log copied to clipboard');
|
||||
showMessage(
|
||||
context, AppLocalizations.of(context)!.general_log_copied);
|
||||
},
|
||||
);
|
||||
},
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
class ErrorPage extends StatelessWidget {
|
||||
final String error;
|
||||
@ -8,7 +9,7 @@ class ErrorPage extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Application error'),
|
||||
title: Text(AppLocalizations.of(context)!.general_application_error),
|
||||
),
|
||||
body: Center(
|
||||
child: Column(
|
||||
|
@ -70,6 +70,34 @@
|
||||
"oath_reset": "Reset",
|
||||
"oath_warning_will_delete_accounts": "Warning! This will irrevocably delete all OATH TOTP/HOTP accounts from your YubiKey.",
|
||||
"oath_warning_disable_these_creds": "Your OATH credentials, as well as any password set, will be removed from this YubiKey. Make sure to first disable these from their respective web sites to avoid being locked out of your accounts.",
|
||||
|
||||
"widgets_cancel": "Cancel",
|
||||
"widgets_close": "Close",
|
||||
|
||||
"mgmt_min_one_interface": "At least one interface must be enabled",
|
||||
"mgmt_reconfiguring_yubikey": "Reconfiguring YubiKey...",
|
||||
"mgmt_configuration_updated": "Configuration updated",
|
||||
"mgmt_configuration_updated_remove_reinsert": "Configuration updated, remove and reinsert your YubiKey",
|
||||
"mgmt_toggle_applications": "Toggle applications",
|
||||
"mgmt_save": "Save",
|
||||
|
||||
"general_terms_of_use": "Terms of use",
|
||||
"general_privacy_policy": "Privacy policy",
|
||||
"general_open_src_licenses": "Open source licenses",
|
||||
"general_help_and_feedback": "Help and feedback",
|
||||
"general_send_feedback": "Send us feedback",
|
||||
"general_i_need_help": "I need help",
|
||||
"general_application_error": "Application error",
|
||||
"general_troubleshooting": "Troubleshooting",
|
||||
"general_run_diagnostics": "Run diagnostics",
|
||||
"general_diagnostics_copied": "Diagnostic data copied to clipboard",
|
||||
"general_log_level": "Log level",
|
||||
"general_log_level_set_to": "Log level set to",
|
||||
"general_copy_log": "Copy log",
|
||||
"general_log_copied": "Log copied to clipboard",
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
|
||||
@ -59,7 +60,9 @@ class _ModeForm extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
),
|
||||
Text(interfaces == 0 ? 'At least one interface must be enabled' : ''),
|
||||
Text(interfaces == 0
|
||||
? AppLocalizations.of(context)!.mgmt_min_one_interface
|
||||
: ''),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -177,7 +180,7 @@ class _ManagementScreenState extends ConsumerState<ManagementScreen> {
|
||||
// This will take longer, show a message
|
||||
close = showMessage(
|
||||
context,
|
||||
'Reconfiguring YubiKey...',
|
||||
AppLocalizations.of(context)!.mgmt_reconfiguring_yubikey,
|
||||
duration: const Duration(seconds: 8),
|
||||
);
|
||||
}
|
||||
@ -190,7 +193,8 @@ class _ManagementScreenState extends ConsumerState<ManagementScreen> {
|
||||
);
|
||||
if (!mounted) return;
|
||||
if (!reboot) Navigator.pop(context);
|
||||
showMessage(context, 'Configuration updated');
|
||||
showMessage(
|
||||
context, AppLocalizations.of(context)!.mgmt_configuration_updated);
|
||||
} finally {
|
||||
close?.call();
|
||||
}
|
||||
@ -214,9 +218,10 @@ class _ManagementScreenState extends ConsumerState<ManagementScreen> {
|
||||
showMessage(
|
||||
context,
|
||||
widget.deviceData.node.maybeMap(
|
||||
nfcReader: (_) => 'Configuration updated',
|
||||
orElse: () =>
|
||||
'Configuration updated, remove and reinsert your YubiKey'));
|
||||
nfcReader: (_) =>
|
||||
AppLocalizations.of(context)!.mgmt_configuration_updated,
|
||||
orElse: () => AppLocalizations.of(context)!
|
||||
.mgmt_configuration_updated_remove_reinsert));
|
||||
Navigator.pop(context);
|
||||
}
|
||||
|
||||
@ -272,11 +277,11 @@ class _ManagementScreenState extends ConsumerState<ManagementScreen> {
|
||||
);
|
||||
|
||||
return ResponsiveDialog(
|
||||
title: const Text('Toggle applications'),
|
||||
title: Text(AppLocalizations.of(context)!.mgmt_toggle_applications),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: canSave ? _submitForm : null,
|
||||
child: const Text('Save'),
|
||||
child: Text(AppLocalizations.of(context)!.mgmt_save),
|
||||
),
|
||||
],
|
||||
child: child,
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
class ResponsiveDialog extends StatefulWidget {
|
||||
final Widget? title;
|
||||
@ -44,8 +45,8 @@ class _ResponsiveDialogState extends State<ResponsiveDialog> {
|
||||
} else {
|
||||
// Dialog
|
||||
final cancelText = widget.onCancel == null && widget.actions.isEmpty
|
||||
? 'Close'
|
||||
: 'Cancel';
|
||||
? AppLocalizations.of(context)!.widgets_close
|
||||
: AppLocalizations.of(context)!.widgets_cancel;
|
||||
return AlertDialog(
|
||||
title: widget.title,
|
||||
scrollable: true,
|
||||
|
Loading…
Reference in New Issue
Block a user