Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3370163
D4730.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D4730.diff
View Options
diff --git a/native/data/sensitive-data-cleaner.react.js b/native/data/sensitive-data-cleaner.react.js
new file mode 100644
--- /dev/null
+++ b/native/data/sensitive-data-cleaner.react.js
@@ -0,0 +1,38 @@
+// @flow
+
+import * as React from 'react';
+import ExitApp from 'react-native-exit-app';
+
+import { useSelector } from '../redux/redux-utils';
+
+function SensitiveDataCleaner(): null {
+ const currentLoggedInUserID = useSelector(state =>
+ state.currentUserInfo?.anonymous ? null : state.currentUserInfo?.id,
+ );
+ React.useEffect(() => {
+ (async () => {
+ try {
+ const databaseCurrentUserInfoID = await global.CommCoreModule.getCurrentUserID();
+ if (
+ databaseCurrentUserInfoID &&
+ databaseCurrentUserInfoID !== currentLoggedInUserID
+ ) {
+ await global.CommCoreModule.clearSensitiveData();
+ }
+ if (currentLoggedInUserID) {
+ await global.CommCoreModule.setCurrentUserID(currentLoggedInUserID);
+ }
+ } catch (e) {
+ if (__DEV__) {
+ throw e;
+ } else {
+ console.log(e);
+ ExitApp.exitApp();
+ }
+ }
+ })();
+ }, [currentLoggedInUserID]);
+ return null;
+}
+
+export { SensitiveDataCleaner };
diff --git a/native/root.react.js b/native/root.react.js
--- a/native/root.react.js
+++ b/native/root.react.js
@@ -22,6 +22,7 @@
import PersistedStateGate from './components/persisted-state-gate';
import ConnectedStatusBar from './connected-status-bar.react';
import CoreDataProvider from './data/core-data-provider.react';
+import { SensitiveDataCleaner } from './data/sensitive-data-cleaner.react';
import { SQLiteContextProvider } from './data/sqlite-context-provider';
import ErrorBoundary from './error-boundary.react';
import InputStateContainer from './input/input-state-container.react';
@@ -222,6 +223,7 @@
<ConnectivityUpdater />
<ThemeHandler />
<OrientationHandler />
+ <SensitiveDataCleaner />
</>
);
let navigation;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 1:12 AM (20 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2587199
Default Alt Text
D4730.diff (1 KB)
Attached To
Mode
D4730: Implement react component that clears database anbd secure store when user logs out or deletes account
Attached
Detach File
Event Timeline
Log In to Comment