mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 15:45:55 +08:00
Time limit improvements
This commit is contained in:
parent
d2c16381e2
commit
338f18d2af
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue