v1.7.3/dynamic welcome url
This commit is contained in:
@@ -10,10 +10,21 @@ CITED ARE THE SOLE INTELLECTUAL PROPERTY OF AYUSHYA AMITABH, AND MAY NOT BE
|
||||
COPIED, EDITED, OR REPRODUCED WITHOUT PERMISSION.
|
||||
************************************************************************/
|
||||
/* global chrome */
|
||||
/* global browswer */
|
||||
/* global browser */
|
||||
/* global firebase */
|
||||
|
||||
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_STRING = APP_VERSION.replace(/\./g, '');
|
||||
@@ -35,8 +46,6 @@ firebase.auth().setPersistence(firebase.auth.Auth.Persistence.LOCAL);
|
||||
const isAuthed = () => true && firebase.auth().currentUser;
|
||||
const doAuth = () => firebase.auth().signInAnonymously();
|
||||
|
||||
let currentUser;
|
||||
|
||||
if (!isAuthed()) doAuth();
|
||||
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') !== APP_VERSION) {
|
||||
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,
|
||||
});
|
||||
window.localStorage.setItem('watchPartyVersion', APP_VERSION);
|
||||
}
|
||||
} else {
|
||||
CHROME_OR_BROWSER.tabs.create({
|
||||
url: 'https://www.chromewatchparty.com/welcome',
|
||||
url: `https://www.${BASE_URL}.com/welcome`,
|
||||
active: true,
|
||||
});
|
||||
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') !== APP_VERSION) {
|
||||
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,
|
||||
});
|
||||
window.localStorage.setItem('watchPartyVersion', APP_VERSION);
|
||||
}
|
||||
} else {
|
||||
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,
|
||||
});
|
||||
window.localStorage.setItem('watchPartyVersion', APP_VERSION);
|
||||
|
||||
Reference in New Issue
Block a user