Skip to content

Commit

Permalink
feat: detect Samsung Galaxy Tab S7+ SM-T970 as a tablet
Browse files Browse the repository at this point in the history
  • Loading branch information
allanheremi authored and AhsanAyaz committed May 19, 2023
1 parent 7b7c279 commit 757a502
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export const TABLETS_RE = {
SM-T350|SM-T550|SM-T9000|SM-P9000|SM-T705Y|SM-T805|GT-P3113|SM-T710|SM-T810|SM-T815|SM-T360|SM-T533|
SM-T113|SM-T335|SM-T715|SM-T560|SM-T670|SM-T677|SM-T377|SM-T567|SM-T357T|SM-T555|SM-T561|SM-T713|
SM-T719|SM-T725|SM-T813|SM-T819|SM-T580|SM-T590|SM-T355Y?|SM-T280|SM-T817A|SM-T820|SM-W700|SM-P580|SM-T587|SM-P350|
SM-P555M|SM-P355M|SM-T113NU|SM-T815Y|SM-T585|SM-T285|SM-T825|SM-W708|SM-T835|SM-P585Y|SM-X200`),
SM-P555M|SM-P355M|SM-T113NU|SM-T815Y|SM-T585|SM-T285|SM-T825|SM-W708|SM-T835|SM-P585Y|SM-X200|SM-T970`),
Kindle: new RegExp(`Kindle|Silk.*Accelerated|Android.*\\b(KFOT|KFTT|KFJWI|KFJWA|KFOTE|KFSOWI|KFTHWI|KFTHWA|KFAPWI|
KFAPWA|WFJWAE|KFSAWA|KFSAWI|KFASWI|KFARWI|KFFOWI|KFGIWI|KFMEWI)\\b|Android.*Silk\/[0-9.]+ like Chrome\
/[0-9.]+ (?!Mobile)`),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,4 +302,21 @@ describe('DeviceDetectorService', () => {
expectAsTablet(service, userAgent);
}
));
it('should detect Device Samsung Galaxy Tab S7+ as a tablet', inject(
[DeviceDetectorService],
(service: DeviceDetectorService) => {
const userAgent =
'Mozilla/5.0 (Linux; Android 11; SM-T970) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.152 Safari/537.36';
service.setDeviceInfo(userAgent);
expect(service.isMobile(userAgent)).toBeFalsy();
expect(service.isDesktop(userAgent)).toBeFalsy();
expect(service.isTablet(userAgent)).toBeTruthy();
const deviceInfo = service.getDeviceInfo();
expect(deviceInfo.device).toBe('Android');
expect(deviceInfo.browser).toBe('Chrome');
expect(deviceInfo.browser_version).toBe('88.0.4324.152');
expect(deviceInfo.deviceType).toBe('tablet');
}
));

});

0 comments on commit 757a502

Please sign in to comment.