mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-22 08:22:16 +03:00
Default to home when section is not enabled
This commit is contained in:
parent
bb00b2c65e
commit
f38e5a5f46
@ -27,16 +27,13 @@ import '../../fido/views/passkeys_screen.dart';
|
||||
import '../../fido/views/webauthn_page.dart';
|
||||
import '../../home/views/home_message_page.dart';
|
||||
import '../../home/views/home_screen.dart';
|
||||
import '../../management/views/management_screen.dart';
|
||||
import '../../oath/views/oath_screen.dart';
|
||||
import '../../oath/views/utils.dart';
|
||||
import '../../otp/views/otp_screen.dart';
|
||||
import '../../piv/views/piv_screen.dart';
|
||||
import '../message.dart';
|
||||
import '../models.dart';
|
||||
import '../state.dart';
|
||||
import 'device_error_screen.dart';
|
||||
import 'message_page.dart';
|
||||
|
||||
class MainPage extends ConsumerWidget {
|
||||
const MainPage({super.key});
|
||||
@ -131,41 +128,6 @@ class MainPage extends ConsumerWidget {
|
||||
return ref.watch(currentDeviceDataProvider).when(
|
||||
data: (data) {
|
||||
final section = ref.watch(currentSectionProvider);
|
||||
final capabilities = section.capabilities;
|
||||
if (section.getAvailability(data) == Availability.unsupported) {
|
||||
return MessagePage(
|
||||
title: section.getDisplayName(l10n),
|
||||
capabilities: capabilities,
|
||||
header: l10n.s_app_not_supported,
|
||||
message: l10n.l_app_not_supported_on_yk(capabilities
|
||||
.map((c) => c.getDisplayName(l10n))
|
||||
.join(',')),
|
||||
);
|
||||
} else if (section.getAvailability(data) !=
|
||||
Availability.enabled) {
|
||||
return MessagePage(
|
||||
title: section.getDisplayName(l10n),
|
||||
capabilities: capabilities,
|
||||
header: l10n.s_app_disabled,
|
||||
message: l10n.l_app_disabled_desc(capabilities
|
||||
.map((c) => c.getDisplayName(l10n))
|
||||
.join(',')),
|
||||
actionsBuilder: (context, expanded) => [
|
||||
ActionChip(
|
||||
label: Text(data.info.version.major > 4
|
||||
? l10n.s_toggle_applications
|
||||
: l10n.s_toggle_interfaces),
|
||||
onPressed: () async {
|
||||
await showBlurDialog(
|
||||
context: context,
|
||||
builder: (context) => ManagementScreen(data),
|
||||
);
|
||||
},
|
||||
avatar: const Icon(Symbols.construction),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
return switch (section) {
|
||||
Section.home => HomeScreen(data),
|
||||
|
@ -261,15 +261,10 @@ class DesktopCurrentSectionNotifier extends CurrentSectionNotifier {
|
||||
state.getAvailability(data) != Availability.enabled) {
|
||||
state = Section.passkeys;
|
||||
}
|
||||
if (state.getAvailability(data) != Availability.unsupported) {
|
||||
// Keep current app
|
||||
return;
|
||||
if (state.getAvailability(data) != Availability.enabled) {
|
||||
// Default to home if app is not enabled
|
||||
state = Section.home;
|
||||
}
|
||||
|
||||
state = _supportedSections.firstWhere(
|
||||
(app) => app.getAvailability(data) == Availability.enabled,
|
||||
orElse: () => _supportedSections.first,
|
||||
);
|
||||
}
|
||||
|
||||
static Section _fromName(String? name, List<Section> supportedSections) =>
|
||||
|
@ -203,7 +203,6 @@
|
||||
"app": {}
|
||||
}
|
||||
},
|
||||
"s_app_disabled": "Anwendung deaktiviert",
|
||||
"l_app_disabled_desc": "Aktivieren Sie die Anwendung '{app}' auf Ihrem YubiKey für Zugriff",
|
||||
"@l_app_disabled_desc": {
|
||||
"placeholders": {
|
||||
|
@ -203,7 +203,6 @@
|
||||
"app": {}
|
||||
}
|
||||
},
|
||||
"s_app_disabled": "Application disabled",
|
||||
"l_app_disabled_desc": "Enable the '{app}' application on your YubiKey to access",
|
||||
"@l_app_disabled_desc": {
|
||||
"placeholders": {
|
||||
|
@ -203,7 +203,6 @@
|
||||
"app": {}
|
||||
}
|
||||
},
|
||||
"s_app_disabled": "Application désactivée",
|
||||
"l_app_disabled_desc": "Activez l'application {app} sur votre YubiKey pour y accéder",
|
||||
"@l_app_disabled_desc": {
|
||||
"placeholders": {
|
||||
|
@ -203,7 +203,6 @@
|
||||
"app": {}
|
||||
}
|
||||
},
|
||||
"s_app_disabled": "アプリケーションが無効です",
|
||||
"l_app_disabled_desc": "アクセスするにはYubiKeyで{app}アプリケーションを有効にしてください",
|
||||
"@l_app_disabled_desc": {
|
||||
"placeholders": {
|
||||
|
@ -203,7 +203,6 @@
|
||||
"app": {}
|
||||
}
|
||||
},
|
||||
"s_app_disabled": "Aplikacja została wyłączona",
|
||||
"l_app_disabled_desc": "Włącz aplikację '{app}' w kluczu YubiKey, aby uzyskać do niej dostęp",
|
||||
"@l_app_disabled_desc": {
|
||||
"placeholders": {
|
||||
|
@ -203,7 +203,6 @@
|
||||
"app": {}
|
||||
}
|
||||
},
|
||||
"s_app_disabled": "Ứng dụng đã bị tắt",
|
||||
"l_app_disabled_desc": "Bật ứng dụng '{app}' trên YubiKey của bạn để truy cập",
|
||||
"@l_app_disabled_desc": {
|
||||
"placeholders": {
|
||||
|
Loading…
Reference in New Issue
Block a user