2021-11-24 13:38:30 +03:00
|
|
|
import 'dart:io';
|
|
|
|
|
2021-11-19 17:05:57 +03:00
|
|
|
import 'package:flutter/material.dart';
|
2021-11-24 13:38:30 +03:00
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
import 'package:logging/logging.dart';
|
2021-11-25 13:56:25 +03:00
|
|
|
|
|
|
|
import 'core/state.dart';
|
2022-01-27 14:34:29 +03:00
|
|
|
import 'desktop/state.dart';
|
2021-11-24 13:38:30 +03:00
|
|
|
|
2022-02-21 11:38:09 +03:00
|
|
|
final _log = Logger('about');
|
2021-11-19 17:05:57 +03:00
|
|
|
|
2021-11-24 13:38:30 +03:00
|
|
|
class AboutPage extends ConsumerWidget {
|
2021-11-19 17:05:57 +03:00
|
|
|
const AboutPage({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
2021-11-24 13:38:30 +03:00
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
2021-11-19 17:05:57 +03:00
|
|
|
return Scaffold(
|
|
|
|
appBar: AppBar(
|
|
|
|
title: const Text('About Yubico Authenticator'),
|
|
|
|
),
|
|
|
|
body: Center(
|
2021-11-24 15:28:38 +03:00
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
child: Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
2022-01-27 14:34:29 +03:00
|
|
|
if (isDesktop)
|
|
|
|
Text('ykman version: ${ref.watch(rpcStateProvider).version}'),
|
2021-11-24 15:28:38 +03:00
|
|
|
Text('Dart version: ${Platform.version}'),
|
|
|
|
const SizedBox(height: 8.0),
|
2021-12-02 13:44:17 +03:00
|
|
|
const Divider(),
|
2022-01-27 14:34:29 +03:00
|
|
|
if (isDesktop)
|
|
|
|
TextButton(
|
|
|
|
onPressed: () async {
|
2022-02-21 11:38:09 +03:00
|
|
|
_log.info('Running diagnostics...');
|
2022-01-27 14:34:29 +03:00
|
|
|
final response =
|
|
|
|
await ref.read(rpcProvider).command('diagnose', []);
|
2022-02-21 11:38:09 +03:00
|
|
|
_log.info('Response', response['diagnostics']);
|
2022-01-27 14:34:29 +03:00
|
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
|
|
const SnackBar(
|
|
|
|
content:
|
|
|
|
Text('Diagnostics done. See log for results...'),
|
|
|
|
duration: Duration(seconds: 2),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
child: const Text('Run diagnostics...'),
|
|
|
|
),
|
2021-11-24 15:28:38 +03:00
|
|
|
],
|
|
|
|
),
|
2021-11-19 17:05:57 +03:00
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|