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

Commit 4c1d687b authored by Steve Elliott's avatar Steve Elliott
Browse files

Fix incorrect RemoteInput result source

Conditional was accidentally flipped in a previous change. This change
also de-dupes the problematic code.

Test: atest RemoteInputViewTest
Fixes: 224824265
Change-Id: I75fc4b77ea76b9166df0ef4f54a27d0381ba492a
parent 0ede4b88
Loading
Loading
Loading
Loading
+7 −8
Original line number Original line Diff line number Diff line
@@ -299,10 +299,7 @@ class RemoteInputViewControllerImpl @Inject constructor(
        view.clearAttachment()
        view.clearAttachment()
        entry.remoteInputUri = null
        entry.remoteInputUri = null
        entry.remoteInputMimeType = null
        entry.remoteInputMimeType = null
        val resultSource = entry.editedSuggestionInfo
        RemoteInput.setResultsSource(fillInIntent, remoteInputResultsSource)
                ?.let { RemoteInput.SOURCE_FREE_FORM_INPUT }
                ?: RemoteInput.SOURCE_CHOICE
        RemoteInput.setResultsSource(fillInIntent, resultSource)
        return fillInIntent
        return fillInIntent
    }
    }


@@ -332,10 +329,12 @@ class RemoteInputViewControllerImpl @Inject constructor(
        entry.remoteInputText = fullText
        entry.remoteInputText = fullText


        // mirror prepareRemoteInputFromText for text input
        // mirror prepareRemoteInputFromText for text input
        val resultSource = entry.editedSuggestionInfo
        RemoteInput.setResultsSource(fillInIntent, remoteInputResultsSource)
                ?.let { RemoteInput.SOURCE_FREE_FORM_INPUT }
                ?: RemoteInput.SOURCE_CHOICE
        RemoteInput.setResultsSource(fillInIntent, resultSource)
        return fillInIntent
        return fillInIntent
    }
    }

    private val remoteInputResultsSource
        get() = entry.editedSuggestionInfo
                ?.let { RemoteInput.SOURCE_CHOICE }
                ?: RemoteInput.SOURCE_FREE_FORM_INPUT
}
}