Skip to content

Commit

Permalink
Added callback exposure
Browse files Browse the repository at this point in the history
  • Loading branch information
nsingh-branch committed Nov 11, 2024
1 parent e4aaad5 commit 4182e19
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions Branch-SDK/src/main/java/io/branch/referral/Branch.java
Original file line number Diff line number Diff line change
Expand Up @@ -2592,21 +2592,32 @@ public static void setFBAppID(String fbAppID) {
}

/**
* Sets the consumer protection attribution level
* Sets the consumer protection attribution level.
*
* @param level The consumer protection attribution level {@link Defines.BranchAttributionLevel}.
*/
public void setConsumerProtectionAttributionLevel(Defines.BranchAttributionLevel level) {
setConsumerProtectionAttributionLevel(level, null);
}

/**
* Sets the consumer protection attribution level with an optional callback.
*
* @param level The consumer protection attribution level {@link Defines.BranchAttributionLevel}.
* @param callback An optional {@link TrackingStateCallback} for receiving notifications about
* the change in tracking state. This parameter can be {@code null} if no callback actions are needed.
*/
public void setConsumerProtectionAttributionLevel(Defines.BranchAttributionLevel level, @Nullable TrackingStateCallback callback) {
prefHelper_.setConsumerProtectionAttributionLevel(level);
BranchLogger.v("Set Consumer Protection Preference to " + level);

if (level == Defines.BranchAttributionLevel.NONE) {
trackingController.disableTracking(context_, true, null);
trackingController.disableTracking(context_, true, callback);
} else {
if (trackingController.isTrackingDisabled()) {
trackingController.disableTracking(context_, false, null);
trackingController.disableTracking(context_, false, callback);
}
}

}

}

0 comments on commit 4182e19

Please sign in to comment.