diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2016-08-03 00:01:33 -0400 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2016-08-02 20:01:33 -0800 |
commit | 1de3bd3b4340cb51b2699a14a92d653db988a988 (patch) | |
tree | 604703f9acf4ea3b71f30bdfa532020e9fb233be /webapp/stores/browser_store.jsx | |
parent | 790dd91e7d93b5debaf86915c34f8a73a3ff95bd (diff) | |
download | chat-1de3bd3b4340cb51b2699a14a92d653db988a988.tar.gz chat-1de3bd3b4340cb51b2699a14a92d653db988a988.tar.bz2 chat-1de3bd3b4340cb51b2699a14a92d653db988a988.zip |
PLT-3640 Add mobile landing pages (#3674)
* PLT-3640 Moved all clientside user agent snooping into a single file
* PLT-3640 Added mobile landing pages on login to iOS and Android web apps
* PLT-3640 Moved landing page to appear before first login
* PLT-3640 Fixed detection of Chrome on Android
* PLT-3640 Disabled mobile landing pages when their respective URLs are set to blank
Diffstat (limited to 'webapp/stores/browser_store.jsx')
-rw-r--r-- | webapp/stores/browser_store.jsx | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/webapp/stores/browser_store.jsx b/webapp/stores/browser_store.jsx index f19e5b9a1..9acd8530c 100644 --- a/webapp/stores/browser_store.jsx +++ b/webapp/stores/browser_store.jsx @@ -20,27 +20,6 @@ function getPrefix() { } class BrowserStoreClass { - constructor() { - this.getItem = this.getItem.bind(this); - this.setItem = this.setItem.bind(this); - this.removeItem = this.removeItem.bind(this); - this.setGlobalItem = this.setGlobalItem.bind(this); - this.getGlobalItem = this.getGlobalItem.bind(this); - this.removeGlobalItem = this.removeGlobalItem.bind(this); - this.actionOnItemsWithPrefix = this.actionOnItemsWithPrefix.bind(this); - this.actionOnGlobalItemsWithPrefix = this.actionOnGlobalItemsWithPrefix.bind(this); - this.isLocalStorageSupported = this.isLocalStorageSupported.bind(this); - this.getLastServerVersion = this.getLastServerVersion.bind(this); - this.setLastServerVersion = this.setLastServerVersion.bind(this); - this.clear = this.clear.bind(this); - this.clearAll = this.clearAll.bind(this); - this.checkedLocalStorageSupported = ''; - this.signalLogout = this.signalLogout.bind(this); - this.isSignallingLogout = this.isSignallingLogout.bind(this); - this.signalLogin = this.signalLogin.bind(this); - this.isSignallingLogin = this.isSignallingLogin.bind(this); - } - setItem(name, value) { this.setGlobalItem(getPrefix() + name, value); } @@ -162,9 +141,10 @@ class BrowserStoreClass { } clear() { - // don't clear the logout id so IE11 can tell which tab sent a logout request + // persist some values through logout since they're independent of which user is logged in const logoutId = sessionStorage.getItem('__logout__'); const serverVersion = this.getLastServerVersion(); + const landingPageSeen = this.hasSeenLandingPage(); sessionStorage.clear(); localStorage.clear(); @@ -176,11 +156,10 @@ class BrowserStoreClass { if (serverVersion) { this.setLastServerVersion(serverVersion); } - } - clearAll() { - sessionStorage.clear(); - localStorage.clear(); + if (landingPageSeen) { + this.setLandingPageSeen(landingPageSeen); + } } isLocalStorageSupported() { @@ -210,6 +189,14 @@ class BrowserStoreClass { return this.checkedLocalStorageSupported; } + + hasSeenLandingPage() { + return JSON.parse(sessionStorage.getItem('__landingPageSeen__')); + } + + setLandingPageSeen(landingPageSeen) { + return sessionStorage.setItem('__landingPageSeen__', JSON.stringify(landingPageSeen)); + } } var BrowserStore = new BrowserStoreClass(); |