-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ui): Implement Notification
API
#2023
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #2023 +/- ##
==========================================
+ Coverage 75.91% 75.96% +0.05%
==========================================
Files 152 153 +1
Lines 16725 16749 +24
==========================================
+ Hits 12696 12723 +27
+ Misses 4029 4026 -3
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks generally good. Some minors stuff to update. We need to test this for real to see if it behaves as expected.
NotificationApi
Notification
1dbddde
to
9decb06
Compare
Notification
Notification
API
…evice events Signed-off-by: Benjamin Bouvier <public@benj.me>
Signed-off-by: Benjamin Bouvier <public@benj.me>
…nsion Signed-off-by: Benjamin Bouvier <public@benj.me>
… API testing Signed-off-by: Benjamin Bouvier <public@benj.me>
Signed-off-by: Benjamin Bouvier <public@benj.me>
Signed-off-by: Benjamin Bouvier <public@benj.me>
Signed-off-by: Benjamin Bouvier <public@benj.me>
Signed-off-by: Benjamin Bouvier <public@benj.me>
Signed-off-by: Benjamin Bouvier <public@benj.me>
Too cute? :) Signed-off-by: Benjamin Bouvier <public@benj.me>
…loop terminates Signed-off-by: Benjamin Bouvier <public@benj.me>
…n sync loop This makes sure that we `sync()` the notification sync loop only once. Signed-off-by: Benjamin Bouvier <public@benj.me>
Signed-off-by: Benjamin Bouvier <public@benj.me>
5131501
to
b64781b
Compare
Signed-off-by: Benjamin Bouvier <public@benj.me>
Signed-off-by: Benjamin Bouvier <public@benj.me>
Signed-off-by: Benjamin Bouvier <public@benj.me>
The macro used in the
|
Signed-off-by: Benjamin Bouvier <public@benj.me>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm all good, I just want to check again the RoomList
modification, esp. on the test suite :-).
/// | ||
/// See the module's documentation for more details. | ||
#[derive(Clone)] | ||
pub struct NotificationSync { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about E2EESync
or EncryptionSync
? Because as far as I understand it, it has very little to do with notifications so far, except the lock maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I've also discussed with other people and thought about EncryptionSync, so let's go with that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And if that's alright, I'd rather do it in the next PR, to not mess up too much with my rebase 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK!
"e2ee": { | ||
"enabled": true, | ||
}, | ||
"to_device": { | ||
"enabled": true, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's wrong, we should have those :-).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noooo! ... or maybe, you're right, at least on Android :-)
On iOS, the main app will use both the RoomList
and EncryptionSync
, so the RoomList
on iOS mustn't have these two extensions. Maybe we could make it a parameter in the room list ctor? Or have Android spawn both too, at least for symmetry with iOS? (and so it gets some of other benefits: e2ee not being blocked by processing of lists on the ss proxy, etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, let's keep this as is for now :-). Sorry for the confusion!
"lists": { | ||
ALL_ROOMS: { | ||
"ranges": [ | ||
[0, 49], | ||
], | ||
"timeline_limit": 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added support for sticky parameters in the test macro, and this one is sticky, so it's not reemitted in the next request, since it's the same :)
Signed-off-by: Benjamin Bouvier <public@benj.me>
Signed-off-by: Benjamin Bouvier <public@benj.me>
/// | ||
/// See the module's documentation for more details. | ||
#[derive(Clone)] | ||
pub struct NotificationSync { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK!
"e2ee": { | ||
"enabled": true, | ||
}, | ||
"to_device": { | ||
"enabled": true, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, let's keep this as is for now :-). Sorry for the confusion!
Signed-off-by: Benjamin Bouvier <public@benj.me>
This is the first PR for splitting the sync loop into two. This offers a new high-level API,
NotificationApi
, that makes use of a separateSlidingSync
instance which sole role is to listen to to-device events and e2ee; it's pre-configured to do so. That means we're not force-enabling e2ee and to-device by default for every sliding sync instance, and as such we won't either generate Olm requests to the home server in general.In the future, this new high-level API will hide some low-level dirty details so that its can be instantiated in multiple processes at the same time (lock across process, invalidate and refill crypto caches, etc.).
An embedder who would want to make use of this would need the following:
matrix_sdk_ui::RoomList
would be the best bet, at this time.matrix_sdk_ui::NotificationApi
, with a different identifier.Note that this is not ready to be used in an external process; or it will cause the same kind of issues that we're seeing as of today: invalid crypto caches resulting in UTD, etc.
This PR can be looked at, commit per commit, at the time of writing this.
Fixes #1961.