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%;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
|
||||
&:hover {
|
||||
filter: none;
|
||||
|
@ -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 = () => {
|
||||
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;
|
||||
return resolve(false);
|
||||
}
|
||||
|
||||
return (ua || {}).name.toLowerCase() === 'chrome';
|
||||
return resolve((ua || {}).name.toLowerCase() === 'chrome');
|
||||
}, 5000);
|
||||
});
|
||||
}
|
||||
|
||||
installExtension = () => {
|
||||
|
Loading…
Reference in New Issue
Block a user