Skip to content

Instantly share code, notes, and snippets.

@bearprada
Created July 2, 2018 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bearprada/73c91181cdeab93675d06331a42b465f to your computer and use it in GitHub Desktop.
Save bearprada/73c91181cdeab93675d06331a42b465f to your computer and use it in GitHub Desktop.
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