famedly / matrix-dart-sdk

Matrix SDK written in pure Dart.
GNU Affero General Public License v3.0
61 stars 31 forks source link

Get a proper method to get latestEvent in room #192

Closed famedly-bot closed 1 year ago

famedly-bot commented 3 years ago

In GitLab by @Techno-Disaster on Aug 14, 2021, 16:05

Question: Is there any proper way to get the actual latest event in a room (not one from edits) https://gitlab.com/famedly/company/frontend/famedlysdk/-/blob/main/lib/src/room.dart#L323

Related to: https://gitlab.com/famedly/app/-/issues/1496

famedly-bot commented 3 years ago

In GitLab by @Sorunome on Aug 14, 2021, 16:08

currently it would be getState for m.room.message. We abuse the state thing for that.

As you mentioned, it includes edits. The workaround for that would be to special-case m.room.message inside of setState to ignore edits / ignore them if the current event id is not the message being edited.

famedly-bot commented 3 years ago

In GitLab by @Techno-Disaster on Aug 14, 2021, 16:14

Nico says Ah, you are trying to get the latest event. Nheko just stores the visual index of events in addition to the arrival index which imo is simple and not that confusing. Can we implement something like this?

famedly-bot commented 3 years ago

In GitLab by @Sorunome on Aug 14, 2021, 16:26

the difference is that we can't access the timeline of all rooms at once. due to running on a phone we have to be more conscious about resources. So, we abused the state store to only store the latest event per room. And that storing logic simply needs updating to respect edits.

famedly-bot commented 3 years ago

In GitLab by @Techno-Disaster on Aug 14, 2021, 17:23

Ah makes sense, thanks for pointing me in the right direction. I'll look into it now