From 240e8389ee38cce28890469a843949b2bd4fb270 Mon Sep 17 00:00:00 2001 From: Byron Clark Date: Thu, 5 Oct 2023 16:39:52 -0600 Subject: [PATCH 1/2] Detect embedded webview on iPadOS. iPadOS identifies as Mac OS, but ua-parser-js does the extra detection to determine if it's an iPad. Use the device model to detect when we're in an embedded webview on iPadOS. Also removes the version check for best effort webkit detection as iPadOS sends version 10.15 and checking RTCRtpTransceiver should be sufficient without the version check. --- src/Device.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Device.ts b/src/Device.ts index d6d475ce..942de6a2 100644 --- a/src/Device.ts +++ b/src/Device.ts @@ -103,8 +103,10 @@ export function detectDevice(): BuiltinHandlerName | undefined const os = uaParser.getOS(); const osName = os.name?.toLowerCase() ?? ''; const osVersion = parseFloat(os.version ?? '0'); + const device = uaParser.getDevice(); + const deviceModel = device.model?.toLowerCase() ?? ''; - const isIOS = osName === 'ios'; + const isIOS = osName === 'ios' || (osName === 'mac os' && deviceModel === 'ipad'); const isChrome = [ @@ -188,7 +190,6 @@ export function detectDevice(): BuiltinHandlerName | undefined else if ( engineName === 'webkit' && isIOS && - osVersion >= 14.3 && typeof RTCRtpTransceiver !== 'undefined' && RTCRtpTransceiver.prototype.hasOwnProperty('currentDirection')) { From 79fba5b8c99f9d2785e55beaadd5aaf63f471e71 Mon Sep 17 00:00:00 2001 From: Byron Clark Date: Fri, 6 Oct 2023 08:54:10 -0600 Subject: [PATCH 2/2] Update src/Device.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: IƱaki Baz Castillo --- src/Device.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Device.ts b/src/Device.ts index 942de6a2..1554b60a 100644 --- a/src/Device.ts +++ b/src/Device.ts @@ -106,7 +106,7 @@ export function detectDevice(): BuiltinHandlerName | undefined const device = uaParser.getDevice(); const deviceModel = device.model?.toLowerCase() ?? ''; - const isIOS = osName === 'ios' || (osName === 'mac os' && deviceModel === 'ipad'); + const isIOS = osName === 'ios' || deviceModel === 'ipad'; const isChrome = [