mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-27 00:13:13 +00:00
Check schedule on scheduling next poll
This commit is contained in:
parent
4d52549b7c
commit
96cd456a3d
2 changed files with 8 additions and 4 deletions
|
@ -1604,7 +1604,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|||
ServiceUI.schedule(context, enabled);
|
||||
}
|
||||
|
||||
private static long[] getSchedule(Context context) {
|
||||
static long[] getSchedule(Context context) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
if (!prefs.getBoolean("schedule", false))
|
||||
return null;
|
||||
|
|
|
@ -459,10 +459,14 @@ public class ServiceUI extends IntentService {
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
if (reschedule)
|
||||
schedule(this, true);
|
||||
|
||||
ServiceSynchronize.eval(this, "poll");
|
||||
|
||||
if (reschedule) {
|
||||
long now = new Date().getTime();
|
||||
long[] schedule = ServiceSynchronize.getSchedule(this);
|
||||
boolean enabled = (schedule == null || (now >= schedule[0] && now < schedule[1]));
|
||||
schedule(this, enabled);
|
||||
}
|
||||
}
|
||||
|
||||
private void onBanner() {
|
||||
|
|
Loading…
Reference in a new issue