Reset WebDAV config state when the UI is left

This commit is contained in:
Torsten Grote 2024-04-17 16:33:10 -03:00
parent f4366d930f
commit a95ba41196
No known key found for this signature in database
GPG key ID: 3E5F77D92CF891FF
3 changed files with 11 additions and 0 deletions

View file

@ -65,6 +65,10 @@ internal class WebDavHandler(
}
}
fun resetConfigState() {
_configState.value = WebDavConfigState.Empty
}
/**
* Searches if there's really an app backup available in the given storage location.
* Returns true if at least one was found and false otherwise.

View file

@ -99,6 +99,8 @@ internal abstract class StorageViewModel(
}
}
fun resetWebDavConfig() = webdavHandler.resetConfigState()
@UiThread
fun onWebDavConfigSuccess(properties: WebDavProperties, plugin: WebDavStoragePlugin) {
mLocationSet.setEvent(true)

View file

@ -93,6 +93,11 @@ class WebDavConfigFragment : Fragment(), View.OnClickListener {
}
}
override fun onDestroy() {
viewModel.resetWebDavConfig()
super.onDestroy()
}
private fun onConfigStateChanged(state: WebDavConfigState) {
when (state) {
WebDavConfigState.Empty -> {