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

View File

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