BlueWallet/Navigation.tsx

641 lines
28 KiB
TypeScript
Raw Normal View History

2024-02-24 12:27:17 +01:00
import { DrawerNavigationOptions, createDrawerNavigator } from '@react-navigation/drawer';
import { NativeStackNavigationOptions, createNativeStackNavigator } from '@react-navigation/native-stack';
2024-03-07 16:55:20 +01:00
import React, { useContext, useMemo } from 'react';
2024-02-24 12:27:17 +01:00
import { Dimensions, I18nManager, Platform, useWindowDimensions } from 'react-native';
2020-05-27 13:12:17 +02:00
2024-02-24 12:27:17 +01:00
import PlausibleDeniability from './screen/PlausibleDeniability';
2020-05-27 13:12:17 +02:00
import Selftest from './screen/selftest';
2024-01-27 14:44:11 +01:00
import Currency from './screen/settings/Currency';
2020-05-27 13:12:17 +02:00
import GeneralSettings from './screen/settings/GeneralSettings';
2024-02-24 12:27:17 +01:00
import Licensing from './screen/settings/Licensing';
2020-05-27 13:12:17 +02:00
import NetworkSettings from './screen/settings/NetworkSettings';
2024-02-24 12:27:17 +01:00
import Settings from './screen/settings/Settings';
import About from './screen/settings/about';
2020-05-27 13:12:17 +02:00
import DefaultView from './screen/settings/defaultView';
2024-02-24 12:27:17 +01:00
import ElectrumSettings from './screen/settings/electrumSettings';
import EncryptStorage from './screen/settings/encryptStorage';
import Language from './screen/settings/language';
import LightningSettings from './screen/settings/lightningSettings';
import NotificationSettings from './screen/settings/notificationSettings';
import ReleaseNotes from './screen/settings/releasenotes';
import Tools from './screen/settings/tools';
2020-05-27 13:12:17 +02:00
import AddWallet from './screen/wallets/add';
import WalletsAddMultisig from './screen/wallets/addMultisig';
2023-12-17 16:05:00 +01:00
import WalletsAddMultisigHelp, { WalletAddMultisigHelpNavigationOptions } from './screen/wallets/addMultisigHelp';
2024-02-24 12:27:17 +01:00
import WalletsAddMultisigStep2 from './screen/wallets/addMultisigStep2';
import WalletAddresses from './screen/wallets/addresses';
2020-05-27 13:12:17 +02:00
import WalletDetails from './screen/wallets/details';
import WalletExport from './screen/wallets/export';
2020-10-05 23:25:14 +02:00
import ExportMultisigCoordinationSetup from './screen/wallets/exportMultisigCoordinationSetup';
2024-02-24 12:27:17 +01:00
import GenerateWord from './screen/wallets/generateWord';
import ImportWallet from './screen/wallets/import';
import ImportCustomDerivationPath from './screen/wallets/importCustomDerivationPath';
import ImportWalletDiscovery from './screen/wallets/importDiscovery';
import ImportSpeed from './screen/wallets/importSpeed';
import WalletsList from './screen/wallets/list';
import PleaseBackup from './screen/wallets/pleaseBackup';
import PleaseBackupLNDHub from './screen/wallets/pleaseBackupLNDHub';
import PleaseBackupLdk from './screen/wallets/pleaseBackupLdk';
import ProvideEntropy from './screen/wallets/provideEntropy';
2020-05-27 13:12:17 +02:00
import ReorderWallets from './screen/wallets/reorderWallets';
import SelectWallet from './screen/wallets/selectWallet';
2024-02-24 12:27:17 +01:00
import SignVerify from './screen/wallets/signVerify';
import WalletTransactions from './screen/wallets/transactions';
import ViewEditMultisigCosigners from './screen/wallets/viewEditMultisigCosigners';
import WalletXpub from './screen/wallets/xpub';
2020-05-27 13:12:17 +02:00
import CPFP from './screen/transactions/CPFP';
import RBFBumpFee from './screen/transactions/RBFBumpFee';
import RBFCancel from './screen/transactions/RBFCancel';
2024-02-24 12:27:17 +01:00
import TransactionDetails from './screen/transactions/details';
import TransactionStatus from './screen/transactions/transactionStatus';
2020-05-27 13:12:17 +02:00
import AztecoRedeem from './screen/receive/aztecoRedeem';
2024-02-24 12:27:17 +01:00
import ReceiveDetails from './screen/receive/details';
2020-05-27 13:12:17 +02:00
import ScanQRCode from './screen/send/ScanQRCode';
2024-02-24 12:27:17 +01:00
import Broadcast from './screen/send/broadcast';
import CoinControl from './screen/send/coinControl';
2020-05-27 13:12:17 +02:00
import Confirm from './screen/send/confirm';
2024-02-24 12:27:17 +01:00
import SendCreate from './screen/send/create';
import SendDetails from './screen/send/details';
import IsItMyAddress from './screen/send/isItMyAddress';
2020-10-05 23:25:14 +02:00
import PsbtMultisig from './screen/send/psbtMultisig';
2021-02-18 14:37:43 +01:00
import PsbtMultisigQRCode from './screen/send/psbtMultisigQRCode';
2024-02-24 12:27:17 +01:00
import PsbtWithHardwareWallet from './screen/send/psbtWithHardwareWallet';
2020-05-27 13:12:17 +02:00
import Success from './screen/send/success';
2024-02-24 12:27:17 +01:00
import UnlockWith from './UnlockWith';
import { isDesktop, isHandset, isTablet } from './blue_modules/environment';
2024-02-27 04:04:51 +01:00
import navigationStyle from './components/navigationStyle';
2024-02-24 12:27:17 +01:00
import { useTheme } from './components/themes';
import loc from './loc';
2020-05-27 13:12:17 +02:00
import LappBrowser from './screen/lnd/browser';
2021-09-09 13:00:11 +02:00
import LdkInfo from './screen/lnd/ldkInfo';
2024-02-24 12:27:17 +01:00
import LdkOpenChannel from './screen/lnd/ldkOpenChannel';
import LNDCreateInvoice from './screen/lnd/lndCreateInvoice';
2020-05-27 13:12:17 +02:00
import LNDViewAdditionalInvoiceInformation from './screen/lnd/lndViewAdditionalInvoiceInformation';
2024-02-24 12:27:17 +01:00
import LNDViewAdditionalInvoicePreImage from './screen/lnd/lndViewAdditionalInvoicePreImage';
import LNDViewInvoice from './screen/lnd/lndViewInvoice';
import LnurlAuth from './screen/lnd/lnurlAuth';
2020-07-23 20:06:13 +02:00
import LnurlPay from './screen/lnd/lnurlPay';
import LnurlPaySuccess from './screen/lnd/lnurlPaySuccess';
2024-02-24 12:27:17 +01:00
import ScanLndInvoice from './screen/lnd/scanLndInvoice';
import SettingsPrivacy from './screen/settings/SettingsPrivacy';
2024-02-24 12:27:17 +01:00
import DrawerList from './screen/wallets/drawerList';
2021-09-09 13:00:11 +02:00
import LdkViewLogs from './screen/wallets/ldkViewLogs';
2022-12-07 03:43:54 +01:00
import PaymentCode from './screen/wallets/paymentCode';
2023-03-15 21:42:25 +01:00
import PaymentCodesList from './screen/wallets/paymentCodesList';
2024-03-07 16:55:20 +01:00
import { BlueStorageContext } from './blue_modules/storage-context';
2020-05-27 13:12:17 +02:00
2021-09-13 19:43:26 +02:00
const WalletsStack = createNativeStackNavigator();
2020-12-25 17:09:53 +01:00
const WalletsRoot = () => {
const theme = useTheme();
return (
2023-11-11 12:33:50 +01:00
<WalletsStack.Navigator screenOptions={{ headerShadowVisible: false }}>
2021-03-11 14:43:21 +01:00
<WalletsStack.Screen name="WalletsList" component={WalletsList} options={WalletsList.navigationOptions(theme)} />
2020-12-25 17:09:53 +01:00
<WalletsStack.Screen name="WalletTransactions" component={WalletTransactions} options={WalletTransactions.navigationOptions(theme)} />
2021-09-09 13:00:11 +02:00
<WalletsStack.Screen name="LdkOpenChannel" component={LdkOpenChannel} options={LdkOpenChannel.navigationOptions(theme)} />
<WalletsStack.Screen name="LdkInfo" component={LdkInfo} options={LdkInfo.navigationOptions(theme)} />
2020-12-25 17:09:53 +01:00
<WalletsStack.Screen name="WalletDetails" component={WalletDetails} options={WalletDetails.navigationOptions(theme)} />
2021-09-09 13:00:11 +02:00
<WalletsStack.Screen name="LdkViewLogs" component={LdkViewLogs} options={LdkViewLogs.navigationOptions(theme)} />
2020-12-25 17:09:53 +01:00
<WalletsStack.Screen name="TransactionDetails" component={TransactionDetails} options={TransactionDetails.navigationOptions(theme)} />
<WalletsStack.Screen name="TransactionStatus" component={TransactionStatus} options={TransactionStatus.navigationOptions(theme)} />
<WalletsStack.Screen name="CPFP" component={CPFP} options={CPFP.navigationOptions(theme)} />
<WalletsStack.Screen name="RBFBumpFee" component={RBFBumpFee} options={RBFBumpFee.navigationOptions(theme)} />
<WalletsStack.Screen name="RBFCancel" component={RBFCancel} options={RBFCancel.navigationOptions(theme)} />
<WalletsStack.Screen name="Settings" component={Settings} options={Settings.navigationOptions(theme)} />
<WalletsStack.Screen name="SelectWallet" component={SelectWallet} options={SelectWallet.navigationOptions(theme)} />
2024-02-27 04:04:51 +01:00
<WalletsStack.Screen name="Currency" component={Currency} options={navigationStyle({ title: loc.settings.currency })(theme)} />
2020-12-25 17:09:53 +01:00
<WalletsStack.Screen name="About" component={About} options={About.navigationOptions(theme)} />
<WalletsStack.Screen name="ReleaseNotes" component={ReleaseNotes} options={ReleaseNotes.navigationOptions(theme)} />
<WalletsStack.Screen name="Selftest" component={Selftest} options={Selftest.navigationOptions(theme)} />
<WalletsStack.Screen name="Licensing" component={Licensing} options={Licensing.navigationOptions(theme)} />
<WalletsStack.Screen name="DefaultView" component={DefaultView} options={DefaultView.navigationOptions(theme)} />
2024-02-27 04:04:51 +01:00
<WalletsStack.Screen name="Language" component={Language} options={navigationStyle({ title: loc.settings.language })(theme)} />
2020-12-25 17:09:53 +01:00
<WalletsStack.Screen name="EncryptStorage" component={EncryptStorage} options={EncryptStorage.navigationOptions(theme)} />
2024-02-27 04:04:51 +01:00
<WalletsStack.Screen
name="GeneralSettings"
component={GeneralSettings}
options={navigationStyle({ title: loc.settings.general })(theme)}
/>
2020-12-25 17:09:53 +01:00
<WalletsStack.Screen name="NetworkSettings" component={NetworkSettings} options={NetworkSettings.navigationOptions(theme)} />
<WalletsStack.Screen
name="NotificationSettings"
component={NotificationSettings}
options={NotificationSettings.navigationOptions(theme)}
/>
<WalletsStack.Screen
name="PlausibleDeniability"
component={PlausibleDeniability}
2024-02-27 04:14:17 +01:00
options={navigationStyle({ title: loc.plausibledeniability.title })(theme)}
2020-12-25 17:09:53 +01:00
/>
<WalletsStack.Screen name="LightningSettings" component={LightningSettings} options={LightningSettings.navigationOptions(theme)} />
<WalletsStack.Screen name="ElectrumSettings" component={ElectrumSettings} options={ElectrumSettings.navigationOptions(theme)} />
<WalletsStack.Screen name="SettingsPrivacy" component={SettingsPrivacy} options={SettingsPrivacy.navigationOptions(theme)} />
<WalletsStack.Screen name="Tools" component={Tools} options={Tools.navigationOptions(theme)} />
2020-12-25 17:09:53 +01:00
<WalletsStack.Screen name="LNDViewInvoice" component={LNDViewInvoice} options={LNDViewInvoice.navigationOptions(theme)} />
<WalletsStack.Screen
name="LNDViewAdditionalInvoiceInformation"
component={LNDViewAdditionalInvoiceInformation}
options={LNDViewAdditionalInvoiceInformation.navigationOptions(theme)}
/>
<WalletsStack.Screen
name="LNDViewAdditionalInvoicePreImage"
component={LNDViewAdditionalInvoicePreImage}
options={LNDViewAdditionalInvoicePreImage.navigationOptions(theme)}
/>
<WalletsStack.Screen name="Broadcast" component={Broadcast} options={Broadcast.navigationOptions(theme)} />
<WalletsStack.Screen name="IsItMyAddress" component={IsItMyAddress} options={IsItMyAddress.navigationOptions(theme)} />
<WalletsStack.Screen name="GenerateWord" component={GenerateWord} options={GenerateWord.navigationOptions(theme)} />
2020-12-25 17:09:53 +01:00
<WalletsStack.Screen name="LnurlPay" component={LnurlPay} options={LnurlPay.navigationOptions(theme)} />
<WalletsStack.Screen name="LnurlPaySuccess" component={LnurlPaySuccess} options={LnurlPaySuccess.navigationOptions(theme)} />
2022-02-11 15:18:56 +01:00
<WalletsStack.Screen name="LnurlAuth" component={LnurlAuth} options={LnurlAuth.navigationOptions(theme)} />
2020-12-25 17:09:53 +01:00
<WalletsStack.Screen
name="Success"
component={Success}
options={{
headerShown: false,
gestureEnabled: false,
}}
/>
2021-04-16 16:05:25 +02:00
<WalletsStack.Screen name="WalletAddresses" component={WalletAddresses} options={WalletAddresses.navigationOptions(theme)} />
2020-12-25 17:09:53 +01:00
</WalletsStack.Navigator>
);
};
2020-05-27 13:12:17 +02:00
2021-09-13 19:43:26 +02:00
const AddWalletStack = createNativeStackNavigator();
2020-12-25 17:09:53 +01:00
const AddWalletRoot = () => {
const theme = useTheme();
return (
2023-11-11 12:33:50 +01:00
<AddWalletStack.Navigator screenOptions={{ headerShadowVisible: false }}>
2024-02-24 12:27:17 +01:00
<AddWalletStack.Screen
name="AddWallet"
component={AddWallet}
2024-02-27 04:04:51 +01:00
options={navigationStyle({
closeButton: true,
headerBackVisible: false,
title: loc.wallets.add_title,
})(theme)}
2024-02-24 12:27:17 +01:00
/>
2020-12-25 17:09:53 +01:00
<AddWalletStack.Screen name="ImportWallet" component={ImportWallet} options={ImportWallet.navigationOptions(theme)} />
<AddWalletStack.Screen
name="ImportWalletDiscovery"
component={ImportWalletDiscovery}
options={ImportWalletDiscovery.navigationOptions(theme)}
/>
<AddWalletStack.Screen
name="ImportCustomDerivationPath"
component={ImportCustomDerivationPath}
options={ImportCustomDerivationPath.navigationOptions(theme)}
/>
<AddWalletStack.Screen name="ImportSpeed" component={ImportSpeed} options={ImportSpeed.navigationOptions(theme)} />
2024-02-24 12:27:17 +01:00
<AddWalletStack.Screen
name="PleaseBackup"
component={PleaseBackup}
2024-02-27 04:04:51 +01:00
options={navigationStyle({
gestureEnabled: false,
headerBackVisible: false,
title: loc.pleasebackup.title,
})(theme)}
2024-02-24 12:27:17 +01:00
/>
2020-12-25 17:09:53 +01:00
<AddWalletStack.Screen
name="PleaseBackupLNDHub"
component={PleaseBackupLNDHub}
options={PleaseBackupLNDHub.navigationOptions(theme)}
/>
2021-09-09 13:00:11 +02:00
<AddWalletStack.Screen name="PleaseBackupLdk" component={PleaseBackupLdk} options={PleaseBackupLdk.navigationOptions(theme)} />
2020-12-25 17:09:53 +01:00
<AddWalletStack.Screen name="ProvideEntropy" component={ProvideEntropy} options={ProvideEntropy.navigationOptions(theme)} />
<AddWalletStack.Screen
name="WalletsAddMultisig"
component={WalletsAddMultisig}
options={WalletsAddMultisig.navigationOptions(theme)}
2023-12-16 20:18:53 +01:00
initialParams={WalletsAddMultisig.initialParams}
2020-12-25 17:09:53 +01:00
/>
<AddWalletStack.Screen
name="WalletsAddMultisigStep2"
component={WalletsAddMultisigStep2}
options={WalletsAddMultisigStep2.navigationOptions(theme)}
/>
<AddWalletStack.Screen
name="WalletsAddMultisigHelp"
component={WalletsAddMultisigHelp}
2023-12-17 16:05:00 +01:00
options={WalletAddMultisigHelpNavigationOptions}
2020-12-25 17:09:53 +01:00
/>
</AddWalletStack.Navigator>
);
};
2020-05-27 13:12:17 +02:00
// CreateTransactionStackNavigator === SendDetailsStack
2021-09-13 19:43:26 +02:00
const SendDetailsStack = createNativeStackNavigator();
2020-12-25 17:09:53 +01:00
const SendDetailsRoot = () => {
const theme = useTheme();
return (
2023-11-11 12:33:50 +01:00
<SendDetailsStack.Navigator screenOptions={{ headerShadowVisible: false }}>
<SendDetailsStack.Screen
name="SendDetails"
component={SendDetails}
options={SendDetails.navigationOptions(theme)}
initialParams={SendDetails.initialParams}
/>
2020-12-25 17:09:53 +01:00
<SendDetailsStack.Screen name="Confirm" component={Confirm} options={Confirm.navigationOptions(theme)} />
<SendDetailsStack.Screen
name="PsbtWithHardwareWallet"
component={PsbtWithHardwareWallet}
options={PsbtWithHardwareWallet.navigationOptions(theme)}
/>
<SendDetailsStack.Screen name="CreateTransaction" component={SendCreate} options={SendCreate.navigationOptions(theme)} />
<SendDetailsStack.Screen name="PsbtMultisig" component={PsbtMultisig} options={PsbtMultisig.navigationOptions(theme)} />
<SendDetailsStack.Screen
name="PsbtMultisigQRCode"
component={PsbtMultisigQRCode}
options={PsbtMultisigQRCode.navigationOptions(theme)}
/>
<SendDetailsStack.Screen
name="Success"
component={Success}
options={{
headerShown: false,
gestureEnabled: false,
}}
/>
<SendDetailsStack.Screen name="SelectWallet" component={SelectWallet} options={SelectWallet.navigationOptions(theme)} />
<SendDetailsStack.Screen name="CoinControl" component={CoinControl} options={CoinControl.navigationOptions(theme)} />
</SendDetailsStack.Navigator>
);
};
2020-05-27 13:12:17 +02:00
2021-09-13 19:43:26 +02:00
const LNDCreateInvoiceStack = createNativeStackNavigator();
2020-12-25 17:09:53 +01:00
const LNDCreateInvoiceRoot = () => {
const theme = useTheme();
return (
2023-11-11 12:33:50 +01:00
<LNDCreateInvoiceStack.Navigator screenOptions={{ headerShadowVisible: false }}>
2020-12-25 17:09:53 +01:00
<LNDCreateInvoiceStack.Screen
name="LNDCreateInvoice"
component={LNDCreateInvoice}
options={LNDCreateInvoice.navigationOptions(theme)}
/>
<LNDCreateInvoiceStack.Screen name="SelectWallet" component={SelectWallet} options={SelectWallet.navigationOptions(theme)} />
<LNDCreateInvoiceStack.Screen name="LNDViewInvoice" component={LNDViewInvoice} options={LNDViewInvoice.navigationOptions(theme)} />
<LNDCreateInvoiceStack.Screen
name="LNDViewAdditionalInvoiceInformation"
component={LNDViewAdditionalInvoiceInformation}
options={LNDViewAdditionalInvoiceInformation.navigationOptions(theme)}
/>
<LNDCreateInvoiceStack.Screen
name="LNDViewAdditionalInvoicePreImage"
component={LNDViewAdditionalInvoicePreImage}
options={LNDViewAdditionalInvoicePreImage.navigationOptions(theme)}
/>
</LNDCreateInvoiceStack.Navigator>
);
};
2020-05-27 13:12:17 +02:00
// LightningScanInvoiceStackNavigator === ScanLndInvoiceStack
2021-09-13 19:43:26 +02:00
const ScanLndInvoiceStack = createNativeStackNavigator();
2020-12-25 17:09:53 +01:00
const ScanLndInvoiceRoot = () => {
const theme = useTheme();
return (
2023-11-11 12:33:50 +01:00
<ScanLndInvoiceStack.Navigator screenOptions={{ headerShadowVisible: false }}>
2024-01-12 14:10:48 +01:00
<ScanLndInvoiceStack.Screen
name="ScanLndInvoice"
component={ScanLndInvoice}
options={ScanLndInvoice.navigationOptions(theme)}
initialParams={ScanLndInvoice.initialParams}
/>
2020-12-25 17:09:53 +01:00
<ScanLndInvoiceStack.Screen name="SelectWallet" component={SelectWallet} options={SelectWallet.navigationOptions(theme)} />
<ScanLndInvoiceStack.Screen name="Success" component={Success} options={{ headerShown: false, gestureEnabled: false }} />
<ScanLndInvoiceStack.Screen name="LnurlPay" component={LnurlPay} options={LnurlPay.navigationOptions(theme)} />
<ScanLndInvoiceStack.Screen name="LnurlPaySuccess" component={LnurlPaySuccess} options={LnurlPaySuccess.navigationOptions(theme)} />
</ScanLndInvoiceStack.Navigator>
);
};
2020-05-27 13:12:17 +02:00
2021-09-30 13:33:50 +02:00
const LDKOpenChannelStack = createNativeStackNavigator();
const LDKOpenChannelRoot = () => {
const theme = useTheme();
return (
2024-02-24 12:27:17 +01:00
<LDKOpenChannelStack.Navigator id="LDKOpenChannelRoot" screenOptions={{ headerShadowVisible: false }} initialRouteName="SelectWallet">
2021-09-30 13:33:50 +02:00
<LDKOpenChannelStack.Screen name="SelectWallet" component={SelectWallet} options={SelectWallet.navigationOptions(theme)} />
<LDKOpenChannelStack.Screen
name="LDKOpenChannelSetAmount"
component={LdkOpenChannel}
options={LdkOpenChannel.navigationOptions(theme)}
/>
<LDKOpenChannelStack.Screen name="Success" component={Success} options={{ headerShown: false, gestureEnabled: false }} />
</LDKOpenChannelStack.Navigator>
);
};
2021-09-13 19:43:26 +02:00
const AztecoRedeemStack = createNativeStackNavigator();
2020-12-25 17:09:53 +01:00
const AztecoRedeemRoot = () => {
const theme = useTheme();
return (
2023-11-11 12:33:50 +01:00
<AztecoRedeemStack.Navigator screenOptions={{ headerShadowVisible: false }}>
2020-12-25 17:09:53 +01:00
<AztecoRedeemStack.Screen name="AztecoRedeem" component={AztecoRedeem} options={AztecoRedeem.navigationOptions(theme)} />
2021-09-13 19:43:26 +02:00
<AztecoRedeemStack.Screen name="SelectWallet" component={SelectWallet} />
2020-12-25 17:09:53 +01:00
</AztecoRedeemStack.Navigator>
);
};
2021-09-13 19:43:26 +02:00
const ScanQRCodeStack = createNativeStackNavigator();
2020-05-30 07:30:43 +02:00
const ScanQRCodeRoot = () => (
2024-01-09 16:40:29 +01:00
<ScanQRCodeStack.Navigator
initialRouteName="ScanQRCode"
2024-02-24 12:27:17 +01:00
id="ScanQRCodeRoot"
2024-01-09 16:40:29 +01:00
screenOptions={{ headerShown: false, presentation: 'fullScreenModal' }}
>
2024-01-07 14:43:38 +01:00
<ScanQRCodeStack.Screen name="ScanQRCode" component={ScanQRCode} initialParams={ScanQRCode.initialParams} />
2020-05-30 07:30:43 +02:00
</ScanQRCodeStack.Navigator>
);
2021-09-13 19:43:26 +02:00
const UnlockWithScreenStack = createNativeStackNavigator();
const UnlockWithScreenRoot = () => (
2024-03-13 18:29:20 +01:00
<UnlockWithScreenStack.Navigator
id="UnlockWithScreenRoot"
screenOptions={{ headerShown: false, statusBarStyle: 'auto', autoHideHomeIndicator: true }}
>
<UnlockWithScreenStack.Screen name="UnlockWithScreen" component={UnlockWith} />
</UnlockWithScreenStack.Navigator>
);
2021-09-13 19:43:26 +02:00
const ReorderWalletsStack = createNativeStackNavigator();
2020-12-25 17:09:53 +01:00
const ReorderWalletsStackRoot = () => {
const theme = useTheme();
return (
2024-02-24 12:27:17 +01:00
<ReorderWalletsStack.Navigator id="ReorderWalletsRoot" screenOptions={{ headerShadowVisible: false }}>
2024-01-01 19:16:37 +01:00
<ReorderWalletsStack.Screen
name="ReorderWalletsScreen"
component={ReorderWallets}
options={ReorderWallets.navigationOptions(theme)}
/>
2020-12-25 17:09:53 +01:00
</ReorderWalletsStack.Navigator>
);
};
2020-09-16 02:48:24 +02:00
const Drawer = createDrawerNavigator();
const DrawerRoot = () => {
const dimensions = useWindowDimensions();
const isLargeScreen = useMemo(() => {
return Platform.OS === 'android' ? isTablet() : (dimensions.width >= Dimensions.get('screen').width / 2 && isTablet()) || isDesktop;
}, [dimensions.width]);
2024-02-24 12:27:17 +01:00
const drawerStyle: DrawerNavigationOptions = useMemo(
() => ({
drawerPosition: I18nManager.isRTL ? 'right' : 'left',
drawerStyle: { width: isLargeScreen ? 320 : '0%' },
drawerType: isLargeScreen ? 'permanent' : 'back',
}),
[isLargeScreen],
);
return (
2024-02-24 12:27:17 +01:00
<Drawer.Navigator screenOptions={drawerStyle} drawerContent={DrawerList}>
<Drawer.Screen
name="Navigation"
component={Navigation}
options={{ headerShown: false, gestureHandlerProps: { enableTrackpadTwoFingerGesture: false } }}
/>
</Drawer.Navigator>
);
};
2021-09-13 19:43:26 +02:00
const ReceiveDetailsStack = createNativeStackNavigator();
2020-12-25 17:09:53 +01:00
const ReceiveDetailsStackRoot = () => {
const theme = useTheme();
return (
2024-02-24 12:27:17 +01:00
<ReceiveDetailsStack.Navigator id="ReceiveDetailsRoot" screenOptions={{ headerShadowVisible: false }} initialRouteName="ReceiveDetails">
<ReceiveDetailsStack.Screen name="ReceiveDetails" component={ReceiveDetails} options={ReceiveDetails.navigationOptions(theme)} />
2020-12-25 17:09:53 +01:00
</ReceiveDetailsStack.Navigator>
);
};
2021-09-13 19:43:26 +02:00
const WalletXpubStack = createNativeStackNavigator();
2020-12-25 17:09:53 +01:00
const WalletXpubStackRoot = () => {
2024-02-27 04:04:51 +01:00
const theme = useTheme();
2020-12-25 17:09:53 +01:00
return (
2023-10-20 04:12:08 +02:00
<WalletXpubStack.Navigator
2024-02-24 12:27:17 +01:00
id="WalletXpubRoot"
2023-11-11 12:33:50 +01:00
screenOptions={{ headerShadowVisible: false, statusBarStyle: 'light' }}
2023-10-20 04:12:08 +02:00
initialRouteName="WalletXpub"
>
2024-02-24 12:27:17 +01:00
<WalletXpubStack.Screen
name="WalletXpub"
component={WalletXpub}
2024-02-27 04:04:51 +01:00
options={navigationStyle({
closeButton: true,
2024-02-24 12:27:17 +01:00
headerBackVisible: false,
headerTitle: loc.wallets.xpub_title,
2024-02-27 04:04:51 +01:00
})(theme)}
2024-02-24 12:27:17 +01:00
/>
2020-12-25 17:09:53 +01:00
</WalletXpubStack.Navigator>
);
};
2021-09-13 19:43:26 +02:00
const SignVerifyStack = createNativeStackNavigator();
2021-03-23 13:16:32 +01:00
const SignVerifyStackRoot = () => {
const theme = useTheme();
return (
2023-10-20 04:12:08 +02:00
<SignVerifyStack.Navigator
2024-02-24 12:27:17 +01:00
id="SignVerifyRoot"
2023-11-11 12:33:50 +01:00
screenOptions={{ headerShadowVisible: false, statusBarStyle: 'light' }}
2023-10-20 04:12:08 +02:00
initialRouteName="SignVerify"
>
2021-03-23 13:16:32 +01:00
<SignVerifyStack.Screen name="SignVerify" component={SignVerify} options={SignVerify.navigationOptions(theme)} />
</SignVerifyStack.Navigator>
);
};
2021-09-13 19:43:26 +02:00
const WalletExportStack = createNativeStackNavigator();
2020-12-25 17:09:53 +01:00
const WalletExportStackRoot = () => {
const theme = useTheme();
return (
2023-10-20 04:28:49 +02:00
<WalletExportStack.Navigator
2024-02-24 12:27:17 +01:00
id="WalletExportRoot"
2023-11-11 12:33:50 +01:00
screenOptions={{ headerShadowVisible: false, statusBarStyle: 'light' }}
2023-10-20 04:28:49 +02:00
initialRouteName="WalletExport"
>
2020-12-25 17:09:53 +01:00
<WalletExportStack.Screen name="WalletExport" component={WalletExport} options={WalletExport.navigationOptions(theme)} />
</WalletExportStack.Navigator>
);
};
2021-09-13 19:43:26 +02:00
const LappBrowserStack = createNativeStackNavigator();
2020-12-25 17:09:53 +01:00
const LappBrowserStackRoot = () => {
const theme = useTheme();
return (
2024-02-24 12:27:17 +01:00
<LappBrowserStack.Navigator id="LappBrowserRoot" screenOptions={{ headerShadowVisible: false }} initialRouteName="LappBrowser">
2020-12-25 17:09:53 +01:00
<LappBrowserStack.Screen name="LappBrowser" component={LappBrowser} options={LappBrowser.navigationOptions(theme)} />
</LappBrowserStack.Navigator>
);
};
2021-09-13 19:43:26 +02:00
const InitStack = createNativeStackNavigator();
2024-03-07 16:55:20 +01:00
const InitRoot = () => {
const { walletsInitialized } = useContext(BlueStorageContext);
return (
<InitStack.Navigator initialRouteName="UnlockWithScreenRoot" screenOptions={{ animationTypeForReplace: 'push' }}>
{!walletsInitialized ? (
<InitStack.Screen name="UnlockWithScreenRoot" component={UnlockWithScreenRoot} options={{ headerShown: false }} />
) : (
<InitStack.Screen
name={isHandset ? 'Navigation' : 'DrawerRoot'}
component={isHandset ? Navigation : DrawerRoot}
options={{ headerShown: false }}
/>
)}
</InitStack.Navigator>
);
};
2024-02-24 12:27:17 +01:00
export type ViewEditMultisigCosignersStackParamsList = {
ViewEditMultisigCosigners: { walletId: string };
};
const ViewEditMultisigCosignersStack = createNativeStackNavigator<ViewEditMultisigCosignersStackParamsList>();
2020-12-25 17:09:53 +01:00
const ViewEditMultisigCosignersRoot = () => {
const theme = useTheme();
return (
<ViewEditMultisigCosignersStack.Navigator
2024-02-24 12:27:17 +01:00
id="ViewEditMultisigCosignersRoot"
2020-12-25 17:09:53 +01:00
initialRouteName="ViewEditMultisigCosigners"
2023-11-11 12:33:50 +01:00
screenOptions={{ headerShadowVisible: false, statusBarStyle: 'light' }}
2020-12-25 17:09:53 +01:00
>
<ViewEditMultisigCosignersStack.Screen
name="ViewEditMultisigCosigners"
component={ViewEditMultisigCosigners}
options={ViewEditMultisigCosigners.navigationOptions(theme)}
/>
</ViewEditMultisigCosignersStack.Navigator>
);
};
2020-12-12 01:27:43 +01:00
2021-09-13 19:43:26 +02:00
const ExportMultisigCoordinationSetupStack = createNativeStackNavigator();
2020-12-25 17:09:53 +01:00
const ExportMultisigCoordinationSetupRoot = () => {
const theme = useTheme();
2020-12-25 17:09:53 +01:00
return (
<ExportMultisigCoordinationSetupStack.Navigator
2024-02-24 12:27:17 +01:00
id="ExportMultisigCoordinationSetupRoot"
2020-12-25 17:09:53 +01:00
initialRouteName="ExportMultisigCoordinationSetup"
2023-11-11 12:33:50 +01:00
screenOptions={{ headerShadowVisible: false, statusBarStyle: 'light' }}
2020-12-25 17:09:53 +01:00
>
<ExportMultisigCoordinationSetupStack.Screen
name="ExportMultisigCoordinationSetup"
component={ExportMultisigCoordinationSetup}
options={ExportMultisigCoordinationSetup.navigationOptions(theme)}
/>
</ExportMultisigCoordinationSetupStack.Navigator>
);
};
2024-02-24 12:27:17 +01:00
export type PaymentCodeStackParamList = {
PaymentCode: { paymentCode: string };
PaymentCodesList: { walletID: string };
};
const PaymentCodeStack = createNativeStackNavigator<PaymentCodeStackParamList>();
2022-12-07 03:43:54 +01:00
const PaymentCodeStackRoot = () => {
return (
2024-02-24 12:27:17 +01:00
<PaymentCodeStack.Navigator id="PaymentCodeRoot" screenOptions={{ headerShadowVisible: false }} initialRouteName="PaymentCode">
2023-02-10 02:44:58 +01:00
<PaymentCodeStack.Screen name="PaymentCode" component={PaymentCode} options={{ headerTitle: loc.bip47.payment_code }} />
2023-03-15 21:42:25 +01:00
<PaymentCodeStack.Screen
name="PaymentCodesList"
component={PaymentCodesList}
options={{ headerTitle: loc.bip47.payment_codes_list }}
/>
2022-12-07 03:43:54 +01:00
</PaymentCodeStack.Navigator>
);
};
2021-09-13 19:43:26 +02:00
const RootStack = createNativeStackNavigator();
2024-02-24 12:27:17 +01:00
const NavigationDefaultOptions: NativeStackNavigationOptions = { headerShown: false, presentation: 'modal' };
const NavigationFormModalOptions: NativeStackNavigationOptions = {
headerShown: false,
presentation: 'formSheet',
};
const StatusBarLightOptions: NativeStackNavigationOptions = { statusBarStyle: 'light' };
2020-12-25 17:09:53 +01:00
const Navigation = () => {
return (
2024-02-24 12:27:17 +01:00
<RootStack.Navigator initialRouteName="UnlockWithScreenRoot" screenOptions={{ headerShadowVisible: false, statusBarStyle: 'auto' }}>
2020-12-25 17:09:53 +01:00
{/* stacks */}
2024-02-24 12:27:17 +01:00
<RootStack.Screen name="WalletsRoot" component={WalletsRoot} options={{ headerShown: false, statusBarTranslucent: false }} />
<RootStack.Screen name="AddWalletRoot" component={AddWalletRoot} options={NavigationFormModalOptions} />
2021-09-13 19:43:26 +02:00
<RootStack.Screen name="SendDetailsRoot" component={SendDetailsRoot} options={NavigationDefaultOptions} />
<RootStack.Screen name="LNDCreateInvoiceRoot" component={LNDCreateInvoiceRoot} options={NavigationDefaultOptions} />
<RootStack.Screen name="ScanLndInvoiceRoot" component={ScanLndInvoiceRoot} options={NavigationDefaultOptions} />
<RootStack.Screen name="AztecoRedeemRoot" component={AztecoRedeemRoot} options={NavigationDefaultOptions} />
2020-12-25 17:09:53 +01:00
{/* screens */}
2023-10-20 04:28:49 +02:00
<RootStack.Screen
name="WalletExportRoot"
component={WalletExportStackRoot}
2023-10-20 16:58:20 +02:00
options={{ ...NavigationDefaultOptions, ...StatusBarLightOptions }}
2023-10-20 04:28:49 +02:00
/>
2020-12-25 17:09:53 +01:00
<RootStack.Screen
name="ExportMultisigCoordinationSetupRoot"
component={ExportMultisigCoordinationSetupRoot}
options={NavigationDefaultOptions}
2020-12-25 17:09:53 +01:00
/>
2023-10-20 04:12:08 +02:00
<RootStack.Screen
name="ViewEditMultisigCosignersRoot"
component={ViewEditMultisigCosignersRoot}
2023-10-20 16:58:20 +02:00
options={{ ...NavigationDefaultOptions, ...StatusBarLightOptions }}
2023-10-20 04:12:08 +02:00
/>
<RootStack.Screen
name="WalletXpubRoot"
component={WalletXpubStackRoot}
2023-10-20 16:58:20 +02:00
options={{ ...NavigationDefaultOptions, ...StatusBarLightOptions }}
2023-10-20 04:12:08 +02:00
/>
<RootStack.Screen
name="SignVerifyRoot"
component={SignVerifyStackRoot}
2023-10-20 16:58:20 +02:00
options={{ ...NavigationDefaultOptions, ...StatusBarLightOptions }}
2023-10-20 04:12:08 +02:00
/>
2021-09-13 19:43:26 +02:00
<RootStack.Screen name="SelectWallet" component={SelectWallet} />
<RootStack.Screen name="ReceiveDetailsRoot" component={ReceiveDetailsStackRoot} options={NavigationDefaultOptions} />
<RootStack.Screen name="LappBrowserRoot" component={LappBrowserStackRoot} options={NavigationDefaultOptions} />
2021-09-30 13:33:50 +02:00
<RootStack.Screen name="LDKOpenChannelRoot" component={LDKOpenChannelRoot} options={NavigationDefaultOptions} />
2020-12-25 17:09:53 +01:00
<RootStack.Screen
name="ScanQRCodeRoot"
component={ScanQRCodeRoot}
options={{
headerShown: false,
2024-01-04 19:47:17 +01:00
presentation: 'fullScreenModal',
2023-10-20 03:54:19 +02:00
statusBarHidden: true,
2020-12-25 17:09:53 +01:00
}}
initialParams={ScanQRCode.initialParams}
2020-12-25 17:09:53 +01:00
/>
2022-12-07 03:43:54 +01:00
<RootStack.Screen name="PaymentCodeRoot" component={PaymentCodeStackRoot} options={NavigationDefaultOptions} />
2024-03-07 16:55:20 +01:00
<InitStack.Screen
name="ReorderWallets"
component={ReorderWalletsStackRoot}
options={{
headerShown: false,
gestureEnabled: false,
presentation: 'modal',
}}
/>
2020-12-25 17:09:53 +01:00
</RootStack.Navigator>
);
};
2020-05-27 13:12:17 +02:00
export default InitRoot;