Skip to content

Commit

Permalink
feat(sync): add KaiOS rule for feature phone type
Browse files Browse the repository at this point in the history
  • Loading branch information
sanchezzzhak committed Jan 17, 2025
1 parent b59a898 commit c5c0df8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -576,12 +576,19 @@ class DeviceDetector {

/**
* All unknown devices under running Java ME
* are more likely a features phones
* are more likely features phones
*/
if (deviceType === '' && osName === 'Java ME') {
deviceType = DEVICE_TYPE.FEATURE_PHONE;
}

/**
* All devices running KaiOS are more likely features phones
*/
if ('KaiOS' === osName) {
deviceType = DEVICE_TYPE.FEATURE_PHONE;
}

/**
* According to http://msdn.microsoft.com/en-us/library/ie/hh920767(v=vs.85).aspx
* Internet Explorer 10 introduces the "Touch" UA string token. If this token is present at the end of the
Expand Down Expand Up @@ -626,9 +633,13 @@ class DeviceDetector {
deviceType = DEVICE_TYPE.TV;
}
/**
* All devices that contain "Andr0id" in string are assumed to be a tv
* All devices that contain Andr0id in string are assumed to be a tv
*/
if (helper.hasAndroidTVFragment(userAgent)) {
const hasDeviceTvType = [
DEVICE_TYPE.TV,
DEVICE_TYPE.PERIPHERAL
].indexOf(deviceType) === -1 && helper.hasAndroidTVFragment(userAgent)
if (hasDeviceTvType) {
deviceType = DEVICE_TYPE.TV;
}
/**
Expand Down
2 changes: 1 addition & 1 deletion parser/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ function hasPuffinTabletFragment(userAgent) {
*/
function hasAndroidTVFragment(userAgent) {
return matchUserAgent(
'Andr0id|(?:Android(?: UHD)?|Google) TV|[(]lite[)] TV|BRAVIA|[(]TV;| TV$',
'Andr0id|(?:Android(?: UHD)?|(?<!Xming )Google) TV|\\(lite\\) TV|BRAVIA| TV$',
userAgent
) !== null;
}
Expand Down

0 comments on commit c5c0df8

Please sign in to comment.