forked from upstream-mirrors/quik
change to not save sms body input text as draft between adding new recipients to sms on compose screen
This commit is contained in:
@@ -48,4 +48,5 @@ data class ComposeState(
|
||||
val canSend: Boolean = false,
|
||||
val validRecipientNumbers: Int = 1,
|
||||
val audioMsgRecording: Boolean = false,
|
||||
val saveDraft: Boolean = true,
|
||||
)
|
||||
@@ -328,6 +328,7 @@ class ComposeViewModel @Inject constructor(
|
||||
view.optionsItemIntent
|
||||
.filter { it == R.id.add }
|
||||
.withLatestFrom(selectedChips) { _, chips ->
|
||||
newState { copy(saveDraft = false) } // do not save draft on next activity invisibility
|
||||
view.showContacts(sharing, chips)
|
||||
}
|
||||
.autoDisposable(view.scope())
|
||||
@@ -641,8 +642,10 @@ class ComposeViewModel @Inject constructor(
|
||||
.withLatestFrom(conversation) { _, conversation -> conversation }
|
||||
.mapNotNull { conversation -> conversation.takeIf { it.isValid }?.id }
|
||||
.observeOn(Schedulers.io())
|
||||
.withLatestFrom(view.textChangedIntent) { threadId, draft ->
|
||||
conversationRepo.saveDraft(threadId, draft.toString())
|
||||
.withLatestFrom(view.textChangedIntent, state) { threadId, draftText, state ->
|
||||
if (state.saveDraft)
|
||||
conversationRepo.saveDraft(threadId, draftText.toString())
|
||||
newState { copy(saveDraft = true) }
|
||||
}
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe()
|
||||
|
||||
Reference in New Issue
Block a user