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, }; -const QRAuthContext: React.Context = - React.createContext({ +const SecondaryDeviceQRAuthContext: React.Context = + React.createContext({ qrData: null, generateQRCode: async () => {}, }); -function QRAuthProvider(props: Props): React.Node { +function SecondaryDeviceQRAuthContextProvider(props: Props): React.Node { const { children, onLogInError, @@ -218,15 +218,20 @@ ); return ( - {children} + + {children} + ); } -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 @@ - - + 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 @@ > - - +