Skip to content

Commit

Permalink
fixup! SDK-2230: Add example for share v2
Browse files Browse the repository at this point in the history
  • Loading branch information
irotech committed Aug 1, 2023
1 parent 341fbe9 commit 9f55a60
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import com.yoti.api.client.Attribute;

enum AttributeDisplayProperty {
public enum AttributeDisplayProperty {

FAMILY_NAME("family_name", "Family name", "yoti-icon-profile"),
GIVEN_NAMES("given_names", "Given names", "yoti-icon-profile"),
Expand All @@ -16,7 +16,6 @@ enum AttributeDisplayProperty {
STRUCTURED_POSTAL_ADDRESS("structured_postal_address", "Structured address", "yoti-icon-address"),
NATIONALITY("nationality", "Nationality", "yoti-icon-nationality"),
PHONE_NUMBER("phone_number", "Mobile number", "yoti-icon-phone"),
SELFIE("selfie"),
EMAIL_ADDRESS("email_address", "Email address", "yoti-icon-email"),
IDENTITY_PROFILE_REPORT("identity_profile_report", "Identity Profile Report", "yoti-icon-document", true);

Expand All @@ -25,13 +24,6 @@ enum AttributeDisplayProperty {
private final String icon;
private final boolean isJson;

AttributeDisplayProperty(String name) {
this.name = name;
label = null;
icon = null;
isJson = false;
}

AttributeDisplayProperty(String name, String label, String icon) {
this.name = name;
this.label = label;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ public class AttributeMapper {

public static DisplayAttribute mapToDisplayAttribute(Attribute<?> attribute) {
return AttributeDisplayProperty.fromAttribute(attribute)
.map(displayProperty -> !displayProperty.isJson()
? new DisplayAttribute(attribute, displayProperty)
: new DisplayAttribute(toJson(attribute), displayProperty)
.map(property -> property.isJson()
? new DisplayAttribute(toJson(attribute), property)
: new DisplayAttribute(attribute, property)
)
.orElseGet(() -> {
if (attribute.getName().contains(":")) {
Expand Down Expand Up @@ -43,8 +43,9 @@ private static DisplayAttribute handleAgeVerification(Attribute<?> attribute) {
}

private static DisplayAttribute handleProfileAttribute(Attribute<?> attribute) {
String attributeName = StringUtils.capitalize(attribute.getName());
return new DisplayAttribute(attributeName, attribute, "yoti-icon-profile");
return attribute.getName().equalsIgnoreCase("selfie")
? null
: new DisplayAttribute(StringUtils.capitalize(attribute.getName()), attribute, "yoti-icon-profile");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ <h3 class="yoti-sponsor-app-header">The Yoti app is free to download and use:</h
sdkId: '[[${sdkId}]]',
hooks: {
sessionIdResolver: onSessionIdResolver,
// completionHandler: onCompletionHandler,
errorListener: onErrorListener
}
})
Expand Down

0 comments on commit 9f55a60

Please sign in to comment.