Add mobile sync setting (#6349)

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

View File

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

View File

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

View File

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

View File

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