Skip to content

Commit

Permalink
Add new device: Apple Watch, new os: watchOS
Browse files Browse the repository at this point in the history
(cherry picked from commit 1873045)
  • Loading branch information
faisalman committed Mar 4, 2023
1 parent 097f736 commit 551ad88
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Linpus, Linspire,Linux, Mac OS, Maemo, Mageia, Mandriva, Manjaro, MeeGo, Minix,
Mint, Morph OS, NetBSD, NetRange, NetTV, Nintendo, OpenBSD, OpenVMS, OS/2, Palm,
PC-BSD, PCLinuxOS, Plan9, PlayStation, QNX, Raspbian, RedHat, RIM Tablet OS,
RISC OS, Sabayon, Sailfish, Series40, Slackware, Solaris, SUSE, Symbian, Tizen,
Ubuntu, Unix, VectorLinux, Viera, WebOS, Windows [Phone/Mobile], Zenwalk, ...
Ubuntu, Unix, VectorLinux, Viera, watchOS, WebOS, Windows [Phone/Mobile], Zenwalk, ...

# 'os.version' determined dynamically
```
Expand Down
4 changes: 4 additions & 0 deletions src/ua-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,8 @@

/((pebble))app/i // Pebble
], [VENDOR, MODEL, [TYPE, WEARABLE]], [
/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i // Apple Watch
], [MODEL, [VENDOR, APPLE], [TYPE, WEARABLE]], [
/droid.+; (glass) \d/i // Google Glass
], [MODEL, [VENDOR, GOOGLE], [TYPE, WEARABLE]], [
/droid.+; (wt63?0{2,3})\)/i
Expand Down Expand Up @@ -736,6 +738,8 @@
/web0s;.+rt(tv)/i,
/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i // WebOS
], [VERSION, [NAME, 'webOS']], [
/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i // watchOS
], [VERSION, [NAME, 'watchOS']], [

// Google Chromecast
/crkey\/([\d\.]+)/i // Google Chromecast
Expand Down
9 changes: 9 additions & 0 deletions test/device-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,15 @@
"type": "undefined"
}
},
{
"desc": "Apple Watch",
"ua": "atc/1.0 watchOS/7.3.3 model/Watch4,2 hwp/t8006 build/18S830 (6; dt:191)",
"expect": {
"vendor": "Apple",
"model": "watch",
"type": "wearable"
}
},
{
"desc": "iPad using UCBrowser",
"ua": "Mozilla/5.0 (iPad; U; CPU OS 11_2 like Mac OS X; zh-CN; iPad5,3) AppleWebKit/534.46 (KHTML, like Gecko) UCBrowser/3.0.1.776 U3/ Mobile/10A403 Safari/7543.48.3",
Expand Down
27 changes: 27 additions & 0 deletions test/os-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,33 @@
"version" : "undefined"
}
},
{
"desc" : "watchOS",
"ua" : "server-bag [Watch OS,8.4,19S546,Watch3,4]",
"expect" :
{
"name" : "watchOS",
"version" : "8.4"
}
},
{
"desc" : "watchOS",
"ua" : "atc/1.0 watchOS/7.4.1 model/Watch3,3 hwp/t8004 build/18T201 (6; dt:155)",
"expect" :
{
"name" : "watchOS",
"version" : "7.4.1"
}
},
{
"desc" : "watchOS",
"ua" : "Watch4,3/5.3.8 (16U680)",
"expect" :
{
"name" : "watchOS",
"version" : "5.3.8"
}
},
{
"desc" : "Mac OS on PowerPC",
"ua" : "Mozilla/4.0 (compatible; MSIE 5.0b1; Mac_PowerPC)",
Expand Down

0 comments on commit 551ad88

Please sign in to comment.