Skip to content

Commit

Permalink
fix: Ensure initial status length calculation includes the content wa…
Browse files Browse the repository at this point in the history
…rning (#821)

Previous code set `doOnTextChanged` listener for the content warning
*after* the initial value had been set. This meant the initial content
warning text was not included when calculating the status' initial
length.

Fix that by setting the listener before the text is set.

Fixes #815
  • Loading branch information
nikclayton authored Jul 14, 2024
1 parent 00a2cd3 commit 311e451
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -396,12 +396,12 @@ class ComposeActivity :
}

private fun setupContentWarningField(startingContentWarning: String?) {
if (startingContentWarning != null) {
binding.composeContentWarningField.setText(startingContentWarning)
}
binding.composeContentWarningField.doOnTextChanged { newContentWarning, _, _, _ ->
viewModel.onContentWarningChanged(newContentWarning?.toString() ?: "")
}
if (startingContentWarning != null) {
binding.composeContentWarningField.setText(startingContentWarning)
}
}

private fun setupComposeField(
Expand Down

0 comments on commit 311e451

Please sign in to comment.