yubioath-flutter/lib/android/management/state.dart

45 lines
1.2 KiB
Dart
Raw Normal View History

2022-03-16 12:37:52 +03:00
import 'dart:async';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:yubico_authenticator/management/models.dart';
import '../../app/models.dart';
import '../../app/state.dart';
import '../../management/state.dart';
final androidManagementState = StateNotifierProvider.autoDispose
.family<ManagementStateNotifier, AsyncValue<DeviceInfo>, DevicePath>(
2022-03-16 12:37:52 +03:00
(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
2022-05-05 13:40:56 +03:00
Future<void> setMode(
{required int interfaces,
int challengeResponseTimeout = 0,
int? autoEjectTimeout}) async {}
2022-03-16 12:37:52 +03:00
@override
Future<void> writeConfig(DeviceConfig config,
{String currentLockCode = '',
String newLockCode = '',
bool reboot = false}) async {
if (reboot) {
state = const AsyncValue.loading();
2022-03-16 12:37:52 +03:00
}
_ref.read(attachedDevicesProvider.notifier).refresh();
}
}