rename event and mention event in method documentation

This commit is contained in:
Simon Laux
2024-01-12 21:20:43 +01:00
committed by bjoern
parent df455bbcf5
commit 727428a965
4 changed files with 19 additions and 3 deletions

View File

@@ -3157,6 +3157,10 @@ void dc_accounts_maybe_network_lost (dc_accounts_t* accounts);
*
* dc_accounts_background_fetch() was created for the iOS Background fetch.
*
* The `DC_EVENT_ACCOUNTS_BACKGROUND_FETCH_DONE` event is emitted at the end,
* process all events until you get this one and you can safely return to the background
* without forgeting to create notifications caused by timing race conditions.
*
* @memberof dc_accounts_t
* @param timeout The timeout in seconds
* @return Return 1 on success and 0 on failure (like timeout)
@@ -6278,7 +6282,7 @@ void dc_event_unref(dc_event_t* event);
* This event is only emitted by the account manager
*/
#define DC_EVENT_BACKGROUND_FETCH_COMPLETED_FOR_ALL_ACCOUNTS 2200
#define DC_EVENT_ACCOUNTS_BACKGROUND_FETCH_DONE 2200
/**
* @}

View File

@@ -232,6 +232,10 @@ impl CommandApi {
}
/// Performs a background fetch for all accounts in parallel with a timeout.
///
/// The `BackgroundFetchCompletedForAllAccounts` event is emitted at the end,
/// process all events until you get this one and you can safely return to the background
/// without forgeting to create notifications caused by timing race conditions.
async fn background_fetch_for_all_accounts(&self, timeout_in_seconds: f64) -> Result<()> {
self.accounts
.write()

View File

@@ -29,7 +29,7 @@ export enum C {
DC_DOWNLOAD_FAILURE = 20,
DC_DOWNLOAD_IN_PROGRESS = 1000,
DC_DOWNLOAD_UNDECIPHERABLE = 30,
DC_EVENT_BACKGROUND_FETCH_COMPLETED_FOR_ALL_ACCOUNTS = 2200,
DC_EVENT_ACCOUNTS_BACKGROUND_FETCH_DONE = 2200,
DC_EVENT_CHAT_EPHEMERAL_TIMER_MODIFIED = 2021,
DC_EVENT_CHAT_MODIFIED = 2020,
DC_EVENT_CONFIGURE_PROGRESS = 2041,
@@ -327,5 +327,5 @@ export const EventId2EventName: { [key: number]: string } = {
2111: 'DC_EVENT_CONFIG_SYNCED',
2120: 'DC_EVENT_WEBXDC_STATUS_UPDATE',
2121: 'DC_EVENT_WEBXDC_INSTANCE_DELETED',
2200: 'DC_EVENT_BACKGROUND_FETCH_COMPLETED_FOR_ALL_ACCOUNTS',
2200: 'DC_EVENT_ACCOUNTS_BACKGROUND_FETCH_DONE',
}

View File

@@ -295,6 +295,10 @@ impl Accounts {
/// Performs a background fetch for all accounts in parallel.
///
/// If you need a timeout, then use [Accounts::background_fetch_with_timeout] instead.
///
/// The `BackgroundFetchCompletedForAllAccounts` event is emitted at the end,
/// process all events until you get this one and you can safely return to the background
/// without forgeting to create notifications caused by timing race conditions.
pub async fn background_fetch(&self) {
async fn background_fetch_and_log_error(account: Context) {
if let Err(error) = account.background_fetch().await {
@@ -316,6 +320,10 @@ impl Accounts {
/// Performs a background fetch for all accounts in parallel with a timeout.
///
/// If you want no timeout, then use [Accounts::background_fetch] instead.
///
/// The `BackgroundFetchCompletedForAllAccounts` event is emitted at the end,
/// process all events until you get this one and you can safely return to the background
/// without forgeting to create notifications caused by timing race conditions.
pub async fn background_fetch_with_timeout(&self, timeout: std::time::Duration) -> Result<()> {
let result = tokio::time::timeout(timeout, self.background_fetch()).await;
self.emit_event(EventType::BackgroundFetchCompletedForAllAccounts);