From 98fd9efc33fa7554e30a8c8869102904154266c5 Mon Sep 17 00:00:00 2001 From: Kushagra Gour Date: Tue, 23 Jan 2018 02:12:35 +0530 Subject: [PATCH] handle multitab error. --- src/auth.js | 4 +--- src/db.js | 5 ++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/auth.js b/src/auth.js index 18561a2..8a8583e 100644 --- a/src/auth.js +++ b/src/auth.js @@ -1,5 +1,3 @@ -/* global trackEvent */ - window.logout = function logout() { firebase.auth().signOut(); }; @@ -20,7 +18,7 @@ function login(providerName) { .auth() .signInWithPopup(provider) .then(function() { - trackEvent('fn', 'loggedIn', providerName); + window.trackEvent('fn', 'loggedIn', providerName); // Save to recommend next time window.db.local.set({ lastAuthProvider: providerName }); }) diff --git a/src/db.js b/src/db.js index c2c9395..7346b12 100644 --- a/src/db.js +++ b/src/db.js @@ -58,7 +58,10 @@ if (err.code === 'failed-precondition') { // Multiple tabs open, persistence can only be enabled // in one tab at a a time. - // ... + alert( + "Opening Web Maker web app in multiple tabs isn't supported at present and it seems like you already have it opened in another tab. Please use in one tab." + ); + window.trackEvent('fn', 'multiTabError'); } else if (err.code === 'unimplemented') { // The current browser does not support all of the // features required to enable persistence