Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/components/scenes/PluginViewYAOBScene.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,11 @@ class PluginView extends React.Component<PluginProps, PluginState> {
const mapStateToProps = state => {
const account = CORE_SELECTORS.getAccount(state)
const guiWallet = UI_SELECTORS.getSelectedWallet(state)
const coreWallet = CORE_SELECTORS.getWallet(state, guiWallet.id)
const coreWallet = guiWallet && guiWallet.id ? CORE_SELECTORS.getWallet(state, guiWallet.id) : null
const coreWallets = state.core.wallets.byId
const wallets = state.ui.wallets.byId
const walletName = coreWallet.name
const walletId = coreWallet.id
const walletName = coreWallet ? coreWallet.name : null
const walletId = coreWallet ? coreWallet.id : null
const currentState = state
return {
account,
Expand Down
4 changes: 2 additions & 2 deletions src/locales/strings/enUS.json
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,6 @@
"error_creating_wallets": "Network timeout occurred trying to create and backup wallets. Please check your network connection and restart app to retry wallet creation.",
"edge_login_failed": "Failed to Login",
"edge_login_fetching": "Fetching Edge Login info...",
"modal_addressexplorer_message": "Show Address in Blockexplorer?",
"modal_addressexplorer_message": "Show Address in Block Explorer?",
"modal_addressexplorer_null": "This currency has no explorer site as of now"
}
}
26 changes: 24 additions & 2 deletions src/modules/DeepLinkingManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import { Alert } from 'react-native'
import { Actions } from 'react-native-router-flux'
import { connect } from 'react-redux'
import { sprintf } from 'sprintf-js'
import parse from 'url-parse'

import { selectWallet } from '../actions/WalletActions.js'
import { SCAN } from '../constants/indexConstants.js'
import { PLUGIN_SPEND, SCAN } from '../constants/indexConstants.js'
import s from '../locales/strings.js'
import { buySellPlugins, spendPlugins } from '../modules/UI/scenes/Plugins/plugins'
import type { Dispatch } from './ReduxTypes.js'

type DeepLinkingManagerStateProps = {
Expand All @@ -33,11 +35,31 @@ class DeepLinkingManager extends React.Component<Props> {
componentDidUpdate () {
if (Object.keys(this.props.wallets).length > 0 && this.props.deepLinkPending) this.checkForWallet()
}
processPluginDeepLink = (parsedUrl: Object) => {
if (parsedUrl.pathname.includes('simplex')) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like this to be more plugin-agnostic, but this works for now.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do we take the pathname and inject it into the plugin? How do they know what the URI parameters are?

const plugins = spendPlugins(false).concat(buySellPlugins(false))
let i = 0
for (i; i < plugins.length; i++) {
const plugin = plugins[i]
if (plugin.name === 'Simplex') {
Actions[PLUGIN_SPEND]({ plugin: plugin })
this.props.markAddressDeepLinkDone()
return
}
}
}
this.props.markAddressDeepLinkDone()
}

checkForWallet () {
const { addressDeepLinkData } = this.props
const { currencyCode } = addressDeepLinkData

// check to see what we have for a deep link.
const parsedUrl = parse(addressDeepLinkData.uri, {}, false)
if (parsedUrl.hostname === 'plugins') {
this.processPluginDeepLink(parsedUrl)
return
}
if (!currencyCode) {
Actions[SCAN]()
return
Expand Down