Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App hangs when lots of emoticons are sent #1995

Open
CGenie opened this issue May 21, 2024 · 2 comments
Open

App hangs when lots of emoticons are sent #1995

CGenie opened this issue May 21, 2024 · 2 comments

Comments

@CGenie
Copy link

CGenie commented May 21, 2024

DESCRIPTION

My son was playing with my wife's phone. He sent me an SMS with lots of emojis. Now, when I open the conversation with my wife, QKSMS hangs and doesn't seem to respond. I even can't go back to list view.

STEPS

  1. Send lots of emojis to yourself like you're 4.
  2. Open the conversation
  3. App hangs

EXPECTED

Don't hang.

OBSERVATIONS

I can send couple of normal SMS from my wife's phone to fill up my screen, then the conversation does open. However, when scrolling up and revealing that monstrous message, the app hangs again.

@Invocatis
Copy link

Invocatis commented Jun 6, 2024

I'm having a similar issue. Here's my specifics

  • Phone: Pixel 5
  • OS: iode, version: 4.4-20230824-redfin
  • Build number: TQ3A.230805.001 dev-keys
  • App version: 3.10.1

Specific message
🤍💕🤍💕🤍💕🤍💕🤍💕🤍💕🤍💕🤍💕🤍💕🤍💕🤍💕🤍💕🤍💕🤍💕🤍💕🤍💕!!!!!!!!!!!!!!

@rezaJpour
Copy link

rezaJpour commented Jun 10, 2024

Remove EMOJI_REGEX from MessagesAdapter:
Remove the declaration and usage of EMOJI_REGEX from your MessagesAdapter class. This means you no longer need the Regex pattern EMOJI_REGEX in your adapter.

Update emojiOnly variable:
Change the line
val emojiOnly = messageText.isNotBlank() && messageText.matches(EMOJI_REGEX)
to :
val emojiOnly = messageText.isNotBlank() && containsOnlyEmoji(messageText.toString())
This means you're now calling the containsOnlyEmoji function to check if the message contains only emojis.

Add containsOnlyEmoji function:
Add the following function to your code:

fun containsOnlyEmoji(text: String): Boolean {
    val regexPattern = Regex("^[\\p{So}]+$")
    return regexPattern.matches(text)
}

This function checks if the given text contains only emojis by using the Regex pattern ^[\p{So}]+$. If the text matches this pattern (i.e., contains only emojis), it returns true; otherwise, it returns false.

         // Update emojiOnly variable
        val emojiOnly = messageText.isNotBlank() && containsOnlyEmoji(messageText.toString())

By following these steps, you'll remove the EMOJI_REGEX, update the emojiOnly variable, and add the containsOnlyEmoji function to your MessagesAdapter class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants