Upgrade rust sdk to v48 (#1186)
- Sends content instead of string in message reply and edit - Adds poll response and end APIs - Adds logoUri to OidcConfiguration
This commit is contained in:
parent
35bdc95fac
commit
023bfc2ffa
5 changed files with 88 additions and 5 deletions
|
|
@ -146,7 +146,7 @@ jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" }
|
||||||
appyx_core = { module = "com.bumble.appyx:core", version.ref = "appyx" }
|
appyx_core = { module = "com.bumble.appyx:core", version.ref = "appyx" }
|
||||||
molecule-runtime = { module = "app.cash.molecule:molecule-runtime", version.ref = "molecule" }
|
molecule-runtime = { module = "app.cash.molecule:molecule-runtime", version.ref = "molecule" }
|
||||||
timber = "com.jakewharton.timber:timber:5.0.1"
|
timber = "com.jakewharton.timber:timber:5.0.1"
|
||||||
matrix_sdk = "org.matrix.rustcomponents:sdk-android:0.1.47"
|
matrix_sdk = "org.matrix.rustcomponents:sdk-android:0.1.48"
|
||||||
sqldelight-driver-android = { module = "com.squareup.sqldelight:android-driver", version.ref = "sqldelight" }
|
sqldelight-driver-android = { module = "com.squareup.sqldelight:android-driver", version.ref = "sqldelight" }
|
||||||
sqldelight-driver-jvm = { module = "com.squareup.sqldelight:sqlite-driver", version.ref = "sqldelight" }
|
sqldelight-driver-jvm = { module = "com.squareup.sqldelight:sqlite-driver", version.ref = "sqldelight" }
|
||||||
sqldelight-coroutines = { module = "com.squareup.sqldelight:coroutines-extensions", version.ref = "sqldelight" }
|
sqldelight-coroutines = { module = "com.squareup.sqldelight:coroutines-extensions", version.ref = "sqldelight" }
|
||||||
|
|
|
||||||
|
|
@ -157,6 +157,22 @@ interface MatrixRoom : Closeable {
|
||||||
pollKind: PollKind,
|
pollKind: PollKind,
|
||||||
): Result<Unit>
|
): Result<Unit>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a response to a poll.
|
||||||
|
*
|
||||||
|
* @param pollStartId The event ID of the poll start event.
|
||||||
|
* @param answers The list of answer ids to send.
|
||||||
|
*/
|
||||||
|
suspend fun sendPollResponse(pollStartId: EventId, answers: List<String>): Result<Unit>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ends a poll in the room.
|
||||||
|
*
|
||||||
|
* @param pollStartId The event ID of the poll start event.
|
||||||
|
* @param text Fallback text of the poll end event.
|
||||||
|
*/
|
||||||
|
suspend fun endPoll(pollStartId: EventId, text: String): Result<Unit>
|
||||||
|
|
||||||
override fun close() = destroy()
|
override fun close() = destroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ val oidcConfiguration: OidcConfiguration = OidcConfiguration(
|
||||||
clientName = "Element",
|
clientName = "Element",
|
||||||
redirectUri = OidcConfig.redirectUri,
|
redirectUri = OidcConfig.redirectUri,
|
||||||
clientUri = "https://element.io",
|
clientUri = "https://element.io",
|
||||||
|
logoUri = "https://element.io/mobile-icon.png",
|
||||||
tosUri = "https://element.io/user-terms-of-service",
|
tosUri = "https://element.io/user-terms-of-service",
|
||||||
policyUri = "https://element.io/privacy",
|
policyUri = "https://element.io/privacy",
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,7 @@ class RustMatrixRoom(
|
||||||
override suspend fun editMessage(originalEventId: EventId?, transactionId: TransactionId?, message: String): Result<Unit> = withContext(roomDispatcher) {
|
override suspend fun editMessage(originalEventId: EventId?, transactionId: TransactionId?, message: String): Result<Unit> = withContext(roomDispatcher) {
|
||||||
if (originalEventId != null) {
|
if (originalEventId != null) {
|
||||||
runCatching {
|
runCatching {
|
||||||
innerRoom.edit(/* TODO use content */ message, originalEventId.value, transactionId?.value)
|
innerRoom.edit(messageEventContentFromMarkdown(message), originalEventId.value, transactionId?.value)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
runCatching {
|
runCatching {
|
||||||
|
|
@ -226,10 +226,8 @@ class RustMatrixRoom(
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun replyMessage(eventId: EventId, message: String): Result<Unit> = withContext(roomDispatcher) {
|
override suspend fun replyMessage(eventId: EventId, message: String): Result<Unit> = withContext(roomDispatcher) {
|
||||||
val transactionId = genTransactionId()
|
|
||||||
// val content = messageEventContentFromMarkdown(message)
|
|
||||||
runCatching {
|
runCatching {
|
||||||
innerRoom.sendReply(/* TODO use content */ message, eventId.value, transactionId)
|
innerRoom.sendReply(messageEventContentFromMarkdown(message), eventId.value, genTransactionId())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -402,6 +400,32 @@ class RustMatrixRoom(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override suspend fun sendPollResponse(
|
||||||
|
pollStartId: EventId,
|
||||||
|
answers: List<String>
|
||||||
|
): Result<Unit> = withContext(roomDispatcher) {
|
||||||
|
runCatching {
|
||||||
|
innerRoom.sendPollResponse(
|
||||||
|
pollStartId = pollStartId.value,
|
||||||
|
answers = answers,
|
||||||
|
txnId = genTransactionId(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun endPoll(
|
||||||
|
pollStartId: EventId,
|
||||||
|
text: String
|
||||||
|
): Result<Unit> = withContext(roomDispatcher) {
|
||||||
|
runCatching {
|
||||||
|
innerRoom.endPoll(
|
||||||
|
pollStartId = pollStartId.value,
|
||||||
|
text = text,
|
||||||
|
txnId = genTransactionId(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private suspend fun sendAttachment(files: List<File>, handle: () -> SendAttachmentJoinHandle): Result<MediaUploadHandler> {
|
private suspend fun sendAttachment(files: List<File>, handle: () -> SendAttachmentJoinHandle): Result<MediaUploadHandler> {
|
||||||
return runCatching {
|
return runCatching {
|
||||||
MediaUploadHandlerImpl(files, handle())
|
MediaUploadHandlerImpl(files, handle())
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,8 @@ class FakeMatrixRoom(
|
||||||
private var reportContentResult = Result.success(Unit)
|
private var reportContentResult = Result.success(Unit)
|
||||||
private var sendLocationResult = Result.success(Unit)
|
private var sendLocationResult = Result.success(Unit)
|
||||||
private var createPollResult = Result.success(Unit)
|
private var createPollResult = Result.success(Unit)
|
||||||
|
private var sendPollResponseResult = Result.success(Unit)
|
||||||
|
private var endPollResult = Result.success(Unit)
|
||||||
private var progressCallbackValues = emptyList<Pair<Long, Long>>()
|
private var progressCallbackValues = emptyList<Pair<Long, Long>>()
|
||||||
val editMessageCalls = mutableListOf<String>()
|
val editMessageCalls = mutableListOf<String>()
|
||||||
|
|
||||||
|
|
@ -109,6 +111,12 @@ class FakeMatrixRoom(
|
||||||
private val _createPollInvocations = mutableListOf<CreatePollInvocation>()
|
private val _createPollInvocations = mutableListOf<CreatePollInvocation>()
|
||||||
val createPollInvocations: List<CreatePollInvocation> = _createPollInvocations
|
val createPollInvocations: List<CreatePollInvocation> = _createPollInvocations
|
||||||
|
|
||||||
|
private val _sendPollResponseInvocations = mutableListOf<SendPollResponseInvocation>()
|
||||||
|
val sendPollResponseInvocations: List<SendPollResponseInvocation> = _sendPollResponseInvocations
|
||||||
|
|
||||||
|
private val _endPollInvocations = mutableListOf<EndPollInvocation>()
|
||||||
|
val endPollInvocations: List<EndPollInvocation> = _endPollInvocations
|
||||||
|
|
||||||
var invitedUserId: UserId? = null
|
var invitedUserId: UserId? = null
|
||||||
private set
|
private set
|
||||||
|
|
||||||
|
|
@ -320,6 +328,22 @@ class FakeMatrixRoom(
|
||||||
return createPollResult
|
return createPollResult
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override suspend fun sendPollResponse(
|
||||||
|
pollStartId: EventId,
|
||||||
|
answers: List<String>
|
||||||
|
): Result<Unit> = simulateLongTask {
|
||||||
|
_sendPollResponseInvocations.add(SendPollResponseInvocation(pollStartId, answers))
|
||||||
|
return sendPollResponseResult
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun endPoll(
|
||||||
|
pollStartId: EventId,
|
||||||
|
text: String
|
||||||
|
): Result<Unit> = simulateLongTask {
|
||||||
|
_endPollInvocations.add(EndPollInvocation(pollStartId, text))
|
||||||
|
return endPollResult
|
||||||
|
}
|
||||||
|
|
||||||
fun givenLeaveRoomError(throwable: Throwable?) {
|
fun givenLeaveRoomError(throwable: Throwable?) {
|
||||||
this.leaveRoomError = throwable
|
this.leaveRoomError = throwable
|
||||||
}
|
}
|
||||||
|
|
@ -416,6 +440,14 @@ class FakeMatrixRoom(
|
||||||
createPollResult = result
|
createPollResult = result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun givenSendPollResponseResult(result: Result<Unit>) {
|
||||||
|
sendPollResponseResult = result
|
||||||
|
}
|
||||||
|
|
||||||
|
fun givenEndPollResult(result: Result<Unit>) {
|
||||||
|
endPollResult = result
|
||||||
|
}
|
||||||
|
|
||||||
fun givenProgressCallbackValues(values: List<Pair<Long, Long>>) {
|
fun givenProgressCallbackValues(values: List<Pair<Long, Long>>) {
|
||||||
progressCallbackValues = values
|
progressCallbackValues = values
|
||||||
}
|
}
|
||||||
|
|
@ -435,3 +467,13 @@ data class CreatePollInvocation(
|
||||||
val maxSelections: Int,
|
val maxSelections: Int,
|
||||||
val pollKind: PollKind,
|
val pollKind: PollKind,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
data class SendPollResponseInvocation(
|
||||||
|
val pollStartId: EventId,
|
||||||
|
val answers: List<String>,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class EndPollInvocation(
|
||||||
|
val pollStartId: EventId,
|
||||||
|
val text: String,
|
||||||
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue