Refactor lock and unlock logic
At the moment, there is not a clear separation between the UnlockDatabase
, UnlockedDatabase
and DatabaseManager
and the code to lock and unlock a database is split between these 3 classes.
The main idea of this MR is to move all this logic in the DatabaseManager
class. This is achieved by adding a locked
property to it. Then, UnlockDatabase
and UnlockedDatabase
listen to the changes of this property to update accordingly.