matrix-org / matrix-ios-sdk

The Matrix SDK for iOS
Apache License 2.0
452 stars 213 forks source link

lastMessage.text & lastMessage.attributedText From the MXRoomLastMessage is always nil #1782

Open Dhruvil-sim opened 1 year ago

Dhruvil-sim commented 1 year ago

I want to show the last message received by each room in the room listing along with name, time and avatar. But lastMessage.text and lastMessage.attributedText are always nil

roomSummary.lastMessage.text

always return nil even if room has message

ezhes commented 1 year ago

So I took a closer look at it, and it seems as though lastMessage is actually better named lastEvent. I ended up implementing a real lastMessage the crumby way:

room.enumeratorForStoredMessagesWithType(in: [MXEventType.roomMessage.identifier]).nextEvent
ravi-loomyai commented 1 year ago

did you find a solution to this @Dhruvil-sim ?

ronnie-codes commented 1 year ago

Bump. Also having this issue.