Update SDK bindings version to 0.2.62 and fix SendHandle usages (#3876)

This commit is contained in:
Jorge Martin Espinosa 2024-11-15 14:48:59 +01:00 committed by GitHub
parent 1b33e1ac31
commit 56fe177c31
26 changed files with 135 additions and 59 deletions

View file

@ -0,0 +1,12 @@
/*
* Copyright 2024 New Vector Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only
* Please see LICENSE in the repository root for full details.
*/
package io.element.android.libraries.matrix.api.core
fun interface SendHandle {
suspend fun retry(): Result<Unit>
}

View file

@ -12,6 +12,7 @@ import io.element.android.libraries.matrix.api.core.EventId
import io.element.android.libraries.matrix.api.core.ProgressCallback
import io.element.android.libraries.matrix.api.core.RoomAlias
import io.element.android.libraries.matrix.api.core.RoomId
import io.element.android.libraries.matrix.api.core.SendHandle
import io.element.android.libraries.matrix.api.core.SessionId
import io.element.android.libraries.matrix.api.core.TransactionId
import io.element.android.libraries.matrix.api.core.UserId
@ -154,8 +155,6 @@ interface MatrixRoom : Closeable {
suspend fun forwardEvent(eventId: EventId, roomIds: List<RoomId>): Result<Unit>
suspend fun retrySendMessage(transactionId: TransactionId): Result<Unit>
suspend fun cancelSend(transactionId: TransactionId): Result<Unit>
suspend fun leave(): Result<Unit>
@ -356,20 +355,20 @@ interface MatrixRoom : Closeable {
* Ignore the local trust for the given devices and resend messages that failed to send because said devices are unverified.
*
* @param devices The map of users identifiers to device identifiers received in the error
* @param transactionId The send queue transaction identifier of the local echo the send error applies to.
* @param sendHandle The send queue handle of the local echo the send error applies to. It can be used to retry the upload.
*
*/
suspend fun ignoreDeviceTrustAndResend(devices: Map<UserId, List<DeviceId>>, transactionId: TransactionId): Result<Unit>
suspend fun ignoreDeviceTrustAndResend(devices: Map<UserId, List<DeviceId>>, sendHandle: SendHandle): Result<Unit>
/**
* Remove verification requirements for the given users and
* resend messages that failed to send because their identities were no longer verified.
*
* @param userIds The list of users identifiers received in the error.
* @param transactionId The send queue transaction identifier of the local echo the send error applies to.
* @param sendHandle The send queue handle of the local echo the send error applies to. It can be used to retry the upload.
*
*/
suspend fun withdrawVerificationAndResend(userIds: List<UserId>, transactionId: TransactionId): Result<Unit>
suspend fun withdrawVerificationAndResend(userIds: List<UserId>, sendHandle: SendHandle): Result<Unit>
override fun close() = destroy()
}

View file

@ -8,6 +8,7 @@
package io.element.android.libraries.matrix.api.timeline.item.event
import io.element.android.libraries.matrix.api.core.EventId
import io.element.android.libraries.matrix.api.core.SendHandle
import io.element.android.libraries.matrix.api.core.TransactionId
import io.element.android.libraries.matrix.api.core.UserId
import io.element.android.libraries.matrix.api.timeline.item.TimelineItemDebugInfo
@ -30,6 +31,7 @@ data class EventTimelineItem(
val origin: TimelineItemEventOrigin?,
val timelineItemDebugInfoProvider: TimelineItemDebugInfoProvider,
val messageShieldProvider: MessageShieldProvider,
val sendHandleProvider: SendHandleProvider,
) {
fun inReplyTo(): InReplyTo? {
return (content as? MessageContent)?.inReplyTo
@ -52,3 +54,7 @@ fun interface TimelineItemDebugInfoProvider {
fun interface MessageShieldProvider {
operator fun invoke(strict: Boolean): MessageShield?
}
fun interface SendHandleProvider {
operator fun invoke(): SendHandle?
}