Page MenuHomePhabricator

D11227.id37852.diff
No OneTemporary

D11227.id37852.diff

diff --git a/native/data/sqlite-data-handler.js b/native/data/sqlite-data-handler.js
--- a/native/data/sqlite-data-handler.js
+++ b/native/data/sqlite-data-handler.js
@@ -1,22 +1,16 @@
// @flow
-import invariant from 'invariant';
import * as React from 'react';
import { setClientDBStoreActionType } from 'lib/actions/client-db-store-actions.js';
import { MediaCacheContext } from 'lib/components/media-cache-provider.react.js';
-import { useStaffContext } from 'lib/components/staff-provider.react.js';
import type { CallKeyserverEndpoint } from 'lib/keyserver-conn/keyserver-conn-types.js';
-import { resolveKeyserverSessionInvalidation } from 'lib/keyserver-conn/recovery-utils.js';
+import { useKeyserverRecoveryLogIn } from 'lib/keyserver-conn/recovery-utils.js';
import { communityStoreOpsHandlers } from 'lib/ops/community-store-ops.js';
import { keyserverStoreOpsHandlers } from 'lib/ops/keyserver-store-ops.js';
import { reportStoreOpsHandlers } from 'lib/ops/report-store-ops.js';
import { threadStoreOpsHandlers } from 'lib/ops/thread-store-ops.js';
import { userStoreOpsHandlers } from 'lib/ops/user-store-ops.js';
-import {
- cookieSelector,
- urlPrefixSelector,
-} from 'lib/selectors/keyserver-selectors.js';
import { isLoggedIn } from 'lib/selectors/user-selectors.js';
import { useInitialNotificationsEncryptedMessage } from 'lib/shared/crypto-utils.js';
import {
@@ -47,6 +41,8 @@
}
}
+const returnsFalseSinceDoesntNeedToSupportCancellation = () => false;
+
function SQLiteDataHandler(): React.Node {
const storeLoaded = useSelector(state => state.storeLoaded);
@@ -56,11 +52,7 @@
const rehydrateConcluded = useSelector(
state => !!(state._persist && state._persist.rehydrated),
);
- const cookie = useSelector(cookieSelector(authoritativeKeyserverID));
- const urlPrefix = useSelector(urlPrefixSelector(authoritativeKeyserverID));
- invariant(urlPrefix, "missing urlPrefix for ashoat's keyserver");
const staffCanSee = useStaffCanSee();
- const { staffUserHasBeenLoggedIn } = useStaffContext();
const loggedIn = useSelector(isLoggedIn);
const currentLoggedInUserID = useSelector(state =>
state.currentUserInfo?.anonymous ? undefined : state.currentUserInfo?.id,
@@ -69,6 +61,9 @@
const getInitialNotificationsEncryptedMessage =
useInitialNotificationsEncryptedMessage(authoritativeKeyserverID);
+ const keyserverRecoveryLogIn = useKeyserverRecoveryLogIn(
+ authoritativeKeyserverID,
+ );
const recoverDataFromAuthoritativeKeyserver = React.useCallback(
async (source: RecoveryActionSource) => {
const innerRecoverDataFromAuthoritativeKeyserver = (
@@ -82,16 +77,13 @@
source,
authoritativeKeyserverID,
getInitialNotificationsEncryptedMessage,
- () => false,
+ returnsFalseSinceDoesntNeedToSupportCancellation,
);
try {
- await resolveKeyserverSessionInvalidation(
- dispatch,
- cookie,
- urlPrefix,
+ await keyserverRecoveryLogIn(
source,
- authoritativeKeyserverID,
innerRecoverDataFromAuthoritativeKeyserver,
+ returnsFalseSinceDoesntNeedToSupportCancellation,
);
dispatch({ type: setStoreLoadedActionType });
} catch (fetchCookieException) {
@@ -108,11 +100,10 @@
}
},
[
- cookie,
dispatch,
dispatchActionPromise,
+ keyserverRecoveryLogIn,
staffCanSee,
- urlPrefix,
getInitialNotificationsEncryptedMessage,
],
);
@@ -246,13 +237,10 @@
currentLoggedInUserID,
handleSensitiveData,
loggedIn,
- cookie,
dispatch,
rehydrateConcluded,
staffCanSee,
storeLoaded,
- urlPrefix,
- staffUserHasBeenLoggedIn,
recoverDataFromAuthoritativeKeyserver,
callClearSensitiveData,
mediaCacheContext,

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 10:25 PM (20 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2580912
Default Alt Text
D11227.id37852.diff (3 KB)

Event Timeline