Skip to content

Commit

Permalink
Reset WebDAV config state when the UI is left
Browse files Browse the repository at this point in the history
  • Loading branch information
grote committed Apr 22, 2024
1 parent 2b0bd4b commit e92c9c9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ internal abstract class StorageViewModel(
}
}

fun resetWebDavConfig() = webdavHandler.resetConfigState()

@UiThread
fun onWebDavConfigSuccess(properties: WebDavProperties, plugin: WebDavStoragePlugin) {
mLocationSet.setEvent(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 -> {
Expand Down

0 comments on commit e92c9c9

Please sign in to comment.