Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pdf): Enable pdf font conversion option for Safari user agents #1070

Merged
merged 1 commit into from
Sep 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions src/lib/Browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,26 +319,14 @@ class Browser {
}

/**
* Returns whether or not the device is a laptop/desktop Mac
*
* @public
* @return {boolean} Whether device is a Mac
*/
static isMac() {
return /Macintosh; Intel Mac OS X/g.test(userAgent);
}

/**
* Returns whether or not the device is running IOS 10.3.x or browser is desktop Safari, both of which have Font
* Returns whether or not the device is running IOS 10.3.x, which has Font
* Ligature rendering issues due to the font loading API.
*
* @public
* @return {boolean} Whether device or browser have font ligature issues
*/
static hasFontIssue() {
return (
(Browser.isIOS() && /(?:OS\s)10_3/i.test(userAgent)) || (Browser.isMac() && Browser.getName() === 'Safari')
);
return Browser.isIOS() && /(?:OS\s)10_3/i.test(userAgent);
}

/**
Expand Down
30 changes: 0 additions & 30 deletions src/lib/__tests__/Browser-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,20 +467,6 @@ describe('lib/Browser', () => {
});
});

describe('isMac()', () => {
it('should return true if device is a Mac', () => {
Browser.overrideUserAgent('(Macintosh; Intel Mac OS X 10_10_4)');
const mac = Browser.isMac();
expect(mac).to.be.true;
});

it('should return false if device is not a Mac', () => {
Browser.overrideUserAgent('(Windows NT 6.1; Win64; x64; rv:47.0)');
const mac = Browser.isMac();
expect(mac).to.be.false;
});
});

describe('hasFontIssue()', () => {
it('should return true if device is on ios and is OS 10.3.XX', () => {
Browser.overrideUserAgent('iPhone OS 10_3_90 safari/2');
Expand All @@ -493,22 +479,6 @@ describe('lib/Browser', () => {
const hasIssue = Browser.hasFontIssue();
expect(hasIssue).to.be.false;
});

it('should return true if device is a Mac running Safari', () => {
Browser.overrideUserAgent(
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/8.0.7 Safari/600.7.12',
);
const hasIssue = Browser.hasFontIssue();
expect(hasIssue).to.be.true;
});

it('should return false if device is a Mac and not on Safari', () => {
Browser.overrideUserAgent(
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36',
);
const hasIssue = Browser.hasFontIssue();
expect(hasIssue).to.be.false;
});
});

describe('getBrowserInfo()', () => {
Expand Down