Adds the "diagnose" command to the about page.

This commit is contained in:
Dain Nilsson 2021-11-25 11:56:25 +01:00
parent ad6c9ce76b
commit f69d22a9a8
No known key found for this signature in database
GPG Key ID: F04367096FBA95E8

View File

@ -3,7 +3,8 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:logging/logging.dart';
import 'package:yubico_authenticator/core/state.dart';
import 'core/state.dart';
final log = Logger('about');
@ -49,6 +50,21 @@ class AboutPage extends ConsumerWidget {
),
],
),
TextButton(
onPressed: () async {
log.info('Running diagnostics...');
final response =
await ref.read(rpcProvider).command('diagnose', []);
log.info('Response', response['diagnostics']);
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Diagnostics done. See log for results...'),
duration: Duration(seconds: 2),
),
);
},
child: const Text('Run diagnostics...'),
),
],
),
),