Skip to content

Commit

Permalink
handleAnything: handle iterator bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kaloudis committed Mar 4, 2023
1 parent 2f4004b commit b4dfd97
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
11 changes: 11 additions & 0 deletions utils/handleAnything.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,17 @@ const handleAnything = async (
} else if (!!findlnurl(value) || !!lnurl) {
const raw: string = findlnurl(value) || lnurl || '';
return getlnurlParams(raw).then((params: any) => {
if (params.domain.endsWith('.onion')) {
// placeholder before we try to fetch params with Tor
throw new Error(
params.status === 'ERROR'
? `${params.domain} says: ${params.reason}`
: `${localeString(
'utils.handleAnything.unsupportedLnurlType'
)}: ${params.tag}`
);
}

switch (params.tag) {
case 'withdrawRequest':
if (isClipboardValue) return true;
Expand Down
4 changes: 2 additions & 2 deletions views/Send.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ export default class Send extends React.Component<SendProps, SendState> {
handleAnything(text, this.state.amount)
.then((response) => {
try {
const [route, props] = response;
navigation.navigate(route, props);
if (response)
navigation.navigate(response.route, response.props);
} catch {
this.setState({
loading: false,
Expand Down
8 changes: 6 additions & 2 deletions views/handleAnythingQRScanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,15 @@ export default class handleAnythingQRScanner extends React.Component<
loading: true
});
handleAnything(data)
.then(([route, props]) => {
.then((response) => {
this.setState({
loading: false
});
navigation.navigate(route, props);
if (response) {
navigation.navigate(response.route, response.props);
} else {
navigation.navigate('Send');
}
})
.catch((err) => {
Alert.alert(
Expand Down

0 comments on commit b4dfd97

Please sign in to comment.