Skip to content

Commit

Permalink
fix: Display image correctly for default vc #3004
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Oct 30, 2024
1 parent 795726d commit a8494e1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/app/shared/helper_functions/helper_functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1738,6 +1738,7 @@ Future<(String?, String?, String?, String?, String?)> getClientDetails({
}) {
Display? display;
dynamic credentialSupported;

if (openIdConfiguration.credentialsSupported != null) {
final credentialsSupported = openIdConfiguration.credentialsSupported!;
final CredentialsSupported? credSupported =
Expand Down Expand Up @@ -1803,6 +1804,20 @@ Future<(String?, String?, String?, String?, String?)> getClientDetails({
}
}
}

if (display == null && openIdConfiguration.display != null) {
final displays = openIdConfiguration.display!;

display = displays.firstWhereOrNull(
(Display display) => display.locale.toString().contains(languageCode),
) ??
displays.firstWhereOrNull(
(Display display) => display.locale.toString().contains('en'),
) ??
displays.firstWhereOrNull(
(Display display) => display.locale != null,
);
}
return (display, credentialSupported);
}

Expand Down
3 changes: 3 additions & 0 deletions packages/oidc4vc/lib/src/models/openid_configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class OpenIdConfiguration extends Equatable {
this.credentialEndpoint,
this.pushedAuthorizationRequestEndpoint,
this.credentialIssuer,
this.display,
this.subjectSyntaxTypesSupported,
this.tokenEndpoint,
this.batchEndpoint,
Expand All @@ -40,6 +41,7 @@ class OpenIdConfiguration extends Equatable {
final String? credentialEndpoint;
@JsonKey(name: 'credential_issuer')
final String? credentialIssuer;
final List<Display>? display;
@JsonKey(name: 'subject_syntax_types_supported')
final List<dynamic>? subjectSyntaxTypesSupported;
@JsonKey(name: 'token_endpoint')
Expand Down Expand Up @@ -80,6 +82,7 @@ class OpenIdConfiguration extends Equatable {
authorizationServers,
credentialEndpoint,
credentialIssuer,
display,
subjectSyntaxTypesSupported,
tokenEndpoint,
batchEndpoint,
Expand Down

0 comments on commit a8494e1

Please sign in to comment.