Add mobile sync setting ()

This commit is contained in:
ByteHamster 2023-02-24 22:06:12 +01:00 committed by GitHub
parent 658c47f7a7
commit 6d72d7cebf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 1 deletions
app/src/main/java/de/danoeh/antennapod/preferences
core/src/main
java/de/danoeh/antennapod/core/sync
res/values
storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences

@ -140,6 +140,7 @@ public class PreferenceUpgrader {
.putBoolean(UserPreferences.PREF_THEME_BLACK, true) .putBoolean(UserPreferences.PREF_THEME_BLACK, true)
.apply(); .apply();
} }
UserPreferences.setAllowMobileSync(true);
} }
} }
} }

@ -325,7 +325,7 @@ public class SyncService extends Worker {
private static OneTimeWorkRequest.Builder getWorkRequest() { private static OneTimeWorkRequest.Builder getWorkRequest() {
Constraints.Builder constraints = new Constraints.Builder(); Constraints.Builder constraints = new Constraints.Builder();
if (UserPreferences.isAllowMobileFeedRefresh()) { if (UserPreferences.isAllowMobileSync()) {
constraints.setRequiredNetworkType(NetworkType.CONNECTED); constraints.setRequiredNetworkType(NetworkType.CONNECTED);
} else { } else {
constraints.setRequiredNetworkType(NetworkType.UNMETERED); constraints.setRequiredNetworkType(NetworkType.UNMETERED);

@ -93,6 +93,7 @@
<item>@string/pref_mobileUpdate_auto_download</item> <item>@string/pref_mobileUpdate_auto_download</item>
<item>@string/pref_mobileUpdate_streaming</item> <item>@string/pref_mobileUpdate_streaming</item>
<item>@string/pref_mobileUpdate_images</item> <item>@string/pref_mobileUpdate_images</item>
<item>@string/synchronization_pref</item>
</string-array> </string-array>
<string-array name="mobile_update_values"> <string-array name="mobile_update_values">
@ -101,10 +102,12 @@
<item>auto_download</item> <item>auto_download</item>
<item>streaming</item> <item>streaming</item>
<item>images</item> <item>images</item>
<item>sync</item>
</string-array> </string-array>
<string-array name="mobile_update_default_value"> <string-array name="mobile_update_default_value">
<item>images</item> <item>images</item>
<item>sync</item>
</string-array> </string-array>
<string-array name="episode_cleanup_entries"> <string-array name="episode_cleanup_entries">

@ -507,6 +507,10 @@ public class UserPreferences {
return isAllowMobileFor("feed_refresh"); return isAllowMobileFor("feed_refresh");
} }
public static boolean isAllowMobileSync() {
return isAllowMobileFor("sync");
}
public static boolean isAllowMobileEpisodeDownload() { public static boolean isAllowMobileEpisodeDownload() {
return isAllowMobileFor("episode_download"); return isAllowMobileFor("episode_download");
} }
@ -556,6 +560,10 @@ public class UserPreferences {
setAllowMobileFor("images", allow); setAllowMobileFor("images", allow);
} }
public static void setAllowMobileSync(boolean allow) {
setAllowMobileFor("sync", allow);
}
public static int getParallelDownloads() { public static int getParallelDownloads() {
return Integer.parseInt(prefs.getString(PREF_PARALLEL_DOWNLOADS, "4")); return Integer.parseInt(prefs.getString(PREF_PARALLEL_DOWNLOADS, "4"));
} }