Skip to content

Commit

Permalink
Added support for Webview in iOS v12.1.4 (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
e-compton authored and DamonOehlman committed Mar 25, 2019
1 parent 68f4f52 commit 4fefc5a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/index.ts
Expand Up @@ -113,6 +113,7 @@ const userAgentRules: UserAgentRule[] = [
['facebook', /FBAV\/([0-9\.]+)/],
['instagram', /Instagram\s([0-9\.]+)/],
['ios-webview', /AppleWebKit\/([0-9\.]+).*Mobile/],
['ios-webview', /AppleWebKit\/([0-9\.]+).*Gecko\)$/],
['searchbot', SEARCHBOX_UA_REGEX],
];
const operatingSystemRules: OperatingSystemRule[] = [
Expand Down
15 changes: 15 additions & 0 deletions test/logic.js
Expand Up @@ -16,6 +16,11 @@ test('detects Chrome', function(t) {
{ name: 'chrome', version: '41.0.2228', os: 'Windows 7' }
);

assertAgentString(t,
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36',
{ name: 'chrome', version: '72.0.3626', os: 'Windows 10' }
)

t.end();
});

Expand Down Expand Up @@ -233,6 +238,16 @@ test('detects native iOS WebView browser', function (t) {
{ name: 'ios-webview', version: '605.1.15', os: 'iOS' }
);

assertAgentString(t,
'Mozilla/5.0 (iPhone; CPU iPhone OS 12_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/16B92',
{ name: 'ios-webview', version: '605.1.15', os: 'iOS' }
);

assertAgentString(t,
'Mozilla/5.0 (iPhone; CPU iPhone OS 12_1_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko)',
{ name: 'ios-webview', version: '605.1.15', os: 'iOS' }
);

t.end();
});

Expand Down

0 comments on commit 4fefc5a

Please sign in to comment.