Commit Graph

1328 Commits

Author SHA1 Message Date
Nicolas Werner 8146aa05b8 refactor: make user nullsafe 2021-10-14 10:27:34 +00:00
Nicolas Werner 978c3bb994
refactor: make voip_content nullsafe 2021-10-13 17:03:34 +02:00
Nicolas Werner 60956bde00 chore: port the remaining encryption files to nullsafety 2021-10-13 13:58:21 +00:00
Krille Fear 3ae42d1a88 fix: Type error when using CryptoKey in dart web
In Dart Web when using CryptoKey we
get a type error. When using the html version of it
it seems to work fine.
2021-10-13 12:30:04 +00:00
Lukas Lihotzki 3130139bde refactor: prepare null safefy for user.dart
With this commit, the migration tool needs to do 8 fewer changes.
2021-10-11 19:58:26 +00:00
Sorunome f811e45102 fix: events with unknown users having invalid mxids
This caused issues down the line where the sender id was assumed to
be a valid matrix identifier
2021-10-11 19:49:10 +00:00
Lukas Lihotzki b516bd1005 refactor: add and use constructor with named parameters 2021-10-08 14:26:23 +02:00
Lukas Lihotzki 66f29c7685 refactor: move voip content in its own file 2021-10-08 14:26:23 +02:00
Krille Fear 3603dae312 feat: Calc benchmarks for hive operations on init 2021-10-07 12:18:13 +00:00
Lukas Lihotzki a7818bbd0f refactor: null safety for all utils 2021-10-05 15:41:25 +02:00
Christian Pauly 687a6341f1 fix: Sent events are sorted in SENDING timeline
Events with a status of 1 should be sorted in the normal timeline.
They should not be stucked at the bottom. This fixes a bug
where a limited timeline flag
can stuck a SENT event at the bottom of
the chat forever.
2021-10-04 17:45:27 +00:00
Lukas Lihotzki 4bd659fd56 style: remove unneeded trailing comma 2021-09-30 15:53:43 +02:00
Lukas Lihotzki 85004e1faf refactor: capture member variables as finals 2021-09-30 15:53:43 +02:00
Lukas Lihotzki 41d905ca60 refactor: use more ?. 2021-09-30 15:53:43 +02:00
Nicolas Werner 71e5ec1bb5 style: use map entry with explicit types over cast 2021-09-30 12:58:37 +00:00
Nicolas Werner 6f7f7100e1 fix: use explicit type in fold instead of cast 2021-09-30 12:58:37 +00:00
Nicolas Werner 7dd176c278 fix: apply review feedback 2021-09-30 12:58:37 +00:00
Nicolas Werner 08bbb3f6f5 fix: prefer ! over ? 2021-09-30 12:58:37 +00:00
Nicolas Werner d15c71e5b3 fix: pre vs postcrement confusion 2021-09-30 12:58:37 +00:00
Nicolas Werner e5682fcb91 refactor: remove clientid from encryption code 2021-09-30 12:58:37 +00:00
Nicolas Werner 1c838e3be8 fix: Cleanup nullsafe encryption a bit 2021-09-30 12:58:37 +00:00
Lukas Lihotzki da80658c09 refactor: simplify device_keys_list.dart 2021-09-30 12:58:37 +00:00
Nicolas Werner a196b53219 refactor: nullsafe encryption 2021-09-30 12:58:37 +00:00
Sorunome 259c9cade6
fix: missing range check
When requesting history the `start` parameter could become larger than the loaded events
from the database were, resulting in an error when attempting to request history.
2021-09-30 14:34:28 +02:00
Lukas Lihotzki 1d0202e14e refactor: null safe matrix_id_string_extension 2021-09-27 12:59:51 +00:00
Lukas Lihotzki 3b1c6e3d2b refactor: arbitrary components in _parseIdentifierIntoUri 2021-09-27 12:59:51 +00:00
Lukas Lihotzki fb0ea2efc3 refactor: parseIdentifierIntoParts 2021-09-27 12:59:51 +00:00
Lukas Lihotzki 7fce5b6040 refactor: inline parseQueryString in parseIdentifierIntoParts 2021-09-27 12:59:51 +00:00
Lukas Lihotzki 8ea01fcee0 refactor: simplify parseQueryString in parseIdentifierIntoParts 2021-09-27 12:59:51 +00:00
Krille Fear 62fe7a1704 fix: New verification requests on requesting history
If requesting history happens to contain a m.key.verification.request we currently create a new key verification object and push it to the client.
This fixes it.
2021-09-27 14:51:25 +02:00
Jayesh Nirve 77ca7523d0 refactor: remove unused clientId 2021-09-24 16:05:05 +02:00
Lukas Lihotzki 42434761e8 chore: dart analyze fix 2021-09-23 14:57:30 +02:00
Lukas Lihotzki 5da26a6923 refactor: null safe commands_extension 2021-09-23 00:15:05 +00:00
Lukas Lihotzki 01c3b4d0bc refactor: null safe MatrixFile 2021-09-22 23:40:21 +00:00
Sorunome b455a54304 fix: Less log clutter about tags 2021-09-22 23:32:27 +00:00
Sorunome d8986f1d10 fix: Add type checkings for User.displayName 2021-09-22 23:00:36 +00:00
Christian Pauly 0125272b7e fix: Autodetect mimetype on file upload 2021-09-22 07:59:45 +02:00
Sorunome 80be9629bf
fix: Setting stuff in the database assumed event relationships were well-formatted 2021-09-21 11:31:53 +02:00
Sorunome b41c7b1bc6
fix: Don't re-play m.dummy to_device events
If both ends had m.dummy events queued as last messages an an olm
session corrupted, then the clients landed in an infinite game of
ping-pong. It was so stable, that the clients could have won the
ping-pong world championships!
2021-09-21 10:05:51 +02:00
Lukas Lihotzki 7a3553839c fix: remove unused parameter in VariableTimeoutHttpClient 2021-09-21 07:12:07 +00:00
Lukas Lihotzki f491cfacc2 refactor: null safe http_timeout 2021-09-21 07:12:07 +00:00
Krille Fear e0e09c2f67 feat: Add waitForFirstSync parameter to init method
Just using the .init() method to wait for the client
to initialize is a more easy way than listen to onLoginStateChanged.
But by default it waits for the first sync.
This should be configurable.
2021-09-20 11:41:40 +02:00
Sorunome fe9145d580 fix: missing null check 2021-09-18 07:50:45 +00:00
Sorunome 6f0c7c5f64 feat: Add /discardsession command 2021-09-17 05:52:53 +00:00
Sorunome 0611ea1495
fix: Auto-reply key requests 2021-09-16 22:14:41 +02:00
Sorunome 1652213ab0
fix: Room previews not showing replies 2021-09-16 15:48:41 +02:00
Jindra d8f642372e fix: missing content-type when changing avatar 2021-09-15 09:35:58 +02:00
Jindřich Pikora 03f82d84b9 fix: only/number emotes in a reply 2021-09-14 09:21:49 +00:00
Krille Fear dec32975e2 fix: Clearing corrupted boxes
If a box is corrupted the clear function fails on it. Then
we should delete the box from the disk.
Currently we use the Hive.deletefromDisk() method which does not
work because it deletes only open boxes, but the box is obviously not open in
this case.
2021-09-14 10:33:11 +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
Krille Fear 1e2ccabe85 fix: Missing null fallback when update notificationCount
Previously when using RoomUpdate in the constructor the notificationCount to update
was never null and set to 0 if it was missing. Now that we are
no longer using it, I forgot to
add the null fallback at this point.
This leads to serious crashes in the apps at runtime
and thats why I bump the version here as well!
2021-09-13 16:42:55 +02:00
Christian Pauly 00771fc209 refactor: _updateUserDeviceKeys method 2021-09-13 14:58:07 +02:00
Krille Fear 56af96c7ea fix: Get direct chat from user ID method
The method was not type safe and therefore there
was no warning that with the sortOrder changes
now DateTimes are compared which leads to
an exception in the app if not using converting to milliseconds first.
2021-09-13 13:53:37 +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 e13b00d127 refactor: Make RoomUpdate class null safe by removing it
RoomUpdate came from a time where we had no data model for
SyncUpdates but now we have and therefore this class is just
code duplication. This removes the class
and uses the SyncRoomUpdate class from
the package matrix_api_lite instead.
It needed a lot of refactoring at some places
where I also have removed some unnecessary null or type checks.
2021-09-08 12:31:55 +00:00
Christian Pauly 5b13e0442e refactor: Make Uri extension null safe 2021-09-08 12:31:55 +00:00
Christian Pauly 92755c07d3 refactor: Don't create dummy User object just to start a new chat 2021-09-08 12:31:55 +00:00
Christian Pauly 210c925a0a fix: Do not handle sending event updates which are already synced
This is an edge case which might occour
on unstable data connections. The user sends an event and receives the sync
before the response to the sending
http request. This leads to duplicated
events while the response actually
should be ignored at this point.
2021-09-08 11:33:36 +02:00
Christian Pauly 646d7e2640 fix: revert make bytes in EncryptedFile nullable 2021-09-06 09:35:53 +02:00
Christian Pauly 2cd32a8547 fix: Make bytes in encrypted file nullable
This was a mistake to make them non nullable. There are fields in the app where
we create this object without bytes.
2021-09-06 08:46:23 +02:00
Christian Pauly 630203e7b6 fix: Check if database got disposed in keyManager 2021-09-03 15:05:34 +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 fb62307730 fix: Check if client is disposed in a callback
This fixed an edge case in the tests.
2021-09-02 06:43:06 +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 efb5842959
fix: Implement dummy transactions for hive
That way some concurrency bugs might be fixed, such as if two sync
requests are processed at the same time. That can e.g. happen if you
request history while a sync request is already being processed.
2021-09-01 19:11:46 +02:00
Nicolas Werner 8b46fa3fc2 fix: room account data key/type returned encoded
We uri encode all hive keys. But in some cases we never decode them.
This leads to fun issues like SSSS being unreadable after restart.

fixes https://gitlab.com/famedly/company/frontend/famedlysdk/-/issues/179
2021-09-01 16:37:51 +00:00
Sorunome 33d31cecd1
fix: Missing chatUpdate.prev_batch != null test
We *always* have to update the in-memory prev_batch if it is non-null
2021-09-01 17:42:49 +02:00
Christian Pauly 62694248b9 refactor: Make UIA Request null safe 2021-08-30 09:26:34 +02:00
Christian Pauly efca583cf5 refactor: SyncUpdateExtension null safe 2021-08-30 09:20:17 +02:00
Christian Pauly 8ae77215b5 refactor: SpaceChild and SpaceParent null safe 2021-08-30 09:20:17 +02:00
Christian Pauly dd48a379ec refactor: runInRoot null safe 2021-08-30 09:20:17 +02:00
Christian Pauly 8621f82333 refactor: Null safe receipt 2021-08-30 09:20:17 +02:00
Christian Pauly 2589206851 refactor: Null safe QueuedToDeviceEvent and fix CamelCase filename 2021-08-30 09:20:17 +02:00
Christian Pauly 607658dcda refactor: Null safe QueuedToDeviceEvent and fix CamelCase filename 2021-08-30 09:20:17 +02:00
Christian Pauly 4b9a2945f4 refactor: Null safe multilock 2021-08-30 09:20:17 +02:00
Christian Pauly 0cd73e846d refactor: Null safe matrix localizations 2021-08-30 09:20:17 +02:00
Christian Pauly f311ca62e0 refactor: Make markedUnread null safe 2021-08-30 09:20:17 +02:00
Christian Pauly 1fd40dd186 refactor: Make database null safe 2021-08-30 09:20:17 +02:00
Christian Pauly 5eb2d22207 refactor: Make eventupdate null safe 2021-08-30 09:20:17 +02:00
Christian Pauly d75b27a0cd refactor: Ignore import_of_legacy_library_into_null_safe 2021-08-30 09:20:17 +02:00
Christian Pauly 8f35683120 refactor: Make encryption utils null safe 2021-08-30 09:20:17 +02:00
Christian Pauly 4bee82dbe0 fix: uiaRequests send broken auth object at first try
We should just let the `auth` object null and dont send it at the
first try and wait for the servers response. This worked in the past
but now it is broken because of changes in the
matrix_api_lite. This could also be fault for some
bootstrap issues.
I have also removed an unnecessary check if a String is a String and just made it a
null check because this was intended at this point.

Because of that this blocks uiaRequests it is a hotfix and therefore directly bumps the version.
2021-08-30 08:31:20 +02: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
Sorunome f3f9b219e1 feat: Cleanup Event.plaintextBody and add [plaintextBody] to Event.getLocalizedBody
It appears that [hideEdit] in Event.getLocalizedBody was written in a way that it
assumes a valid event body. This was also fixed, while also adding tests for the
various parameters of Event.getLocalizedBody
2021-08-28 09:46:03 +00:00
Sorunome b849c828e3
fix: String.parseIdentifierIntoParts not working with unicode matrix.to links
Some clients do not uri-encode the identifier for matrix.to links, so we must
handle if we can't uri-decode them
2021-08-28 11:19:26 +02:00
Jayesh Nirve 4af6763765
fix: missing null check in hideEdit condition 2021-08-27 21:11:06 +05:30
Sorunome 56817df437
fix: missing null check
It seems `device_keys` in the reply of `/keys/query` is not required. While synapse always
sent it, conduit did not, which resulted in an error.
2021-08-27 17:22:54 +02:00
Jayesh Nirve 42614bdfbd
Merge branch 'main' of gitlab.com:famedly/company/frontend/famedlysdk into td/fix-lastevent-preview 2021-08-26 02:42:36 +05:30
Christian Pauly 5621c9bdb0 fix: sortAtTheEnd for LeftRoomUpdate was not set
This fixes a bug where requesting
history on archived room leads to a
wrong sorted timeline.
2021-08-25 11:06:26 +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
Christian Pauly 2f35277e47 refactor: Change name of archive getter to function
This is more intuitive because it is
a function that loads something from
the server and doesnt directly return
something.
2021-08-25 10:36:58 +02:00
Christian Pauly cec08b3775 feat: cache archived rooms to access them with `getRoomById`
getRoomById searches now in the local cache for the given room and returns null if not
found. If you have loaded the [archive] before, it can also return
archived rooms.
This should make it much easier to display
archived rooms in the client.
2021-08-25 09:52:57 +02:00
Lukas Lihotzki 9087f08775 chore: mxc url in Uri 2021-08-23 11:05:47 +02:00
Jayesh Nirve 164a95ea29 clean stuff up? 2021-08-23 07:34:57 +00:00
Nicolas Werner a4ac9eab66 cleaner conditions 2021-08-23 07:34:57 +00:00
Jayesh Nirve c4c1c676da fix null check 2021-08-23 07:34:57 +00:00
Jayesh Nirve 572402980c fix null check 2021-08-23 07:34:57 +00:00
Jayesh Nirve 38235415eb fix: lastEvent in room preview now crespects edits order 2021-08-23 07:34:57 +00:00
Christian Pauly 93c689fd4d hotfix: Opt-out null safety for crypto files because of an error in web
`packages/matrix/src/utils/crypto/crypto.dart:19:1: Error: Null safe libraries are not allowed to export declarations from of opt-out libraries.
`
2021-08-20 13:56:15 +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
xenofem a1b95c0915
feat(events): add plain-text body representation from HTML
Co-Authored-By: Sorunome <mail@sorunome.de>
2021-08-17 18:33:45 +02:00
Jayesh f0dd8ca061 feat: get new_content in getLocalizedBody 2021-08-17 15:24:53 +00:00
Sorunome 98b0bd4322 feat: Add a way to get a verification request by its transaction id
A client might find the need to get the verification request object by
its transaction id, to be able to e.g. display for in-room verification
an "accept verification request" button easily.
2021-08-17 15:03:30 +00:00
Christian Pauly 86041513f8 refactor: Remove deprecated moor database
We have used some data models which were only used in moor in the tests.
I needed to rewrite them in the original data as well.
Also now the "fake database" on native is the same like on web now with hive.
2021-08-17 10:11:59 +02:00
Sorunome fb16b96ea6 fix: Correctly parse the reason of a spoiler
Previously only the first child node of a spoiler was considered to
determine if there should be a spoiler reason. This was, unfortunately,
incorrect, as soon as e.g. the reason had more than one space. This is
fixed by properly iterating all child nodes to search for the reason.
2021-08-17 07:33:53 +00:00
Christian Pauly 37cfadd7e9 fix: Add space states to important events
We need the space state events in the important events to be able to
differentiate rooms and spaces in the room list.
2021-08-17 06:47:25 +00: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
Marcus f91f662c75 chore: update to matrix_sdk_lite 0.4.1 2021-08-05 12:10:45 +00:00
Nicolas Werner 08c808562b fix: Typo in key backup requests
This may lead to messages not decrypting after interactive verification,
which would make the user manually press the request keys button.
2021-08-03 13:18:15 +00:00
Jindřich Pikora cf441e533d refactor: rename LoginState.logged to loggedIn 2021-08-03 12:26:17 +00:00
Nicolas Werner 162436cc8d fix: accidental OTK uploads on internal fakeSync 2021-08-02 20:52:09 +02:00
Christian Pauly 4ca69e3e1d fix: Missing required field `nextBatch` 2021-07-27 10:50:06 +02:00
Christian Pauly e8d511a371 fix: Missing null checks in syncUpdate handling 2021-07-27 10:49:50 +02:00
Lukas Lihotzki 46b2f8898e fix: use TryGet.optional 2021-07-26 15:33:36 +02:00
Lukas Lihotzki 6d6830505f refactor: implement http timeouts in this package 2021-07-26 15:33:36 +02:00
Lukas Lihotzki 8665f092f4 chore: matrix_api_lite 0.4.0 2021-07-26 14:54:22 +02:00
Lukas Lihotzki bc2dac2ecc refactor: use more specific type 2021-07-26 14:40:15 +02:00
Nicolas Werner 179f73db3a fix: Upload OTKs if the otk_count field is missing
fixes #180
2021-07-26 09:47:05 +02:00
Christian Pauly 209035ffbd refactor: Use official Dart isolates
The isolates package is discontinued and not compatible
with the newest Dart version.
dart:isolate is not an option because importing this
library makes it impossible to run the matrix
SDK on dart web native. It just won't
build. So we now just depend on
that the flutter app pass through the compute method.
2021-07-21 12:34:43 +02:00
Christian Pauly 99c900be9c fix: Add missing null check
With Synapse 1.38 SyncUpdate.accountData is null if it is empty.
2021-07-19 09:18:23 +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
Sorunome 44b7c96d73
fix: preserve homeserver port when creating thumbnail URIs 2021-07-11 13:15:57 +02:00
Sorunome cd5131daa5
fix: Add locking to sending encrypted to_device messages to prevent potential race conditions
Due to chunked lazy sending of megolm sessions it was in theory that we encrypted two olm
messages to the same device in different futures out-of-order. Introducing locking here should
fix this (increadibly rare, so far only theoretical?) race-condition
2021-07-11 13:06:39 +02:00
Sorunome e86353a412
fix: Provide a reasonable well-known fallback
If the well-known look fails (not json, 404, etc.) we should assume a
reasonable fallback (domain part with https prepended). As clients are
expected to call Client.checkHomeserver on the resulting domain anyways
we can safely assume this default, as it is still validated, if there
is actually a matrix homeserver running on that endpoint.
2021-07-11 12:26:48 +02:00
Christian Pauly e86fd7cc07 refactor: Restructure states box and use dedicated members hive box
More description about this here: https://gitlab.com/famedly/company/frontend/frontend-issue-inbox/-/issues/40
2021-07-10 08:38:38 +00:00
Christian Pauly aeb808b5dc fix: Dont migrate from version null
If the currentVersion of the database is null then the database has never been used yet.
Therefore we store the current version and do not call the migrate method.
2021-07-10 08:38:38 +00:00
Sorunome 36a9b53de1
fix: Adjust emoji ranges to have less false positives
Before too many characters, e.g. kanji, were incorrectly detected
as emoji
2021-07-09 20:53:49 +02:00
Sorunome 4735d2d0a8
fix: Sending of the to_device key
With the switch to hive a regression of sending the to_device key was
introduced: When popping elements .deleteAt(), so deleting at the index,
was used, instead of .delete(), so deleting of the key. As the new events
pushed onto the queue used hives auto increment key, a .delete() is
appropriate here.
2021-07-09 19:43:48 +02:00
Christian Pauly 535a3b1d70 feat: Make it possible to get the current loginState
You may have missed the last valid loginState from the stream if you
listen too late to it. This makes it possible to
get always the current loginState.
2021-07-06 12:25:00 +00:00
Christian Pauly 7c0dd5d8fd fix: Broken nested accountData content maps
If you call BasicEvent.fromJson the given content is copied first
which recursively makes sure
that the Map is from type
Map<String,dynamic>.
Using just the constructor doesnt have this which can lead that nested Maps in
the content is InternallinkedHashMap and
therefore lead to type errors.
2021-07-06 08:11:30 +02:00
Christian Pauly ebc9be250d fix: Mark unsent events as failed
In Moor this was implemented but forgotten in Hive.
Events with status 0 (not sent yet) should be marked as failed on restart.
In fact they should be marked as failed if older than 1 minute. To not have a big startup job which iterates through all events in the database
we just do a time check when opening a room where we iterate through all events anyway.
The new implementation is now in the constructor of the Event and therefore
independent from the database implementation.
2021-07-05 08:37:46 +02:00
Sorunome b664640a05
fix: Don't run syncs while the client is being initialized
Fixes that a sync could be done / processed while the client was still being initialized (loaded from database). This has lead to multiple bugs, such as the verified status of keys getting lost, notifications that come in during app startup displaying oddly, etc.

Additionally, the init lock was released too early; it is now released when the init is actually done.
2021-06-25 13:26:23 +02:00
Christian Pauly 768b0623da feat: Implement sync status stream
This new sync status stream gives the current status of the sync to make it possible
to display in the UI where the sync currently hangs and
what the progress is while updating 1000 rooms. So the app can display a
progress bar.
2021-06-20 15:59:59 +02:00
Christian Pauly 96d28a1b76 feat: Implement migration for hive schema versions 2021-06-20 10:31:17 +02:00
Christian Pauly a7ffe4835d feat: Also migrate inbound group sessions
For users who do not use the chat backup this could be useful.
2021-06-19 11:03:52 +02:00
Christian Pauly 4dc62f6150 fix: Make sure hive keys only contain valid characters
There are some matrix IDs like room IDs which contain for example emojis.
This is valid from the spec and some people hack their Synapse to have this.
2021-06-19 10:51:17 +02:00
Christian Pauly 69b52ba85b refactor: Move pedantic to dev_dependencies
The unawaited method from the pedantic package was a historic solution
for the case that you dont want to await a future in an async function.
But now we can do this with just a comment which
is the recommended way to do this now.
This makes it possible to have pedantic as a dev_dependency which means just one dependency less.
2021-06-18 10:15:59 +02:00
Christian Pauly c0c7f68bf3 chore: Rename to matrix 2021-06-18 09:58:25 +02:00
Christian Pauly 38d81d6093 fix: Migrate missing device keys
Currently we only migrate the client and SSSSCache but this leads to the
problem that we are no longer self signed after the migration.
We need to migrate all device keys too.
This also abstracts the migration code in a method. init() is too large already...
2021-06-18 09:16:12 +02:00
Christian Pauly 14ee16fe16 feat: Implement new Hive Database
The hive database now implements the whole API except for storing files which
should be better done by the flutter_cache_manager package inside of the
flutter app. All tests already run with Hive now but the Moor database is still
tested too. We needed to change some wait jobs in the tests because the Hive
database is not 100% in memory for the tests like Moor.
For now both database implementations are equal and the developer can pick
which one to use but we plan to get rid of Moor in the future.
2021-06-16 08:43:33 +02:00
Christian Pauly 28dc8b4ff0 refactor: Improve clearing
This makes sure that the database is null after clearing so it will
be built again using the databaseBuilder.
Also this makes sure that the sync has
aborted BEFORE the clearing starts to
get rid of some warnings in the logs.
2021-06-14 11:00:41 +02:00
Christian Pauly fe06b96e93 fix: Do not logout before migration
Before the migration of the databases starts there is always a
logout signal sent. This was wrong.
This also cleans up the logs a little bit
and removes the useless parameters for the second init() call
because those are going to come from the new database anyway.
2021-06-14 08:29:03 +02:00
Christian Pauly 967712adfe feat: Implement database migration
This allows the user to give a legacyDatabaseBuilder to the client object
and in the init proccess the client checks by itself if there is old data in the legacy
database. If yes then it migrates them and
then deletes the old database. This uses the database_api and is agnostic to
the database implementation.
2021-06-11 10:10:18 +02:00
Christian Pauly c387b33e9f refactor: Make support for file storing optional in database API 2021-06-01 15:27:18 +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 73db010db4 fix: Make QueuedToDeviceEvent store content as String OR Map
Temporary fix to stay compatible to Moor AND a key value store
2021-06-01 12:56:43 +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 9631cea83a feat: Add toJson method for StoredInboundGroupSession 2021-06-01 12:51:17 +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
Christian Pauly d1b76b01c4 fix: Try clear and try close database 2021-05-17 14:36:10 +02:00
Christian Pauly bb9a8ff7e9 fix: SdkError Exception can be anything so should be dynamic 2021-05-17 14:17:46 +02:00
Nicolas Werner 6f52c0e2c3 fix: Allow SDK users to delete the db after logout 2021-05-17 07:38:53 +00:00
Lukas Lihotzki c196610998 chore: operation names from OpenAPI spec 2021-05-12 13:56:16 +02:00
Christian Pauly 70ee808911 feat: Enhanced alias handling 2021-05-01 09:26:46 +02:00
Lukas Lihotzki fdf650abd5 refactor: avoid if-condition based on bit value 2021-04-26 18:48:54 +02:00
Lukas Lihotzki b4f755388a refactor: high-level loops 2021-04-19 18:58:59 +02:00
Lukas Lihotzki 71fdd28a8a refactor: await unconditionally 2021-04-16 14:19:42 +02:00
Christian Pauly ffef732103 refactor: enable more linter rules
enable prefer_final_locals and prefer_final_in_for_each linter rules
2021-04-14 10:29:29 +02:00
Lukas Lihotzki 545ce26e39 style: fix format and lint 2021-04-12 14:49:03 +02:00
Lukas Lihotzki ac9df588d1 chore: recreate database.g.dart 2021-04-12 14:49:03 +02:00
Lukas Lihotzki d413f54f10 refactor: use OpenSSL for file e2ee 2021-04-12 14:49:03 +02:00
Lukas Lihotzki 761138a56d refactor: use OpenSSL for AES 2021-04-12 14:49:01 +02:00
Lukas Lihotzki 7faf05fe90 refactor: selectable hash for pbkdf2 2021-04-12 14:48:38 +02:00
Lukas Lihotzki a25d1932ee fix: fast pbkdf2 with OpenSSL 2021-04-12 14:48:38 +02:00
Lukas Lihotzki 4f32168017 chore: upgrade to markdown 4.0.0 2021-04-12 14:48:38 +02:00
Lukas Lihotzki 285b14912a chore: null safe crypto dependencies 2021-04-12 14:48:36 +02:00
Christian Pauly fb0177ac5f feat: Implement spaces 2021-04-12 09:24:20 +02:00
Lukas Lihotzki f69acda419 refactor: use parameters in EncryptedFile constructor 2021-04-06 18:57:34 +02:00
Lukas Lihotzki 2a2a170609 refactor: upgrade http package 2021-04-01 13:43:24 +02:00
Lukas Lihotzki 08043c06f4 refactor: high-level loops 2021-04-01 12:51:45 +02:00
Christian Pauly 0ceb2b26df refactor: Constants names 2021-03-30 12:43:50 +02:00
Lukas Lihotzki 3d55abdd11 chore: upgrade to ffi 1.0.0 2021-03-29 16:37:29 +02:00
Christian Pauly 9012ce6b2c fix: Display errors from isolates in the logs 2021-03-17 09:46:13 +01:00
Christian Pauly 0a9f8497e2 chore: Make bootstrap logs more chatty 2021-03-17 08:22:22 +01:00
Krille Fear 9bef8452d3 docs: Clean up dart documentations
Changing to `code` blocks where it cant be resolved to [stuff] things.
2021-03-16 12:32:21 +00:00
Krille Fear 9626c64993 docs: Fix deprecation warning 2021-03-16 09:23:44 +00:00
Christian Pauly 97daae3419 refactor: Update to matrix_api_lite 0.2.0
This introduces a minor breaking change in the login method.
It now uses correctly the AuthenticationIdentifier
and deprecates the user, medium and address parameter.
2021-03-09 19:14:53 +01:00
Krille Fear 5cf97886b4 Merge branch 'soru/strip-at-room' into 'main'
feat: Escape @room in the reply fallback when replying

See merge request famedly/famedlysdk!667
2021-03-09 18:12:47 +00:00
Krille Fear 57fde98fec Merge branch 'soru/less-sql-statements' into 'main'
chore: Reduce needed database accessess

See merge request famedly/famedlysdk!666
2021-03-09 18:12:40 +00:00
Krille Fear d43d4bedee Merge branch 'soru/fix-ssss-cache' into 'main'
fix: A few ssss fixes

See merge request famedly/famedlysdk!668
2021-03-09 18:12:30 +00:00
Sorunome 6d171542af
feat: Escape @room in the reply fallback when replying 2021-03-09 18:29:13 +01:00
Sorunome c76dc0daa2
chore: Reduce needed database accessess 2021-03-09 18:28:58 +01:00
Christian Pauly 1f8285c3e7 refactor: Room states 2021-03-09 17:28:55 +00:00
Sorunome 7ef288ec91
fix: A few ssss fixes 2021-03-09 18:28:42 +01:00
Krille Fear 44ca96e544 refactor: Update pedantic
This enforces to NOT use curly braces in Strings where not needed
and not await non-future variables.
2021-03-09 17:28:04 +00:00
Krille Fear 0d8bddf708 Merge branch 'soru/fallback-keys' into 'main'
feat: Add fallback keys support

Closes #136

See merge request famedly/famedlysdk!653
2021-03-03 07:38:32 +00:00
Sorunome 498c7825a5
feat: Add fallback keys support 2021-03-02 16:17:32 +01:00
Christian Pauly 5c35799e18 refactor: Request user 2021-03-01 10:32:04 +01:00
Sorunome 885141968c Merge branch 'krille/refactor-event-update' into 'main'
refactor: Deprecate eventType in EventUpdate

See merge request famedly/famedlysdk!661
2021-02-26 16:11:57 +00:00
Sorunome 5431056c1c Merge branch 'krille/implement-canrequesthistory' into 'main'
feat: Implement can request history calculation

See merge request famedly/famedlysdk!659
2021-02-26 16:09:17 +00:00
Christian Pauly b8659213ae feat: Implement can request history calculation 2021-02-26 13:48:29 +01:00
Christian Pauly c9d3c327f6 refactor: Deprecate eventType in EventUpdate 2021-02-26 13:06:02 +01:00
Christian Pauly 29d0e673e0 fix: Sync error handling 2021-02-24 09:17:41 +01:00
Sorunome e7c8e754a1
chore: Update matrix scheme parsing to match updated MSC 2021-02-23 16:34:43 +01:00
Christian Pauly 72a7bc1637 feat: Implement upload sync filters 2021-02-18 14:03:58 +01:00
Christian Pauly c7f78bdaf5 fix: Dont catch sync errors 2021-02-18 13:01:13 +01:00
Nicolas Werner ac1ad1b897 fix: escape attributes in markdown less aggressively 2021-02-17 22:56:31 +01:00
Sorunome 681b27e269
fix: Don't allow transitive trust unless it is for ouself 2021-02-15 12:19:05 +01:00
Sorunome 34b15e45fc
fix: Better logic when to auto-trigger self-sign 2021-02-13 15:03:10 +01:00
Sorunome 6c2fc1679a
feat: Auto-selfsign and auto-cache when opening ssss keys 2021-02-13 14:55:09 +01:00
Krille Fear fb5a0bc6a2 Merge branch 'soru/membership-null' into 'main'
fix: Make defaults catch if constructor is null

See merge request famedly/famedlysdk!647
2021-02-13 10:38:49 +00:00
Christian Pauly fc8563849a feat: Custom Exception and return type for Change Homeserver 2021-02-13 09:08:56 +01:00
Sorunome f08dabaf03
fix: Make defaults catch if constructor is null 2021-02-11 12:09:44 +01:00
Marcus ff04b1cce5 Merge branch 'krille/uia-cancel' into 'main'
feat: Implement cancel uiarequest

See merge request famedly/famedlysdk!644
2021-02-10 12:46:10 +00:00
Krille Fear 6d7ab8e1d4 Merge branch 'soru/cancel-broadcast-verify' into 'main'
fix: Allow to broadcast cancels during key verification

See merge request famedly/famedlysdk!643
2021-02-10 12:44:21 +00:00
Christian Pauly fd05f642d8 feat: Implement cancel uiarequest 2021-02-10 13:41:09 +01:00
Sorunome 2d70360a8d
fix: Better detection if x-signing and megolm backup is enabled 2021-02-10 13:35:45 +01:00
Sorunome d07b663866
fix: Allow to broadcast cancels during key verification 2021-02-10 13:05:09 +01:00
Sorunome fcb8d48bd7
feat: Add command parser 2021-02-09 18:19:38 +01:00
Christian Pauly d362d6db23 fix: Request history on limited timeline 2021-02-09 15:02:48 +01:00
Krille Fear 1154bc3606 Merge branch 'soru/replay-to-device' into 'main'
fix: Add to_device queue to prevent olm session corruptions

Closes #141

See merge request famedly/famedlysdk!640
2021-02-09 08:24:21 +00:00
Sorunome d373a06aa2
fix: Add to_device queue to prevent olm session corruptions 2021-02-08 14:57:19 +01:00
Christian Pauly 9faf07e31a refactor: New start direct chat method in client 2021-02-06 10:48:36 +01:00
Christian Pauly bd4c4a6131 chore: Add more bootstrap logging 2021-02-04 15:33:27 +01:00
Sorunome 0462863ce6
fix: Cache ssss keys if using an existing ssss in bootstrapping 2021-02-03 14:47:42 +01:00
Sorunome 8a4af0c0ea
chore: add keyOrPassphrase to cross-signing selfVerify 2021-02-03 13:02:38 +01:00
Sorunome 0c4db25d05
feat: Add a way to string-encode a recovery key 2021-02-03 11:34:56 +01:00
Sorunome 650484c306 Merge branch 'krille/olmerrorhandling' into 'main'
change: Olm exception handling

See merge request famedly/famedlysdk!633
2021-02-03 10:09:43 +00:00
Krille Fear 1236e0bec2 Merge branch 'krille/bootstraptrycatch' into 'main'
chore: More try catch in bootstrap

See merge request famedly/famedlysdk!630
2021-02-03 10:08:37 +00:00
Krille Fear a492fc8f96 Merge branch 'krille/updateuserdevicekeys' into 'main'
fix: Dont update user device keys if logged out

See merge request famedly/famedlysdk!628
2021-02-03 10:08:31 +00:00
Krille Fear f58da0c33f Merge branch 'krille/invite-direct-chat' into 'main'
chore: Determine invites as direct chats too

Closes app#1110

See merge request famedly/famedlysdk!624
2021-02-03 10:08:24 +00:00
Christian Pauly 9fac03639e change: Olm exception handling 2021-02-03 11:01:01 +01:00
Sorunome 21a5854fbf
fix: Attempt event decryption on fetching replied events 2021-02-02 12:51:43 +01:00
Christian Pauly ad39e3af25 chore: More try catch in bootstrap 2021-01-29 11:18:18 +01:00
Christian Pauly fefa140758 fix: Dont update user device keys if logged out 2021-01-27 11:15:41 +01:00
Christian Pauly d16c9eaf32 fix: Trailing slash homeserver from wellknown 2021-01-27 09:41:18 +01:00
Christian Pauly 94e3e5f681 chore: Determine invites as direct chats too 2021-01-26 14:04:55 +01:00
Christian Pauly 7b29563caa change: requestHistoryOnLimitedTimeline by default false 2021-01-21 12:17:30 +01:00
Krille Fear c701268d71 feat: Do well known by default in check homeserver 2021-01-20 13:21:51 +00:00
Sorunome a35266f1e4
feat: Replay last sent olm message on olm session recovery from other device 2021-01-20 12:50:52 +01:00
Sorunome 44a1bcfd57
fix: Accidental pills in URLs 2021-01-20 12:02:40 +01:00
Krille Fear 8de72c869a Merge branch 'soru/fix-emotes-msc-compliance' into 'main'
fix: Emotes MSC compliance

See merge request famedly/famedlysdk!619
2021-01-20 09:42:26 +00:00
Sorunome 70a4dad1c3
fix: Emotes MSC compliance 2021-01-20 10:36:06 +01:00
Christian Pauly 4d1134a2db fix: Logout after failed init 2021-01-18 22:44:01 +01:00
Sorunome 4597ea3445 Merge branch 'krille/deprecate-sendername' into 'main'
change: Deprecate senderName

Closes app#1065

See merge request famedly/famedlysdk!615
2021-01-15 14:45:43 +00:00
Christian Pauly 03e17f890e change: Deprecate senderName 2021-01-15 14:24:30 +01:00
Sorunome 9d6005ca2a
fix: Smoothen up sending to rooms with extremely many devices 2021-01-14 18:47:51 +01:00
Sorunome 88f8a57863
fix: Correctly generate reply fallbacks 2021-01-14 13:51:17 +01:00
Krille Fear 347a1ee6e0 Merge branch 'krille/hide-verification' into 'main'
fix: Hide verification timeline events in lastEvent

Closes app#1059

See merge request famedly/famedlysdk!612
2021-01-14 12:21:15 +00:00