Skip to content
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

[SDK-2325] Added callback to disableTracking() #1180

Merged
merged 3 commits into from
Mar 29, 2024
Merged

Conversation

nsingh-branch
Copy link
Contributor

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]

  • 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.

Copy link

codecov bot commented Mar 21, 2024

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 ⚠️
...h-SDK/src/main/java/io/branch/referral/Branch.java 80.00% 1 Missing ⚠️
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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nsingh-branch nsingh-branch merged commit 038d103 into master Mar 29, 2024
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants