Time limit improvements

This commit is contained in:
RainLoop Team 2016-05-22 15:27:50 +03:00
parent d2c16381e2
commit 338f18d2af
3 changed files with 38 additions and 22 deletions

View file

@ -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);

View file

@ -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();
}
};

View file

@ -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() {