From 6b291ae01207e0b72b41fb4fb80ffeca00dbbcb0 Mon Sep 17 00:00:00 2001 From: Erica Wright Date: Thu, 27 Jul 2017 11:13:59 -0400 Subject: [PATCH 1/7] show error page on firefox v49 and below --- frontend/src/common.js | 16 ++++++++++++++++ frontend/src/download.js | 10 +--------- frontend/src/upload.js | 10 ---------- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/frontend/src/common.js b/frontend/src/common.js index 5fa712a3..e2790798 100644 --- a/frontend/src/common.js +++ b/frontend/src/common.js @@ -3,8 +3,24 @@ window.Raven.config(window.dsn).install(); window.dsn = undefined; const testPilotGA = require('testpilot-ga'); +const {gcmCompliant, sendEvent} = require('./utils'); window.analytics = new testPilotGA({ an: 'Firefox Send', ds: 'web', tid: window.trackerId }); + +gcmCompliant().catch(err => { + $('#page-one').attr('hidden', true); + $('#download').attr('hidden', true); + sendEvent('sender', 'unsupported', { + cd6: err + }).then(() => { + location.replace('/unsupported'); + }); +}); + +if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && + parseInt(navigator.userAgent.toLowerCase().match(/firefox\/*([^\n\r]*)\./)[1]) <= 49) { + location.replace('/unsupported'); +} diff --git a/frontend/src/download.js b/frontend/src/download.js index 0a90f3dc..224d3731 100644 --- a/frontend/src/download.js +++ b/frontend/src/download.js @@ -1,6 +1,6 @@ require('./common'); const FileReceiver = require('./fileReceiver'); -const { notify, findMetric, gcmCompliant, sendEvent } = require('./utils'); +const { notify, findMetric, sendEvent } = require('./utils'); const bytes = require('bytes'); const Storage = require('./storage'); const storage = new Storage(localStorage); @@ -11,14 +11,6 @@ require('jquery-circle-progress'); const Raven = window.Raven; $(document).ready(function() { - gcmCompliant().catch(err => { - $('#download').attr('hidden', true); - sendEvent('recipient', 'unsupported', { - cd6: err - }).then(() => { - location.replace('/unsupported'); - }); - }); //link back to homepage $('.send-new').attr('href', window.location.origin); diff --git a/frontend/src/upload.js b/frontend/src/upload.js index ab8a0c13..bb1c3f55 100644 --- a/frontend/src/upload.js +++ b/frontend/src/upload.js @@ -3,7 +3,6 @@ require('./common'); const FileSender = require('./fileSender'); const { notify, - gcmCompliant, findMetric, sendEvent, ONE_DAY_IN_MS @@ -25,15 +24,6 @@ if (storage.has('referrer')) { } $(document).ready(function() { - gcmCompliant().catch(err => { - $('#page-one').attr('hidden', true); - sendEvent('sender', 'unsupported', { - cd6: err - }).then(() => { - location.replace('/unsupported'); - }); - }); - $('#file-upload').change(onUpload); $('.legal-links a, .social-links a, #dl-firefox').click(function(target) { From fae65613930bdff1f5da0c4a918b18d3b5b875da Mon Sep 17 00:00:00 2001 From: Abhinav Adduri Date: Thu, 27 Jul 2017 09:09:09 -0700 Subject: [PATCH 2/7] adding metrics event --- frontend/src/common.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/common.js b/frontend/src/common.js index e2790798..48724ef7 100644 --- a/frontend/src/common.js +++ b/frontend/src/common.js @@ -22,5 +22,9 @@ gcmCompliant().catch(err => { if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && parseInt(navigator.userAgent.toLowerCase().match(/firefox\/*([^\n\r]*)\./)[1]) <= 49) { - location.replace('/unsupported'); + sendEvent('sender', 'unsupported', { + cd6: 'Unsupported Firefox' + }).then(() => { + location.replace('/unsupported'); + }); } From 8eae1f282b387f552ec62ba7af7bd99f47e43717 Mon Sep 17 00:00:00 2001 From: Abhinav Adduri Date: Thu, 27 Jul 2017 09:54:50 -0700 Subject: [PATCH 3/7] fixed metrics for sender and recipient --- frontend/src/common.js | 21 +-------------------- frontend/src/download.js | 19 +++++++++++++++++++ frontend/src/upload.js | 20 ++++++++++++++++++++ 3 files changed, 40 insertions(+), 20 deletions(-) diff --git a/frontend/src/common.js b/frontend/src/common.js index 48724ef7..27e9e5fa 100644 --- a/frontend/src/common.js +++ b/frontend/src/common.js @@ -8,23 +8,4 @@ window.analytics = new testPilotGA({ an: 'Firefox Send', ds: 'web', tid: window.trackerId -}); - -gcmCompliant().catch(err => { - $('#page-one').attr('hidden', true); - $('#download').attr('hidden', true); - sendEvent('sender', 'unsupported', { - cd6: err - }).then(() => { - location.replace('/unsupported'); - }); -}); - -if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && - parseInt(navigator.userAgent.toLowerCase().match(/firefox\/*([^\n\r]*)\./)[1]) <= 49) { - sendEvent('sender', 'unsupported', { - cd6: 'Unsupported Firefox' - }).then(() => { - location.replace('/unsupported'); - }); -} +}); \ No newline at end of file diff --git a/frontend/src/download.js b/frontend/src/download.js index 224d3731..2268fc86 100644 --- a/frontend/src/download.js +++ b/frontend/src/download.js @@ -8,6 +8,25 @@ const storage = new Storage(localStorage); const $ = require('jquery'); require('jquery-circle-progress'); +gcmCompliant().catch(err => { + $('#page-one').attr('hidden', true); + $('#download').attr('hidden', true); + sendEvent('recipient', 'unsupported', { + cd6: err + }).then(() => { + location.replace('/unsupported'); + }); +}); + +if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && + parseInt(navigator.userAgent.toLowerCase().match(/firefox\/*([^\n\r]*)\./)[1]) <= 49) { + sendEvent('recipient', 'unsupported', { + cd6: new Error('Firefox is outdated.') + }).then(() => { + location.replace('/unsupported'); + }); +} + const Raven = window.Raven; $(document).ready(function() { diff --git a/frontend/src/upload.js b/frontend/src/upload.js index bb1c3f55..0d283f88 100644 --- a/frontend/src/upload.js +++ b/frontend/src/upload.js @@ -11,6 +11,26 @@ const bytes = require('bytes'); const Storage = require('./storage'); const storage = new Storage(localStorage); +gcmCompliant().catch(err => { + $('#page-one').attr('hidden', true); + $('#download').attr('hidden', true); + sendEvent('sender', 'unsupported', { + cd6: err + }).then(() => { + location.replace('/unsupported'); + }); +}); + +if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && + parseInt(navigator.userAgent.toLowerCase().match(/firefox\/*([^\n\r]*)\./)[1]) <= 49) { + sendEvent('sender', 'unsupported', { + cd6: new Error('Firefox is outdated.') + }).then(() => { + location.replace('/unsupported'); + }); +} + + const $ = require('jquery'); require('jquery-circle-progress'); From 7a53ed96ed5b6c439456172335bc51e2f00eb01c Mon Sep 17 00:00:00 2001 From: Abhinav Adduri Date: Thu, 27 Jul 2017 10:01:39 -0700 Subject: [PATCH 4/7] moved back to common --- frontend/src/common.js | 23 ++++++++++++++++++++++- frontend/src/download.js | 19 ------------------- frontend/src/upload.js | 20 -------------------- 3 files changed, 22 insertions(+), 40 deletions(-) diff --git a/frontend/src/common.js b/frontend/src/common.js index 27e9e5fa..bd49f149 100644 --- a/frontend/src/common.js +++ b/frontend/src/common.js @@ -8,4 +8,25 @@ window.analytics = new testPilotGA({ an: 'Firefox Send', ds: 'web', tid: window.trackerId -}); \ No newline at end of file +}); + +const isSender = location.pathname.includes('/download'); + +gcmCompliant().catch(err => { + $('#page-one').attr('hidden', true); + $('#download').attr('hidden', true); + sendEvent(isSender ? 'sender' : 'recipient', 'unsupported', { + cd6: err + }).then(() => { + location.replace('/unsupported'); + }); +}); + +if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && + parseInt(navigator.userAgent.toLowerCase().match(/firefox\/*([^\n\r]*)\./)[1]) <= 49) { + sendEvent(isSender ? 'sender' : 'recipient', 'unsupported', { + cd6: new Error('Firefox is outdated.') + }).then(() => { + location.replace('/unsupported'); + }); +} \ No newline at end of file diff --git a/frontend/src/download.js b/frontend/src/download.js index 2268fc86..224d3731 100644 --- a/frontend/src/download.js +++ b/frontend/src/download.js @@ -8,25 +8,6 @@ const storage = new Storage(localStorage); const $ = require('jquery'); require('jquery-circle-progress'); -gcmCompliant().catch(err => { - $('#page-one').attr('hidden', true); - $('#download').attr('hidden', true); - sendEvent('recipient', 'unsupported', { - cd6: err - }).then(() => { - location.replace('/unsupported'); - }); -}); - -if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && - parseInt(navigator.userAgent.toLowerCase().match(/firefox\/*([^\n\r]*)\./)[1]) <= 49) { - sendEvent('recipient', 'unsupported', { - cd6: new Error('Firefox is outdated.') - }).then(() => { - location.replace('/unsupported'); - }); -} - const Raven = window.Raven; $(document).ready(function() { diff --git a/frontend/src/upload.js b/frontend/src/upload.js index 0d283f88..bb1c3f55 100644 --- a/frontend/src/upload.js +++ b/frontend/src/upload.js @@ -11,26 +11,6 @@ const bytes = require('bytes'); const Storage = require('./storage'); const storage = new Storage(localStorage); -gcmCompliant().catch(err => { - $('#page-one').attr('hidden', true); - $('#download').attr('hidden', true); - sendEvent('sender', 'unsupported', { - cd6: err - }).then(() => { - location.replace('/unsupported'); - }); -}); - -if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && - parseInt(navigator.userAgent.toLowerCase().match(/firefox\/*([^\n\r]*)\./)[1]) <= 49) { - sendEvent('sender', 'unsupported', { - cd6: new Error('Firefox is outdated.') - }).then(() => { - location.replace('/unsupported'); - }); -} - - const $ = require('jquery'); require('jquery-circle-progress'); From 318e1a49bfcad516d51d9985883981a8cbf19510 Mon Sep 17 00:00:00 2001 From: Erica Wright Date: Thu, 27 Jul 2017 13:15:50 -0400 Subject: [PATCH 5/7] remove hiding elements with jquery --- frontend/src/common.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/frontend/src/common.js b/frontend/src/common.js index bd49f149..26ecff1a 100644 --- a/frontend/src/common.js +++ b/frontend/src/common.js @@ -10,11 +10,9 @@ window.analytics = new testPilotGA({ tid: window.trackerId }); -const isSender = location.pathname.includes('/download'); +const isSender = !location.pathname.includes('/download'); gcmCompliant().catch(err => { - $('#page-one').attr('hidden', true); - $('#download').attr('hidden', true); sendEvent(isSender ? 'sender' : 'recipient', 'unsupported', { cd6: err }).then(() => { From 8d8c2efa23a0c3dc55f398bf763afabb90cddeda Mon Sep 17 00:00:00 2001 From: Erica Wright Date: Thu, 27 Jul 2017 14:24:49 -0400 Subject: [PATCH 6/7] create /unsupported/outdated version of the /unsupported page --- frontend/src/common.js | 4 ++-- public/locales/en-US/send.ftl | 2 ++ public/main.css | 11 ++++++----- server/server.js | 7 +++++-- views/unsupported.handlebars | 22 +++++++++++++++------- 5 files changed, 30 insertions(+), 16 deletions(-) diff --git a/frontend/src/common.js b/frontend/src/common.js index 26ecff1a..ecee7102 100644 --- a/frontend/src/common.js +++ b/frontend/src/common.js @@ -16,7 +16,7 @@ gcmCompliant().catch(err => { sendEvent(isSender ? 'sender' : 'recipient', 'unsupported', { cd6: err }).then(() => { - location.replace('/unsupported'); + location.replace('/unsupported/gcm'); }); }); @@ -25,6 +25,6 @@ if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && sendEvent(isSender ? 'sender' : 'recipient', 'unsupported', { cd6: new Error('Firefox is outdated.') }).then(() => { - location.replace('/unsupported'); + location.replace('/unsupported/outdated'); }); } \ No newline at end of file diff --git a/public/locales/en-US/send.ftl b/public/locales/en-US/send.ftl index f9ddf900..8f3b18bc 100644 --- a/public/locales/en-US/send.ftl +++ b/public/locales/en-US/send.ftl @@ -67,6 +67,8 @@ expiredPageHeader = This link has expired or never existed in the first place! notSupportedHeader = Your browser is not supported. // Firefox Send is a brand name and should not be localized. notSupportedDetail = Unfortunately this browser does not support the web technology that powers Firefox Send. You’ll need to try another browser. We recommend Firefox! +notSupportedOutdatedDetail = Unfortunately this version of Firefox does not support the web technology that powers Firefox Send. You’ll need to update your browser. +updateFirefox = Update Firefox downloadFirefoxButtonSub = Free Download uploadedFile = File copyFileList = Copy URL diff --git a/public/main.css b/public/main.css index 5be705a2..8f51109f 100644 --- a/public/main.css +++ b/public/main.css @@ -517,13 +517,13 @@ tbody { margin: 0 auto 23px; } -#firefox-logo { +.firefox-logo { width: 70px; } -#dl-firefox { +#dl-firefox, +#update-firefox { margin-bottom: 181px; - width: 260px; height: 80px; background: #12bc00; border-radius: 3px; @@ -538,14 +538,15 @@ tbody { justify-content: center; align-items: center; line-height: 1; + padding: 0 25px; } -#dl-firefox-text { +.unsupported-button-text { text-align: left; margin-left: 20.4px; } -#dl-firefox-text > span { +.unsupported-button-text > span { font-family: 'Fira Sans'; font-weight: 300; font-size: 18px; diff --git a/server/server.js b/server/server.js index b12f3f57..1daf549e 100644 --- a/server/server.js +++ b/server/server.js @@ -96,8 +96,11 @@ app.get('/', (req, res) => { res.render('index'); }); -app.get('/unsupported', (req, res) => { - res.render('unsupported'); +app.get('/unsupported/:reason', (req, res) => { + const outdated = req.params.reason === 'outdated'? true : false; + res.render('unsupported', { + outdated: outdated + }); }); app.get('/legal', (req, res) => { diff --git a/views/unsupported.handlebars b/views/unsupported.handlebars index 62814e57..358bab65 100644 --- a/views/unsupported.handlebars +++ b/views/unsupported.handlebars @@ -1,11 +1,19 @@
-
- - -
Firefox
- -
-
+ {{#if outdated}} +
+ + +
+
+ {{else}} +
+ + +
Firefox
+ +
+
+ {{/if}}
From 8cb40effa553d543ea5f8c637064e3c1a860a8e4 Mon Sep 17 00:00:00 2001 From: Erica Wright Date: Thu, 27 Jul 2017 14:54:36 -0400 Subject: [PATCH 7/7] edit some syntax --- server/server.js | 2 +- views/unsupported.handlebars | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/server.js b/server/server.js index 1daf549e..92fcee82 100644 --- a/server/server.js +++ b/server/server.js @@ -97,7 +97,7 @@ app.get('/', (req, res) => { }); app.get('/unsupported/:reason', (req, res) => { - const outdated = req.params.reason === 'outdated'? true : false; + const outdated = req.params.reason === 'outdated'; res.render('unsupported', { outdated: outdated }); diff --git a/views/unsupported.handlebars b/views/unsupported.handlebars index 358bab65..04a428b2 100644 --- a/views/unsupported.handlebars +++ b/views/unsupported.handlebars @@ -2,7 +2,7 @@
{{#if outdated}}
- +