feat!: extend browser, OS, device and in-app detection#11
Merged
Conversation
2a14d18 to
6267345
Compare
BREAKING CHANGE: `isMac()` no longer returns `true` for iOS or iPadOS. Use the new `isiOS()` method instead. `deviceType()` now returns `TV`, `Console`, and `Wearable` in addition to the existing values. New browser detection: - isBrave(), isVivaldi(), isSamsungBrowser(), isArc(), isDuckDuckGo() New OS detection: - isiOS() (split from isMac), isChromeOS(), isHarmonyOS() New device type detection: - isTV(), isConsole(), isWearable() Expanded in-app detection: - Facebook, Instagram, TikTok, Snapchat, LinkedIn, Telegram, Line, Pinterest (in addition to existing WebView, Twitter, WeChat) Also fixes pre-existing issues: - iPadOS was not matched by any OS flag - Samsung Internet was misidentified as Chrome - Smart TVs, consoles, wearables all defaulted to Desktop - deviceType() used stringly-typed magic dispatch - parseVersion() produced dead version string overwritten downstream - skipBotDetection() called on every request instead of once - IE match used overly broad 'ie' substring (now word-boundary) - detectIsInApp() re-fetched agent from payload unnecessarily
6267345 to
e3e849a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
isMac()no longer returnstruefor iOS/iPadOS — newisiOS()method takes overdeviceType()now returnsTV,Console,Wearablein addition to existing valuesSee UPGRADING.md for migration details.
Test plan
composer test— 116 tests, 360 assertions passcomposer analyse— PHPStan level max, 0 errorsisiOS()=true,isMac()=false