Created
March 8, 2022 11:54
-
-
Save Mirkoddd/5cefe4f66206120b72a26ee24559db81 to your computer and use it in GitHub Desktop.
This file contains 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
private boolean hasAttribute(String input, int index) { | |
if (input == null) return false; | |
return input.length() >= index && input.charAt(index-1) == '1'; | |
} | |
private boolean hasConsentFor(List<Integer> indexes, String purposeConsent, boolean hasVendorConsent) { | |
for (Integer p: indexes) { | |
if (!hasAttribute(purposeConsent, p)) { | |
Log.e(TAG, "hasConsentFor: denied for purpose #" + p ); | |
return false; | |
} | |
} | |
return hasVendorConsent; | |
} | |
private boolean hasConsentOrLegitimateInterestFor(List<Integer> indexes, String purposeConsent, String purposeLI, boolean hasVendorConsent, boolean hasVendorLI){ | |
for (Integer p: indexes) { | |
boolean purposeAndVendorLI = hasAttribute(purposeLI, p) && hasVendorLI; | |
boolean purposeConsentAndVendorConsent = hasAttribute(purposeConsent, p) && hasVendorConsent; | |
boolean isOk = purposeAndVendorLI || purposeConsentAndVendorConsent; | |
if (!isOk){ | |
Log.e(TAG, "hasConsentOrLegitimateInterestFor: denied for #" + p); | |
return false; | |
} | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment