Skip to content

Commit

Permalink
Clear active source if deleted sources contains active source
Browse files Browse the repository at this point in the history
  • Loading branch information
msasikanth committed Apr 27, 2024
1 parent 752fa04 commit 703bcb2
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,12 @@ class FeedsPresenter(
private fun onDeleteSelectedSources() {
coroutineScope
.launch { rssRepository.deleteSources(_state.value.selectedSources) }
.invokeOnCompletion { dispatch(FeedsEvent.CancelSourcesSelection) }
.invokeOnCompletion {
if (_state.value.selectedSources.any { it.id == _state.value.activeSource?.id }) {
_state.update { it.copy(activeSource = null) }
}
dispatch(FeedsEvent.CancelSourcesSelection)
}
}

private fun onCancelSourcesSelection() {
Expand Down

0 comments on commit 703bcb2

Please sign in to comment.