feat(security&privacy) : expose new sdk methods
This commit is contained in:
parent
a781cc057b
commit
b549400011
20 changed files with 269 additions and 61 deletions
|
|
@ -8,6 +8,8 @@
|
|||
package io.element.android.libraries.matrix.api.createroom
|
||||
|
||||
import io.element.android.libraries.matrix.api.core.UserId
|
||||
import io.element.android.libraries.matrix.api.room.join.JoinRule
|
||||
import io.element.android.libraries.matrix.api.roomdirectory.RoomVisibility
|
||||
import java.util.Optional
|
||||
|
||||
data class CreateRoomParameters(
|
||||
|
|
@ -19,6 +21,6 @@ data class CreateRoomParameters(
|
|||
val preset: RoomPreset,
|
||||
val invite: List<UserId>? = null,
|
||||
val avatar: String? = null,
|
||||
val joinRuleOverride: JoinRuleOverride = JoinRuleOverride.None,
|
||||
val joinRuleOverride: JoinRule? = null,
|
||||
val roomAliasName: Optional<String> = Optional.empty(),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
/*
|
||||
* Copyright 2024 New Vector Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.matrix.api.createroom
|
||||
|
||||
/**
|
||||
* Rules to override the default room join rules.
|
||||
*/
|
||||
sealed interface JoinRuleOverride {
|
||||
data object Knock : JoinRuleOverride
|
||||
data object None : JoinRuleOverride
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
/*
|
||||
* Copyright 2023, 2024 New Vector Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
package io.element.android.libraries.matrix.api.createroom
|
||||
|
||||
enum class RoomVisibility {
|
||||
PUBLIC,
|
||||
PRIVATE,
|
||||
}
|
||||
|
|
@ -24,10 +24,12 @@ 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.history.RoomHistoryVisibility
|
||||
import io.element.android.libraries.matrix.api.room.knock.KnockRequest
|
||||
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
|
||||
import io.element.android.libraries.matrix.api.roomdirectory.RoomVisibility
|
||||
import io.element.android.libraries.matrix.api.timeline.ReceiptType
|
||||
import io.element.android.libraries.matrix.api.timeline.Timeline
|
||||
import io.element.android.libraries.matrix.api.timeline.item.event.EventOrTransactionId
|
||||
|
|
@ -402,4 +404,32 @@ interface MatrixRoom : Closeable {
|
|||
suspend fun withdrawVerificationAndResend(userIds: List<UserId>, sendHandle: SendHandle): Result<Unit>
|
||||
|
||||
override fun close() = destroy()
|
||||
|
||||
/**
|
||||
* Update the canonical alias of the room.
|
||||
*
|
||||
* Note that publishing the alias in the room directory is done separately.
|
||||
*/
|
||||
suspend fun updateCanonicalAlias(
|
||||
canonicalAlias: RoomAlias?,
|
||||
alternativeAliases: List<RoomAlias>
|
||||
): Result<Unit>
|
||||
|
||||
/**
|
||||
* Update the room's visibility in the room directory.
|
||||
*/
|
||||
suspend fun updateRoomVisibility(roomVisibility: RoomVisibility): Result<Unit>
|
||||
|
||||
/**
|
||||
* Update room history visibility for this room.
|
||||
*/
|
||||
suspend fun updateHistoryVisibility(historyVisibility: RoomHistoryVisibility): Result<Unit>
|
||||
|
||||
/**
|
||||
* Returns the visibility for this room in the room directory.
|
||||
*
|
||||
* [Public](`RoomVisibility::Public`) rooms are listed in the room
|
||||
* directory and can be found using it.
|
||||
*/
|
||||
suspend fun getRoomVisibility(): Result<RoomVisibility>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import io.element.android.libraries.matrix.api.core.EventId
|
|||
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.UserId
|
||||
import io.element.android.libraries.matrix.api.room.history.RoomHistoryVisibility
|
||||
import io.element.android.libraries.matrix.api.room.join.JoinRule
|
||||
import io.element.android.libraries.matrix.api.user.MatrixUser
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
|
|
@ -71,6 +72,7 @@ data class MatrixRoomInfo(
|
|||
val heroes: ImmutableList<MatrixUser>,
|
||||
val pinnedEventIds: ImmutableList<EventId>,
|
||||
val creator: UserId?,
|
||||
val historyVisibility: RoomHistoryVisibility,
|
||||
) {
|
||||
val aliases: List<RoomAlias>
|
||||
get() = listOfNotNull(canonicalAlias) + alternativeAliases
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright 2025 New Vector Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.matrix.api.room.history
|
||||
|
||||
sealed interface RoomHistoryVisibility {
|
||||
/**
|
||||
* Previous events are accessible to newly joined members from the point
|
||||
* they were invited onwards.
|
||||
*
|
||||
* Events stop being accessible when the member's state changes to
|
||||
* something other than *invite* or *join*.
|
||||
*/
|
||||
data object Invited : RoomHistoryVisibility
|
||||
|
||||
/**
|
||||
* Previous events are accessible to newly joined members from the point
|
||||
* they joined the room onwards.
|
||||
* Events stop being accessible when the member's state changes to
|
||||
* something other than *join*.
|
||||
*/
|
||||
data object Joined : RoomHistoryVisibility
|
||||
|
||||
/**
|
||||
* Previous events are always accessible to newly joined members.
|
||||
*
|
||||
* All events in the room are accessible, even those sent when the member
|
||||
* was not a part of the room.
|
||||
*/
|
||||
data object Shared : RoomHistoryVisibility
|
||||
|
||||
/**
|
||||
* All events while this is the `HistoryVisibility` value may be shared by
|
||||
* any participating homeserver with anyone, regardless of whether they
|
||||
* have ever joined the room.
|
||||
*/
|
||||
data object WorldReadable : RoomHistoryVisibility
|
||||
|
||||
/**
|
||||
* A custom visibility value.
|
||||
*/
|
||||
data class Custom(val value: String) : RoomHistoryVisibility
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright 2025 New Vector Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.matrix.api.roomdirectory
|
||||
|
||||
/**
|
||||
* Enum class representing the visibility of a room in the room directory.
|
||||
*/
|
||||
sealed interface RoomVisibility {
|
||||
/**
|
||||
* Indicates that the room will be shown in the published room list.
|
||||
*/
|
||||
data object Public : RoomVisibility
|
||||
|
||||
/**
|
||||
* Indicates that the room will not be shown in the published room list.
|
||||
*/
|
||||
data object Private : RoomVisibility
|
||||
|
||||
/**
|
||||
* A custom value that's not present in the spec.
|
||||
*/
|
||||
data class Custom(val value: String) : RoomVisibility
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue