From ea82e167ece9dabf8944f68b06932e0bb9b69937 Mon Sep 17 00:00:00 2001 From: gavine99 Date: Thu, 6 Mar 2025 20:03:15 +1100 Subject: [PATCH] fix circular update of message and db conversation in qkreply causing cursor return to start of edit box --- .../com/moez/QKSMS/feature/qkreply/QkReplyViewModel.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/qkreply/QkReplyViewModel.kt b/presentation/src/main/java/com/moez/QKSMS/feature/qkreply/QkReplyViewModel.kt index 45454e60..049ea1af 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/qkreply/QkReplyViewModel.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/qkreply/QkReplyViewModel.kt @@ -104,10 +104,11 @@ class QkReplyViewModel @Inject constructor( super.bindView(view) conversation - .map { conversation -> conversation.draft } - .distinctUntilChanged() - .autoDisposable(view.scope()) - .subscribe { draft -> view.setDraft(draft) } + .take(1) // only update saved draft to ui once + .map { conversation -> conversation.draft } + .distinctUntilChanged() + .autoDisposable(view.scope()) + .subscribe { draft -> view.setDraft(draft) } // Mark read view.menuItemIntent