Ejemplo n.º 1
0
        public void Show()
        {
            if (this.loadState != LoadState.LOADED)
            {
                listener.OnConsentFormError("Consent form is not ready to be displayed.");
                return;
            }

            if (ConsentInformation.GetInstance(context).IsTaggedForUnderAgeOfConsent())
            {
                listener.OnConsentFormError("Error: tagged for under age of consent");
                return;
            }

            this.dialog.Window.SetLayout(ViewGroup.LayoutParams.MatchParent,
                                         ViewGroup.LayoutParams.MatchParent);
            this.dialog.Window.SetBackgroundDrawable(new ColorDrawable(Color.Transparent));
            this.dialog.SetOnShowListener(new DialogListener(listener));
            this.dialog.Show();

            if (!this.dialog.IsShowing)
            {
                listener.OnConsentFormError("Consent form could not be displayed.");
            }
        }
Ejemplo n.º 2
0
        private void HandleDismiss(String status)
        {
            this.loadState = LoadState.NOT_READY;
            dialog.Dismiss();

            if (String.IsNullOrEmpty(status))
            {
                listener.OnConsentFormError("No information provided.");
                return;
            }

            if (status.Contains("Error"))
            {
                listener.OnConsentFormError(status);
                return;
            }

            bool          userPrefersAdFree = false;
            ConsentStatus consentStatus;

            switch (status)
            {
            case "personalized":
                consentStatus = ConsentStatus.PERSONALIZED;
                break;

            case "non_personalized":
                consentStatus = ConsentStatus.NON_PERSONALIZED;
                break;

            case "ad_free":
                userPrefersAdFree = true;
                consentStatus     = ConsentStatus.UNKNOWN;
                break;

            default:
                consentStatus = ConsentStatus.UNKNOWN;
                break;
            }

            ConsentInformation.GetInstance(context).SetConsentStatus(consentStatus, "form");
            listener.OnConsentFormClosed(consentStatus, userPrefersAdFree);
        }
Ejemplo n.º 3
0
        private void UpdateDialogContent(WebView webView)
        {
            var formInfo = new Dictionary <String, Object>();

            formInfo.Add("app_name", GetApplicationName(context));
            formInfo.Add("app_icon", GetAppIconURIString(context));
            formInfo.Add("offer_personalized", this.personalizedAdsOption);
            formInfo.Add("offer_non_personalized", this.nonPersonalizedAdsOption);
            formInfo.Add("offer_ad_free", this.adFreeOption);
            formInfo.Add("is_request_in_eea_or_unknown",
                         ConsentInformation.GetInstance(context).IsRequestLocationInEeaOrUnknown());
            formInfo.Add("app_privacy_url", this.appPrivacyPolicyURL);
            ConsentData consentData = ConsentInformation.GetInstance(context).LoadConsentData();

            formInfo.Add("plat", consentData.SdkPlatformString);
            formInfo.Add("consent_info", consentData);

            String argumentsJSON     = JsonConvert.SerializeObject(formInfo);
            String javascriptCommand = CreateJavascriptCommand("setUpConsentDialog",
                                                               argumentsJSON);

            webView.LoadUrl(javascriptCommand);
        }