Ivan Enderlin
3d9dffa3b7
chore(base): Remove unused imports.
2023-12-14 14:18:56 +01:00
Ivan Enderlin
a46bf76d74
test(base): Improve test_media_content.
...
This patch improves `test_media_content` to ensure that, in case of
multiple medias, only the expected ones are removed. Previously, the
test wasn't testing _other_ medias that should be kept in case of
removals.
This patch continues to improve `test_media_content` to ensure that the
content of the media are the expected ones.
Finally, this patch updates the `MemoryStore` implementation to make
tests happy.
2023-12-14 14:15:01 +01:00
Ivan Enderlin
326935db63
feat(base): Correct implementations for MemoryStore media removal.
...
This patch rewrites `MemoryStore::add_media_content`,
`::get_media_content`, `::remove_media_content` and
`::remove_media_content_for_uri` to (i) work on `mxc://` URI instead
of “unique key”, and (ii) to handle removal correctly thanks to the new
`RingBuffer::remove` method.
2023-12-14 13:54:12 +01:00
Ivan Enderlin
416bc8b0e4
feat(base): Implement Media::uri.
...
This new method returns the `MxcUri` associated to the `Media`.
2023-12-14 13:53:23 +01:00
Ivan Enderlin
edd113a17c
feat(common): Implement RingBuffer::remove.
2023-12-14 13:28:17 +01:00
Ivan Enderlin
cdb3449ce2
test(sdk): Test that Media::get_media_content with caching works.
2023-12-14 12:11:24 +01:00
Ivan Enderlin
c5b11fc2f8
feat(sdk): Simplify code from Media::get_media_content.
...
If `use_cache` is true and the cache exists, let's return everything in
one go instead of declaring a `content` variable. It makes the code
easier to read and to understand.
2023-12-14 12:10:08 +01:00
Ivan Enderlin
2ad6acb930
doc(common): Add documentation for RingBuffer::drain.
2023-12-14 12:07:08 +01:00
Ivan Enderlin
dac779f4fc
test(base): Re-implement a super basic media cache for MemoryStore.
...
This is a rather over simplistic media cache implementation for the
`MemoryStore`.
It's based on a `RingBuffer` of size 20.
`remove_media_content` pops all medias until the correct one is met (if
it exists). `remove_media_content_for_uri` removes all medias, it
ignores the URI.
2023-12-14 12:04:58 +01:00
Ivan Enderlin
b314da37b8
feat(ffi): Timeline::send_image and send_video takes an optional thumbnail_url
...
feat(ffi): `Timeline::send_image` and `send_video` takes an optional `thumbnail_url`
2023-12-14 10:48:16 +01:00
Ivan Enderlin
02ba6c0dbe
feat(ffi): Client::*media* are now async
...
feat(ffi): `Client::*media*` are now async
2023-12-14 09:14:39 +01:00
Ivan Enderlin
22d9c62262
feat(ffi): Timeline::send_image and send_video takes an optional thumbnail_url.
...
This patch updates `Timeline::send_image` and `Timeline::send_video` so
that `thumbnail_url` is now an `Option<String>`.
The idea is to allow sending an image or a video without a thumbnail.
2023-12-13 17:07:03 +01:00
Ivan Enderlin
18b6387a7a
Merge pull request #2935 from matrix-org/rav/fix_nonmonotonic_panic
...
Configure `Instant` wasm polyfill to use monotonic time
2023-12-13 15:57:32 +01:00
Ivan Enderlin
c5ddba2e13
feat(ffi): Client::*media* are now async.
...
This patch removes `RUNTIME.block_on` inside `Client::get_media_file`,
`::upload_media`, `::get_media_content` and `::get_media_thumbnail`, and
makes those methods async.
2023-12-13 15:33:01 +01:00
Richard van der Hoff
5701cea51e
Configure Instant wasm polyfill to use monotonic time
...
With the `inaccurate` feature, this polyfill uses `Date.now()` to emulate
`Instant`, which is not monotonic, causing problems like
https://github.com/element-hq/element-web/issues/26416 .
2023-12-13 12:08:54 +00:00
Doug
d764fca7da
xtask: Move all the Swift files found
...
… and fix build swift errors.
- The XCFramework was being built with dylibs which aren't supported on iOS
- The tests build was attempting to generate uniffi from a moved file
2023-12-12 16:51:49 +01:00
Jonas Platte
3b7f9f7361
Reapply "bindings: Use new uniffi-bindgen build mode"
...
This reverts commit 0d24bcf6e5 .
2023-12-12 16:51:49 +01:00
Doug
73770b78bb
room: Add test for unban_user.
2023-12-12 16:13:09 +01:00
Doug
7cffc34984
ffi: Support banning, unbanning and kicking users.
2023-12-12 16:13:09 +01:00
Benjamin Bouvier
c4ef967523
dx: tweak debugging of user/device pairs missing a session
2023-12-11 17:11:11 +01:00
Kévin Commaille
f0b378179e
matrix auth: Await save_session_callback
...
Otherwise the future will not run.
Changes the corresponding test to fail with the old behavior.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-12-11 16:54:53 +01:00
Benoit Marty
1f52aca210
Fix typo in doc.
2023-12-11 12:13:05 +01:00
Kévin Commaille
74091de8ef
sdk: Make sure "testing" feature is enabled for integration tests
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-12-11 11:53:25 +01:00
Mauro
c707e1f17e
feat(bindings): expose a function to send private read receipts ( #2906 )
2023-12-11 09:29:06 +00:00
Benjamin Bouvier
5ab69f7400
ffi: add emoji indices in the session verification data + use decimals as a fallback
2023-12-08 14:48:48 +01:00
Jonas Platte
e652069896
sdk: Use crates.io release of mas-oidc-client
2023-12-07 17:34:36 +01:00
Benjamin Bouvier
5337c9d9ea
refactoring: make it clear that notifications aren't stored in the state store
...
`notifications` were stored in the `StateChanges` struct, which made me think that they're then persisted in the database. It's not the case, they
were just stored there by convenience. This commit changes it to a parameter that's passed, as it's not too invasive and clearer that this is only
transient data.
2023-12-07 16:56:18 +01:00
Benjamin Bouvier
9fd52e5df7
timeline: document event_filter better
2023-12-07 10:35:42 +01:00
Benjamin Bouvier
4ab79a4085
timeline: add the room version in the event_filter parameters
2023-12-07 10:35:42 +01:00
Benjamin Bouvier
a132c0a885
read receipts: apply a default event filter only for events that get rendered
2023-12-07 10:35:42 +01:00
Benjamin Bouvier
5081802177
room: try restoring from a key backup during backpagination too
2023-12-05 16:53:06 +01:00
Stefan Ceriu
736188811f
ffi: expose the call member state event type for clients to check if users can join calls
2023-12-05 15:51:28 +01:00
Benoit Marty
1337fdf0b8
ffi: Expose is_invite_for_me_enabled and set_invite_for_me_enabled in notification settings
2023-12-04 17:04:19 +01:00
Ivan Enderlin
0573137835
Merge pull request #2902 from matrix-org/rav/outgoing_key_requests_switch
...
Crypto: add new methods for turning off room key requests
2023-12-04 15:12:33 +01:00
Ivan Enderlin
21ce2b07a7
Merge pull request #2904 from matrix-org/jme/add-typing-notice-bindings
...
Add FFI bindgings for `Room.typing_notice()`
2023-12-04 15:09:46 +01:00
Richard van der Hoff
6451a9dffe
rename toggle -> set
2023-12-04 12:53:02 +00:00
Kévin Commaille
a6af31984a
Assert that the stream is pending
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-12-04 13:30:43 +01:00
Kévin Commaille
2de45bcb51
notification settings: Do not expose NotificationSettings::new in the public API
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-12-04 13:30:43 +01:00
Kévin Commaille
7bdc1448bd
notification settings: Drop event handler only when last instance is dropped
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-12-04 13:30:43 +01:00
Kévin Commaille
511c44c588
Add test for NotificationSettings::subscribe_to_changes
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-12-04 13:30:43 +01:00
Kévin Commaille
a915900580
notification settings: Allow to subscribe to changes
...
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-12-04 13:30:43 +01:00
Kévin Commaille
e12f6fcbb7
notification settings: Accept any type that implements AsRef<str> as rule_id
...
Simplifies the use of this API with the Predefined{*}RuleId Ruma types.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr >
2023-12-04 13:30:43 +01:00
Jorge Martín
72dfd3d1fd
Add FFI bindgings for Room.typing_notice()
2023-12-01 16:19:32 +01:00
Richard van der Hoff
a6c206118d
changelog
2023-12-01 12:50:43 +00:00
Richard van der Hoff
2536373546
Add new methods for turning off room key requests
2023-12-01 12:47:44 +00:00
Jorge Martín
045d94ab4b
Rename message inside an error, since it clashes with Kotlin's default message property in exceptions
2023-12-01 12:07:40 +01:00
Benjamin Bouvier
d8c02d7e55
timeline builder: tweak comments
2023-12-01 11:05:53 +01:00
Benjamin Bouvier
b20313c492
read receipts: rename ReadReceipts fields
...
The "read_receipts" suffix isn't useful since we're looking at the fields of `ReadReceipts` already.
2023-12-01 11:05:53 +01:00
Benjamin Bouvier
c3ea2c3736
Format with rustfmt nightly.
2023-12-01 11:05:53 +01:00
Benjamin Bouvier
2c1377b2b5
read receipts: a few function renamings and add getter/setter for receipts on events
2023-12-01 11:05:53 +01:00