From 852d47901bd7b1460e1b9f4d672356826663cb27 Mon Sep 17 00:00:00 2001 From: mehdi-git Date: Tue, 18 May 2021 10:40:31 +0430 Subject: [PATCH] Fix problem when put whitespace in search inbox. --- .../src/main/java/com/moez/QKSMS/feature/main/MainViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/main/MainViewModel.kt b/presentation/src/main/java/com/moez/QKSMS/feature/main/MainViewModel.kt index e4fec32bd..8e3b7cd8c 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/main/MainViewModel.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/main/MainViewModel.kt @@ -190,6 +190,7 @@ class MainViewModel @Inject constructor( view.queryChangedIntent .debounce(200, TimeUnit.MILLISECONDS) .observeOn(AndroidSchedulers.mainThread()) + .map { query -> query.trim() } .withLatestFrom(state) { query, state -> if (query.isEmpty() && state.page is Searching) { newState { copy(page = Inbox(data = conversationRepo.getConversations())) } @@ -197,7 +198,6 @@ class MainViewModel @Inject constructor( query } .filter { query -> query.length >= 2 } - .map { query -> query.trim() } .distinctUntilChanged() .doOnNext { newState {