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

Image message in group not recognized as group message sometimes #181

Closed
quaqo opened this issue Mar 9, 2021 · 23 comments · Fixed by #183, #219 or #344
Closed

Image message in group not recognized as group message sometimes #181

quaqo opened this issue Mar 9, 2021 · 23 comments · Fixed by #183, #219 or #344
Assignees
Labels
bug Something isn't working
Projects

Comments

@quaqo
Copy link

quaqo commented Mar 9, 2021

As I found in this reddit thread, I also experience the same issue.

Since today the app stopped working.

May I suggest a switch to enable a local logcat that we can share as users?
I also encountered another bug (which I'll report when I can reproduce, basically: if the group switch is off, but someone sends a picture to a group as the first message, this gets autoreplied).

If you need more info, please ask. I'm on 1.10, I'll try as soon as I can with 1.11 on my other device with LineageOS (where I can access more data).

@adeekshith adeekshith added the bug Something isn't working label Mar 9, 2021
@adeekshith
Copy link
Owner

Since today the app stopped working

Thanks for reporting @quaqo . This looks serious if it happened to more than one person. Will work look into it asap.

enable a local logcat that we can share as users

Already working on it

if the group switch is off, but someone sends a picture to a group as the first message, this gets autoreplied.

Oh, will try to reproduce that.

If you need more info, please ask

Thanks a lot! Will get back to you 😊

@quaqo
Copy link
Author

quaqo commented Mar 9, 2021

Thanks to you for being so proactive. Unfortunately I haven't got much time on my hand right now, I wish I could be of more help with a patch.

@adeekshith
Copy link
Owner

I wish I could be of more help with a patch

Really appreciate it! 😊

I found the issue. Updating it now. Hopefully, Google play deploys it fast enough before any serious damage is done.

adeekshith added a commit that referenced this issue Mar 10, 2021
@quaqo
Copy link
Author

quaqo commented Mar 10, 2021

I saw the commit. Good eye, but I don't think it was my issue. I didn't upgrade from the old schema. And I also tried a fresh install.

I enabled a json collector for the notifications so I can give you examples of when it doesn't work, I'll let it run for 24 hrs and report back!

@adeekshith
Copy link
Owner

And I also tried a fresh install.

Oh! What I fixed is also an issue. I could reproduce that on my VM after some testing.

For fresh install, does it not reply to any message? or is it missing once in a while?

@adeekshith adeekshith reopened this Mar 10, 2021
@quaqo
Copy link
Author

quaqo commented Mar 10, 2021

Every once in a while.
I also started investigating the group bug I was talking about in the first post.

I think that sometimes a group notification from WhatsApp comes without the group tag at first and then gets updated. This seems to happen consistently for me with picture messages in groups.

Watomatic doesn't see that is a group and replies.

It would be again very handy to have access to the message log database for debug purposes.

Otherwise I'll build a modified apk when I'll have time. Thanks!

@adeekshith
Copy link
Owner

I think that sometimes a group notification from WhatsApp comes without the group tag at first and then gets updated. This seems to happen consistently for me with picture messages in groups

Thats a very good insight. This probably explains it. As of now it just checks if the notification object has isGroup field in the notification object which is either set by WhatsApp or by the OS. Will see if there is any other way. One hacky way is to parse the notification title. Title for groups are in this format: ": ". We can detect semi colon or something but there are a thousand ways this can go wrong. Will investigate this.

I'll build a modified apk when I'll have time

Thanks a lot! @spuday90 is also working on implementing local debug logs. He already did some work in #175 for some ad-hoc testing which is not useful for us yet. But he is working on logging all the events. Will ping you when there is an update there.

Thank you 😊

@quaqo
Copy link
Author

quaqo commented Mar 11, 2021

Thats a very good insight. This probably explains it. As of now it just checks if the notification object has isGroup field in the notification object which is either set by WhatsApp or by the OS. Will see if there is any other way. One hacky way is to parse the notification title. Title for groups are in this format: ": ". We can detect semi colon or something but there are a thousand ways this can go wrong. Will investigate this.

FYI, if you want to parse it (I think it would be wise, even though as you said it may go wrong...), from my notification logs, the same message with picture (which seems that is the only type that sometimes doesn't get assigned a isGroup immediately) can appear as:

  1. isGroup = false
    style = Notification.MessagingStyle
    tickerText = null
    title = "$GroupName: $ContactName"
    text = "📷 $PictureCaptionMessage"
    textSummary = null

  2. isGroup = true
    style = null
    tickerText = "Message from $ContactName @ $GroupName" * Localised string
    title = "$GroupName"
    text = "$ContactName: 📷 $PictureCaptionMessage"
    textSummary = null

  3. isGroup = false
    style = Notification.BigPictureStyle
    tickerText = null
    title = "$ContactName @ $GroupName"
    text = "📷 $PictureCaptionMessage"
    textSummary = "$ContactName: 📷 $PictureCaptionMessage"

As you see, depending of what you parse (ticker, title, text, summary and isgroup) you have different formats:

  • group: true / false
  • ticker: empty / "Message from Person @ Group"
  • title: "Group: Person" / "Person @ Group"
  • text: "📷 TEXT" / "Person: 📷 TEXT"
  • summary: empty / "Person: 📷 TEXT"

Let me know if this makes sense.

Also thanks to @spuday90 for local debug logs.

@spuday90
Copy link
Collaborator

Hi @quaqo, thanks for the detailed description. Its making a lot sense. We will check more conditions to decide it's a group reply or individual.

@adeekshith
Copy link
Owner

@quaqo those logs are very useful! Thanks a lot for that. Yeah, just title many not be of much use but agree we can parse rest of those to decide if it is a group or not.

Also, this happened to me today for personal chat too. My reply frequency was set to 1 day but it replied the second time within a few minutes when the message is an image. Will work on fixing this ASAP.

@adeekshith adeekshith changed the title The app stopped working Image message in group not recognized as group message sometimes Mar 17, 2021
@quaqo
Copy link
Author

quaqo commented Apr 12, 2021

Hi there. Any updates on this? I partially re-created the logic of Watomatic in Tasker, and found that I can safely consider every notification coming from "com.whatsapp" with a ":" in either title or text as a group message.

@adeekshith
Copy link
Owner

adeekshith commented Apr 13, 2021

Hi 👋😊
Yeah I think we have to go with pattern matching. Was searching for a standard solution but could not find anything. Checking for : or text: 📷 (need to verify) might be the only option. Will do this by tomorrow and aim for a release tomorrow on Friday. All other group related issues are fixed in previous release but could not do this yet.
Thanks @quaqo

@adeekshith
Copy link
Owner

@quaqo Can you help me test this PR please: #219

I think it is safe but cannot reproduce the issue on my end.

@quaqo
Copy link
Author

quaqo commented Apr 15, 2021

I'm currently AFK and can't compile anything, I do have my second phone thou: are you able to provide me with an APK that I can install?

@adeekshith
Copy link
Owner

Awesome! Thanks a lot! 😃
But not urgent. Try whenever you are free.

Github is not allowing me to attach the apk here. Sharing it here: https://transfer.sh/SH8zC/watomatic-issue181-release.apk
Might want to remove existing app from your system before installing it.

Also attaching the patch image if you want to preview;
181-code-patch

@quaqo
Copy link
Author

quaqo commented Apr 15, 2021

Already saw the commit, thanks. I'll sideload it ASAP and test it. Thanks!

@quaqo
Copy link
Author

quaqo commented Apr 20, 2021

@adeekshith sorry for getting back so late: I had work-related unforeseen issues. I saw you committed the patch, anyways I wanted to chime in anyways and confirm it seems to work on my end! Thank you for fixing it!

@adeekshith
Copy link
Owner

@quaqo Oh no probs at all. Thanks a lot for helping to debug and confirming. Planning to release this today and should be available on Play store in 3 to 4 days 😃

@quaqo
Copy link
Author

quaqo commented Apr 30, 2021

@adeekshith unfortunately in the last 2 days it happened again.

So this has to be reopen.

What happens is that like I mentioned here:

  • title: "Group: Person" / "Person @ Group"

sometimes the title is "Person @ Group".

Your patch looks at rawTitle, but check just if it is of the first kind.

Of the group messages that were answered, both were pictures, but the title was "Person @ Group".

So I think the check should be changed in something like:

boolean isPossiblyAnImageGrpMsg = ((rawTitle.contains(": ") || rawTitle.contains(" @ ")) && rawText.startsWith("\uD83D\uDCF7"));

@spuday90
Copy link
Collaborator

Hi @quaqo,
Sorry to hear that. Just give us some more time we will fix it once and for all.
Thanks for your detailed observations, that would definitely help us fix the issue faster.

@quaqo
Copy link
Author

quaqo commented Apr 30, 2021

Hi @quaqo,
Sorry to hear that. Just give us some more time we will fix it once and for all.
Thanks for your detailed observations, that would definitely help us fix the issue faster.

Thanks to you!

@adeekshith adeekshith reopened this May 7, 2021
@quaqo
Copy link
Author

quaqo commented Jun 4, 2021

Hi there. Any update on this?

@adeekshith
Copy link
Owner

Hi @quaqo Will get to it this week.
There was an issue where Watomatic was not working on many devices (battery optimization was killing the app) which was a higher priority so had to work on that. That took a very long time as it is device specific and there is no standard way to fix it. Releasing that update in a day and this is next. Will try to release this by next friday.

This is not happening on any of the device that I have access to so that caused the delay too.
Plan is, will add your fix (below) and in the troubleshooting section, will have a "Run extra checks to prevent accidental group replies" checkbox which can be enabled. So, users will not be confused why auto reply is not working if contact name contains some symbols.

boolean isPossiblyAnImageGrpMsg = ((rawTitle.contains(": ") || rawTitle.contains(" @ ")) && rawText.startsWith("\uD83D\uDCF7"));

@adeekshith adeekshith added this to To do in default via automation Jun 7, 2021
@spuday90 spuday90 moved this from To do to Review in progress in default Jul 16, 2021
default automation moved this from Review in progress to Done Jul 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment