2017-06-22 23:50:57 +02:00
|
|
|
window.Raven = require('raven-js');
|
|
|
|
window.Raven.config(window.dsn).install();
|
|
|
|
window.dsn = undefined;
|
2017-07-20 01:16:46 +02:00
|
|
|
|
|
|
|
const testPilotGA = require('testpilot-ga');
|
2017-07-31 17:32:55 +02:00
|
|
|
const { gcmCompliant, sendEvent } = require('./utils');
|
2017-07-20 01:16:46 +02:00
|
|
|
window.analytics = new testPilotGA({
|
|
|
|
an: 'Firefox Send',
|
|
|
|
ds: 'web',
|
|
|
|
tid: window.trackerId
|
2017-07-27 19:01:39 +02:00
|
|
|
});
|
|
|
|
|
2017-07-27 19:15:50 +02:00
|
|
|
const isSender = !location.pathname.includes('/download');
|
2017-07-31 17:32:55 +02:00
|
|
|
const ec = isSender ? 'sender' : 'recipient';
|
|
|
|
const ua = navigator.userAgent.toLowerCase();
|
2017-07-27 19:01:39 +02:00
|
|
|
|
|
|
|
gcmCompliant().catch(err => {
|
2017-07-31 17:32:55 +02:00
|
|
|
sendEvent(ec, 'unsupported', {
|
2017-07-27 19:01:39 +02:00
|
|
|
cd6: err
|
|
|
|
}).then(() => {
|
2017-07-27 20:24:49 +02:00
|
|
|
location.replace('/unsupported/gcm');
|
2017-07-27 19:01:39 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-07-31 17:32:55 +02:00
|
|
|
if (
|
|
|
|
ua.indexOf('firefox') > -1 &&
|
|
|
|
parseInt(ua.match(/firefox\/*([^\n\r]*)\./)[1], 10) <= 49
|
|
|
|
) {
|
|
|
|
sendEvent(ec, 'unsupported', {
|
|
|
|
cd6: new Error('Firefox is outdated.')
|
|
|
|
}).then(() => {
|
|
|
|
location.replace('/unsupported/outdated');
|
|
|
|
});
|
|
|
|
}
|