Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 132a6543 authored by moezbhatti's avatar moezbhatti Committed by Moez Bhatti
Browse files

Go back to search mode if all contacts are removed

parent cd368ddd
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -27,7 +27,9 @@ import com.moez.QKSMS.R
import com.moez.QKSMS.model.Recipient
import kotlinx.android.synthetic.main.group_avatar_view.view.*

class GroupAvatarView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : ConstraintLayout(context, attrs) {
class GroupAvatarView @JvmOverloads constructor(
    context: Context, attrs: AttributeSet? = null
) : ConstraintLayout(context, attrs) {

    var contacts: List<Recipient> = ArrayList()
        set(value) {
+7 −1
Original line number Diff line number Diff line
@@ -324,7 +324,13 @@ class ComposeViewModel @Inject constructor(
        // Update the list of selected contacts when a new contact is selected or an existing one is deselected
        Observable.merge(
                view.chipDeletedIntent.doOnNext { contact ->
                    contactsReducer.onNext { contacts -> contacts.filterNot { it == contact } }
                    contactsReducer.onNext { contacts ->
                        val result = contacts.filterNot { it == contact }
                        if (result.isEmpty()) {
                            newState { copy(searching = true) }
                        }
                        result
                    }
                },
                view.chipSelectedIntent.doOnNext { composeItem ->
                    newState { copy(searching = false) }