Skip to content

Commit

Permalink
fix: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
reneaaron committed Sep 18, 2024
1 parent ac12662 commit 4ef17b3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
7 changes: 6 additions & 1 deletion hooks/useHandleLinking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ export function useHandleLinking() {
url: currentUrl,
},
});
break;
return;
}
}

// Code below here is only executed if the link could not be handled
router.replace({
pathname: "/",
});
}, [url, hasNavigationState]);
}
1 change: 0 additions & 1 deletion pages/Wildcard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export function Wildcard() {
/>
<Loading />
<Text>Loading</Text>
<Text className="text-muted-foreground">{pathname}</Text>
</View>
);
}
5 changes: 3 additions & 2 deletions pages/send/LNURLPay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ import { DualCurrencyInput } from "~/components/DualCurrencyInput";
import DismissableKeyboardView from "~/components/DismissableKeyboardView";

export function LNURLPay() {
const { lnurlDetailsJSON, originalText } =
const { lnurlDetailsJSON, originalText, humanReadablePaymentInfo } =
useLocalSearchParams() as unknown as {
lnurlDetailsJSON: string;
originalText: string;
humanReadablePaymentInfo: string;
};
const lnurlDetails: LNURLPayServiceResponse = JSON.parse(lnurlDetailsJSON);
const [isLoading, setLoading] = React.useState(false);
Expand Down Expand Up @@ -72,7 +73,7 @@ export function LNURLPay() {
To
</Text>
<Text className="text-center text-foreground text-2xl font-medium2">
{originalText.toLowerCase().replace("lightning:", "")}
{humanReadablePaymentInfo}
</Text>
</View>
</View>
Expand Down
9 changes: 8 additions & 1 deletion pages/send/Send.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export function Send() {
}
console.log("loading payment", text);
const originalText = text;
let humanReadablePaymentInfo = text;
setLoading(true);
try {
if (text.startsWith("bitcoin:")) {
Expand All @@ -88,6 +89,7 @@ export function Send() {
if (text.startsWith("lightning:")) {
text = text.substring("lightning:".length);
}

const lnurlValue = lnurl.findLnurl(text);
console.log("Checked lnurl value", text, lnurlValue);
if (lnurlValue) {
Expand All @@ -97,24 +99,29 @@ export function Send() {
throw new Error("LNURL tag " + lnurlDetails.tag + " not supported");
}

humanReadablePaymentInfo = lnurlValue;

router.replace({
pathname: "/send/lnurl-pay",
params: {
lnurlDetailsJSON: JSON.stringify(lnurlDetails),
originalText,
humanReadablePaymentInfo
},
});

return true;
} else {
humanReadablePaymentInfo = text;

// Check if this is a valid invoice
new Invoice({
pr: text,
});

router.replace({
pathname: "/send/confirm",
params: { invoice: text, originalText },
params: { invoice: text, originalText, humanReadablePaymentInfo },
});

return true;
Expand Down

0 comments on commit 4ef17b3

Please sign in to comment.