From 987a7825ed8db14c513423b9fa1b1fd36abe301f Mon Sep 17 00:00:00 2001 From: First-Terraner Date: Wed, 27 Mar 2024 22:29:48 +0100 Subject: [PATCH] fix going back from amount selection screen --- src/model/nav.ts | 2 ++ src/screens/Payment/SelectAmount.tsx | 4 ++-- src/screens/QRScan/QRProcessing.tsx | 8 +++++--- src/screens/QRScan/index.tsx | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/model/nav.ts b/src/model/nav.ts index 32776652..a4d7c007 100644 --- a/src/model/nav.ts +++ b/src/model/nav.ts @@ -83,6 +83,7 @@ export type RootStackParamList = { balance: number lnurl?: ILnurlNavData targetMint?: IMintUrl + scanned?: boolean } selectNostrAmount: { mint: IMintUrl @@ -125,6 +126,7 @@ export type RootStackParamList = { 'qr processing': { tokenInfo?: ITokenInfo token?: string + scanned?: boolean ln?: { invoice: string mint?: IMintUrl diff --git a/src/screens/Payment/SelectAmount.tsx b/src/screens/Payment/SelectAmount.tsx index 63dd1e25..47132420 100644 --- a/src/screens/Payment/SelectAmount.tsx +++ b/src/screens/Payment/SelectAmount.tsx @@ -22,7 +22,7 @@ import { Animated, KeyboardAvoidingView, TextInput, View } from 'react-native' import { s, ScaledSheet, vs } from 'react-native-size-matters' export default function SelectAmountScreen({ navigation, route }: TSelectAmountPageProps) { - const { mint, balance, lnurl, isMelt, isSendEcash, nostr, isSwap, targetMint } = route.params + const { mint, balance, lnurl, isMelt, isSendEcash, nostr, isSwap, targetMint, scanned } = route.params const { openPromptAutoClose } = usePromptContext() const { t } = useTranslation([NS.wallet]) const { color, highlight } = useThemeContext() @@ -171,7 +171,7 @@ export default function SelectAmountScreen({ navigation, route }: TSelectAmountP navigation.goBack()} + handlePress={() => scanned ? navigation.navigate('qr scan', {}) : navigation.goBack()} mintBalance={balance} disableMintBalance={isMelt || isSwap} handleMintBalancePress={() => setAmount(`${balance}`)} diff --git a/src/screens/QRScan/QRProcessing.tsx b/src/screens/QRScan/QRProcessing.tsx index 6b1dca6a..e65dbb43 100644 --- a/src/screens/QRScan/QRProcessing.tsx +++ b/src/screens/QRScan/QRProcessing.tsx @@ -20,7 +20,7 @@ import { ScaledSheet } from 'react-native-size-matters' export default function QRProcessingScreen({ navigation, route }: TQRProcessingPageProps) { const { t } = useTranslation([NS.mints]) const { color } = useThemeContext() - const { tokenInfo, token, ln, lnurl } = route.params + const { tokenInfo, token, ln, lnurl, scanned } = route.params const getProcessingtxt = () => { if (token && tokenInfo) { return 'claiming' } @@ -84,6 +84,7 @@ export default function QRProcessingScreen({ navigation, route }: TQRProcessingP mint: lnurl?.mint, balance: lnurl?.balance, isMelt: true, + scanned, lnurl: { userInput: lnurl.data, url: lnurl.url, @@ -103,7 +104,7 @@ export default function QRProcessingScreen({ navigation, route }: TQRProcessingP mintsWithBal, isMelt: true, allMintsEmpty: true, - scanned: true, + scanned, lnurl: { userInput: lnurl.data, url: lnurl.url, @@ -129,6 +130,7 @@ export default function QRProcessingScreen({ navigation, route }: TQRProcessingP mint: nonEmptyMint[0], balance: nonEmptyMint[0].amount, isMelt: true, + scanned, lnurl: { userInput: lnurl.data, url: lnurl.url, @@ -143,7 +145,7 @@ export default function QRProcessingScreen({ navigation, route }: TQRProcessingP mintsWithBal, allMintsEmpty: !nonEmptyMint.length, isMelt: true, - scanned: true, + scanned, lnurl: { userInput: lnurl.data, url: lnurl.url, diff --git a/src/screens/QRScan/index.tsx b/src/screens/QRScan/index.tsx index 953c9a22..63dfdf5f 100644 --- a/src/screens/QRScan/index.tsx +++ b/src/screens/QRScan/index.tsx @@ -120,7 +120,7 @@ export default function QRScanPage({ navigation, route }: TQRScanPageProps) { if (!decoded) { return openPromptAutoClose({ msg: t('unknownType') + ` - decoded LNURL: "${decoded}"` }) } - return navigation.navigate('qr processing', { lnurl: { data, mint, balance, url: decoded } }) + return navigation.navigate('qr processing', { lnurl: { data, mint, balance, url: decoded }, scanned: true }) } // handle LN invoice try {