aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrunobar79 <brunobar79@gmail.com>2018-07-13 14:03:54 +0800
committerbrunobar79 <brunobar79@gmail.com>2018-07-13 14:03:54 +0800
commit82a93bb2872809df19744afdd95c68485c0dcd25 (patch)
tree2cfe3f88cb6d8a93d137b144dc0831db73de9eda
parentd23227dc4faf8c859073d1918dd41bd0d7a71d4a (diff)
downloadtangerine-wallet-browser-82a93bb2872809df19744afdd95c68485c0dcd25.tar
tangerine-wallet-browser-82a93bb2872809df19744afdd95c68485c0dcd25.tar.gz
tangerine-wallet-browser-82a93bb2872809df19744afdd95c68485c0dcd25.tar.bz2
tangerine-wallet-browser-82a93bb2872809df19744afdd95c68485c0dcd25.tar.lz
tangerine-wallet-browser-82a93bb2872809df19744afdd95c68485c0dcd25.tar.xz
tangerine-wallet-browser-82a93bb2872809df19744afdd95c68485c0dcd25.tar.zst
tangerine-wallet-browser-82a93bb2872809df19744afdd95c68485c0dcd25.zip
detect ability to open popup instead of browser
-rw-r--r--ui/app/components/pages/create-account/connect-hardware/connect-screen.js14
-rw-r--r--ui/app/components/pages/create-account/connect-hardware/index.js5
2 files changed, 13 insertions, 6 deletions
diff --git a/ui/app/components/pages/create-account/connect-hardware/connect-screen.js b/ui/app/components/pages/create-account/connect-hardware/connect-screen.js
index dd9fdfba2..0dd8e285b 100644
--- a/ui/app/components/pages/create-account/connect-hardware/connect-screen.js
+++ b/ui/app/components/pages/create-account/connect-hardware/connect-screen.js
@@ -16,9 +16,11 @@ class ConnectScreen extends Component {
]),
h(
'button.btn-primary.btn--large',
- { onClick: () => global.platform.openWindow({
- url: 'https://google.com/chrome',
- }), style: { margin: 12 } },
+ {
+ onClick: () => global.platform.openWindow({
+ url: 'https://google.com/chrome',
+ }),
+ },
this.context.t('downloadGoogleChrome')
),
])
@@ -49,8 +51,7 @@ class ConnectScreen extends Component {
}
render () {
- const isChrome = window.navigator.userAgent.search('Chrome') !== -1
- if (isChrome) {
+ if (this.props.browserSupported) {
return this.renderConnectScreen()
}
return this.renderUnsupportedBrowser()
@@ -59,7 +60,8 @@ class ConnectScreen extends Component {
ConnectScreen.propTypes = {
connectToTrezor: PropTypes.func.isRequired,
- btnText: PropTypes.string,
+ btnText: PropTypes.string.isRequired,
+ browserSupported: PropTypes.bool.isRequired,
}
ConnectScreen.contextTypes = {
diff --git a/ui/app/components/pages/create-account/connect-hardware/index.js b/ui/app/components/pages/create-account/connect-hardware/index.js
index fa9cf4894..689e88f2e 100644
--- a/ui/app/components/pages/create-account/connect-hardware/index.js
+++ b/ui/app/components/pages/create-account/connect-hardware/index.js
@@ -16,6 +16,7 @@ class ConnectHardwareForm extends Component {
btnText: context.t('connectToTrezor'),
selectedAccount: null,
accounts: [],
+ browserSupported: true,
}
}
@@ -78,6 +79,9 @@ class ConnectHardwareForm extends Component {
}
})
.catch(e => {
+ if (e === 'Window blocked') {
+ this.setState({ browserSupported: false })
+ }
this.setState({ btnText: this.context.t('connectToTrezor') })
})
}
@@ -125,6 +129,7 @@ class ConnectHardwareForm extends Component {
return h(ConnectScreen, {
connectToTrezor: this.connectToTrezor,
btnText: this.state.btnText,
+ browserSupported: this.state.browserSupported,
})
}