Skip to content

Commit

Permalink
Merge pull request #291 from rcohen-unext/production
Browse files Browse the repository at this point in the history
Add PlayStation 4 browser support
  • Loading branch information
lancedikson authored Feb 9, 2019
2 parents 943adfb + dcbb0a5 commit b986897
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/parser-browsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,23 @@ const browsersList = [
},
},

/* PlayStation 4 */
{
test: [/playstation 4/i],
describe(ua) {
const browser = {
name: 'PlayStation 4',
};
const version = getFirstMatch(commonVersionIdentifier, ua);

if (version) {
browser.version = version;
}

return browser;
},
},

/* Safari */
{
test: [/safari|applewebkit/i],
Expand Down
12 changes: 12 additions & 0 deletions src/parser-os.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,16 @@ export default [
};
},
},

/* Playstation 4 */
{
test: [/PlayStation 4/],
describe(ua) {
const version = getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i, ua);
return {
name: 'PlayStation 4',
version,
};
},
},
];
13 changes: 13 additions & 0 deletions src/parser-platforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const TYPES_LABELS = {
tablet: 'tablet',
mobile: 'mobile',
desktop: 'desktop',
tv: 'tv',
};

/*
Expand Down Expand Up @@ -232,4 +233,16 @@ export default [
};
},
},

/* PlayStation 4 */
{
test(parser) {
return parser.getOSName(true) === 'playstation 4';
},
describe() {
return {
type: TYPES_LABELS.tv,
};
},
},
];
14 changes: 14 additions & 0 deletions test/acceptance/useragentstrings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2595,3 +2595,17 @@
type: "desktop"
engine:
name: "Blink"
PlayStation 4:
-
ua: "Mozilla/5.0 (PlayStation 4 6.20) AppleWebKit/605.1.15 (KHTML, like Gecko) "
spec:
browser:
name: "PlayStation 4"
os:
name: "PlayStation 4"
version: "6.20"
platform:
type: "tv"
engine:
name: "WebKit"
version: "605.1.15"

0 comments on commit b986897

Please sign in to comment.