mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-21 15:26:17 -04:00
fix header not showing on snapdrop-android app
This commit is contained in:
parent
5b2bebcdee
commit
28c7fcd7a2
2 changed files with 16 additions and 26 deletions
|
@ -70,21 +70,17 @@ class PeersUI {
|
||||||
this.$header = document.querySelector('header.opacity-0');
|
this.$header = document.querySelector('header.opacity-0');
|
||||||
Events.on('header-evaluated', e => this._fadeInHeader(e.detail));
|
Events.on('header-evaluated', e => this._fadeInHeader(e.detail));
|
||||||
|
|
||||||
// wait for evaluation of notification, install and edit-paired-devices buttons
|
// wait for evaluation of notification and edit-paired-devices buttons
|
||||||
this.evaluateHeaderCount = 3;
|
this.evaluateHeader = ["notification", "edit-paired-devices"];
|
||||||
if (!('Notification' in window)) this.evaluateHeaderCount -= 1;
|
|
||||||
if (
|
if (!('Notification' in window)) this.evaluateHeader.splice(this.evaluateHeader.indexOf("notification"), 1);
|
||||||
!('BeforeInstallPromptEvent' in window) ||
|
|
||||||
('BeforeInstallPromptEvent' in window && window.matchMedia('(display-mode: minimal-ui)').matches)
|
|
||||||
) {
|
|
||||||
this.evaluateHeaderCount -= 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_fadeInHeader(id) {
|
_fadeInHeader(id) {
|
||||||
this.evaluateHeaderCount -= 1;
|
this.evaluateHeader.splice(this.evaluateHeader.indexOf(id), 1);
|
||||||
console.log(`Header btn ${id} evaluated. ${this.evaluateHeaderCount} to go.`);
|
console.log(`Header btn ${id} evaluated. ${this.evaluateHeader.length} to go.`);
|
||||||
if (this.evaluateHeaderCount !== 0) return;
|
|
||||||
|
if (this.evaluateHeader.length !== 0) return;
|
||||||
|
|
||||||
this.$header.classList.remove('opacity-0');
|
this.$header.classList.remove('opacity-0');
|
||||||
}
|
}
|
||||||
|
@ -2838,7 +2834,6 @@ window.addEventListener('beforeinstallprompt', installEvent => {
|
||||||
installBtn.setAttribute('hidden', '');
|
installBtn.setAttribute('hidden', '');
|
||||||
installEvent.prompt();
|
installEvent.prompt();
|
||||||
});
|
});
|
||||||
Events.fire('header-evaluated', 'install');
|
|
||||||
}
|
}
|
||||||
return installEvent.preventDefault();
|
return installEvent.preventDefault();
|
||||||
});
|
});
|
|
@ -70,21 +70,17 @@ class PeersUI {
|
||||||
this.$header = document.querySelector('header.opacity-0');
|
this.$header = document.querySelector('header.opacity-0');
|
||||||
Events.on('header-evaluated', e => this._fadeInHeader(e.detail));
|
Events.on('header-evaluated', e => this._fadeInHeader(e.detail));
|
||||||
|
|
||||||
// wait for evaluation of notification, install and edit-paired-devices buttons
|
// wait for evaluation of notification and edit-paired-devices buttons
|
||||||
this.evaluateHeaderCount = 3;
|
this.evaluateHeader = ["notification", "edit-paired-devices"];
|
||||||
if (!('Notification' in window)) this.evaluateHeaderCount -= 1;
|
|
||||||
if (
|
if (!('Notification' in window)) this.evaluateHeader.splice(this.evaluateHeader.indexOf("notification"), 1);
|
||||||
!('BeforeInstallPromptEvent' in window) ||
|
|
||||||
('BeforeInstallPromptEvent' in window && window.matchMedia('(display-mode: minimal-ui)').matches)
|
|
||||||
) {
|
|
||||||
this.evaluateHeaderCount -= 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_fadeInHeader(id) {
|
_fadeInHeader(id) {
|
||||||
this.evaluateHeaderCount -= 1;
|
this.evaluateHeader.splice(this.evaluateHeader.indexOf(id), 1);
|
||||||
console.log(`Header btn ${id} evaluated. ${this.evaluateHeaderCount} to go.`);
|
console.log(`Header btn ${id} evaluated. ${this.evaluateHeader.length} to go.`);
|
||||||
if (this.evaluateHeaderCount !== 0) return;
|
|
||||||
|
if (this.evaluateHeader.length !== 0) return;
|
||||||
|
|
||||||
this.$header.classList.remove('opacity-0');
|
this.$header.classList.remove('opacity-0');
|
||||||
}
|
}
|
||||||
|
@ -2840,7 +2836,6 @@ window.addEventListener('beforeinstallprompt', installEvent => {
|
||||||
installBtn.setAttribute('hidden', '');
|
installBtn.setAttribute('hidden', '');
|
||||||
installEvent.prompt();
|
installEvent.prompt();
|
||||||
});
|
});
|
||||||
Events.fire('header-evaluated', 'install');
|
|
||||||
}
|
}
|
||||||
return installEvent.preventDefault();
|
return installEvent.preventDefault();
|
||||||
});
|
});
|
Loading…
Add table
Add a link
Reference in a new issue