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(null);
const secondaryDeviceID = React.useRef(null);
const secondaryDeviceType = React.useRef(null);
@@ -285,10 +285,10 @@
);
return (
-
+
{props.children}
-
+
);
}
-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,
+ +connectingInProgress: boolean,
+ +onRemoveSecondaryDevice: () => Promise,
+};
+
+const PrimaryDeviceQRAuthContext: React.Context =
+ React.createContext();
+
+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,
- +connectingInProgress: boolean,
- +onRemoveSecondaryDevice: () => Promise,
-};
-
-const QRAuthContext: React.Context =
- React.createContext();
-
-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 (
-
+
-
+
);
}
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