Merge branch 'master' of github.com:M66B/FairEmail

pull/180/head
M66B 5 years ago
commit 14d851069e

@ -13,8 +13,8 @@ android {
applicationId "eu.faircode.email"
minSdkVersion 21
targetSdkVersion 30
versionCode 1205
versionName "1.1205"
versionCode 1206
versionName "1.1206"
archivesBaseName = "FairEmail-v$versionName"
// https://en.wikipedia.org/wiki/List_of_dinosaur_genera

@ -6779,6 +6779,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
this.across = !folder.account.equals(message.account);
this.account = account;
this.folder = folder;
this.copy = false;
}
MessageTarget(EntityMessage message, EntityAccount account, EntityFolder folder, boolean copy) {

@ -95,7 +95,6 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
private long lastLost = 0;
private int lastAccounts = 0;
private int lastOperations = 0;
private Handler handler;
private Map<Long, Core.State> coreStates = new Hashtable<>();
private MutableLiveData<ConnectionHelper.NetworkState> liveNetworkState = new MutableLiveData<>();
@ -115,7 +114,6 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
private static final int ACCOUNT_ERROR_AFTER = 60; // minutes
private static final int ACCOUNT_ERROR_AFTER_POLL = 3; // times
private static final int BACKOFF_ERROR_AFTER = 16; // seconds
private static final long WIDGET_UPDATE_DELAY = 1500L; // milliseconds
private static final String ACTION_NEW_MESSAGE_COUNT = BuildConfig.APPLICATION_ID + ".NEW_MESSAGE_COUNT";
@ -147,8 +145,6 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
else
startForeground(Helper.NOTIFICATION_SYNCHRONIZE, getNotificationService(null, null).build());
handler = new Handler();
// Listen for network changes
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkRequest.Builder builder = new NetworkRequest.Builder();
@ -530,8 +526,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
last = stats;
handler.removeCallbacks(refreshWidget);
handler.postDelayed(refreshWidget, WIDGET_UPDATE_DELAY);
Widget.update(ServiceSynchronize.this);
boolean badge = prefs.getBoolean("badge", true);
boolean unseen_ignored = prefs.getBoolean("unseen_ignored", false);
@ -585,10 +580,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
break;
}
if (changed) {
handler.removeCallbacks(refreshWidgetUnified);
handler.postDelayed(refreshWidgetUnified, WIDGET_UPDATE_DELAY);
}
if (changed)
WidgetUnified.updateData(ServiceSynchronize.this);
last = current;
}
@ -597,20 +590,6 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
prefs.registerOnSharedPreferenceChangeListener(this);
}
private final Runnable refreshWidget = new Runnable() {
@Override
public void run() {
Widget.update(ServiceSynchronize.this);
}
};
private final Runnable refreshWidgetUnified = new Runnable() {
@Override
public void run() {
WidgetUnified.updateData(ServiceSynchronize.this);
}
};
@Override
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
if (PREF_EVAL.contains(key)) {
@ -1808,7 +1787,10 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
return;
}
if (networkState == null || accountStates == null)
if (networkState == null)
networkState = ConnectionHelper.getNetworkState(ServiceSynchronize.this);
if (accountStates == null)
return;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ServiceSynchronize.this);

Loading…
Cancel
Save