Leave CardDAV config fragment when sync is succesful

This commit is contained in:
Sylvain Berfini 2024-05-23 16:36:51 +02:00
parent 75ce3a9c05
commit f6e6914656
2 changed files with 10 additions and 0 deletions

View file

@ -72,5 +72,12 @@ class CardDavAddressBookConfigurationFragment : GenericMainFragment() {
binding.setBackClickListener {
goBack()
}
viewModel.syncSuccessfulEvent.observe(viewLifecycleOwner) {
it.consume {
Log.i("$TAG Sync successful, going back")
goBack()
}
}
}
}

View file

@ -52,6 +52,8 @@ class CardDavViewModel : GenericViewModel() {
val syncInProgress = MutableLiveData<Boolean>()
val syncSuccessfulEvent = MutableLiveData<Event<Boolean>>()
private lateinit var friendList: FriendList
private val friendListListener = object : FriendListListenerStub() {
@ -75,6 +77,7 @@ class CardDavViewModel : GenericViewModel() {
)
)
)
syncSuccessfulEvent.postValue(Event(true))
}
FriendList.SyncStatus.Failure -> {
syncInProgress.postValue(false)