From 201b1a873a252bdfffe0764a2f282a6909e1b912 Mon Sep 17 00:00:00 2001 From: Bibash Shrestha Date: Tue, 5 Nov 2024 14:09:15 +0545 Subject: [PATCH] refactor: Choose first display if locale is not provided #3006 --- lib/app/shared/helper_functions/get_display.dart | 6 +++++- lib/app/shared/helper_functions/helper_functions.dart | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/app/shared/helper_functions/get_display.dart b/lib/app/shared/helper_functions/get_display.dart index 44600ad64..360e1dc6b 100644 --- a/lib/app/shared/helper_functions/get_display.dart +++ b/lib/app/shared/helper_functions/get_display.dart @@ -21,7 +21,11 @@ dynamic getDisplay(dynamic value, String languageCode) { orElse: () => displays.firstWhere( (element) => element is Map && element.containsKey('locale'), - orElse: () => null, + orElse: () => displays.firstWhere( + (element) => + element is Map, // if local is not provided + orElse: () => null, + ), ), ), ); diff --git a/lib/app/shared/helper_functions/helper_functions.dart b/lib/app/shared/helper_functions/helper_functions.dart index e37091348..460d09627 100644 --- a/lib/app/shared/helper_functions/helper_functions.dart +++ b/lib/app/shared/helper_functions/helper_functions.dart @@ -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) {