[web][native] Extract the common logic determining when to clear the data
Summary:
If the ID of the current user changes and was defined we should clear both Redux and SQLite.
https://linear.app/comm/issue/ENG-7076/extract-common-logic-from-sqlite-handler-and-master-reducer
Depends on D11533
Test Plan: Check if logging out clears both Redux and SQLite.
Reviewers: kamil, inka, varun
Reviewed By: inka
Subscribers: ashoat
Differential Revision: https://phab.comm.dev/D11534