deltachat-core-rust icon indicating copy to clipboard operation
deltachat-core-rust copied to clipboard

feat: dc_accounts_set_push_device_token API

Open link2xt opened this issue 1 year ago • 0 comments

Based on PR #5315

PR adds two new APIs:

  • dc_accounts_set_push_device_token(accounts, token) to provide device token from the application to the core. This can be called as soon as the token becomes available, possibly even after starting I/O. Core will make sure to register the token with the email server (currently not possible, chatmail server does not have notification implementation) or, if it is not possible, register with the heartbeat server.
  • dc_get_push_state(context) to get the status of the push server registration. iOS currently needs this, later we may deprecate this and integrate into connectivity view.

Currently missing:

  • [x] Register with the heartbeat server asynchronously so dc_accounts_set_push_device_token() returns immediately.
  • [x] Register with the heartbeat server only once IMAP client connects to the server and determines that the server does not support push. This should currently happen every time, but prevent heartbeat registration when there are no configured accounts with working IMAP.
  • [x] Store encrypted device ID on mail server via SETMETADATA if the server supports it. Corresponding chatmail PR: https://github.com/deltachat/chatmail/pull/201
  • [x] Add DC_PUSH_CONNECTED state

link2xt avatar Feb 23 '24 10:02 link2xt