Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32542891
D14100.1767172747.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
9 KB
Referenced Files
None
Subscribers
None
D14100.1767172747.diff
View Options
diff --git a/native/account/qr-auth/qr-auth-navigator.react.js b/native/account/qr-auth/qr-auth-navigator.react.js
new file mode 100644
--- /dev/null
+++ b/native/account/qr-auth/qr-auth-navigator.react.js
@@ -0,0 +1,63 @@
+// @flow
+
+import type {
+ StackNavigationHelpers,
+ StackNavigationProp,
+} from '@react-navigation/core';
+import { createStackNavigator } from '@react-navigation/stack';
+import * as React from 'react';
+
+import type { RootNavigationProp } from '../../navigation/root-navigator.react.js';
+import {
+ type NavigationRoute,
+ type QRAuthNavigatorParamList,
+ type ScreenParamList,
+ SecondaryDeviceQRCodeScannerRouteName,
+} from '../../navigation/route-names.js';
+import SecondaryDeviceQRCodeScanner from '../../profile/secondary-device-qr-code-scanner.react.js';
+import { deviceIsEmulator } from '../../utils/url-utils.js';
+
+export type QRAuthNavigationProp<RouteName: $Keys<QRAuthNavigatorParamList>> =
+ StackNavigationProp<ScreenParamList, RouteName>;
+
+const QRAuthStack = createStackNavigator<
+ ScreenParamList,
+ QRAuthNavigatorParamList,
+ StackNavigationHelpers<ScreenParamList>,
+>();
+
+type Props = {
+ +navigation: RootNavigationProp<'QRAuthNavigator'>,
+ +route: NavigationRoute<'QRAuthNavigator'>,
+};
+
+const screenOptions = {
+ headerShown: true,
+ headerTransparent: true,
+ headerBackTitleVisible: false,
+ headerTitle: '',
+ headerTintColor: 'white',
+ headerLeftContainerStyle: {
+ paddingLeft: 12,
+ },
+ gestureEnabled: true,
+};
+const secondaryDeviceQRCodeScannerOptions = {
+ headerTitle: deviceIsEmulator ? 'Link device' : '',
+ headerBackTitleVisible: false,
+};
+
+// eslint-disable-next-line no-unused-vars
+function QRAuthNavigator(props: Props): React.Node {
+ return (
+ <QRAuthStack.Navigator screenOptions={screenOptions}>
+ <QRAuthStack.Screen
+ name={SecondaryDeviceQRCodeScannerRouteName}
+ component={SecondaryDeviceQRCodeScanner}
+ options={secondaryDeviceQRCodeScannerOptions}
+ />
+ </QRAuthStack.Navigator>
+ );
+}
+
+export default QRAuthNavigator;
diff --git a/native/navigation/deep-links-context-provider.react.js b/native/navigation/deep-links-context-provider.react.js
--- a/native/navigation/deep-links-context-provider.react.js
+++ b/native/navigation/deep-links-context-provider.react.js
@@ -30,7 +30,7 @@
import {
InviteLinkModalRouteName,
- SecondaryDeviceQRCodeScannerRouteName,
+ QRAuthNavigatorRouteName,
} from './route-names.js';
import { useSelector } from '../redux/redux-utils.js';
import {
@@ -155,7 +155,7 @@
showVersionUnsupportedAlert();
return;
}
- navigation.navigate(SecondaryDeviceQRCodeScannerRouteName);
+ navigation.navigate(QRAuthNavigatorRouteName);
}
})();
}, [
diff --git a/native/navigation/root-navigator.react.js b/native/navigation/root-navigator.react.js
--- a/native/navigation/root-navigator.react.js
+++ b/native/navigation/root-navigator.react.js
@@ -57,8 +57,10 @@
CreateMissingSIWEBackupMessageRouteName,
RestoreSIWEBackupRouteName,
LinkedDevicesBottomSheetRouteName,
+ QRAuthNavigatorRouteName,
} from './route-names.js';
import LoggedOutModal from '../account/logged-out-modal.react.js';
+import QRAuthNavigator from '../account/qr-auth/qr-auth-navigator.react.js';
import CreateMissingSIWEBackupMessage from '../account/registration/missing-registration-data/missing-siwe-backup-message.react.js';
import RegistrationNavigator from '../account/registration/registration-navigator.react.js';
import SignInNavigator from '../account/sign-in-navigator.react.js';
@@ -316,6 +318,11 @@
name={RestoreSIWEBackupRouteName}
component={RestoreSIWEBackup}
/>
+ <Root.Screen
+ name={QRAuthNavigatorRouteName}
+ component={QRAuthNavigator}
+ options={disableGesturesScreenOptions}
+ />
</Root.Navigator>
);
}
diff --git a/native/navigation/route-names.js b/native/navigation/route-names.js
--- a/native/navigation/route-names.js
+++ b/native/navigation/route-names.js
@@ -179,6 +179,7 @@
export const HomeTabTipRouteName = 'HomeTabTip';
export const MutedTabTipRouteName = 'MutedTabTip';
export const NUXTipOverlayBackdropRouteName = 'NUXTipOverlayBackdrop';
+export const QRAuthNavigatorRouteName = 'QRAuthNavigator';
export type RootParamList = {
+LoggedOutModal: void,
@@ -207,6 +208,7 @@
+TagFarcasterChannelNavigator: void,
+CreateMissingSIWEBackupMessage: void,
+RestoreSIWEBackup: RestoreSIWEBackupParams,
+ +QRAuthNavigator: void,
};
export type NUXTipRouteNames =
@@ -289,7 +291,6 @@
+FriendList: void,
+BlockList: void,
+LinkedDevices: void,
- +SecondaryDeviceQRCodeScanner: void,
+BackupMenu: void,
+TunnelbrokerMenu: void,
+KeyserverSelectionList: void,
@@ -351,6 +352,10 @@
+UserRelationshipTooltipModal: UserRelationshipTooltipModalParams,
};
+export type QRAuthNavigatorParamList = {
+ +SecondaryDeviceQRCodeScanner: void,
+};
+
export type ScreenParamList = {
...RootParamList,
...OverlayParamList,
@@ -367,6 +372,7 @@
...SignInParamList,
...UserProfileBottomSheetParamList,
...TagFarcasterChannelParamList,
+ ...QRAuthNavigatorParamList,
};
export type NavigationRoute<RouteName: string = $Keys<ScreenParamList>> =
diff --git a/native/profile/linked-devices-header-right-button.react.js b/native/profile/linked-devices-header-right-button.react.js
--- a/native/profile/linked-devices-header-right-button.react.js
+++ b/native/profile/linked-devices-header-right-button.react.js
@@ -4,13 +4,13 @@
import * as React from 'react';
import HeaderRightTextButton from '../navigation/header-right-text-button.react.js';
-import { SecondaryDeviceQRCodeScannerRouteName } from '../navigation/route-names.js';
+import { QRAuthNavigatorRouteName } from '../navigation/route-names.js';
function LinkedDevicesHeaderRightButton(): React.Node {
const { navigate } = useNavigation();
const navigateToQRCodeScanner = React.useCallback(() => {
- navigate(SecondaryDeviceQRCodeScannerRouteName);
+ navigate(QRAuthNavigatorRouteName);
}, [navigate]);
return (
diff --git a/native/profile/profile.react.js b/native/profile/profile.react.js
--- a/native/profile/profile.react.js
+++ b/native/profile/profile.react.js
@@ -28,7 +28,6 @@
import ProfileHeader from './profile-header.react.js';
import ProfileScreen from './profile-screen.react.js';
import RelationshipList from './relationship-list.react.js';
-import SecondaryDeviceQRCodeScanner from './secondary-device-qr-code-scanner.react.js';
import TunnelbrokerMenu from './tunnelbroker-menu.react.js';
import KeyboardAvoidingView from '../components/keyboard-avoiding-view.react.js';
import CommunityDrawerButton from '../navigation/community-drawer-button.react.js';
@@ -46,7 +45,6 @@
DefaultNotificationsPreferencesRouteName,
BlockListRouteName,
LinkedDevicesRouteName,
- SecondaryDeviceQRCodeScannerRouteName,
BackupMenuRouteName,
KeyserverSelectionListRouteName,
AddKeyserverRouteName,
@@ -57,7 +55,6 @@
} from '../navigation/route-names.js';
import type { TabNavigationProp } from '../navigation/tab-navigator.react.js';
import { useStyles, useColors } from '../themes/colors.js';
-import { deviceIsEmulator } from '../utils/url-utils.js';
const header = (props: StackHeaderProps) => <ProfileHeader {...props} />;
const profileScreenOptions = { headerTitle: 'Profile' };
@@ -78,10 +75,6 @@
const addKeyserverOptions = { headerTitle: 'Add keyserver' };
const backupMenuOptions = { headerTitle: 'Backup menu' };
const tunnelbrokerMenuOptions = { headerTitle: 'Tunnelbroker menu' };
-const secondaryDeviceQRCodeScannerOptions = {
- headerTitle: deviceIsEmulator ? 'Link device' : '',
- headerBackTitleVisible: false,
-};
const buildInfoOptions = { headerTitle: 'Build info' };
const devToolsOptions = { headerTitle: 'Developer tools' };
const appearanceOptions = { headerTitle: 'Appearance' };
@@ -189,11 +182,6 @@
component={TunnelbrokerMenu}
options={tunnelbrokerMenuOptions}
/>
- <Profile.Screen
- name={SecondaryDeviceQRCodeScannerRouteName}
- component={SecondaryDeviceQRCodeScanner}
- options={secondaryDeviceQRCodeScannerOptions}
- />
<Profile.Screen
name={BuildInfoRouteName}
component={BuildInfo}
diff --git a/native/profile/secondary-device-qr-code-scanner.react.js b/native/profile/secondary-device-qr-code-scanner.react.js
--- a/native/profile/secondary-device-qr-code-scanner.react.js
+++ b/native/profile/secondary-device-qr-code-scanner.react.js
@@ -29,7 +29,7 @@
} from 'lib/types/tunnelbroker/peer-to-peer-message-types.js';
import { qrCodeAuthMessageTypes } from 'lib/types/tunnelbroker/qr-code-auth-message-types.js';
-import type { ProfileNavigationProp } from './profile.react.js';
+import type { QRAuthNavigationProp } from '../account/qr-auth/qr-auth-navigator.react.js';
import TextInput from '../components/text-input.react.js';
import { commCoreModule } from '../native-modules.js';
import HeaderRightTextButton from '../navigation/header-right-text-button.react.js';
@@ -46,7 +46,7 @@
const barCodeTypes = [BarCodeScanner.Constants.BarCodeType.qr];
type Props = {
- +navigation: ProfileNavigationProp<'SecondaryDeviceQRCodeScanner'>,
+ +navigation: QRAuthNavigationProp<'SecondaryDeviceQRCodeScanner'>,
+route: NavigationRoute<'SecondaryDeviceQRCodeScanner'>,
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 31, 9:19 AM (1 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5872918
Default Alt Text
D14100.1767172747.diff (9 KB)
Attached To
Mode
D14100: [native] implement QR Auth stack navigator
Attached
Detach File
Event Timeline
Log In to Comment