Skip to content

Add dispose function for proper disabling of tracking #9

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

Merged
merged 3 commits into from
Aug 1, 2024

Conversation

Robert27
Copy link
Contributor

Executing init with an empty key string leads to the following warning Tracking will be disabled.

However, this tracking is only deactivated if there is no previously initialized tracking object.
Otherwise, the old one will continue to be used, although the warning promises that tracking is now disabled.

Specifically, we use it to deactivate tracking as a user option during the app runtime. The console warning implies that tracking is now also off, but the network logs showed that it was not actually deactivated. Thus, it poses an active risk of violating privacy.

This PR fixes this problem by actually stopping the polling in addition and overwriting the old client with undefined.

@cristipufu
Copy link
Member

I think it would be more elegant to add a stop/dispose/destroy method. Once you know the user preference, the next time he opens the app, you can simply skip the init call if tracking is disabled

@Robert27 Robert27 changed the title Fixes reinitialization during app runtime Add dispose function for proper disabling of tracking Jul 28, 2024
@Robert27
Copy link
Contributor Author

I have now added a dispose function that can be called directly by the user to disable tracking completely instead of having to initialize it with invalid data.
In addition, this function is still executed in the case of an incorrect init in order to comply with the console warning and to prevent incorrectness. Although it is checked a second time whether the client exists at all, this is the simplest solution for me to avoid generating a false warning.

@ivnbogdan ivnbogdan merged commit e672584 into aptabase:main Aug 1, 2024
1 check 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