Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3485170
D14166.id46559.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D14166.id46559.diff
View Options
diff --git a/lib/components/qr-auth-provider.react.js b/lib/components/secondary-device-qr-auth-context-provider.react.js
rename from lib/components/qr-auth-provider.react.js
rename to lib/components/secondary-device-qr-auth-context-provider.react.js
--- a/lib/components/qr-auth-provider.react.js
+++ b/lib/components/secondary-device-qr-auth-context-provider.react.js
@@ -40,18 +40,18 @@
type QRData = ?{ +deviceID: string, +aesKey: string };
-type QRAuthContextType = {
+type SecondaryDeviceQRAuthContextType = {
+qrData: QRData,
+generateQRCode: () => Promise<void>,
};
-const QRAuthContext: React.Context<?QRAuthContextType> =
- React.createContext<?QRAuthContextType>({
+const SecondaryDeviceQRAuthContext: React.Context<?SecondaryDeviceQRAuthContextType> =
+ React.createContext<?SecondaryDeviceQRAuthContextType>({
qrData: null,
generateQRCode: async () => {},
});
-function QRAuthProvider(props: Props): React.Node {
+function SecondaryDeviceQRAuthContextProvider(props: Props): React.Node {
const {
children,
onLogInError,
@@ -218,15 +218,20 @@
);
return (
- <QRAuthContext.Provider value={value}>{children}</QRAuthContext.Provider>
+ <SecondaryDeviceQRAuthContext.Provider value={value}>
+ {children}a
+ </SecondaryDeviceQRAuthContext.Provider>
);
}
-function useQRAuthContext(): QRAuthContextType {
- const context = React.useContext(QRAuthContext);
- invariant(context, 'QRAuthContext not found');
+function useSecondaryDeviceQRAuthContext(): SecondaryDeviceQRAuthContextType {
+ const context = React.useContext(SecondaryDeviceQRAuthContext);
+ invariant(context, 'SecondaryDeviceQRAuthContext not found');
return context;
}
-export { QRAuthProvider, useQRAuthContext };
+export {
+ SecondaryDeviceQRAuthContextProvider,
+ useSecondaryDeviceQRAuthContext,
+};
diff --git a/native/account/qr-code-screen.react.js b/native/account/qr-code-screen.react.js
--- a/native/account/qr-code-screen.react.js
+++ b/native/account/qr-code-screen.react.js
@@ -4,7 +4,7 @@
import { View, Text, useWindowDimensions } from 'react-native';
import QRCode from 'react-native-qrcode-svg';
-import { useQRAuthContext } from 'lib/components/qr-auth-provider.react.js';
+import { useSecondaryDeviceQRAuthContext } from 'lib/components/secondary-device-qr-auth-context-provider.react.js';
import { qrCodeLinkURL } from 'lib/facts/links.js';
import { platformToIdentityDeviceType } from 'lib/types/identity-service-types.js';
import { getConfig } from 'lib/utils/config.js';
@@ -25,7 +25,7 @@
};
function QRCodeScreen(props: QRCodeScreenProps): React.Node {
- const { qrData, generateQRCode } = useQRAuthContext();
+ const { qrData, generateQRCode } = useSecondaryDeviceQRAuthContext();
React.useEffect(() => {
void generateQRCode();
diff --git a/native/root.react.js b/native/root.react.js
--- a/native/root.react.js
+++ b/native/root.react.js
@@ -34,7 +34,7 @@
import { NeynarClientProvider } from 'lib/components/neynar-client-provider.react.js';
import PlatformDetailsSynchronizer from 'lib/components/platform-details-synchronizer.react.js';
import PrekeysHandler from 'lib/components/prekeys-handler.react.js';
-import { QRAuthProvider } from 'lib/components/qr-auth-provider.react.js';
+import { SecondaryDeviceQRAuthContextProvider } from 'lib/components/secondary-device-qr-auth-context-provider.react.js';
import { StaffContextProvider } from 'lib/components/staff-provider.react.js';
import SyncCommunityStoreHandler from 'lib/components/sync-community-store-handler.react.js';
import { UserIdentityCacheProvider } from 'lib/components/user-identity-cache.react.js';
@@ -345,7 +345,7 @@
<NeynarClientProvider apiKey={neynarKey}>
<TunnelbrokerProvider>
<IdentitySearchProvider>
- <QRAuthProvider
+ <SecondaryDeviceQRAuthContextProvider
parseTunnelbrokerQRAuthMessage={
parseTunnelbrokerQRAuthMessage
}
@@ -414,7 +414,7 @@
</RootContext.Provider>
</NavContext.Provider>
</FeatureFlagsProvider>
- </QRAuthProvider>
+ </SecondaryDeviceQRAuthContextProvider>
</IdentitySearchProvider>
</TunnelbrokerProvider>
</NeynarClientProvider>
diff --git a/web/account/qr-code-login.react.js b/web/account/qr-code-login.react.js
--- a/web/account/qr-code-login.react.js
+++ b/web/account/qr-code-login.react.js
@@ -3,7 +3,7 @@
import { QRCodeSVG } from 'qrcode.react';
import * as React from 'react';
-import { useQRAuthContext } from 'lib/components/qr-auth-provider.react.js';
+import { useSecondaryDeviceQRAuthContext } from 'lib/components/secondary-device-qr-auth-context-provider.react.js';
import { qrCodeLinkURL } from 'lib/facts/links.js';
import { platformToIdentityDeviceType } from 'lib/types/identity-service-types.js';
import { getConfig } from 'lib/utils/config.js';
@@ -11,7 +11,7 @@
import css from './qr-code-login.css';
function QRCodeLogin(): React.Node {
- const { qrData, generateQRCode } = useQRAuthContext();
+ const { qrData, generateQRCode } = useSecondaryDeviceQRAuthContext();
React.useEffect(() => {
void generateQRCode();
diff --git a/web/app.react.js b/web/app.react.js
--- a/web/app.react.js
+++ b/web/app.react.js
@@ -24,7 +24,7 @@
} from 'lib/components/modal-provider.react.js';
import { NeynarClientProvider } from 'lib/components/neynar-client-provider.react.js';
import PlatformDetailsSynchronizer from 'lib/components/platform-details-synchronizer.react.js';
-import { QRAuthProvider } from 'lib/components/qr-auth-provider.react.js';
+import { SecondaryDeviceQRAuthContextProvider } from 'lib/components/secondary-device-qr-auth-context-provider.react.js';
import { StaffContextProvider } from 'lib/components/staff-provider.react.js';
import SyncCommunityStoreHandler from 'lib/components/sync-community-store-handler.react.js';
import { DBOpsHandler } from 'lib/handlers/db-ops-handler.react.js';
@@ -572,7 +572,7 @@
>
<BadgeHandler />
<IdentitySearchProvider>
- <QRAuthProvider
+ <SecondaryDeviceQRAuthContextProvider
parseTunnelbrokerQRAuthMessage={
parseTunnelbrokerQRAuthMessage
}
@@ -591,7 +591,7 @@
dispatch={dispatch}
modals={modals}
/>
- </QRAuthProvider>
+ </SecondaryDeviceQRAuthContextProvider>
<DBOpsHandler />
</IdentitySearchProvider>
</TunnelbrokerProvider>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 18, 6:50 PM (13 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2674502
Default Alt Text
D14166.id46559.diff (6 KB)
Attached To
Mode
D14166: [lib] rename `QRAuthContext` to `SecondaryDeviceQRAuthContext`
Attached
Detach File
Event Timeline
Log In to Comment