android-branch-deep-linking-attribution icon indicating copy to clipboard operation
android-branch-deep-linking-attribution copied to clipboard

[SDK-2325] Added callback to disableTracking()

Open nsingh-branch opened this issue 5 months ago • 1 comments

Reference

SDK-2325 -- Add callback to disableTracking()

Description

This change adds a new callback to the disabledTracking() method that returns the new tracking state, the referring params, and an error. If tracking is disabled, only the tracking state will be returned. If tracking is enabled, it will also return the referringParams and any potential errors from the Branch session initialization.

This change is useful for delayed initialization situations where tracking is initially disabled and the re-enabling of tracking is the first Branch initialization call.

Testing Instructions

Call the disableTracking() method without and with the callback and observe that all of the returned variables are correct.

//Example code with callback
Branch.getInstance().disableTracking(true, new Branch.TrackingStateCallback() {
    @Override
    public void onTrackingStateChanged(boolean trackingDisabled, JSONObject referringParams, BranchError error) {
        if (trackingDisabled) {
            Log.d("BranchSDK", "Tracking is now disabled.");
        } else {
            Log.d("BranchSDK", "Tracking is now enabled. Referring params: " + referringParams);
        }
    }
});

Risk Assessment [LOW]

  • [x] I, the PR creator, have tested — integration, unit, or otherwise — this code.

Reviewer Checklist (To be checked off by the reviewer only)

  • [ ] JIRA Ticket is referenced in PR title.
  • Correctness & Style
    • [ ] Conforms to AOSP Style Guides
    • [ ] Mission critical pieces are documented in code and out of code as needed.
  • [ ] Unit Tests reviewed and test issue sufficiently.
  • [ ] Functionality was reviewed in QA independently by another engineer on the team.

cc @BranchMetrics/saas-sdk-devs for visibility.

nsingh-branch avatar Mar 21 '24 23:03 nsingh-branch

Codecov Report

Attention: Patch coverage is 45.00000% with 11 lines in your changes are missing coverage. Please review.

Project coverage is 38.03%. Comparing base (1b6bb47) to head (ac98a07). Report is 2 commits behind head on master.

Files Patch % Lines
...in/java/io/branch/referral/TrackingController.java 33.33% 7 Missing and 3 partials :warning:
...h-SDK/src/main/java/io/branch/referral/Branch.java 80.00% 1 Missing :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1180      +/-   ##
============================================
- Coverage     38.11%   38.03%   -0.08%     
+ Complexity      689      687       -2     
============================================
  Files            59       59              
  Lines          6279     6289      +10     
  Branches        939      941       +2     
============================================
- Hits           2393     2392       -1     
- Misses         3443     3449       +6     
- Partials        443      448       +5     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Mar 21 '24 23:03 codecov[bot]