Skip to content
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

Fetching notifications directly from the SDK when the app is in foreground #813

Closed
2 tasks done
Tracked by #1093
Velin92 opened this issue Apr 19, 2023 · 1 comment · Fixed by #848
Closed
2 tasks done
Tracked by #1093

Fetching notifications directly from the SDK when the app is in foreground #813

Velin92 opened this issue Apr 19, 2023 · 1 comment · Fixed by #848
Assignees
Labels
A-Notifications T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements X-Needs-Rust This issue needs a Rust SDK change. It must have a link to a Rust SDK issue

Comments

@Velin92
Copy link
Member

Velin92 commented Apr 19, 2023

Since we are constantly receiving updates from the Sliding Sync Response, which sometimes might be faster than APNS to notify that a room has received a new message, we can actually also send notifications locally if we are able to intercept notifications events directly from the SDK.

We should expose a notification handler in FFI that gives us at least the basic info of the notification for a given Client, like the room id and the event id, and use these info to send a local notification that behaves like a remote one.

Then we need to implement a mechanism that serves the first notification that is received (the one from the SDK or the one from APNS) without duplications.
For example we could store an hash of the notification event id, room id and user id, and every time a notification arrive check if that hash is already stored, if it is we discard the notification, otherwise we display it and save that hash.

Of course this system will only work in foreground, when the app is fully in background we will only rely on APNS.

  • Implemented the notification handler
  • Implemented a mechanism that does not serve a local/remote notification if another with the same identifiers has already been served
@Velin92 Velin92 self-assigned this Apr 19, 2023
@Velin92 Velin92 added X-Needs-Rust This issue needs a Rust SDK change. It must have a link to a Rust SDK issue A-Notifications T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements labels Apr 19, 2023
@Velin92
Copy link
Member Author

Velin92 commented Apr 27, 2023

the first task is addressed in this PR:
#837

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Notifications T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements X-Needs-Rust This issue needs a Rust SDK change. It must have a link to a Rust SDK issue
Projects
None yet
2 participants