Commit Graph

830 Commits

Author SHA1 Message Date
Ivan Enderlin
51e6e80b3b feat(sdk): SlidingSyncMode has richer variants
feat(sdk): `SlidingSyncMode` has richer variants
2023-05-17 17:10:26 +02:00
Ivan Enderlin
1a60983e8f feat(ffi): Add SlidingSyncListBuilder::sync_mode_*.
This patch replaces `sync_mode` on `SlidingSyncListBuilder` by
`sync_mode_selective`, `sync_mode_paging` and `sync_mode_growing`, which
removes the need to use `SlidingSyncMode` directly.

This patch also removes `batch_size`, `room_limit` and `no_room_limit`
as it's now arguments of `sync_mode_paging` and `sync_mode_growing`.
2023-05-17 15:18:51 +02:00
Ivan Enderlin
c618b03f12 feat(sdk): SlidingSync::add_list has an immediate effect
feat(sdk): `SlidingSync::add_list` has an immediate effect
2023-05-17 13:56:35 +02:00
Ivan Enderlin
39aba1dd95 fix(sdk): Rename SlidingSyncSubscribeResult to SlidingSyncAddTimelineListenerResult. 2023-05-17 13:13:17 +02:00
Ivan Enderlin
b85b585bd7 feat(ffi): Make some methods async.
`SlidingSync::subscribe`, `::unsubscribe` and `::add_list` are
now async. `subscribe` has been renamed to `subscribe_to_room` and
`unsubscribe` to `unsubscribe_from_room`.

`SlidingSyncRoom::subscribe_and_add_timeline_listener` has
been removed, and replaced by a new `::subscribe_to_room` and
`::unsubscribe_from_room` methods (the `::add_timeline_listener` method
already exists).

`TaskHandle::finalizer` is no longer necessary, thus this code has been
cleaned up.
2023-05-17 13:13:17 +02:00
Ivan Enderlin
63257e6226 fix(sdk): Remove room unsubscriptions once the server has received them
fix(sdk): Remove room unsubscriptions once the server has received them
2023-05-17 11:59:16 +02:00
Damir Jelić
1510576ce1 Expose the git description and commit hash in the crypto-ffi bindings
Co-authored-by: Jonas Platte <jplatte@matrix.org>
2023-05-17 09:31:52 +00:00
Ivan Enderlin
501b990248 chore(sdk): Rename SlidingSync::unsubscribe_to_room to …_from_room. 2023-05-17 11:29:26 +02:00
Ivan Enderlin
9b7122768f chore(sdk): Rename SlidingSync room subscriptions and unsubscriptions API.
Notably, this patch renames `SlidingSync::subscribe` and `::unsubscribe`
to `subscribe_to_room` and `unsubscribe_to_room`.
2023-05-17 10:01:55 +02:00
Jonas Platte
cfc8effa66 Move timeline API into a new crate
… aimed at interactive user interfaces.
2023-05-17 09:58:31 +02:00
Jonas Platte
c796302a98 ffi: Fix typo in variant name 2023-05-16 11:32:15 +02:00
Richard van der Hoff
6c0afae0f4 Merge remote-tracking branch 'origin/main' into release-matrix-sdk-crypto-js-0.1.0-alpha.9 2023-05-15 18:59:52 +01:00
Richard van der Hoff
923d425585 crypto-js: expose a constructor for SigningKeysUploadRequest (#1925)
... to help with testing.
2023-05-15 18:58:38 +01:00
Richard van der Hoff
89bf7f27f3 fix typo 2023-05-15 18:42:58 +01:00
Benjamin Bouvier
58dbe1e252 feat: add add_cached_list to SlidingSyncBuilder and SlidingSync (#1876)
This has slightly drifted from the initial design I thought about in the issue.

Instead of having `build()` be fallible and mutably borrow some substate (namely `BTreeMap<OwnedRoomId, SlidingSyncRoom>`) from `SlidingSync` (that may or may not already exist), I've introduced a new `add_cached_list` method on `SlidingSync` and `SlidingSyncBuilder`. This method hides all the underlying machinery, and injects the room data read from the list cache into the sliding sync room map.

In particular, with these changes:

- any list added with `add_list` **won't** be loaded from/written to the cache storage,
- any list added with `add_cached_list` will be cached, and an attempt to reload it from the cache will be done during this call (hence `async` + `Result`).
- `SlidingSyncBuilder::build()` now only fetches the `SlidingSync` data from the cache (assuming the storage key has been defined), not that of the lists anymore.

Fixes #1737.

Signed-off-by: Benjamin Bouvier <public@benj.me>
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2023-05-15 16:17:45 +00:00
Richard van der Hoff
3049328078 matrix-sdk-crypto-js v0.1.0-alpha.9 2023-05-15 15:07:14 +01:00
Richard van der Hoff
3df473a56d update CHANGELOG 2023-05-15 15:07:03 +01:00
Richard van der Hoff
18954a6ba5 crypto-js: fix body of SignatureUploadRequest (#1917)
Currently, the `body` of a `SignatureUploadRequest` includes a spurious
`signed_keys: {...}` property in which the actual content is wrapped. Fix that.
2023-05-15 15:02:01 +01:00
Chris Smith
3449dad89b feat(bindings): expose getting member by id
Allow for retrieving a single room member by their ID.
2023-05-15 15:26:45 +02:00
Stefan Ceriu
593c99d377 ffi: add method for getting the build time git short sha value (#1909) 2023-05-11 18:32:09 +02:00
Ivan Enderlin
f23fd1809b Merge branch 'main' into feat-sliding-sync-room 2023-05-11 17:47:08 +02:00
Benjamin Bouvier
149950cc29 sliding sync: Use RangeInclusive<u32> instead of raw start/end UInt values (#1877)
* chore: use RangeInclusive instead of raw start/end integers for ranges in sliding sync
* chore: have timeline_limit use a u32 instead of a Ruma UInt
* chore: Remove all the `Into<u32>` generics on timeline_limit and ranges APIs
* chore: introduce a `Bound` type alias for u32

Signed-off-by: Benjamin Bouvier <public@benj.me>
2023-05-11 14:27:46 +02:00
Jonas Platte
dab4cdd863 ffi: Add MediaSource::{from_json, to_json} 2023-05-11 11:06:06 +00:00
Mauro Romito
18971e8b11 fix for notification item to get sender in invited rooms 2023-05-11 10:49:42 +02:00
Ivan Enderlin
68337d58f7 chore(ffi): Update according to last commit. 2023-05-11 09:18:43 +02:00
Ivan Enderlin
75f3bbcf63 chore(ffi): Update according to last commit. 2023-05-10 15:57:43 +02:00
Ivan Enderlin
e2af4ccfe6 fix(ffi): Fix types. 2023-05-10 14:01:29 +02:00
Ivan Enderlin
cb2bb84d88 fix(sdk): Remove SlidingSyncRoom::is_loading_more.
First, this field is not used by ElementX.

Second, this field is never updated, so it always returns `false`, which
seems… buggy and useless.
2023-05-10 09:34:38 +02:00
Mauro
6eeee8ee53 ffi: Expose EventTimelineItem::read_receipts and the NotificationItem#room_canonical_alias 2023-05-09 15:26:07 +00:00
Jonas Platte
2de786c516 Rename fetch_event_details to fetch_details_for_event 2023-05-09 17:25:39 +02:00
Benjamin Bouvier
1aff90a96f chore: fix doc comments in code and READMEs
Signed-off-by: Benjamin Bouvier <public@benj.me>
2023-05-09 10:21:48 +02:00
Alfonso Grillo
7ac6ebfb7f Add invited and joined counts 2023-05-08 18:12:12 +02:00
Ivan Enderlin
bfcedcd49c feat(sdk): SlidingSync::*subscribe will cancel in-flight requests.
`SlidingSync::subscribe` and `SlidingSync::unsubscribe` will cancel in-
flight requests, i.e. the `SlidingSyncInternalMessage::ContinueSyncLoop`
will be sent in the internal channel, just like what `SlidingSyncList`s
already do when a parameter is changed.
2023-05-08 16:44:49 +02:00
Ivan Enderlin
281944696a Merge branch 'main' into feat-sdk-sliding-sync-cancellation-token 2023-05-08 14:11:20 +02:00
Kévin Commaille
f92c3649e9 ffi: Use SQLite state store
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2023-05-08 12:11:10 +02:00
Ivan Enderlin
0dab71e94b fix(sdk): Fix previous merge. 2023-05-08 10:16:03 +02:00
Ivan Enderlin
cdb992e3b2 Merge branch 'main' into feat-sdk-sliding-sync-cancellation-token 2023-05-08 09:55:02 +02:00
Jonas Platte
88580d95bf Consistently use Ruma's Owned*Id types
… for simplicity; instead of `Arc<*Id>`.
2023-05-05 12:34:15 +02:00
Mauro
b9cc0b5249 ffi: Add Client::get_notification_item
… and remove NotificationService.
2023-05-05 11:27:56 +02:00
Marcel
211690ab44 Add missing const to make epilogue.js work in ECMAScript Module compatibility mode
Signed-off-by: Marcel Radzio <mtrnord [AT] nordgedanken.dev>
2023-05-05 10:17:36 +02:00
Benjamin Bouvier
e05f8001cf Mandate a Client when creating a SlidingSyncBuilder
Signed-off-by: Benjamin Bouvier <public@benj.me>
2023-05-04 15:42:35 +02:00
Benjamin Bouvier
fd480b3a8d review: remove useless Result in FFI layer too (thanks hywan!)
Signed-off-by: Benjamin Bouvier <public@benj.me>
2023-05-04 15:42:35 +02:00
Benjamin Bouvier
0962b03a75 Get rid of the name() function builders?
Signed-off-by: Benjamin Bouvier <public@benj.me>
2023-05-04 15:42:35 +02:00
Benjamin Bouvier
3e811d5246 Make SlidingSyncListBuilder::build infallible by mandating a name in ctor
Signed-off-by: Benjamin Bouvier <public@benj.me>
2023-05-04 15:42:35 +02:00
Ivan Enderlin
769fd9cad6 Merge pull request #1844 from matrix-org/rav/signing_keys_upload_response
crypto-js: extend `mark_request_as_sent` to accept SigningKeysUploadResponses
2023-05-04 10:34:27 +02:00
Mauro
709bea839e ffi: Expose active_members_count 2023-05-04 10:31:36 +02:00
Mauro
a0cebfcba2 ffi: Fix is_noisy calculation 2023-05-04 09:13:33 +02:00
Richard van der Hoff
5c9fdc51f6 fix lint 2023-05-03 14:36:39 +01:00
Richard van der Hoff
c1c1b1047d Apply suggestions from code review
Co-authored-by: Ivan Enderlin <ivan@mnt.io>
Co-authored-by: Damir Jelić <poljar@termina.org.uk>
2023-05-03 14:16:56 +01:00
Ivan Enderlin
d703380f85 chore(ffi): Re-order methods. 2023-05-03 14:03:12 +02:00