Skip to content

Commit

Permalink
refactor: Choose first display if locale is not provided #3006
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Nov 5, 2024
1 parent 81ec55c commit 201b1a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/app/shared/helper_functions/get_display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ dynamic getDisplay(dynamic value, String languageCode) {
orElse: () => displays.firstWhere(
(element) =>
element is Map<String, dynamic> && element.containsKey('locale'),
orElse: () => null,
orElse: () => displays.firstWhere(
(element) =>
element is Map<String, dynamic>, // if local is not provided
orElse: () => null,
),
),
),
);
Expand Down
3 changes: 2 additions & 1 deletion lib/app/shared/helper_functions/helper_functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1755,7 +1755,8 @@ Future<(String?, String?, String?, String?, String?)> getClientDetails({
) ??
credSupportedDisplay.firstWhereOrNull(
(Display display) => display.locale != null,
);
) ??
credSupportedDisplay.first; // if local is not provided
}
}
} else if (openIdConfiguration.credentialConfigurationsSupported != null) {
Expand Down

0 comments on commit 201b1a8

Please sign in to comment.