diff --git a/app/src/main/java/com/nextcloud/client/jobs/CalendarBackupWork.kt b/app/src/main/java/com/nextcloud/client/jobs/CalendarBackupWork.kt
index 9636afa379..b7e1b156c4 100644
--- a/app/src/main/java/com/nextcloud/client/jobs/CalendarBackupWork.kt
+++ b/app/src/main/java/com/nextcloud/client/jobs/CalendarBackupWork.kt
@@ -29,6 +29,7 @@ import androidx.work.Worker
import androidx.work.WorkerParameters
import com.nextcloud.client.account.UserAccountManager
import com.nextcloud.client.preferences.AppPreferences
+import com.owncloud.android.R
import com.owncloud.android.lib.common.utils.Log_OC
import third_parties.sufficientlysecure.AndroidCalendar
import third_parties.sufficientlysecure.SaveCalendar
@@ -50,6 +51,12 @@ class CalendarBackupWork(
}
override fun doWork(): Result {
+ val showCalendarBackup = applicationContext.resources.getBoolean(R.bool.show_calendar_backup)
+ if (!showCalendarBackup) {
+ Log_OC.d(TAG, "Calendar backup is disabled.")
+ return Result.success()
+ }
+
val accountName = inputData.getString(ACCOUNT) ?: ""
val optionalUser = accountManager.getUser(accountName)
if (!optionalUser.isPresent || TextUtils.isEmpty(accountName)) { // no account provided
diff --git a/app/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java
index dd129515c3..bccf177251 100644
--- a/app/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java
+++ b/app/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java
@@ -561,6 +561,13 @@ public class SettingsActivity extends PreferenceActivity
private void setupBackupPreference() {
Preference pContactsBackup = findPreference("backup");
if (pContactsBackup != null) {
+ boolean showCalendarBackup = getResources().getBoolean(R.bool.show_calendar_backup);
+ pContactsBackup.setTitle(showCalendarBackup
+ ? getString(R.string.backup_title)
+ : getString(R.string.contact_backup_title));
+ pContactsBackup.setSummary(showCalendarBackup
+ ? getString(R.string.prefs_daily_backup_summary)
+ : getString(R.string.prefs_daily_contact_backup_summary));
pContactsBackup.setOnPreferenceClickListener(preference -> {
ContactsPreferenceActivity.startActivityWithoutSidebar(this);
return true;
diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/BackupFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/BackupFragment.java
index 07fedb17a7..f6259a65c1 100644
--- a/app/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/BackupFragment.java
+++ b/app/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/BackupFragment.java
@@ -102,7 +102,8 @@ public class BackupFragment extends FileFragment implements DatePickerDialog.OnD
private CompoundButton.OnCheckedChangeListener calendarCheckedListener;
private User user;
private boolean showSidebar = true;
-
+ //flag to check if calendar backup should be shown and backup should be done or not
+ private boolean showCalendarBackup = true;
public static BackupFragment create(boolean showSidebar) {
BackupFragment fragment = new BackupFragment();
Bundle bundle = new Bundle();
@@ -144,6 +145,8 @@ public class BackupFragment extends FileFragment implements DatePickerDialog.OnD
showSidebar = getArguments().getBoolean(ARG_SHOW_SIDEBAR);
}
+ showCalendarBackup = requireContext().getResources().getBoolean(R.bool.show_calendar_backup);
+
final ContactsPreferenceActivity contactsPreferenceActivity = (ContactsPreferenceActivity) getActivity();
user = contactsPreferenceActivity.getUser().orElseThrow(RuntimeException::new);
@@ -151,7 +154,8 @@ public class BackupFragment extends FileFragment implements DatePickerDialog.OnD
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
- viewThemeUtils.files.themeActionBar(requireContext(), actionBar, R.string.backup_title);
+ viewThemeUtils.files.themeActionBar(requireContext(), actionBar,
+ showCalendarBackup ? R.string.backup_title : R.string.contact_backup_title);
}
@@ -164,6 +168,7 @@ public class BackupFragment extends FileFragment implements DatePickerDialog.OnD
binding.contacts.setChecked(isContactsBackupEnabled() && checkContactBackupPermission());
binding.calendar.setChecked(isCalendarBackupEnabled() && checkCalendarBackupPermission(getContext()));
+ binding.calendar.setVisibility(showCalendarBackup ? View.VISIBLE : View.GONE);
setupCheckListeners();
@@ -395,7 +400,7 @@ public class BackupFragment extends FileFragment implements DatePickerDialog.OnD
startContactsBackupJob();
}
- if (isCalendarBackupEnabled() && checkCalendarBackupPermission(requireContext())) {
+ if (showCalendarBackup && isCalendarBackupEnabled() && checkCalendarBackupPermission(requireContext())) {
startCalendarBackupJob();
}
@@ -651,7 +656,7 @@ public class BackupFragment extends FileFragment implements DatePickerDialog.OnD
}
// calendars
- if (MimeTypeUtil.isCalendar(file)) {
+ if (showCalendarBackup && MimeTypeUtil.isCalendar(file)) {
calendarBackupsToRestore.add(file);
}
}
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 370342829f..0cd6950e4e 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -80,6 +80,7 @@
Abwesend
Sicherungseinstellungen
Kontakte & Kalender-Sicherung
+ Kontakte-Sicherung
Schliessen
Deaktivieren
Ihr Gerät hat möglicherweise Batterieoptimierung aktiv. AutoUpload funktioniert nur dann richtig, wenn Sie diese App davon ausschließen.
@@ -561,6 +562,7 @@
Allgemein
Mehr
Tägliche Sicherung Ihrer Kalender & Kontakte
+ Tägliche Sicherung Ihrer Kontakte
Unerwarteter Fehler beim Einrichten von DAVx5 (früher bekannt als DAVdroid)
Ende-zu-Ende-Verschlüsselung ist eingerichtet!
E2E-Gedächtnisstütze
diff --git a/app/src/main/res/values/setup.xml b/app/src/main/res/values/setup.xml
index ade16d4ce3..71521eee85 100644
--- a/app/src/main/res/values/setup.xml
+++ b/app/src/main/res/values/setup.xml
@@ -36,6 +36,8 @@
/.Contacts-Backup
-1
/.Calendar-Backup
+
+ true
true
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index ca3a8e205e..c97144a3b2 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -50,6 +50,7 @@
Neither F-Droid nor Google Play is installed
Calendar & contacts sync set up
Daily backup of your calendar & contacts
+ Daily backup of your contacts
Manage folders for auto upload
Help
Recommend to a friend
@@ -605,7 +606,7 @@
Backup scheduled and will start shortly
Import scheduled and will start shortly
Contacts & calendar backup
-
+ Contacts backup
Log out
No app found to set a picture with
Privacy