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

Should show amp-app-banner in non-embedded firefox ios #9573

Merged
merged 1 commit into from May 26, 2017
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/service/platform-impl.js
Expand Up @@ -53,7 +53,7 @@ export class Platform {
*/
isSafari() {
return /Safari/i.test(this.navigator_.userAgent) && !this.isChrome() &&
!this.isEdge();
!this.isEdge() && !this.isFirefox();
}

/**
Expand All @@ -70,7 +70,7 @@ export class Platform {
* @return {boolean}
*/
isFirefox() {
return /Firefox/i.test(this.navigator_.userAgent) && !this.isEdge();
return /Firefox|FxiOS/i.test(this.navigator_.userAgent) && !this.isEdge();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize we do for Chrome, but we really shouldn't treat Chrome and Firefox on iOS as Chrome and Firefox. I guess the precedent wins here.

}

/**
Expand Down Expand Up @@ -109,7 +109,7 @@ export class Platform {
return this.evalMajorVersion_(/(Chrome|CriOS)\/(\d+)/, 2);
}
if (this.isFirefox()) {
return this.evalMajorVersion_(/Firefox\/(\d+)/, 1);
return this.evalMajorVersion_(/(Firefox|FxiOS)\/(\d+)/, 2);
}
if (this.isIe()) {
return this.evalMajorVersion_(/MSIE\s(\d+)/, 1);
Expand Down
12 changes: 12 additions & 0 deletions test/functional/test-platform.js
Expand Up @@ -163,6 +163,18 @@ describe('Platform', () => {
'Gecko/20100101 Firefox/40.1');
});

it('Firefox ios', () => {
isIos = true;
isFirefox = true;
isWebKit = true;
majorVersion = 7;
iosVersion = '10.3.1';
iosMajorVersion = 10;
testUserAgent('Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X)' +
' AppleWebKit/603.1.30 (KHTML, like Gecko) FxiOS/7.5b3349' +
' Mobile/14E304 Safari/603.1.30');
});

it('IE', () => {
isIe = true;
majorVersion = 10;
Expand Down