chore: Improved error handling for recovery key

This commit is contained in:
Krille 2024-02-01 07:56:39 +01:00
commit 2af8691536
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
2 changed files with 17 additions and 9 deletions

View file

@ -163,15 +163,16 @@ class HomeserverPickerController extends State<HomeserverPicker> {
List<IdentityProvider>? get identityProviders {
final loginTypes = _rawLoginTypes;
if (loginTypes == null) return null;
final List? rawProviders = loginTypes.tryGetList('flows')!.singleWhere(
(flow) => flow['type'] == AuthenticationTypes.sso,
)['identity_providers'] ??
[
{'id': null},
];
final list = (rawProviders as List)
.map((json) => IdentityProvider.fromJson(json))
.toList();
final List? rawProviders =
loginTypes.tryGetList('flows')?.singleWhereOrNull(
(flow) => flow['type'] == AuthenticationTypes.sso,
)['identity_providers'] ??
[
{'id': null},
];
if (rawProviders == null) return null;
final list =
rawProviders.map((json) => IdentityProvider.fromJson(json)).toList();
if (PlatformInfos.isCupertinoStyle) {
list.sort((a, b) => a.brand == 'apple' ? -1 : 1);
}