Fix extension detection (#6452)
* Fix extension detection. * Fix mobx quirks. * Update submodule.
This commit is contained in:
parent
54bd7d26dc
commit
b602fb4a5e
@ -22,6 +22,7 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
filter: none;
|
filter: none;
|
||||||
|
@ -39,7 +39,6 @@ export default class Store {
|
|||||||
|
|
||||||
constructor () {
|
constructor () {
|
||||||
this.nextDisplay = store.get(NEXT_DISPLAY) || 0;
|
this.nextDisplay = store.get(NEXT_DISPLAY) || 0;
|
||||||
this.testInstall();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@computed get showWarning () {
|
@computed get showWarning () {
|
||||||
@ -59,20 +58,29 @@ export default class Store {
|
|||||||
store.set(NEXT_DISPLAY, this.nextDisplay);
|
store.set(NEXT_DISPLAY, this.nextDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@action testInstall = () => {
|
@action setShouldInstall = (status) => {
|
||||||
this.shouldInstall = this.readStatus();
|
this.shouldInstall = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
testInstall = () => {
|
||||||
|
this.readStatus().then(this.setShouldInstall);
|
||||||
}
|
}
|
||||||
|
|
||||||
readStatus = () => {
|
readStatus = () => {
|
||||||
|
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 hasExtension = Symbol.for('parity.extension') in window;
|
||||||
const ua = browser.analyze(navigator.userAgent || '');
|
const ua = browser.analyze(navigator.userAgent || '');
|
||||||
|
|
||||||
if (hasExtension) {
|
if (hasExtension) {
|
||||||
this.setExtensionActive();
|
this.setExtensionActive();
|
||||||
return false;
|
return resolve(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ua || {}).name.toLowerCase() === 'chrome';
|
return resolve((ua || {}).name.toLowerCase() === 'chrome');
|
||||||
|
}, 5000);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
installExtension = () => {
|
installExtension = () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user