Make keep Num Backups a static Config variable

This commit is contained in:
Torsten Flammiger 2023-07-03 22:46:48 +02:00
parent cb13a6cadd
commit a0a34be22b
2 changed files with 6 additions and 2 deletions

View file

@ -247,4 +247,8 @@ public final class Config {
public static final int QUOTE_MAX_DEPTH = 7;
// How deep nested quotes should be created on quoting a message.
public static final int QUOTING_MAX_DEPTH = 2;
// How many backups should be kept during backup rotation
// We store this as String because the setting is stored as String
public static final String KEEP_DEFAULT_MAX_BACKUPS = "3";
}

View file

@ -431,7 +431,7 @@ public class ExportBackupService extends Service {
// Needed to lookup up the number of files to keep during backup file rotation
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
final Integer keepNumBackups = Integer.parseInt(pref.getString("keep_num_backups", "3"));
final Integer keepNumBackups = Integer.parseInt(pref.getString("keep_num_backups", Config.KEEP_DEFAULT_MAX_BACKUPS));
for (final Account account : this.mAccounts) {
try {
@ -511,7 +511,7 @@ public class ExportBackupService extends Service {
success = true;
if(success) {
final Integer keepNumBackups = Integer.parseInt(pref.getString("keep_num_backups", "3"));
final Integer keepNumBackups = Integer.parseInt(pref.getString("keep_num_backups", Config.KEEP_DEFAULT_MAX_BACKUPS));
rotateBackups(keepNumBackups,"settings");
}