From cc562d2c4fad4a8380cfa94ecc6c5c1234145f48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Fri, 15 Sep 2017 21:08:12 +0200 Subject: [PATCH] Fix extension detection (#6452) (#6524) * Fix extension detection. * Fix mobx quirks. * Update submodule. --- js/src/ui/SelectionList/selectionList.css | 1 + js/src/views/Application/Extension/store.js | 28 +++++++++++++-------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/js/src/ui/SelectionList/selectionList.css b/js/src/ui/SelectionList/selectionList.css index b6e6b05f9..73721e54a 100644 --- a/js/src/ui/SelectionList/selectionList.css +++ b/js/src/ui/SelectionList/selectionList.css @@ -22,6 +22,7 @@ height: 100%; position: relative; width: 100%; + max-width: 100%; &:hover { filter: none; diff --git a/js/src/views/Application/Extension/store.js b/js/src/views/Application/Extension/store.js index d1df2eb5b..af4b1a205 100644 --- a/js/src/views/Application/Extension/store.js +++ b/js/src/views/Application/Extension/store.js @@ -39,7 +39,6 @@ export default class Store { constructor () { this.nextDisplay = store.get(NEXT_DISPLAY) || 0; - this.testInstall(); } @computed get showWarning () { @@ -59,20 +58,29 @@ export default class Store { store.set(NEXT_DISPLAY, this.nextDisplay); } - @action testInstall = () => { - this.shouldInstall = this.readStatus(); + @action setShouldInstall = (status) => { + this.shouldInstall = status; + } + + testInstall = () => { + this.readStatus().then(this.setShouldInstall); } readStatus = () => { - const hasExtension = Symbol.for('parity.extension') in window; - const ua = browser.analyze(navigator.userAgent || ''); + return new Promise((resolve, reject) => { + // Defer checking for the extension since it may not have loaded yet. + setTimeout(() => { + const hasExtension = Symbol.for('parity.extension') in window; + const ua = browser.analyze(navigator.userAgent || ''); - if (hasExtension) { - this.setExtensionActive(); - return false; - } + if (hasExtension) { + this.setExtensionActive(); + return resolve(false); + } - return (ua || {}).name.toLowerCase() === 'chrome'; + return resolve((ua || {}).name.toLowerCase() === 'chrome'); + }, 5000); + }); } installExtension = () => {