From cf2b2b370a9d8aa1bfaf02e9031538d3af0af183 Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Fri, 1 Feb 2019 08:43:32 -0500 Subject: [PATCH] feat(platform): add mobileweb platform --- angular/src/providers/platform.ts | 3 ++- core/src/utils/platform.ts | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/angular/src/providers/platform.ts b/angular/src/providers/platform.ts index 5a5be7f2c6..c2c3558826 100644 --- a/angular/src/providers/platform.ts +++ b/angular/src/providers/platform.ts @@ -98,8 +98,9 @@ export class Platform { * | phablet | on a phablet device. | * | tablet | on a tablet device. | * | electron | in Electron on a desktop device. | - * | pwa | as a PWA app. | + * | pwa | as a PWA app. | * | mobile | on a mobile device. | + * | mobileweb | on a mobile device in a browser. | * | desktop | on a desktop device. | * | hybrid | is a cordova or capacitor app. | * diff --git a/core/src/utils/platform.ts b/core/src/utils/platform.ts index 45bdade125..ee82cb9e6d 100644 --- a/core/src/utils/platform.ts +++ b/core/src/utils/platform.ts @@ -11,6 +11,7 @@ export const PLATFORMS_MAP = { 'electron': isElectron, 'pwa': isPWA, 'mobile': isMobile, + 'mobileweb': isMobileWeb, 'desktop': isDesktop, 'hybrid': isHybrid }; @@ -37,6 +38,10 @@ export function setupPlatforms(win: any) { return platforms; } +function isMobileWeb(win: Window): boolean { + return isMobile(win) && !isHybrid(win); +} + function detectPlatforms(win: Window): string[] { return Object.keys(PLATFORMS_MAP).filter(p => (PLATFORMS_MAP as any)[p](win)); }