workflow-kotlin
workflow-kotlin copied to clipboard
TextChangedListenerWatcher sometimes doesn't notify of changes
trafficstars
TextChangedListenerWatcher tracks the most recent text (oldString), so that it doesn't notify the listener if the text is "updated" to the same thing. However, since updateText does not notify this watcher of text changes, oldString is not updated. Changes from updateText are essentially ignored when considering whether a text update is a duplicate and therefore whether to fire the listener.
e.g. in a chat portion of my app:
- Type "t" (or any letter) in the message box
- Press send; this updates the workflow's state's representation of the input to an empty string after sending it, which is then used in
updateTextby theLayoutRunner, setting the EditText's content to empty - Because of the bug,
oldStringwas not updated to "" byupdateTextand is still "t". So if the user types "t" again,TextChangedListenerWatcherthinks it's a duplicate and doesn't fire the listener. The EditText's content changes to "t", but the workflow is not notified of the change, and it's state's field representing the input remains ""
Fixed with the introdcution of TextController, but we should delete the deprecated class. Leaving this ticket open to track that.