Skip to content

Commit 551ad88

Browse files
committed
Add new device: Apple Watch, new os: watchOS
(cherry picked from commit 1873045)
1 parent 097f736 commit 551ad88

File tree

4 files changed

+41
-1
lines changed

4 files changed

+41
-1
lines changed

readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ Linpus, Linspire,Linux, Mac OS, Maemo, Mageia, Mandriva, Manjaro, MeeGo, Minix,
144144
Mint, Morph OS, NetBSD, NetRange, NetTV, Nintendo, OpenBSD, OpenVMS, OS/2, Palm,
145145
PC-BSD, PCLinuxOS, Plan9, PlayStation, QNX, Raspbian, RedHat, RIM Tablet OS,
146146
RISC OS, Sabayon, Sailfish, Series40, Slackware, Solaris, SUSE, Symbian, Tizen,
147-
Ubuntu, Unix, VectorLinux, Viera, WebOS, Windows [Phone/Mobile], Zenwalk, ...
147+
Ubuntu, Unix, VectorLinux, Viera, watchOS, WebOS, Windows [Phone/Mobile], Zenwalk, ...
148148

149149
# 'os.version' determined dynamically
150150
```

src/ua-parser.js

+4
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,8 @@
650650

651651
/((pebble))app/i // Pebble
652652
], [VENDOR, MODEL, [TYPE, WEARABLE]], [
653+
/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i // Apple Watch
654+
], [MODEL, [VENDOR, APPLE], [TYPE, WEARABLE]], [
653655
/droid.+; (glass) \d/i // Google Glass
654656
], [MODEL, [VENDOR, GOOGLE], [TYPE, WEARABLE]], [
655657
/droid.+; (wt63?0{2,3})\)/i
@@ -736,6 +738,8 @@
736738
/web0s;.+rt(tv)/i,
737739
/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i // WebOS
738740
], [VERSION, [NAME, 'webOS']], [
741+
/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i // watchOS
742+
], [VERSION, [NAME, 'watchOS']], [
739743

740744
// Google Chromecast
741745
/crkey\/([\d\.]+)/i // Google Chromecast

test/device-test.json

+9
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,15 @@
763763
"type": "undefined"
764764
}
765765
},
766+
{
767+
"desc": "Apple Watch",
768+
"ua": "atc/1.0 watchOS/7.3.3 model/Watch4,2 hwp/t8006 build/18S830 (6; dt:191)",
769+
"expect": {
770+
"vendor": "Apple",
771+
"model": "watch",
772+
"type": "wearable"
773+
}
774+
},
766775
{
767776
"desc": "iPad using UCBrowser",
768777
"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",

test/os-test.json

+27
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,33 @@
764764
"version" : "undefined"
765765
}
766766
},
767+
{
768+
"desc" : "watchOS",
769+
"ua" : "server-bag [Watch OS,8.4,19S546,Watch3,4]",
770+
"expect" :
771+
{
772+
"name" : "watchOS",
773+
"version" : "8.4"
774+
}
775+
},
776+
{
777+
"desc" : "watchOS",
778+
"ua" : "atc/1.0 watchOS/7.4.1 model/Watch3,3 hwp/t8004 build/18T201 (6; dt:155)",
779+
"expect" :
780+
{
781+
"name" : "watchOS",
782+
"version" : "7.4.1"
783+
}
784+
},
785+
{
786+
"desc" : "watchOS",
787+
"ua" : "Watch4,3/5.3.8 (16U680)",
788+
"expect" :
789+
{
790+
"name" : "watchOS",
791+
"version" : "5.3.8"
792+
}
793+
},
767794
{
768795
"desc" : "Mac OS on PowerPC",
769796
"ua" : "Mozilla/4.0 (compatible; MSIE 5.0b1; Mac_PowerPC)",

0 commit comments

Comments
 (0)