Skip to content

Commit

Permalink
feat: trim leading and trailing | in message filter
Browse files Browse the repository at this point in the history
Signed-off-by: Next Alone <[email protected]>
  • Loading branch information
NextAlone committed Jul 14, 2024
1 parent a415772 commit d823836
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions TMessagesProj/src/main/java/xyz/nextalone/nnngram/UI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ fun ChatSettingActivity.createMessageFilterSetter(context: Context, resourcesPro
setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null)
setPositiveButton(LocaleController.getString("Save", R.string.Save)) { _, _ ->
runCatching {
if (!editText.text.isNullOrEmpty()) Pattern.compile(editText.text.toString())
if (!editText.text.isNullOrEmpty()) Pattern.compile(editText.text.toString().trim { it == '|' })
}.onSuccess {
Config.messageFilter = editText.text.toString()
Config.messageFilter = editText.text.toString().trim { it == '|' }
}.onFailure {
Toast.makeText(context, LocaleController.getString("InvalidPattern", R.string.InvalidPattern), Toast.LENGTH_SHORT).show()
}
Expand Down

0 comments on commit d823836

Please sign in to comment.