This repository has been archived by the owner on Jan 17, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #3444, toggle different onboarding tour for FF 57+
- For 57+, include the full screen / save visible step in the tour, for four steps overall. Also change the Get Started text and image to refer to a page action, not a toolbar button. - For 56- and non-FF browsers, show the three step tour and refer to the toolbar button. - Add some trivial model unit tests, to get that ball rolling.
- Loading branch information
1 parent
33bb5ff
commit 67a3262
Showing
8 changed files
with
282 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,25 @@ | ||
exports.createModel = function(req) { | ||
let isFirefox = (/firefox\/\d{1,255}/i).test(req.headers['user-agent']); | ||
let isMobile = exports.isMobile(req.headers['user-agent']); | ||
let firefoxVersion = exports.getFirefoxVersion(req.headers['user-agent']); | ||
let model = { | ||
title: "Firefox Screenshots", | ||
showMyShots: !!req.deviceId, | ||
isFirefox | ||
isFirefox: !!firefoxVersion && !isMobile, | ||
firefoxVersion | ||
}; | ||
return model; | ||
}; | ||
|
||
// Helper functions exported for unit testing | ||
|
||
exports.getFirefoxVersion = (userAgent) => { | ||
// https://mdn.io/UserAgent/Firefox suggests filtering on "rv:" and "Gecko". | ||
// Return null or the major part of the Firefox version (for 57+ check, #3444). | ||
let results = /rv:.*Gecko.*Firefox\/([0-9]+)/.exec(userAgent); | ||
return results && results[1]; | ||
}; | ||
|
||
exports.isMobile = (userAgent) => { | ||
// https://mdn.io/UserAgent/Firefox suggests filtering on "Mobi" and "Tablet". | ||
return /Mobi|Tablet/.test(userAgent); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.