Commit Graph

330 Commits

Author SHA1 Message Date
Krille Fear c3a9d64329 Merge branch 'reza/sending-queue' into 'main'
fix: implement sending queue

Closes #257

See merge request famedly/company/frontend/famedlysdk!1061
2022-07-01 06:34:22 +00:00
Reza 4af89c6de4 fix:implement sending queue 2022-06-30 20:16:56 +02:00
Christian Pauly 9628095ac9 feat: Implement CachedStreamController
This makes it possible to access the last
value of a stream at any time.
2022-06-30 09:22:53 +02:00
Nicolas Werner 21e9b802a0 chore: Update Matrix API Lite for spaces fixes 2022-06-08 12:55:16 +02:00
Christian Pauly 58cfd1f688 refactor: Rename methods and get rid of all Future getter 2022-06-08 08:30:05 +02:00
Christian Pauly f1751a0744 refactor: Use single quotes 2022-06-07 08:53:14 +02:00
Henri Carnot 44b7247d2c fix: add deprecation mention for getUserByMYIDSync 2022-06-02 11:13:27 +00:00
Henri Carnot fb18843b08 refactor: make sender getter async 2022-06-02 08:13:21 +00:00
Henri Carnot 2d018d3d5f feat: added waitForSync method 2022-05-25 10:53:52 +00:00
Krille Fear 3f3d4d38d6 refactor: Migrate to Matrix Api Lite 1.0.0 2022-05-17 22:50:04 +00:00
Henri Carnot 7e4096cc63 Merge branch 'henri/fix-remove-duplicated-fully-read' into 'main'
fix: remove duplicated read marker

See merge request famedly/company/frontend/famedlysdk!1033
2022-05-16 11:09:37 +00:00
Henri Carnot bfdd4c810e Henri/fragmented timeline v2 2022-05-16 10:54:42 +00:00
h.carnot 6c2e525a64 fix: remove duplicated read marker 2022-05-16 10:49:57 +02:00
Krille Fear 9a87850092 Revert "feat: non cached fragmented timeline"
This reverts commit 09b324674e
2022-05-12 09:46:29 +02:00
Henri Carnot 09b324674e feat: non cached fragmented timeline 2022-05-03 14:08:33 +00:00
Lanna Michalke ac16724841 chore: make Client.accountData read-only
- for external access, Client.accountData should be read only
- added corresponding getter and private Map

Signed-off-by: Lanna Michalke <l.michalke@famedly.com>
2022-05-03 03:29:20 +02:00
Henri Carnot f23abcd323 feat: get fully read marker 2022-05-02 08:43:54 +00:00
Christian Pauly bce45cbf2b refactor: Remove old deprecations
They have been lived long
enough and the next version
will have breaking changes
anyway.
2022-04-22 12:44:45 +02:00
Christian Pauly 4e657f8e09 fix: Ignore no permission errors on requesting users
In theory even in invite or left rooms it
can be possible to request a room
state regarding the spec. In most
cases it will throw an error though.
2022-04-14 17:32:52 +02:00
Krille Fear 2f4d455eee fix: Retry sending a file event 2022-04-08 08:41:55 +02:00
Henri Carnot c6393c67d6 Merge branch 'henri/blurhash-fallback' into 'main'
feat: blurhash fallback to thumbnail one

See merge request famedly/company/frontend/famedlysdk!1002
2022-04-07 11:58:48 +00:00
h.carnot 97ca608f60 feat: check thumbnail size 2022-04-06 17:43:31 +02:00
h.carnot f1c007c655 feat: fallback to thumbnail preview 2022-04-06 11:09:05 +02:00
Christian Pauly cdd6111ce1 fix: Missing type check in power level calculation 2022-04-03 08:22:53 +02:00
Krille Fear 6f977b7c9d fix: Store sending files in database and fix retrying to send them 2022-04-01 14:26:57 +02:00
Christian Pauly 117baecfb1 fix: Post load all users on room opening
When opening a room we need to
fetch all users from the database.
Otherwise we would need to
update the timeline per user after
creation which should be much slower.
2022-03-31 13:07:40 +02:00
Christian Pauly 6a57f99c00 feat: Pass through a custom image
resize function to the client

This allows the use of the
native imaging package in a more
easy way.
2022-03-30 11:15:04 +02:00
Christian Pauly 445252b3a5 feat: Pass through a custom image
resize function to the client

This allows the use of the
native imaging package in a more
easy way.
2022-03-30 10:35:17 +02:00
Christian Pauly a915cdacc8 feat: Display dummy event in timeline for sending files
For thumbnail generation, encrypting
and uploading it is not necessary
to block the UI. The given file
event should already be displayed
in the timeline. This placed it in
the UI and adds a additional
fileSendingStatus property so the
app can fetch the current status.
2022-03-30 10:27:42 +02:00
Krille Fear 23e0d29a0d Merge branch 'krille/try-again-sending' into 'main'
feat: Try again uploading file events for one minute

See merge request famedly/company/frontend/famedlysdk!986
2022-03-30 06:38:01 +00:00
Nicolas Werner e2d2a69e45 Merge branch 'voip/move-voip-methods-from-room' into 'main'
chore: Move the call methods in room to the voip class.

See merge request famedly/company/frontend/famedlysdk!980
2022-03-25 23:51:55 +00:00
Duan Weiwei cac4dc967d chore: Move the call methods in room to the voip class. 2022-03-25 23:51:55 +00:00
Christian Pauly f86b242dcf feat: Try again uploading file events for one minute
This also refactors the code for
sending events with the same
Duration of one minute.
2022-03-25 12:54:42 +01:00
Christian Pauly 6b36d6bd79 feat: Get event in a room faster by searching in database 2022-03-24 14:10:41 +01:00
TheOneWithTheBraid c362ead49a feat: implement mofifying widgets
- add predefined MatrixWidget factories
- allow to create widgets
- allow to delete widgets

Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>
2022-03-24 10:40:10 +01:00
Christian Pauly f1d422b89a fix: Dont encrypt reactions
This fixes that server
sends notifications for reactions.
2022-03-15 08:42:53 +01:00
Christian Pauly b30b340b43 fix: hasNewMessage true when last event is sent 2022-02-16 08:09:57 +01:00
Christian Pauly 01dfdb29fd fix: Has new messages compares ts
This compares the origin server timestamp which might not map
to the real sort order of the timeline. But it is the best
solution for now.
2022-02-15 10:26:17 +01:00
Lanna Michalke ade7e7e910 fix: handle dynamic content for pinned events
Signed-off-by: Lanna Michalke <l.michalke@famedly.com>
2022-02-14 18:18:34 +01:00
Christian Pauly 68fcee98cb fix: Show reactions as last events and refactor hasNewMessage
Reactions are triggering push
notifications and should therefore
be displayed as last events
in the room list of a client.
The body should just display
the reaction key.
This fixes that rooms with
new reactions can't set to
read.
2022-02-14 15:06:22 +01:00
Christian Pauly 63e69eaa27 feat: Add hasNewMessages flag to room
This makes it possible to check
if muted rooms have unread
messages.
2022-02-14 10:48:57 +01:00
Nicolas Werner 4a52540006 fix: exception on removed widgets
And widgets without a name.

fixes #267
2022-02-13 23:11:53 +01:00
Krille Fear 84e87279e8 fix: Remove onHistoryReceived which was broken anyway 2022-02-07 15:15:44 +01:00
Christian Pauly 01d13e7e2c refactor: Implement on history received in timeline
In order to make delta updates
for GUIs displaying the
timeline events easier, the
onHistoryReceived callback
has been introduced.
2022-02-03 09:38:39 +01:00
TheOneWithTheBraid fa6bd12294 feat: implement to get a room's widgets
Please note that this does not implement *modifying* widgets,
as this requires a full implementation of the Matrix Integration Manager
API first. This is to be done later.

Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>
2022-02-02 08:38:56 +01:00
Christian Pauly 48572f8f10 fix: Trigger onChange for index on aggregation event update 2022-02-01 11:45:29 +01:00
TheOneWithTheBraid ed6f9c06b7 feat: expose Timeline.onChange to Room.getTimeline
Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>
2022-01-26 12:52:30 +01:00
Lanna Michalke 58f6cde0bf BREAKING CHANGE: high-level hadling of image sizes
- By using [package:image](https://pub.dev/packages/image), the
`MatrixImageFile` was given automatically generated width and heigth.
- Moreover, `MatrixImageFile` was given a factory to create the image
  file from a given maximal dimension.
- When sending images without explicitly providing a thumbnail, the
  thumbnail is automatically generated based on the provided image.
- The blur hash in generated automatically based on the provided image.

Fixes:
https://gitlab.com/famedly/company/frontend/famedly-web/-/issues/162, https://gitlab.com/famedly/fluffychat/-/issues/756

Signed-off-by: Lanna Michalke <l.michalke@famedly.com>
2022-01-19 13:10:17 +01:00
Marcel 1b11efc9eb fix: Use where and map instead of a loop and a removeWhere 2022-01-17 22:06:29 +00:00
Krille Fear bcca5e11f2 feat: Let sendDefaultMessage return false on encryption failure 2022-01-07 17:12:20 +00:00
Krille Fear 6d8fabd1e0 Merge branch 'krille/fix-request-user' into 'main'
fix: Requested users are not stored

See merge request famedly/company/frontend/famedlysdk!930
2022-01-04 06:28:00 +00:00
Christian Pauly 62a04b52d4 fix: Requested users are not stored
Fake Matrix Events for storing
need more paramters to
actually get stored. This fixes
it by creating a fake event ID
which should be unique.
2021-12-26 09:14:52 +01:00
Krille Fear 3bce8b4489 refactor: Remove unnecessary type checks and imports 2021-12-23 11:46:45 +01:00
Nicolas Werner d687973b01 fix: fallback in body for replies to replies 2021-12-15 19:21:41 +00:00
Sorunome b009ada0ac
fix: Allow consecutive edits for state events in-memory
The lastEvent was incorrect when trying to process an edit of an edit.
This fixes that by allowing consecutive edits for the last event.
2021-12-06 11:11:21 +01:00
Krille Fear 3338da4e09 fix: Ability to remove avatar from room and account
To remove an avatar the
client needs to send an
empty object. This is now
possible by making the
MatrixFile parameter nullable.
2021-11-22 19:36:38 +01:00
Krille Fear b7565af56f fix: use originServerTs to check if state event is old
Due to server bugs or whatever it sometimes
happens that old state events appear
in the setState method in the room class.
Previously we checked if we already know
this event ID, but for this we needed to
check the timeline which is very fluid.
Also this is a database operation in a
non-async method which works in Hive but
not in Sembast.
Using originServerTs is not 100% safe as
well but should be more stable because
the chance that servers have veeery wrong
time (which is necessary here) is much
lower than the risk that the timeline
is not long enough to know the
old event.
2021-11-15 10:57:55 +01:00
Krille Fear f052957c0a fix: Change eventstatus of edits in prevEvent
Unfortunately the last fix
was not working.
This fixes it for real now and also
adds a test case to make sure it
never breaks again.
2021-11-11 09:48:50 +01:00
Nicolas Werner be617ee974 Merge branch 'krille/update_api' into 'main'
refactor: Update matrix_api_lite and use SyncUpdate constructors

See merge request famedly/company/frontend/famedlysdk!887
2021-11-10 11:40:49 +00:00
Krille Fear d16c25b26d fix: Edits as lastEvent do not update
This fixes a bug where edit
events as lastEvents do not
update from SENDING status.
Because previously it only
checks if the event ID
matches.
2021-11-10 10:43:05 +01:00
Krille Fear 58b36a67a3 refactor: Update matrix_api_lite and use SyncUpdate constructors 2021-11-10 10:04:03 +01:00
Krille Fear 8116436da8 Merge branch 'krille/improve-start-up-time' into 'main'
feat: Make waiting on init db optional

Closes #235

See merge request famedly/company/frontend/famedlysdk!881
2021-11-09 14:35:13 +00:00
Krille Fear 475e810523 feat: Make waiting on init db optional
This can improve the start-up time of apps.
The three big db reads on init are
loading account data, rooms and
device keys.
This makes it now possible to let
them run parallel
(while it may depend on platform
if this has any effect)
and the init() method can skip
awaiting them. They will
be at least awaited before handling
the first received sync.
So the app can already display the
room list before device keys are
loaded and request the first sync
from the server before anything
else is loaded from the DB.
2021-11-09 15:27:48 +01:00
Krille Fear e313426dd9 refactor: Move setreadmarker functionality to timeline
Apps had a hard time to just set
the marker for the last event.
The lastEvent in the Room may
not be the actual last event
because we ignore several
event types there. Therefore
it makes sense to refactor
the setUnread method.
Now the timeline class has an
easy method to set the read
marker to the last synced
event, which can only be
known by the timeline if we
want to avoid another DB access.
2021-11-09 14:56:59 +01:00
Jindra a0bab1b587 feat: choose memberships returned by requestParticipants() 2021-11-02 09:27:00 +01:00
Nicolas Werner 6e20c53b01
refactor: remove redundant null checks 2021-10-28 14:32:09 +02:00
Nicolas Werner 6abd9e7e22
refactor: nullsafe event test 2021-10-28 03:44:01 +02:00
Nicolas Werner ebd5bc3d24
refactor: make room nullsafe 2021-10-28 00:54:25 +02:00
Jindřich Pikora c6e0359522 refactor: Change event status to enum 2021-10-14 13:31:07 +00:00
Lukas Lihotzki 66f29c7685 refactor: move voip content in its own file 2021-10-08 14:26:23 +02:00
Jayesh Nirve 77ca7523d0 refactor: remove unused clientId 2021-09-24 16:05:05 +02:00
Sorunome b455a54304 fix: Less log clutter about tags 2021-09-22 23:32:27 +00:00
Sorunome 1652213ab0
fix: Room previews not showing replies 2021-09-16 15:48:41 +02:00
Krille Fear 00cc439122 fix: Do not set old events as state events
Previously we had a check which uses the old
sortOrder value.
This check has been removed with the refactoring which leads to
bug #209. This fixes it by checking if the
event is already known in the database.
I am not 100% happy with this solution as this database api is impossible
to be implemented with a sqlite db. Once we start to refactor the whole sync update logic
we maybe could find a better way, but only the fox god knows.
2021-09-14 08:29:54 +02:00
Nicolas Werner e000fbf9be fix: compilation against newer matrix_api_lite 2021-09-10 16:40:40 +02:00
cloudwebrtc ea34f0b82c feat: MSC2746: Improved Signalling for 1:1 VoIP. 2021-09-10 02:50:24 +02:00
Christian Pauly 524b09c572 feat: Do not load all timeline events from store at once 2021-09-03 14:58:43 +02:00
Christian Pauly 9c1f79359e refactor: Replace all logic regarding sortOrder
The current implementation of sortOrder can be made way more easier now
by just keeping the sortOrder of the list
and the timelineFragments in the hiveStore. This needed a huge
change but mostly removes a lot of code which can be done
way more easy now. This also needed some rewriting of the setState logic and changes to
the prevEvent calculation. This solution should also be more stable.
More information:
https://www.reddit.com/r/fluffychat/comments/pfnlhq/the_sort_order_of_matrix_timelines/
2021-09-02 07:13:38 +00:00
Christian Pauly 803c7598c6 refactor: Workarounds for missing mHeroes in rooms
Normally we do not need a workaround here at all but we had
one in the displayname calculation for
historical reasons. A "good" server should always send the mHeroes correctly.
Instead of removing this workaround completely we do a compromise and implement a more
lightweight alt behaviour by just saying that in a DM room with no
heroes, the directChatMatrixId will be used. This is the same behaviour like in Element
and needs way less lines than before and also covers the avatar
calculation. For Synapse we seem to not need this but for Conduit it
might be helpful.
2021-09-02 07:00:12 +00:00
Christian Pauly d921f38734 feat: Pin invited rooms
Invitations should always be on top of the
room list. This makes it an optional parameter now which defaults to
true.
2021-09-02 06:43:06 +00:00
Sorunome ffb6fd426c
fix: Requesting history being funky
As it turns out, some of the code set the prev_batch for rooms too
early to an empty string. For synapse this means "request from the start",
for conduit it is just an error. This commit fixes that by never resolving
null --> empty string, but instead throw an error.
2021-08-29 12:56:16 +02:00
Sorunome 024e0de4b9
fix: Don't lag when sending messages in big rooms
The old mentionMap was very inefficient to build and scaled badly with
room member size. This resulted in noticable lag when sending any message
in a large room, no matter if it contained a message or not.
Now, the algorithm is severly optimized and mentions (and emotes) are
only loaded when actually used.
2021-08-29 11:43:46 +02:00
Christian Pauly aeea0669d5 fix: Send unencrypted thumbnails
There was just one toString() missing and this
lead to a crash in the app because hive tries to store
an URI.
2021-08-28 17:17:25 +02:00
Christian Pauly e1343e9c83 fix: requestHistory() for archived rooms
Using JoinedRoomUpdate() in a fake
sync for archived rooms when requesting
the history leads to the problem that
the room is stored as a joined room
in the store which is wrong.
2021-08-25 10:46:35 +02:00
Lukas Lihotzki 9087f08775 chore: mxc url in Uri 2021-08-23 11:05:47 +02:00
Christian Pauly 9b7474e2f2 refactor: Update to dart 2.12 and opt out in all files
This also adds some missing license headers, I have detected while
using license header search&replace to add the
null safety opt out
2021-08-18 08:09:39 +02:00
Sorunome 0e6ed1c51e
feat: Allow specifying extraContent for Room.sendFileEvent, in case clients want to specify some custom stuff 2021-08-16 19:03:15 +02:00
Jayesh Nirve 5761fb77cb
remove extra if null 2021-08-14 17:24:37 +05:30
Jayesh Nirve 2e7bf1a5c9
fix toDouble was called on null when you had a pinned room 2021-08-13 18:35:46 +05:30
Lukas Lihotzki 0b531d3e99 fix: tryGet for room account data 2021-08-09 11:12:49 +02:00
Lukas Lihotzki 8665f092f4 chore: matrix_api_lite 0.4.0 2021-07-26 14:54:22 +02:00
Sorunome a1594fd9ac
feat: Add general image pack handling as per MSC2545
This also deprecates the old ways to access just emoticons, as the MSC
now covers both emoticons and stickers!
2021-07-18 18:46:32 +02:00
Sorunome ee287a09b9
feat: Add support for nicer mentions
This PR adds support for nicer mentions in markdown: You can now
fetch the mention string of a user with `user.mention` which is
human-friendly (typically contains the display name), which will get
properly pillified upon passing through the markdown parser.
2021-07-18 17:29:25 +02:00
Christian Pauly c0c7f68bf3 chore: Rename to matrix 2021-06-18 09:58:25 +02:00
Christian Pauly ab0ff46900 refactor: Remove types for timeline callbacks
These types weren't that helpful anyway and their names were not compatible
with the new linter rule of Flutter 2.2.
2021-06-01 12:57:52 +02:00
Christian Pauly d0f67f914a refactor: Add sortOrderKey and check for this while Event creation
This makes it easier to write a store which just stores the Event json and
does not have a dedicated scheme for
each object like Moor has.
2021-06-01 12:55:45 +02:00
Christian Pauly 26261ecd5e feat: Add fromJson method for Room
This also included to move the room summary to a dedicated object inside
of the Room object because so it is easier to convert this to and from json.
2021-06-01 12:54:16 +02:00
Christian Pauly c3d47b16c6 CI: Use correct image 2021-05-25 10:46:34 +02:00
Christian Pauly c66e35c16c refactor: Create a clean database API 2021-05-20 07:36:03 +00:00
Lukas Lihotzki c196610998 chore: operation names from OpenAPI spec 2021-05-12 13:56:16 +02:00