Commit Graph

397 Commits

Author SHA1 Message Date
Krille 3f04532ffe
refactor: Remove BasicRoomEvent type
We actually never use the
roomId of this type and the
matrix spec has changed in
a way that the roomId is
never sent there actually. So
it was super easy to just
replace all BasicRoomEvent
with BasicEvent. The roomId
became nullable anyway.
2025-01-09 11:05:01 +01:00
Krille bc328aab5c
refactor: Use Event instead of EventUpdate for storing in db 2025-01-07 14:56:04 +01:00
Karthikeyan S 05ee4031bf
chore: BREAKING rename timeCreated to latestEventReceivedTime in Room 2024-12-31 22:16:31 +05:30
Karthikeyan S 239a39e2cb
feat: support push rule conditions event_property_is & event_property_contains 2024-12-23 15:21:01 +05:30
Krille bc7b987772
refactor: Remove unnecessary roomId parameter from decryptRoomEvent method 2024-12-17 11:23:58 +01:00
Krille 04a46226cb
refactor: Fix new lints from flutter 3.27 2024-12-15 12:21:26 +01:00
Krille a26653a098
refactor: Clarify Room.join() behavior and make sure DM link is purged if room not found 2024-12-09 12:29:45 +01:00
Mohammad Reza Moradi ba9c3e7fc9
Merge branch 'main' into reza/send-reaction-on-only-admin-can-send-message-room 2024-12-05 13:17:53 +01:00
Mohammad Reza Moradi 04612a2296
fix: throw error on failed reaction send 2024-12-05 13:13:47 +01:00
Johannes Nevels 7515ff6dbe
feat: support filtering events when requesting events history or future 2024-11-26 13:43:21 +01:00
Krille 989a1cd504
refactor: Do not set the deprecated dont_notify action in push rules
This has been deprecated since
https://spec.matrix.org/v1.7/client-server-api/#actions
An empty list of actions should now
be equal to a list with the entry
"dont_notify". Clients should
ignore this action and use
empty lists instead. A good
explaination can be found
https://github.com/matrix-org/matrix-spec-proposals/blob/main/proposals/3987-push-actions-clean-up.md
2024-11-25 14:08:45 +01:00
Krille f46e76295c
fix: BREAKING! Cache members for encrypted rooms in database
This fixes a huge performance
leak as for every encrypted room
the whole member list is loaded
every time you start the client.
This also changes the default value of `cache` in
this method to if the room is encrypted or not.
For encrypted rooms we always want a complete
member list locally.
2024-11-11 11:58:18 +01:00
Mohammad Reza Moradi 9c32193dff
chore: add require trailing comma lint 2024-11-07 16:13:37 +01:00
td 7605b1de31
feat: v1.12 spec endpoints support (BREAKING CHANGE) 2024-10-21 13:58:33 +02:00
Krille 4a754ded5f
fix: (BREAKING) Change power level without changing memory
The problem here is that we
have not created a deep copy
of the power level map. By using .copy() we create a
deep copy now.
2024-10-08 15:10:49 +02:00
Krille 13d756856e
refactor: Migrate to m.marked_unread from Matrix v1.12 2024-10-08 15:03:39 +02:00
td 140db616d9
feat: BREAKING CHANGE v1.11 matrix-spec endpoints 2024-09-19 14:16:49 +02:00
td 4c4a062a27
fix: race condition between getState and requestUser updates 2024-08-27 10:04:56 +02:00
Krille a0bfd0c73d
fix: App freezes because of recursive loop with getLocalizedDisplayname() call 2024-08-09 10:17:23 +02:00
Krille b962e8288b
feat: Add support for isFederate option for rooms 2024-07-26 13:45:13 +02:00
Krille cabf357cf7
refactor: Cache profiles in database and refactor API 2024-07-23 08:51:10 +02:00
Krille 2e51b450bf
refactor: Better avatar and names for invites
Group chats with no user
avatar should return null for
the room.avatar getter and not
a random hero avatar. This could
otherwise lead to confusion as
it looks like this is a DM which
is not the case.

For the name we should also
not just display the name of
the invitor like in a DM even for
group chats, but some more
additional information. I found
a String for
invites quite useful here as
this would name rooms without
a m.room.name like this:
"Invited by $senderName"
which should be short enough.
The alternative
"You have been invited by $senderName" could be too
long IMO.
2024-07-16 13:12:00 +02:00
Krille 0f5526e1b8
feat: Automatically cancel typing indicators after 30 seconds 2024-07-03 14:36:40 +02:00
Krille 9d9865a1a1
fix: Do not update lastEvent with state events 2024-07-03 14:27:39 +02:00
td 869a7f41a9
fix: lastEvent after edit and redact 2024-07-01 21:31:13 +05:30
Nicolas Werner f13d4e1f45
fix: Request user causing state update loops for apps
This completely redoes the requestUser function.

It now doesn't stop requesting a user forever just because of a network
error. But redundant calls are still deduplicated, however their
parameters are taken into account now.

It also now only calls onUpdate and onRoomState when there is actually
new state. This way apps can just listen to updates to rerender instead
of having to implement the deduplication themselves.

It also now doesn't treat member events without membership as "join"
anymore. And lookup errors don't cause an empty user to get inserted
into the room state.

In general this should still request the profile from the server, if the
displayname is unset in a leave event, but it should also allow the app
to actually settle in the tests.
2024-06-14 12:33:25 +02:00
Krille 14b8ceb2eb
refactor: requestUser logic 2024-05-29 10:08:46 +02:00
Krille a21ead8cd5
fix: Requst profiles for left users
This has been set to false
to prevent storing global
user profiles as member states
in the database. However
looks like this is already
solved below. We can
safely store the profile
in the local cache, otherwise
we cannot calc the body
for an event synchroniously.
2024-05-29 10:04:32 +02:00
Krille 491313ae7d
refactor: Use enhanced enums for room enums 2024-05-28 14:25:38 +02:00
krille-chan 885aeb3c17
refactor: Deprecate Streams in favor of client.onSync
This deprecates all streams which can
be created by using client.onSync
anyway for a more predictable state
handling in consuming apps.
2024-05-28 13:48:31 +02:00
td 79960d1be3
fix: Do not set messages as state events anymore
We had this as a workaround and forgot to remove it after the database migration to the new way how to store the last message.
2024-05-22 22:22:56 +05:30
Karthikeyan S 29e554337c
perf: check event size in bytes without encoding twice 2024-05-20 16:40:15 +02:00
Karthikeyan S eef3fd1dfc
fix: update event status to error on EventTooLarge 2024-05-16 19:12:25 +05:30
krille-chan 42f44de2b1
refactor: Cache direct chat matrix ID
The direct chat account data
content is a map from matrixId
to roomId(s). If we want to find
the roomId for a given userId,
then this is not a problem. But
the other way around, if we
want to check if a given roomId
is a direct chat or not, needs to
process all entries which can be
hundreds. Doing this very
often in an app costs a lot of
performance. This adds a simple
cache in the room object and
validates the cache every time
to make this more efficient.
2024-05-10 10:52:27 +02:00
Krille 1dbb81ed83
chore: Revert check message size before fake sync
This lead to the huge problem that there is no
user feedback between sending a message and
seeing it in the timeline as it is encrypted
before the first user feedback is shown. But
the encryption step is async and also includes
fetching devices if necessary so that can take
seconds or even forever on bad internet
connection.

This reverts commit 981c3ea94d.
2024-05-10 08:22:09 +02:00
Krille 5b46ae6e31
refactor: Use strippedstatevent as base for room state and user class
Before we have used the Event class for all
state events while for invite rooms those
actually were StrippedStateEvent objects. This
created some problems like we needed to set a
fake originServerTs (usually to DateTime.now()).
Actually we don't need the additional keys for
state events most of the time so just using
StrippedStateEvent for all states and typecasting
them to event where needed is not much of a
hassle while we benefit from a more clear
structure.
This also now uses StrippedStateEvent as a base
class for the User class which makes the User
class more minimal as keys like event_id and
origin_server_ts are no longer necessary. As we
create a lot of fake User objects where we had to
put fake values in it, it brings more benefits
than problems to just get rid of those fields.
2024-05-03 14:06:49 +02:00
Krille 7ed809d748
refactor: Remove unused variable 2024-04-30 07:52:43 +02:00
krille-chan a8214832c0
fix: Fetch invite state after restart app
This makes sure that the
users for an invitation are
correctly loaded so that we
can display the avatar, the
room displayname and
wether the room is a direct
chat or not.
2024-04-29 15:33:54 +02:00
td 20a31c1908
feat: famedly calls 2024-04-23 15:52:35 +05:30
krille-chan 4732580c3d
fix: Make room.setPower more type safe and avoid change powerlevel in RAM before sending request to server
This fixes the bug that the
actual dart Map in the state
has been manipulated because
we have not worked with a
copy of the map. Also this
crashes if the powerlevelmap
would had a wrong type in
users.
2024-04-18 10:56:28 +02:00
Krille 9099dd74c0
chore: Pass reason parameter when invite user to a room 2024-04-12 11:30:59 +02:00
krille-chan d0b1d4a651
fix: Do not use invitor avatar_url for room
When user A invites user B to
a group chat, the avatar getter
should not return the
avatar of the inviting user A.
This is not intuitive. A client might
decide to do so but IMO it makes
no sense to do this by default.
If the
room is a DM invite, user A's
avatar is already used in the
code block before.
2024-04-11 11:39:20 +02:00
Krille 849bd7ca9b
refactor: Make via fields not nullable 2024-04-11 11:32:23 +02:00
td 981c3ea94d
chore: check message size before fake sync 2024-03-25 19:31:01 +05:30
Krille b90b902218
refactor: BREAKING Migrate database to new lastEvent storage method
This changes the way how the last event is stored
for each room. It is now stored next to the
room event itself in the rooms box and no longer
stored like a room state. This way we need to
bump the database version which will cause an
inital sync for the client. Be aware of this when
updating the SDK!
2024-03-18 14:11:15 +01:00
krille-chan 20073ddd49
refactor: Store lastEvent in room object instead of room state 2024-03-18 13:18:36 +01:00
td a60a0cad69
fix: throw EventTooLarge on exceeding max fed PDU 2024-03-14 01:18:10 +05:30
Nicolas Werner 1bde841cb2
fix: properly fetch participants when transitioning from invite to join
We used to add app the member counts of invited users and joined users,
which would make us assume the participants list is complete. Which
would mean we always return the wrong state.

Additionally there is no need to rely on if we have a cached response.
Instead we always only check for completeness instead of possibly
returning stale responses just because we fetched the members once.
2024-03-04 17:55:29 +01:00
Nicolas Werner 582963ab91
fix: Do not compare timestamps when setting roomstate
We now handle state in the correct order in the sync handler. Using the
timestamp lead to false results when we still generated a default
timestamp of "now" for events, however even without that state events
can have an older timestamp like when accepting an invite on a server
with the clock behind by a minute and we should instead rely on the sync
handler giving us state in the right order.
2024-03-04 17:53:23 +01:00
Patrick Hettich 78c610ab92
Merge branch 'main' into pat/archive-room-names 2024-02-29 12:03:45 +01:00