-
Notifications
You must be signed in to change notification settings - Fork 159
[SDK-2459] Implement Consumer Protection Preferences #1206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Automation is faling |
Branch-SDK-Automation-TestBed/src/main/java/io/branch/branchandroiddemo/BranchWrapper.java
Outdated
Show resolved
Hide resolved
|
Please reopen when ready. |
Branch-SDK-Automation-TestBed/src/main/java/io/branch/branchandroiddemo/BranchWrapper.java
Outdated
Show resolved
Hide resolved
| * ({@code false}). | ||
| * @deprecated Use {@link #setConsumerProtectionAttributionLevel(Defines.BranchAttributionLevel)} instead. | ||
| */ | ||
| public void disableTracking(boolean disableTracking) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you test this with the delayed init plus disable tracking by default?
| updateAdvertisingIdsObject(gaid); | ||
| // gaid is put in the request body below, calling to remove hardware id from request now | ||
| replaceHardwareIdOnValidAdvertisingId(); | ||
| if (prefHelper_.getConsumerProtectionAttributionLevel() == Defines.BranchAttributionLevel.FULL || !prefHelper_.isAttributionLevelInitialized()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I think it would be slightly easier to read && prefHelper_.isAttributionLevelInitialized()
I would also suggest that this logical check just be made into its own function since it's repeated several times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So i'm actually checking for either of them to be true, not both. More details in the comment below, but basically the CPP level not being set should be treated the same as it being set to full.
| utility.parseReferringURL(externalIntentUri); | ||
|
|
||
| JSONObject urlQueryParams = utility.getURLQueryParamsForRequest(this); | ||
| if (prefHelper_.getConsumerProtectionAttributionLevel() == Defines.BranchAttributionLevel.FULL || !prefHelper_.isAttributionLevelInitialized()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible for getConsumerProtectionAttributionLevel to have a value and isAttributionLevelInitialized not be true?
In other words, if prefHelper_.getConsumerProtectionAttributionLevel() == Defines.BranchAttributionLevel.FULL how can prefHelper_.isAttributionLevelInitialized() be false? Correct me if I'm wrong but it seems redundant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically we want this if statement to be true if the CPP level is FULL or if it hasn't been set, since that's treated like FULL. However, we don't want to always add the cpp_level field to requests, so i didn't just set the default for getConsumerProtectionAttributionLevel() to be FULL.
So thats why im checking for either the CPP level to be full OR for it to not be set here.
Reference
SDK-2459 -- [Android] Implement Consumer Protection Preferences
Description
Added a new method for setting the consumer protection preference, setConsumerProtectionPreference. This value can be set and changed at any time, but persists across sessions. This change also deprecated the
disableTracking()method since setting the preference toTRACKING_DISABLEDwill perform the same logic.Testing Instructions
Use the new method or the new testbed "Consumer Protection Preference" button to change the preference and observe the
protection_preferencefield change in each request.Risk Assessment [
MEDIUM]It deprecated a frequently used method and replaces it with a new one with some shared logic.
Reviewer Checklist (To be checked off by the reviewer only)
cc @BranchMetrics/saas-sdk-devs for visibility.