Skip to content

Commit

Permalink
RCF-226: Changed consent screen fetch logic (#198)
Browse files Browse the repository at this point in the history
Signed-off-by: Himaja Dhanyamraju <[email protected]>
  • Loading branch information
HimajaDhanyamraju2 authored Nov 6, 2023
1 parent 4b5e520 commit 269438a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ GlobalParamRepository provideGlobalParamRepository(GlobalParamDao globalParamDao

@Provides
@Singleton
IdentitySchemaRepository provideIdentitySchemaRepository(GlobalParamRepository globalParamRepository, IdentitySchemaDao identitySchemaDao) {
return new IdentitySchemaRepository(globalParamRepository, identitySchemaDao);
IdentitySchemaRepository provideIdentitySchemaRepository(TemplateRepository templateRepository, GlobalParamRepository globalParamRepository, IdentitySchemaDao identitySchemaDao) {
return new IdentitySchemaRepository(templateRepository, globalParamRepository, identitySchemaDao);
}

@Provides
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class RegistrationConstants {
public static final String SERVER_VERSION = "mosip.registration.server_version";
public static final String PRIMARY_LANGUAGE = "mosip.primary-language";
public static final String SECONDARY_LANGUAGE = "mosip.secondary-language";
public static final String CONSENT_SCREEN_CONTENT = "mosip.registration.consent-screen-content";
public static final String CONSENT_SCREEN_TEMPLATE_NAME = "mosip.registration.consent-screen-template-name";
public static final String INDIVIDUAL_BIOMETRICS_ID = "mosip.registration.individual-biometrics-id";
public static final String INTRODUCER_BIOMETRICS_ID = "mosip.registration.introducer-biometrics-id";
public static final String INFANT_AGEGROUP_NAME = "mosip.registration.infant-agegroup-name";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ public class IdentitySchemaRepository {

private IdentitySchemaDao identitySchemaDao;
private GlobalParamRepository globalParamRepository;
private TemplateRepository templateRepository;

public IdentitySchemaRepository(GlobalParamRepository globalParamRepository, IdentitySchemaDao identitySchemaDao) {
public IdentitySchemaRepository(TemplateRepository templateRepository, GlobalParamRepository globalParamRepository, IdentitySchemaDao identitySchemaDao) {
this.templateRepository = templateRepository;
this.globalParamRepository = globalParamRepository;
this.identitySchemaDao = identitySchemaDao;
}
Expand Down Expand Up @@ -234,7 +236,8 @@ private IdSchemaResponse migrate115UiSpecToLTSProcessSpec(IdSchemaResponse idSch
List<FieldSpecDto> consentFields = new ArrayList<>();
try {
ObjectMapper objectMapper = new ObjectMapper();
JsonNode jsonArray = objectMapper.readTree(this.globalParamRepository.getCachedStringGlobalParam(RegistrationConstants.CONSENT_SCREEN_CONTENT));
String consentScreenTemplateName = this.globalParamRepository.getCachedStringGlobalParam(RegistrationConstants.CONSENT_SCREEN_TEMPLATE_NAME);
JsonNode jsonArray = objectMapper.readTree(templateRepository.getTemplate(consentScreenTemplateName, primaryLanguage));
for (JsonNode element : jsonArray) {
FieldSpecDto field = objectMapper.treeToValue(element, FieldSpecDto.class);
consentFields.add(field);
Expand Down

0 comments on commit 269438a

Please sign in to comment.