mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-26 08:55:56 +01:00
FIX: deeplinking (safello etc)
This commit is contained in:
parent
8a5e11834f
commit
ea2fd45b11
2 changed files with 17 additions and 13 deletions
|
@ -2,7 +2,9 @@ import { AppStorage, LightningCustodianWallet } from './';
|
|||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
import BitcoinBIP70TransactionDecode from '../bip70/bip70';
|
||||
const bitcoin = require('bitcoinjs-lib');
|
||||
const BlueApp = require('../BlueApp');
|
||||
const BlueApp: AppStorage = require('../BlueApp');
|
||||
const url = require('url');
|
||||
|
||||
class DeeplinkSchemaMatch {
|
||||
static hasSchema(schemaString) {
|
||||
if (typeof schemaString !== 'string' || schemaString.length <= 0) return false;
|
||||
|
@ -95,7 +97,7 @@ class DeeplinkSchemaMatch {
|
|||
if (!haveLnWallet) {
|
||||
// need to create one
|
||||
let w = new LightningCustodianWallet();
|
||||
w.setLabel(this.state.label || w.typeReadable);
|
||||
w.setLabel(w.typeReadable);
|
||||
|
||||
try {
|
||||
let lndhub = await AsyncStorage.getItem(AppStorage.LNDHUB);
|
||||
|
@ -128,17 +130,14 @@ class DeeplinkSchemaMatch {
|
|||
return;
|
||||
}
|
||||
|
||||
this.navigator &&
|
||||
this.navigator.dispatch(
|
||||
completionHandler({
|
||||
routeName: 'LappBrowser',
|
||||
params: {
|
||||
fromSecret: lnWallet.getSecret(),
|
||||
fromWallet: lnWallet,
|
||||
url: urlObject.query.url,
|
||||
},
|
||||
}),
|
||||
);
|
||||
completionHandler({
|
||||
routeName: 'LappBrowser',
|
||||
params: {
|
||||
fromSecret: lnWallet.getSecret(),
|
||||
fromWallet: lnWallet,
|
||||
url: urlObject.query.url,
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,11 @@ describe('unit - DeepLinkSchemaMatch', function() {
|
|||
);
|
||||
});
|
||||
|
||||
it('isSafelloRedirect', () => {
|
||||
assert.ok(DeeplinkSchemaMatch.isSafelloRedirect({ url: 'bluewallet:?safello-state-token=TEST' }));
|
||||
assert.ok(!DeeplinkSchemaMatch.isSafelloRedirect({ url: 'bluewallet:' }));
|
||||
});
|
||||
|
||||
it('navigationForRoute', () => {
|
||||
const event = { uri: '12eQ9m4sgAwTSQoNXkRABKhCXCsjm2jdVG' };
|
||||
DeeplinkSchemaMatch.navigationRouteFor(event, navValue => {
|
||||
|
|
Loading…
Add table
Reference in a new issue