mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-15 14:05:05 -05:00
. fixed bug # 87: Acccounts all refresh at the same freqency
This commit is contained in:
parent
dba525739e
commit
3217d4b772
@ -1441,8 +1441,21 @@ s * critical data as fast as possible, and then we'll fill in the de
|
|||||||
accounts = Preferences.getPreferences(context).getAccounts();
|
accounts = Preferences.getPreferences(context).getAccounts();
|
||||||
}
|
}
|
||||||
for (Account account : accounts) {
|
for (Account account : accounts) {
|
||||||
sendPendingMessagesSynchronous(account);
|
//We do the math in seconds and not millis
|
||||||
synchronizeMailboxSynchronous(account, k9.INBOX);
|
//since timers are not that accurate
|
||||||
|
long now = (long)Math.floor(System.currentTimeMillis() / 1000);
|
||||||
|
long autoCheckIntervalTime = account.getAutomaticCheckIntervalMinutes() * 60;
|
||||||
|
long lastAutoCheckTime = (long)Math.ceil(account.getLastAutomaticCheckTime() / 1000);
|
||||||
|
if (autoCheckIntervalTime>0
|
||||||
|
&& (now-lastAutoCheckTime)>autoCheckIntervalTime) {
|
||||||
|
sendPendingMessagesSynchronous(account);
|
||||||
|
synchronizeMailboxSynchronous(account, k9.INBOX);
|
||||||
|
//This saves the last auto check time even if sync fails
|
||||||
|
//TODO: Listen for both send and sync success and failures
|
||||||
|
//and only save last auto check time is not errors
|
||||||
|
account.setLastAutomaticCheckTime(now*1000);
|
||||||
|
account.save(Preferences.getPreferences(context));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (MessagingListener l : mListeners) {
|
for (MessagingListener l : mListeners) {
|
||||||
l.checkMailFinished(context, account);
|
l.checkMailFinished(context, account);
|
||||||
|
Loading…
Reference in New Issue
Block a user