follow "Only on WiFi" preference strictly

This is a tested version of pserwlyo's suggestion in !415
https://gitlab.com/fdroid/fdroidclient/merge_requests/415#note_18469122
This commit is contained in:
Hans-Christoph Steiner 2016-11-15 21:36:05 +01:00
parent 7e7ec966ee
commit b799fe8494

View File

@ -356,12 +356,11 @@ public class UpdateService extends IntentService {
return;
}
if (manualUpdate || (netState == FLAG_NET_NO_LIMIT)) {
// triggered by the user, or by connecting to WiFi, etc.
Utils.debugLog(TAG, "manually requested update or on unlimited internet");
} else if (Preferences.get().isUpdateOnlyOnUnmeteredNetworks()
|| !verifyIsTimeForScheduledRun()) {
Utils.debugLog(TAG, "don't run update, we're on metered internet");
if (manualUpdate) {
Utils.debugLog(TAG, "manually requested update");
} else if (!verifyIsTimeForScheduledRun()
|| (netState == FLAG_NET_METERED && Preferences.get().isUpdateOnlyOnUnmeteredNetworks())) {
Utils.debugLog(TAG, "don't run update");
return;
}