Draft : expose new apis from sdk
This commit is contained in:
parent
112cd36ce2
commit
dc331640f9
6 changed files with 152 additions and 0 deletions
|
|
@ -29,6 +29,7 @@ import io.element.android.libraries.matrix.api.media.ImageInfo
|
|||
import io.element.android.libraries.matrix.api.media.MediaUploadHandler
|
||||
import io.element.android.libraries.matrix.api.media.VideoInfo
|
||||
import io.element.android.libraries.matrix.api.poll.PollKind
|
||||
import io.element.android.libraries.matrix.api.room.draft.ComposerDraft
|
||||
import io.element.android.libraries.matrix.api.room.location.AssetType
|
||||
import io.element.android.libraries.matrix.api.room.powerlevels.MatrixRoomPowerLevels
|
||||
import io.element.android.libraries.matrix.api.room.powerlevels.UserRoleChange
|
||||
|
|
@ -337,5 +338,20 @@ interface MatrixRoom : Closeable {
|
|||
|
||||
suspend fun setSendQueueEnabled(enabled: Boolean)
|
||||
|
||||
/**
|
||||
* Store the given `ComposerDraft` in the state store of this room.
|
||||
*/
|
||||
suspend fun saveComposerDraft(composerDraft: ComposerDraft): Result<Unit>
|
||||
|
||||
/**
|
||||
* Retrieve the `ComposerDraft` stored in the state store for this room.
|
||||
*/
|
||||
suspend fun loadComposerDraft(): Result<ComposerDraft?>
|
||||
|
||||
/**
|
||||
* Clear the `ComposerDraft` stored in the state store for this room.
|
||||
*/
|
||||
suspend fun clearComposerDraft(): Result<Unit>
|
||||
|
||||
override fun close() = destroy()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) 2024 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.matrix.api.room.draft
|
||||
|
||||
/**
|
||||
* A draft of a message composed by the user.
|
||||
* @param plainText The draft content in plain text.
|
||||
* @param htmlText If the message is formatted in HTML, the HTML representation of the message.
|
||||
* @param draftType The type of draft.
|
||||
*/
|
||||
data class ComposerDraft(
|
||||
val plainText: String,
|
||||
val htmlText: String?,
|
||||
val draftType: ComposerDraftType
|
||||
)
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright (c) 2024 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.matrix.api.room.draft
|
||||
|
||||
import io.element.android.libraries.matrix.api.core.EventId
|
||||
|
||||
sealed class ComposerDraftType {
|
||||
data object NewMessage : ComposerDraftType()
|
||||
data class Reply(val eventId: EventId) : ComposerDraftType()
|
||||
data class Edit(val eventId: EventId) : ComposerDraftType()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue