RetryFailedMessageUseCase

class RetryFailedMessageUseCase(messageRepository: MessageRepository, assetRepository: AssetRepository, conversationRepository: ConversationRepository, persistMessage: PersistMessageUseCase, publishAttachments: PublishAttachmentsUseCase, scope: CoroutineScope, dispatcher: KaliumDispatcher, messageSender: MessageSender, updateAssetMessageTransferStatus: UpdateAssetMessageTransferStatusUseCase, getAssetMessageTransferStatusUseCase: GetAssetMessageTransferStatusUseCase)

Constructors

Link copied to clipboard
internal constructor(messageRepository: MessageRepository, assetRepository: AssetRepository, conversationRepository: ConversationRepository, persistMessage: PersistMessageUseCase, publishAttachments: PublishAttachmentsUseCase, scope: CoroutineScope, dispatcher: KaliumDispatcher, messageSender: MessageSender, updateAssetMessageTransferStatus: UpdateAssetMessageTransferStatusUseCase, getAssetMessageTransferStatusUseCase: GetAssetMessageTransferStatusUseCase)

Functions

Link copied to clipboard
suspend operator fun invoke(messageId: String, conversationId: ConversationId): MessageOperationResult

Function that enables resending of failed message to a given conversation with the strategy of fire & forget. This message must have a status of Message.Status.Failed or Message.Status.FailedRemotely.

Link copied to clipboard
internal suspend fun invokeAndAwait(messageId: String, conversationId: ConversationId): MessageOperationResult

Retries the existing persisted message and returns its actual upload/send result. Work belongs to the calling coroutine, rather than the session's fire-and-forget scope. Cancellation waits for upload/send unwinding and marks unfinished delivery failed before leaving; confirmed successful sends remain sent. No automatic network resend is scheduled. A send skipped because the message is no longer eligible cancels the retry without failure-state cleanup. The message ID and uploaded remote data are preserved.