Skip to content

Commit

Permalink
Ensure draft is saved with NonCancellable
Browse files Browse the repository at this point in the history
Signed-off-by: Dominic Fischer <[email protected]>
  • Loading branch information
Dominaezzz committed Nov 17, 2020
1 parent 574d505 commit 82b21e6
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import io.reactivex.functions.BiFunction
import io.reactivex.rxkotlin.subscribeBy
import io.reactivex.schedulers.Schedulers
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.NonCancellable
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.commonmark.parser.Parser
Expand Down Expand Up @@ -476,7 +477,7 @@ class RoomDetailViewModel @AssistedInject constructor(
* Convert a send mode to a draft and save the draft
*/
private fun handleSaveDraft(action: RoomDetailAction.SaveDraft) = withState {
viewModelScope.launch {
viewModelScope.launch(NonCancellable) {
when {
it.sendMode is SendMode.REGULAR && !it.sendMode.fromSharing -> {
setState { copy(sendMode = it.sendMode.copy(action.draft)) }
Expand Down

0 comments on commit 82b21e6

Please sign in to comment.