mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
detect ability to open popup instead of browser
This commit is contained in:
parent
d23227dc4f
commit
82a93bb287
@ -16,9 +16,11 @@ class ConnectScreen extends Component {
|
|||||||
]),
|
]),
|
||||||
h(
|
h(
|
||||||
'button.btn-primary.btn--large',
|
'button.btn-primary.btn--large',
|
||||||
{ onClick: () => global.platform.openWindow({
|
{
|
||||||
url: 'https://google.com/chrome',
|
onClick: () => global.platform.openWindow({
|
||||||
}), style: { margin: 12 } },
|
url: 'https://google.com/chrome',
|
||||||
|
}),
|
||||||
|
},
|
||||||
this.context.t('downloadGoogleChrome')
|
this.context.t('downloadGoogleChrome')
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
@ -49,8 +51,7 @@ class ConnectScreen extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const isChrome = window.navigator.userAgent.search('Chrome') !== -1
|
if (this.props.browserSupported) {
|
||||||
if (isChrome) {
|
|
||||||
return this.renderConnectScreen()
|
return this.renderConnectScreen()
|
||||||
}
|
}
|
||||||
return this.renderUnsupportedBrowser()
|
return this.renderUnsupportedBrowser()
|
||||||
@ -59,7 +60,8 @@ class ConnectScreen extends Component {
|
|||||||
|
|
||||||
ConnectScreen.propTypes = {
|
ConnectScreen.propTypes = {
|
||||||
connectToTrezor: PropTypes.func.isRequired,
|
connectToTrezor: PropTypes.func.isRequired,
|
||||||
btnText: PropTypes.string,
|
btnText: PropTypes.string.isRequired,
|
||||||
|
browserSupported: PropTypes.bool.isRequired,
|
||||||
}
|
}
|
||||||
|
|
||||||
ConnectScreen.contextTypes = {
|
ConnectScreen.contextTypes = {
|
||||||
|
@ -16,6 +16,7 @@ class ConnectHardwareForm extends Component {
|
|||||||
btnText: context.t('connectToTrezor'),
|
btnText: context.t('connectToTrezor'),
|
||||||
selectedAccount: null,
|
selectedAccount: null,
|
||||||
accounts: [],
|
accounts: [],
|
||||||
|
browserSupported: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,6 +79,9 @@ class ConnectHardwareForm extends Component {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
|
if (e === 'Window blocked') {
|
||||||
|
this.setState({ browserSupported: false })
|
||||||
|
}
|
||||||
this.setState({ btnText: this.context.t('connectToTrezor') })
|
this.setState({ btnText: this.context.t('connectToTrezor') })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -125,6 +129,7 @@ class ConnectHardwareForm extends Component {
|
|||||||
return h(ConnectScreen, {
|
return h(ConnectScreen, {
|
||||||
connectToTrezor: this.connectToTrezor,
|
connectToTrezor: this.connectToTrezor,
|
||||||
btnText: this.state.btnText,
|
btnText: this.state.btnText,
|
||||||
|
browserSupported: this.state.browserSupported,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user