Don't allow changing backup location while backup is running

This commit is contained in:
Torsten Grote 2024-04-16 17:12:37 -03:00
parent 0e4c37e796
commit a4cccabc5e
No known key found for this signature in database
GPG key ID: 3E5F77D92CF891FF
2 changed files with 9 additions and 3 deletions

View file

@ -91,8 +91,14 @@ class SettingsFragment : PreferenceFragmentCompat() {
backupLocation = findPreference("backup_location")!!
backupLocation.setOnPreferenceClickListener {
viewModel.chooseBackupLocation()
true
if (viewModel.isBackupRunning.value) {
// don't allow changing backup destination while backup is running
// TODO we could show toast or snackbar here
false
} else {
viewModel.chooseBackupLocation()
true
}
}
autoRestore = findPreference(PREF_KEY_AUTO_RESTORE)!!

View file

@ -80,7 +80,7 @@ internal class SettingsViewModel(
override val isRestoreOperation = false
private val isBackupRunning: StateFlow<Boolean>
val isBackupRunning: StateFlow<Boolean>
private val mBackupPossible = MutableLiveData(false)
val backupPossible: LiveData<Boolean> = mBackupPossible