Created
July 2, 2018 09:31
-
-
Save bearprada/73c91181cdeab93675d06331a42b465f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun showGDPRConsentDialog() { | |
InMobiSdk.updateGDPRConsent(getGDPRJson(false)) | |
// Launch GDPR concent dialog | |
} | |
fun clickAgreeButton() { | |
InMobiSdk.updateGDPRConsent(getGDPRJson(true)) | |
} | |
fun clickDisagreeButton() { | |
InMobiSdk.updateGDPRConsent(getGDPRJson(false)) | |
} | |
fun getGDPRJson(agree: Boolean): JSONObject { | |
val isEUContries = GDPRLocaleUtil.isEUCountry(Locale.getDefault().country) | |
return JSONObject() | |
.put("gdpr", isEUContries.int() ) | |
.put("gdpr_consent_available", agree.string()) | |
} | |
fun Boolean.string(): String { | |
return if (this) "true" else "false" | |
} | |
fun Boolean.int(): Int { | |
return if (this) 1 else 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment