Skip to content

Allow iPhone to be classed as a 'phone'#41

Open
kgodsmark wants to merge 2 commits intorguerreiro:mainfrom
kgodsmark:iphone-fix
Open

Allow iPhone to be classed as a 'phone'#41
kgodsmark wants to merge 2 commits intorguerreiro:mainfrom
kgodsmark:iphone-fix

Conversation

@kgodsmark
Copy link
Copy Markdown

Some iPhone user agent strings are not matching to 'phone' - as raised in #31.

This PR:

  • adds config to the test case in commit 85d92c9 to avoid the default fallback to 'phone'. The test then fails.

  • adds a condition after all other attempts to match, to match a user agent string including iPhone as 'phone'. The test passes.


The following is how I can now receive 'phone' for iPhone, whilst still receiving null for other unknown strings.

device(
  'Mozilla/5.0 (iPhone; CPU iPhone OS 17_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko)', 
  {unknownUserAgentDeviceType: null}
).type

// 'phone'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant