Commit Graph

1856 Commits

Author SHA1 Message Date
The one with the braid 4ba6e25689
fix: dart:io import in matrix_sdk_database
- removes `Directory` field in high-level `MatrixSdkDatabase`
- migrates `Directory fileStoragePath` to `Uri fileStorageLocation`
- makes file operations in `MatrixSdkDatabase` conditional on
  `dart.libraries.js_util`
- implements a tiny stub of the file operations used in `MatrixSdkDatabase`

It seems like the Flutter tool can compile despite these imports. Sadly
the Dart standalone dart2js compiler doesn't reach there. While
refactorying the code, I decided it's likely cleaner to have a `Uri` as
storage location provider than using some fake directory or String as
relacement.

The advantage of a `Uri` at this place is the explicit `Uri.directory`
constructor available to ensure type and encoding safe directory
locations supporting both Windows and *nix.

Additionally, admitted, that's an edge-case, one could even
easily extend the use of a `Uri` based descriptor to support future
storage location accesses (e.g. IPFS or custom schemes for e.g. local
web browser based file system APIs). Using a `Uri`, one would only need
to override the three methods making use of the `fileStorageLocation`
property to handle different Uri schemes too.

Signed-off-by: The one with the braid <info@braid.business>
2024-04-12 08:50:44 +02:00
Krille 70eb3e3431
docs: Add documentation 2024-04-11 15:36:30 +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
Karthikeyan S 883785db86
feat: add sendAudioEvent and isVoiceMessage method to msc extensions 2024-04-11 14:12:54 +05:30
td f7a4518c5f
fix: userMediaConstraints 2024-04-09 00:39:23 +05:30
Krille 0e867402bc
chore: Sort archive by last activity 2024-03-26 13:30:06 +01:00
td 981c3ea94d
chore: check message size before fake sync 2024-03-25 19:31:01 +05:30
td e08cf742e6
chore: add api lite readme 2024-03-25 17:46:59 +05:30
td cd94cf62a8
chore: merge api_lite and dart sdk 2024-03-25 17:22:05 +05:30
td 691190f07a
Merge remote-tracking branch 'api/td/justUseMV' into td/api 2024-03-22 21:41:45 +05:30
td b7befd781e
chore: git mv 2024-03-22 21:24:21 +05:30
Krille e266ef7312
refactor: Switch to MatrixSdkDatabase as suggested database and deprecate other ones 2024-03-22 16:05:08 +01:00
Krille 1cb7e8f9ba
fix: Typo in upload key json object creates invalid objects 2024-03-21 08:22:15 +01:00
Krille 2456a64f37
refactor: Use dart records for checkHomeserver method
This makes use of dart
records to return three
different values for one
method. This makes the
special class no longer
necessary just for
returning data.
2024-03-18 15:20:31 +01:00
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
Krille 0ae71fa843
feat: Add commands /ignore and /unignore 2024-03-15 10:13:11 +01:00
Krille 3d09219269
feat: Offers client.ensureNotSoftLoggedOut() to fix using client with stopped sync loop
This also makes sure that
the access token is
refreshed when calling
client.getEventByPushNotification()
which is porbably the most
common case for a client
with a stopped sync loop
doing network requests.
2024-03-14 14:49:47 +01:00
td a60a0cad69
fix: throw EventTooLarge on exceeding max fed PDU 2024-03-14 01:18:10 +05:30
td 1e90fcee93
chore: add noice/echo cancelling flags to getUserMedia 2024-03-11 10:45:43 +05:30
Krille d049e667ee
refactor: BREAKING Allow calling init when in soft logout state and fix some bugs
This fixes several problems with current soft logout
handling, as it now stores the refresh token correct and
only refreshs it 1 minute in advance instead of 5
minutes.
2024-03-07 15:49:23 +01:00
Romain GUILLOT 22df8b39a8
feat: add fromLocalStoreOnly to Event.downloadAndDecryptAttachment
Signed-off-by: Romain GUILLOT <romain.guillot@arche-mc2.fr>
2024-03-06 12:13:07 +01:00
Nicolas Werner f6fa9df2c5
fix: archived room state store logic
This was implicitly relying to the timestamp of state events getting
compared in the setState function. Fix this by using the helper
functions already used for invite and join rooms.
2024-03-04 19:31:35 +01:00
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
Nicolas Werner 6f82e92f2c
fix: properly overwrite loaded state for partial loaded rooms
Otherwise invites, which get converted to normal rooms, might still have
old member events set in memory, that don't match the current state.
2024-03-04 17:52:06 +01:00
Nicolas Werner 5ffa99d994
fix: Do not assume a missing timestamp means "now"
This causes issues with state handling as we prefer the newer event. It
also has knock-on effects in other places. Instead set such events to
have an obviously invalid timestamp, which makes issues easier to
identify.

This may break invites showing a timestamp or the timestamps for just
sent events, if you rely on the timestamp getting set to "now".
2024-03-04 17:49:50 +01:00
Patrick Hettich 81f33951bb
Merge branch 'main' into pat/archive-room-names 2024-03-01 12:03:00 +01:00
Krille 4b44af0eb8
chore: pass refreshToken to uiaLogin 2024-02-29 14:10:48 +01:00
Patrick Hettich 78c610ab92
Merge branch 'main' into pat/archive-room-names 2024-02-29 12:03:45 +01:00
Patrick Hettich 18ce3607c6
fix: removed prev_sender for empty chats 2024-02-29 11:57:32 +01:00
Krille 1b93471d64
refactor: Deprecations after dart upgrade 2024-02-28 12:37:54 +01:00
Krille 65c56f3630
feat: Store accesstokenExpiresIn and call softlogout 5 minutes before 2024-02-23 13:06:38 +01:00
Krille 38b1eb75e5
feat: Implement handling soft logout 2024-02-23 13:06:38 +01:00
Gabby Gurdin 4a4eb53dad
fix: convert boxNames to List in clear function when creating transaction 2024-02-23 12:53:37 +01:00
Karthikeyan S b82d8bff0b
feat: specify history_visibility when creating group chat 2024-02-22 15:22:10 +05:30
Patrick Hettich 9b9e311010
fix: updated membership-leave for archived direct chats 2024-02-21 08:16:10 +01:00
td 3fba9a55b3
chore: remove state events both in imp and preview events list 2024-02-20 06:54:11 +05:30
Patrick Hettich 77561ced07
fix: Use name of other participant on archived rooms 2024-02-16 11:47:26 +01:00
td aa77812e8e
fix: ignore expired calls rather than killing them 2024-02-14 03:27:09 +05:30
td c2a2e419cb
fix: group calls terminator having sync glares
this will be removed with the new calls, we should ignore expired calls rather than cleaning up unless you have complete ownership of the event
2024-02-13 11:34:28 +01:00
Krille bef9a79f82
chore: Use some call events as last events 2024-01-31 13:48:19 +01:00
The one with the braid 5dc95dea3f
fix: nested void function in encryption helper
- remove the accidentally nested void in the ffiInit implementation

Signed-off-by: The one with the braid <info@braid.business>
2024-01-31 13:29:46 +01:00
Krille d94e6d2ac8
fix: Skip invalid keys which got corrupted in database 2024-01-26 09:41:55 +01:00
The one with the braid 1adbac31ae
feat: add SQfLite encryption helper
This patch introduces a helper class for SQfLite encryption related operations.

Most matrix clients will encrypt their sqlite database at rest. Since
this is a quite fragmented task using the Flutter sqlite ecosystem, this
helper aims to simplify some more complex operations.

It in particular helps with the following tasks :

- loading the correct shared objects / dynamic libraries for sqlcipher
- check whether a database is encrypted
- migrate an unencrypted SQLite database to SQLCipher
- apply the cipher to a database while opening it and ensure it loads

This code is not exactly matrix related, though presumably any matrix
client will use parts of it.

Possible regressions :

- `package:sqlite3` became a direct dependency. As of now it already was a
  transitive dependency of the SDK itself.

Signed-off-by: The one with the braid <info@braid.business>
2024-01-24 10:43:46 +01:00
krille-chan 48ba7556b2
fix: Transactions on web by doing them in the same way as on io
This refactors the transaction
workaround with
"zone transactions" and
abstracts them in a mixin. Then
it just uses this mixin in the
HiveDatabase and the
sqflite_box and also applies
them on indexedDB to
fix transactions on web.
2024-01-22 15:04:29 +01:00
Krille 534a2a4ff1
fix: Correctly null cache in transactions for indexeddb
This is similar to the bug
in the sqflite but now for
the indexeddb.
2024-01-22 14:53:42 +01:00
krille-chan eef79aad2b
refactor: Improve getTimeline senders
This creates a set before
requesting users from the
database. This prevents
doing the same check for
the same user multiple
times and also prevents
concurrent modifications
of the event list.
2024-01-22 13:02:43 +01:00
Krille 4906ae02cf
feat: Add missing localizations for key verification messages 2024-01-22 12:49:27 +01:00