HomePhabricator
Diffusion Comm 61471c19b4cf

[native] refactor `clearSensitiveData()` method to static member of…

Description

[native] refactor clearSensitiveData() method to static member of SQLiteQueryExecutor

Summary:
Problem with previous approach:
Let's assume that some error occurs in db and migrate() function fails throwing an error. To fix that we want to delete the database file, but calling clearSensitiveData requires SQLiteQueryExecutor instance, which will call constructor, constructor will call migrate(), migrate() will fail, and we're in a dead loop where only uinstalling app by user will help.
To fix this we need to make this method work separate from SQLiteQueryExecutor instance.

I would take this even further and consider making this method part of DatabaseManager. It is not connected to the query executor instance, which by definition should operate on db schema, but performs action on db file. But we need to rethink how to share things like db path between these two classes so it'll require some more changes, I believe.

Test Plan: Build the app and logout to execute clearSensitiveData, this should behave the same way as previously

Reviewers: marcin, tomek

Reviewed By: marcin, tomek

Subscribers: ashoat, tomek, atul

Differential Revision: https://phab.comm.dev/D5989