Skip to content
This repository was archived by the owner on Aug 13, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions consent-library/src/main/assets/consentform.html
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,17 @@
obj.titleAppNameEl.parentNode.insertBefore(appIconEl, obj.titleAppNameEl);
}

// Set title head intro.
var titleIntro = formInfo['title_head_intro'] || '';
if (titleIntro.length <= 0) {
formLoadCompleted('Error: invalid title head intro.');
} else {
var titleHeadIntroEl = document.getElementsByClassName('head_intro');
for (var i = 0; i < titleHeadIntroEl.length; i++) {
titleHeadIntroEl[i].innerText = titleIntro;
}
}

// Returns an onclick handler that opens a URL in a browser.
function createPolicyUrlOnClick(url) {
return function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public class ConsentForm {
private final boolean personalizedAdsOption;
private final boolean nonPersonalizedAdsOption;
private final boolean adFreeOption;
private final String titleHeadIntro;
private final URL appPrivacyPolicyURL;
private final Dialog dialog;
private final WebView webView;
Expand All @@ -73,6 +74,7 @@ private ConsentForm(Builder builder) {
this.personalizedAdsOption = builder.personalizedAdsOption;
this.nonPersonalizedAdsOption = builder.nonPersonalizedAdsOption;
this.adFreeOption = builder.adFreeOption;
this.titleHeadIntro = builder.titleHeadIntro;
this.appPrivacyPolicyURL = builder.appPrivacyPolicyURL;
this.dialog = new Dialog(context, android.R.style.Theme_Translucent_NoTitleBar);
this.loadState = LoadState.NOT_READY;
Expand Down Expand Up @@ -171,6 +173,7 @@ public static class Builder {
private boolean personalizedAdsOption;
private boolean nonPersonalizedAdsOption;
private boolean adFreeOption;
private String titleHeadIntro = "";
private final URL appPrivacyPolicyURL;

public Builder(Context context, URL appPrivacyPolicyURL) {
Expand Down Expand Up @@ -206,6 +209,11 @@ public Builder withAdFreeOption() {
return this;
}

public Builder titleHeadIntro(String titleText) {
this.titleHeadIntro = titleText;
return this;
}

public ConsentForm build() {
return new ConsentForm(this);
}
Expand Down Expand Up @@ -241,6 +249,7 @@ private void updateDialogContent(WebView webView) {
HashMap <String, Object> formInfo = new HashMap < > ();
formInfo.put("app_name", getApplicationName(context));
formInfo.put("app_icon", getAppIconURIString(context));
formInfo.put("title_head_intro", this.titleHeadIntro);
formInfo.put("offer_personalized", this.personalizedAdsOption);
formInfo.put("offer_non_personalized", this.nonPersonalizedAdsOption);
formInfo.put("offer_ad_free", this.adFreeOption);
Expand Down