octoshrimpy / quik

The most beautiful SMS messenger for Android - Revived
GNU General Public License v3.0
741 stars 31 forks source link

✏️ [ FEAT REQ ] Emoji Reactions #152

Open giantdwarf17 opened 3 months ago

giantdwarf17 commented 3 months ago

Is your feature request related to a problem? If so, please describe the problem. I'm in a text group chat with mainly iPhone users, so whenever one of them tries to use the iMessage emoji reaction I just get a message saying "Liked "original text"", "Loved "original text"", etc.

Describe the feature you'd like I would like it if QUIK could somehow convert those "Liked ..." messages into emoji reactions like how Google Messages does: https://techcrunch.com/2022/10/20/google-messages-adds-reaction-support-for-iphone-texts-and-in-app-reminders/

Ideally I'd also like to see QUIK add the functionality to send emoji reactions too.

jgkawell commented 3 months ago

I literally just opened the Issues list to post this exact same thing. I just switched off of Google Messages and would love to have this feature!

octoshrimpy commented 2 months ago

I've been thinking about this one, as some of my family use iOS and I get the same bothersome pings for whenever the whole group chat likes the latest photo of the newest baby or whatever. The only thing is I'm not sure if it's possible to send those emoji reactions back to iOS? I'm pretty sure it's not as easy as sending (and hiding client-side) a message with contents of "phone number liked message ID"

jgkawell commented 2 months ago

I actually do think it's just sending (and hiding) those plain text messages. I say that just because Google Messages enabled the feature a while back without any change to the way iPhones were handling things. I could be wrong though.

jgkawell commented 2 months ago

Okay so I did some testing on this. Turns out they are just sending text in the body of the message but they're doing some invisible special characters to get it to work. Kinda funny how much of a hack it is. Here's what I found:

If the original message was Hey, then the way to do a thumbs up is:  ​👍​ to “ Hey ” . The thing is, the quotes are the special left and right quotes (not the generic quotes normally used) and there's a bunch of invisible characters. Here's what it looks like as HTML for example:  ​👍​ to “ Hey ” 

So the rules seems to be:

  1. Start the message with a Hair Space: 200A
  2. Prefix the emoji with a Zero Width Space: 200B
  3. Insert the emoji reaction
  4. Suffix the emoji with another Zero Width Space: 200B
  5. The word "to" surrounded by regular spaces: to
  6. Start the original message with a Left Double Quotation Mark: 201C
  7. Suffix the left quotation mark with another Hair Space: 200A
  8. The original message
  9. Prefix the right quotation mark with another Hair Space: 200A
  10. End the original message with a Right Double Quotation Mark: 201D
  11. End the body with another Hair Space: 200A

My testing involved just sending a message from Quik to another phone which was running Google Messages. By sending the message from Quick with all the special characters the Google Messages app on the other phone marked it as a reaction. Pretty neat!

jgkawell commented 2 months ago

@octoshrimpy Let me know if there's anything more I can do to help with this. I'm not an Android dev but I'm happy to test things out or research more if it will help.

adamhotep commented 2 months ago

Apple's system is definitely different from Google's. I have been able to successfully emote responses to iPhone users manually using Quik.

Apple's implementation doesn't use hidden characters, though it does subtly use Unicode. Have an iPhone send you every single reaction and you'll easily figure it out given the formula action “text” noting that those are angled quotes ( is U+201C, left double quotation mark, and is U+201D, right double quotation mark). Make sure your test is long so you can figure out where it truncates. I'm guessing the truncation denotation uses Unicode (, U+2026, horizontal ellipsis), but that's not visually distinguishable so I don't know that for certain. There's also the question of how it handles duplicate messages as well as messages that are identical after truncation.

For example, if a friend says Thanks!, I can reply with Liked “Thanks!” or Loved “Thanks!” and it will get 👍 or ♥ accordingly. To ensure the characters are perfect, I simply copy the message text and paste it between the angled double quotes, which can be entered by long-pressing the " key on most soft keyboards, including FlorisBoard and Gboard.

Receiving reactions from either Apple or Google should therefore be trivial to render.

Sending reactions will require knowing what the recipient(s) use. Implementing this is harder but not insurmountable: take notes on reactions as they're received and use them to identify each contact's most recent version. Reuse that system or else default to whatever is the majority is logged. For group chats, go with the majority of participants. Break ties, including zeros, with Google's system since this is an Android app. (Happily disproved; sending should be easier still! See the next two comments.)

jgkawell commented 2 months ago

@adamhotep Oh this is interesting! You got me wanting to try some more things out. Using your examples for iPhone I tried some more things from Quik to Google Messages and found all of these work equivalently:

It makes me wonder why Google Messages is sending the extra characters. Maybe so that they can determine which message comes from a Google Messages client and which comes from other clients? I don't have an iPhone so I can't try to see if these are all equivalent there. I also haven't tried an MMS group chat either. Those usually include the phone number of the sender in the message.

adamhotep commented 2 months ago

Great find, @jgkawell. If Google accepts Apple syntax, then Quik can simply always send that. If that means the Apple or Google system thinks Quik is either Apple or Google, that probably doesn't matter (at least until some resulting message doesn't fail gracefully).

That actually makes sending the easier part (implement just Apple's method) while receiving must implement those three separate methods.

(Personally, the :emoji: to “original message” format is the most intuitive to me and allows an infinite number of emojis without having to implement new ones every Unicode release. Then again, there's the debate over how sane it is to allow every emoji rather than a small curated set. That makes me wonder if you can do something odd like J to “original message” and get Google to actually render the letter J as a reaction...)

octoshrimpy commented 2 months ago

Okay so I did some testing on this. [...] Pretty neat!

this is a fantastic find! I do wonder about dupe message contents and group messages. I don't have devices to test, but and working on a PoC for this right now (as well as refreshing myself on kotlin, it's been a minute)

octoshrimpy commented 2 months ago

@adamhotep and @jgkawell thank you both for the deeper dives! Looks like it shouldn't be too difficult to implement, apart from edge cases mentioned above. I don't have an iphone to test, but if you could test as many edge cases as you could, it will help speed up implementation!

jgkawell commented 2 months ago

@octoshrimpy Awesome!! For the dupe messages I guess a sane fallback would just be to apply the reactions to the latest message that matches? That's the most likely one the reaction would apply to anyways.

I should be able to test out group messages (Quik + Google Messages). I'll see what I find and report back.

gavyncaldwell commented 1 month ago

Curious if there are any updates on this topic anywhere, or possibly plans to implement this. Recently moved from iPhone and have been looking into buying a cheap mac to run bluebubbles, but this would make that unnecessary for me. Has anyone forked the code and tried to implement this on their own? I'm not an android dev otherwise I would take a crack at it. I still might give it a go

giantdwarf17 commented 1 month ago

Not that I know of. Personally I've been using Google Messages in the meantime.

octoshrimpy commented 4 weeks ago

@gavyncaldwell: Curious if there are any updates on this topic anywhere

There are! This is not for Next release, but for the one after that! If you'd like to give it a go, the latest master finally compiles without problems. Let us know how it goes!

dxman commented 2 weeks ago

I just switched from Textra to QUIK, and came here when I noticed this behavior. For whatever it's worth, Textra supported this feature, so it's definitely not solely an iMessage / Google Messages thing.

So thanks for looking into it and for working on the app in general. I'll be keeping an eye on this issue.