FIX: Don't display PWA banner when using native app

This commit is contained in:
Penar Musaraj
2019-08-26 15:55:26 -04:00
parent 3259ea60a6
commit a3cd73ef27

View File

@@ -42,11 +42,15 @@ export default Ember.Component.extend({
@computed("deferredInstallPromptEvent", "bannerDismissed")
showPWAInstallBanner() {
const launchedFromDiscourseHub =
window.location.search.indexOf("discourse_app=1") !== -1;
return (
this.capabilities.isAndroid &&
this.get("currentUser.trust_level") > 0 &&
this.deferredInstallPromptEvent && // Pass the browser engagement checks
!window.matchMedia("(display-mode: standalone)").matches && // Not be in the installed PWA already
!launchedFromDiscourseHub && // not launched via official app
!this.bannerDismissed // Have not a previously dismissed install banner
);
},