v1.7.3/dynamic welcome url

This commit is contained in:
2020-09-09 23:19:54 -04:00
parent c39e25d3ef
commit 7bfd2f04b4
+16 -7
View File
@@ -10,10 +10,21 @@ CITED ARE THE SOLE INTELLECTUAL PROPERTY OF AYUSHYA AMITABH, AND MAY NOT BE
COPIED, EDITED, OR REPRODUCED WITHOUT PERMISSION. COPIED, EDITED, OR REPRODUCED WITHOUT PERMISSION.
************************************************************************/ ************************************************************************/
/* global chrome */ /* global chrome */
/* global browswer */ /* global browser */
/* global firebase */ /* global firebase */
let CHROME_OR_BROWSER = chrome || browser; let CHROME_OR_BROWSER = chrome || browser;
let currentUser;
let BASE_URL = 'chromewatchparty';
try {
if (browser) {
BASE_URL = 'firefoxwatchparty';
console.info('FIREFOX ENV');
}
} catch (err) {
console.info('CHROME ENV');
}
const APP_VERSION = '1.7.3'; const APP_VERSION = '1.7.3';
const APP_VERSION_STRING = APP_VERSION.replace(/\./g, ''); const APP_VERSION_STRING = APP_VERSION.replace(/\./g, '');
@@ -35,8 +46,6 @@ firebase.auth().setPersistence(firebase.auth.Auth.Persistence.LOCAL);
const isAuthed = () => true && firebase.auth().currentUser; const isAuthed = () => true && firebase.auth().currentUser;
const doAuth = () => firebase.auth().signInAnonymously(); const doAuth = () => firebase.auth().signInAnonymously();
let currentUser;
if (!isAuthed()) doAuth(); if (!isAuthed()) doAuth();
else currentUser = firebase.auth().currentUser; else currentUser = firebase.auth().currentUser;
@@ -88,14 +97,14 @@ CHROME_OR_BROWSER.runtime.onInstalled.addListener((details) => {
if (window.localStorage.getItem('watchPartyVersion')) { if (window.localStorage.getItem('watchPartyVersion')) {
if (window.localStorage.getItem('watchPartyVersion') !== APP_VERSION) { if (window.localStorage.getItem('watchPartyVersion') !== APP_VERSION) {
CHROME_OR_BROWSER.tabs.create({ CHROME_OR_BROWSER.tabs.create({
url: `http://www.chromewatchparty.com/changes/v${APP_VERSION}`, url: `http://www.${BASE_URL}.com/changes/v${APP_VERSION}`,
active: true, active: true,
}); });
window.localStorage.setItem('watchPartyVersion', APP_VERSION); window.localStorage.setItem('watchPartyVersion', APP_VERSION);
} }
} else { } else {
CHROME_OR_BROWSER.tabs.create({ CHROME_OR_BROWSER.tabs.create({
url: 'https://www.chromewatchparty.com/welcome', url: `https://www.${BASE_URL}.com/welcome`,
active: true, active: true,
}); });
window.localStorage.setItem('watchPartyVersion', APP_VERSION); window.localStorage.setItem('watchPartyVersion', APP_VERSION);
@@ -104,14 +113,14 @@ CHROME_OR_BROWSER.runtime.onInstalled.addListener((details) => {
if (window.localStorage.getItem('watchPartyVersion')) { if (window.localStorage.getItem('watchPartyVersion')) {
if (window.localStorage.getItem('watchPartyVersion') !== APP_VERSION) { if (window.localStorage.getItem('watchPartyVersion') !== APP_VERSION) {
CHROME_OR_BROWSER.tabs.create({ CHROME_OR_BROWSER.tabs.create({
url: `http://www.chromewatchparty.com/changes/v${APP_VERSION}`, url: `http://www.${BASE_URL}.com/changes/v${APP_VERSION}`,
active: true, active: true,
}); });
window.localStorage.setItem('watchPartyVersion', APP_VERSION); window.localStorage.setItem('watchPartyVersion', APP_VERSION);
} }
} else { } else {
CHROME_OR_BROWSER.tabs.create({ CHROME_OR_BROWSER.tabs.create({
url: `http://www.chromewatchparty.com/changes/v${APP_VERSION}`, url: `http://www.${BASE_URL}.com/changes/v${APP_VERSION}`,
active: true, active: true,
}); });
window.localStorage.setItem('watchPartyVersion', APP_VERSION); window.localStorage.setItem('watchPartyVersion', APP_VERSION);