DEV: Sniff isPwa for capabilities (#15218)

This commit is contained in:
Mark VanLandingham 2021-12-07 15:35:06 -06:00 committed by GitHub
parent f3d480dacb
commit a7fdcb921a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -41,6 +41,10 @@ export default {
caps.hasContactPicker = caps.hasContactPicker =
"contacts" in navigator && "ContactsManager" in window; "contacts" in navigator && "ContactsManager" in window;
caps.canVibrate = "vibrate" in navigator; caps.canVibrate = "vibrate" in navigator;
caps.isPwa =
window.matchMedia("(display-mode: standalone)").matches ||
window.navigator.standalone ||
document.referrer.includes("android-app://");
// Inject it // Inject it
app.register("capabilities:main", caps, { instantiate: false }); app.register("capabilities:main", caps, { instantiate: false });