Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3486862
D14169.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
D14169.diff
View Options
diff --git a/native/account/qr-auth/connect-secondary-device.react.js b/native/account/qr-auth/connect-secondary-device.react.js
--- a/native/account/qr-auth/connect-secondary-device.react.js
+++ b/native/account/qr-auth/connect-secondary-device.react.js
@@ -4,7 +4,7 @@
import * as React from 'react';
import { Text } from 'react-native';
-import { QRAuthContext } from './qr-auth-context.js';
+import { PrimaryDeviceQRAuthContext } from './primary-device-q-r-auth-context.js';
import type { QRAuthNavigationProp } from './qr-auth-navigator.react.js';
import RegistrationButtonContainer from '../../account/registration/registration-button-container.react.js';
import RegistrationContainer from '../../account/registration/registration-container.react.js';
@@ -28,9 +28,14 @@
const styles = useStyles(unboundStyles);
- const qrAuthContext = React.useContext(QRAuthContext);
- invariant(qrAuthContext, 'qrAuthContext should be set');
- const { onConnect, connectingInProgress } = qrAuthContext;
+ const primaryDeviceQRAuthContext = React.useContext(
+ PrimaryDeviceQRAuthContext,
+ );
+ invariant(
+ primaryDeviceQRAuthContext,
+ 'primaryDeviceQRAuthContext should be set',
+ );
+ const { onConnect, connectingInProgress } = primaryDeviceQRAuthContext;
const onPressConnect = React.useCallback(() => {
void onConnect(data);
diff --git a/native/account/qr-auth/qr-auth-context-provider.js b/native/account/qr-auth/primary-device-q-r-auth-context-provider.js
rename from native/account/qr-auth/qr-auth-context-provider.js
rename to native/account/qr-auth/primary-device-q-r-auth-context-provider.js
--- a/native/account/qr-auth/qr-auth-context-provider.js
+++ b/native/account/qr-auth/primary-device-q-r-auth-context-provider.js
@@ -27,7 +27,7 @@
} from 'lib/types/tunnelbroker/peer-to-peer-message-types.js';
import { qrCodeAuthMessageTypes } from 'lib/types/tunnelbroker/qr-code-auth-message-types.js';
-import { QRAuthContext } from './qr-auth-context.js';
+import { PrimaryDeviceQRAuthContext } from './primary-device-q-r-auth-context.js';
import { commCoreModule } from '../../native-modules.js';
import {
SecondaryDeviceConnectedRouteName,
@@ -45,7 +45,7 @@
type Props = {
+children: React.Node,
};
-function QRAuthContextProvider(props: Props): React.Node {
+function PrimaryDeviceQRAuthContextProvider(props: Props): React.Node {
const aes256Key = React.useRef<?string>(null);
const secondaryDeviceID = React.useRef<?string>(null);
const secondaryDeviceType = React.useRef<?IdentityDeviceType>(null);
@@ -285,10 +285,10 @@
);
return (
- <QRAuthContext.Provider value={contextValue}>
+ <PrimaryDeviceQRAuthContext.Provider value={contextValue}>
{props.children}
- </QRAuthContext.Provider>
+ </PrimaryDeviceQRAuthContext.Provider>
);
}
-export { QRAuthContextProvider };
+export { PrimaryDeviceQRAuthContextProvider };
diff --git a/native/account/qr-auth/primary-device-q-r-auth-context.js b/native/account/qr-auth/primary-device-q-r-auth-context.js
new file mode 100644
--- /dev/null
+++ b/native/account/qr-auth/primary-device-q-r-auth-context.js
@@ -0,0 +1,14 @@
+// @flow
+
+import * as React from 'react';
+
+export type PrimaryDeviceQRAuthContextType = {
+ +onConnect: (data: string) => Promise<void>,
+ +connectingInProgress: boolean,
+ +onRemoveSecondaryDevice: () => Promise<void>,
+};
+
+const PrimaryDeviceQRAuthContext: React.Context<?PrimaryDeviceQRAuthContextType> =
+ React.createContext<?PrimaryDeviceQRAuthContextType>();
+
+export { PrimaryDeviceQRAuthContext };
diff --git a/native/account/qr-auth/qr-auth-context.js b/native/account/qr-auth/qr-auth-context.js
deleted file mode 100644
--- a/native/account/qr-auth/qr-auth-context.js
+++ /dev/null
@@ -1,14 +0,0 @@
-// @flow
-
-import * as React from 'react';
-
-export type QRAuthContextType = {
- +onConnect: (data: string) => Promise<void>,
- +connectingInProgress: boolean,
- +onRemoveSecondaryDevice: () => Promise<void>,
-};
-
-const QRAuthContext: React.Context<?QRAuthContextType> =
- React.createContext<?QRAuthContextType>();
-
-export { QRAuthContext };
diff --git a/native/account/qr-auth/qr-auth-navigator.react.js b/native/account/qr-auth/qr-auth-navigator.react.js
--- a/native/account/qr-auth/qr-auth-navigator.react.js
+++ b/native/account/qr-auth/qr-auth-navigator.react.js
@@ -9,7 +9,7 @@
import * as React from 'react';
import ConnectSecondaryDevice from './connect-secondary-device.react.js';
-import { QRAuthContextProvider } from './qr-auth-context-provider.js';
+import { PrimaryDeviceQRAuthContextProvider } from './primary-device-q-r-auth-context-provider.js';
import QRAuthNotPrimaryDevice from './qr-auth-not-primary-device.react.js';
import SecondaryDeviceConnected from './secondary-device-connected.react.js';
import SecondaryDeviceNotResponding from './secondary-device-not-responding.react.js';
@@ -78,7 +78,7 @@
// eslint-disable-next-line no-unused-vars
function QRAuthNavigator(props: Props): React.Node {
return (
- <QRAuthContextProvider>
+ <PrimaryDeviceQRAuthContextProvider>
<QRAuthStack.Navigator screenOptions={screenOptions}>
<QRAuthStack.Screen
name={SecondaryDeviceQRCodeScannerRouteName}
@@ -106,7 +106,7 @@
options={disableGesturesScreenOptions}
/>
</QRAuthStack.Navigator>
- </QRAuthContextProvider>
+ </PrimaryDeviceQRAuthContextProvider>
);
}
diff --git a/native/account/qr-auth/secondary-device-not-responding.react.js b/native/account/qr-auth/secondary-device-not-responding.react.js
--- a/native/account/qr-auth/secondary-device-not-responding.react.js
+++ b/native/account/qr-auth/secondary-device-not-responding.react.js
@@ -11,7 +11,7 @@
import { getMessageForException } from 'lib/utils/errors.js';
-import { QRAuthContext } from './qr-auth-context.js';
+import { PrimaryDeviceQRAuthContext } from './primary-device-q-r-auth-context.js';
import type { QRAuthNavigationProp } from './qr-auth-navigator.react.js';
import RegistrationButtonContainer from '../../account/registration/registration-button-container.react.js';
import RegistrationContainer from '../../account/registration/registration-container.react.js';
@@ -32,9 +32,14 @@
function SecondaryDeviceNotResponding(props: Props): React.Node {
const { navigation } = props;
- const qrAuthContext = React.useContext(QRAuthContext);
- invariant(qrAuthContext, 'qrAuthContext should be set');
- const { onRemoveSecondaryDevice } = qrAuthContext;
+ const primaryDeviceQRAuthContext = React.useContext(
+ PrimaryDeviceQRAuthContext,
+ );
+ invariant(
+ primaryDeviceQRAuthContext,
+ 'primaryDeviceQRAuthContext should be set',
+ );
+ const { onRemoveSecondaryDevice } = primaryDeviceQRAuthContext;
const navigateToLinkedDevices = React.useCallback(() => {
navigation
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 19, 6:17 AM (18 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2675647
Default Alt Text
D14169.diff (6 KB)
Attached To
Mode
D14169: [native] rename `QRAuthContext` to `PrimaryDeviceQRAuthContext`
Attached
Detach File
Event Timeline
Log In to Comment