mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-25 23:14:18 +03:00
add no-op management session
This commit is contained in:
parent
ee37686447
commit
095025b163
@ -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),
|
||||
];
|
||||
}
|
||||
|
46
lib/android/management/state.dart
Executable file
46
lib/android/management/state.dart
Executable 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();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user