add no-op management session

This commit is contained in:
Adam Velebil 2022-03-16 10:37:52 +01:00
parent ee37686447
commit 095025b163
No known key found for this signature in database
GPG Key ID: AC6D6B9D715FC084
2 changed files with 49 additions and 0 deletions

View File

@ -5,6 +5,8 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:logging/logging.dart';
import '../app/models.dart';
import '../management/state.dart';
import 'management/state.dart';
import 'oath/state.dart';
import 'state.dart';
import 'views/tap_request_dialog.dart';
@ -40,5 +42,6 @@ Future<List<Override>> initializeAndGetOverrides() async {
oathStateProvider.overrideWithProvider(androidOathStateProvider),
credentialListProvider.overrideWithProvider(androidCredentialListProvider),
currentAppProvider.overrideWithProvider(androidSubPageProvider),
managementStateProvider.overrideWithProvider(androidManagementState),
];
}

View File

@ -0,0 +1,46 @@
import 'dart:async';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:logging/logging.dart';
import 'package:yubico_authenticator/management/models.dart';
import '../../app/models.dart';
import '../../app/state.dart';
import '../../core/models.dart';
import '../../management/state.dart';
final _log = Logger('android.management.state');
final androidManagementState = StateNotifierProvider.autoDispose.family<
ManagementStateNotifier, ApplicationStateResult<DeviceInfo>, DevicePath>(
(ref, devicePath) {
// Make sure to rebuild if currentDevice changes (as on reboot)
ref.watch(currentDeviceProvider);
final notifier = _AndroidManagementStateNotifier(ref);
return notifier..refresh();
},
);
class _AndroidManagementStateNotifier extends ManagementStateNotifier {
final Ref _ref;
_AndroidManagementStateNotifier(this._ref) : super();
void refresh() async {}
@override
Future<void> setMode(int mode,
{int challengeResponseTimeout = 0, int autoEjectTimeout = 0}) async {}
@override
Future<void> writeConfig(DeviceConfig config,
{String currentLockCode = '',
String newLockCode = '',
bool reboot = false}) async {
if (reboot) {
unsetState();
}
_ref.read(attachedDevicesProvider.notifier).refresh();
}
}