diff --git a/dev/App/User.jsx b/dev/App/User.jsx index 8540bda51..8b83669ca 100644 --- a/dev/App/User.jsx +++ b/dev/App/User.jsx @@ -26,6 +26,7 @@ import ContactStore from 'Stores/User/Contact'; import Local from 'Storage/Client'; import Settings from 'Storage/Settings'; +import RainLoopStorage from 'Storage/RainLoop'; import Remote from 'Remote/User/Ajax'; import Promises from 'Promises/User/Ajax'; @@ -67,21 +68,25 @@ class AppUser extends AbstractApp window.setTimeout(() => window.setInterval(() => Events.pub('interval.10m-after5m'), 60000 * 10), 60000 * 5); $.wakeUp(() => { + if (RainLoopStorage.checkTimestamp()) + { + this.reload(); + } + Remote.jsVersion((sResult, oData) => { if (Enums.StorageResultType.Success === sResult && oData && !oData.Result) { - if (window.parent && !!Settings.appSettingsGet('inIframe')) - { - window.parent.location.reload(); - } - else - { - window.location.reload(); - } + this.reload(); } }, Settings.appSettingsGet('version')); + }, {}, 60 * 60 * 1000); + if (RainLoopStorage.checkTimestamp()) + { + this.reload(); + } + if (Settings.settingsGet('UserBackgroundHash')) { _.delay(() => { @@ -104,6 +109,17 @@ class AppUser extends AbstractApp return Remote; } + reload() { + if (window.parent && !!Settings.appSettingsGet('inIframe')) + { + window.parent.location.reload(); + } + else + { + window.location.reload(); + } + } + reloadFlagsCurrentMessageListAndMessageFromCache() { _.each(MessageStore.messageList(), (message) => { Cache.initMessageFlagsFromCache(message); diff --git a/dev/Common/Booter.jsx b/dev/Common/Booter.jsx index 33ece579f..678bb2807 100644 --- a/dev/Common/Booter.jsx +++ b/dev/Common/Booter.jsx @@ -2,12 +2,12 @@ import window from 'window'; import progressJs from 'progressJs'; -import rainLoopStorage from 'Storage/RainLoop'; +import RainLoopStorage from 'Storage/RainLoop'; let rlAppDataStorage = null; window.__rlah = () => { - return rainLoopStorage ? rainLoopStorage.getHash() : null; + return RainLoopStorage ? RainLoopStorage.getHash() : null; }; window.__rlah_data = () => { @@ -15,16 +15,16 @@ window.__rlah_data = () => { }; window.__rlah_set = () => { - if (rainLoopStorage) + if (RainLoopStorage) { - rainLoopStorage.setHash(); + RainLoopStorage.setHash(); } }; window.__rlah_clear = () => { - if (rainLoopStorage) + if (RainLoopStorage) { - rainLoopStorage.clearHash(); + RainLoopStorage.clearHash(); } }; diff --git a/dev/Storage/RainLoop.jsx b/dev/Storage/RainLoop.jsx index 0c01d7904..d89f4659f 100644 --- a/dev/Storage/RainLoop.jsx +++ b/dev/Storage/RainLoop.jsx @@ -54,21 +54,21 @@ class RainLoopStorage return window.Math.round((new Date()).getTime() / 1000); } - init() { + checkTimestamp() { - const - six = 1000 * 60 * 6, // 6m - now = this.timestamp() - ; - - if (now > this.getTimestamp() + six * 10) + if (this.timestamp() > this.getTimestamp() + 1000 * 60 * 60) // 60m { this.clearHash(); + return true; } + return false; + } + + init() { window.setInterval(() => { this.setTimestamp(); - }, six); + }, 1000 * 60); // 1m } getHash() {