Thursday 17 September 2020

iOS 14 - Message Mentions and Threading

 After diving into some basic stuff of iOS 14 in the last post I wanted to see if I could track any of the new features to iMessage. Both inline replies to messages and mentions didn't really stand out to me when I was doing initial testing because the schema looked mostly the same. Sneaky Apple decided to imbed some of this data as well as create some new columns at the far end of our tables. 


Overall the table structure of iOS 14's sms.db looks the same. Diving into the message table we can see where the new stuff comes into play. 


Mentions: 

In order to see who specifically is mentioned when someone does an direct mention of another user, Apple is embedding this data into the BLOB found in the attributedBody column of the messages table. In the below screenshot you can see when a user is mentioned the text is a little bit bolder than the regular message text. Incoming mentions also appear in a different color. 


Now in order to provide a mention, once you start typing the name of someone in the chat (it doesn't show up for people not in the chat) it will change the color of the name in your text box. If you click on this, it will give you a small pop up that allows to make sure you have the right contact selected. 


Now as far as tracking this information, I thought maybe it would be embedded inside the same binary plist file that tracks if a message was Sent with Siri in iOS 13. Nope. Instead, we have to turn to the attributedBody blob. 

Here we can see a mention of a number (in this case this was an outgoing mention in my test data). 


And next the mention of an AppleID. (This one was an incoming mention)



Inline Replies: 

Apple also added the ability to do inline replies to iOS 14 iMessages. In order to make these backwards compatible if they're sent to an iOS 13 user they'll still appear as just a normal message. For iOS 14, there are some new columns added to the end of the messages table which can help us. Here's how it looks to the end user.


In order to see what messages were replies, and what messages they were replying to, we can use the GUID and thread_originator_guid columns in the messages table. Each message is assigned a guid when it is saved in the database. Messages that are replies, will have a value in the thread originator guid which tie them together. It should be noted that the "reply_to_guid" will still help track the order in which the messages were meant to display in and could be different from the actual inline reply guids.



In the above screenshot you can see that both the "Did you get it yet?" and "I got it shortly after we talked" messages are replies to the guid beginning with 830EEC08 which is the message "Still waiting" found in rowID 12. 

As I said in my original iOS 14 blog post (here), I'm sure we'll be finding things as we all go along so keep watching this space as more stuff gets dropped!

No comments:

Post a Comment