Add some Kdoc

This commit is contained in:
Benoit Marty 2022-05-24 17:49:12 +02:00 committed by Benoit Marty
parent 5fbcec0c9c
commit cffdb7f7a6
4 changed files with 161 additions and 13 deletions

View file

@ -21,32 +21,32 @@ package org.matrix.android.sdk.api.query
*/ */
sealed interface QueryStringValue { sealed interface QueryStringValue {
/** /**
* No condition, i.e. there will be no test on the tested field * No condition, i.e. there will be no test on the tested field.
*/ */
object NoCondition : QueryStringValue object NoCondition : QueryStringValue
/** /**
* The tested field has to be null * The tested field has to be null.
*/ */
object IsNull : QueryStringValue object IsNull : QueryStringValue
/** /**
* The tested field has to be not null * The tested field has to be not null.
*/ */
object IsNotNull : QueryStringValue object IsNotNull : QueryStringValue
/** /**
* The tested field has to be empty * The tested field has to be empty.
*/ */
object IsEmpty : QueryStringValue object IsEmpty : QueryStringValue
/** /**
* The tested field has to not empty * The tested field has to not empty.
*/ */
object IsNotEmpty : QueryStringValue object IsNotEmpty : QueryStringValue
/** /**
* Interface to check String content * Interface to check String content.
*/ */
sealed interface ContentQueryStringValue : QueryStringValue { sealed interface ContentQueryStringValue : QueryStringValue {
val string: String val string: String
@ -59,12 +59,12 @@ sealed interface QueryStringValue {
data class Equals(override val string: String, override val case: Case = Case.SENSITIVE) : ContentQueryStringValue data class Equals(override val string: String, override val case: Case = Case.SENSITIVE) : ContentQueryStringValue
/** /**
* The tested field must contain the [string] * The tested field must contain the [string].
*/ */
data class Contains(override val string: String, override val case: Case = Case.SENSITIVE) : ContentQueryStringValue data class Contains(override val string: String, override val case: Case = Case.SENSITIVE) : ContentQueryStringValue
/** /**
* Case enum for [ContentQueryStringValue] * Case enum for [ContentQueryStringValue].
*/ */
enum class Case { enum class Case {
/** /**

View file

@ -17,7 +17,7 @@
package org.matrix.android.sdk.api.query package org.matrix.android.sdk.api.query
/** /**
* To filter by Room category * To filter by Room category.
* @see [org.matrix.android.sdk.api.session.room.RoomSummaryQueryParams] * @see [org.matrix.android.sdk.api.session.room.RoomSummaryQueryParams]
*/ */
enum class RoomCategoryFilter { enum class RoomCategoryFilter {

View file

@ -28,66 +28,200 @@ import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
* It can be retrieved by [org.matrix.android.sdk.api.session.room.Room] and [org.matrix.android.sdk.api.session.room.RoomService] * It can be retrieved by [org.matrix.android.sdk.api.session.room.Room] and [org.matrix.android.sdk.api.session.room.RoomService]
*/ */
data class RoomSummary( data class RoomSummary(
/**
* The roomId of the room.
*/
val roomId: String, val roomId: String,
// Computed display name /**
* Computed display name. The value of the state event `m.room.name` if not empty, else can be the value returned
* by [org.matrix.android.sdk.api.RoomDisplayNameFallbackProvider].
*/
val displayName: String = "", val displayName: String = "",
/**
* The value of the live state event `m.room.name`.
*/
val name: String = "", val name: String = "",
/**
* The value of the live state event `m.room.topic`.
*/
val topic: String = "", val topic: String = "",
/**
* The value of the live state event `m.room.avatar`.
*/
val avatarUrl: String = "", val avatarUrl: String = "",
/**
* The value of the live state event `m.room.canonical_alias`.
*/
val canonicalAlias: String? = null, val canonicalAlias: String? = null,
/**
* The list of all the aliases of this room. Content of the live state event `m.room.aliases`.
*/
val aliases: List<String> = emptyList(), val aliases: List<String> = emptyList(),
/**
* The value of the live state event `m.room.join_rules`.
*/
val joinRules: RoomJoinRules? = null, val joinRules: RoomJoinRules? = null,
/**
* True is this room is referenced in the account data `m.direct`.
*/
val isDirect: Boolean = false, val isDirect: Boolean = false,
/**
* If [isDirect] is true, this is the id of the first other member of this room.
*/
val directUserId: String? = null, val directUserId: String? = null,
/**
* If [isDirect] is true, this it the presence of the first other member of this room.
*/
val directUserPresence: UserPresence? = null, val directUserPresence: UserPresence? = null,
/**
* Number of members who have joined this room.
*/
val joinedMembersCount: Int? = 0, val joinedMembersCount: Int? = 0,
/**
* Number of members who are invited to this room.
*/
val invitedMembersCount: Int? = 0, val invitedMembersCount: Int? = 0,
/**
* Latest [TimelineEvent] which can be displayed in this room. Can be used in the room list.
*/
val latestPreviewableEvent: TimelineEvent? = null, val latestPreviewableEvent: TimelineEvent? = null,
/**
* List of other member ids of this room.
*/
val otherMemberIds: List<String> = emptyList(), val otherMemberIds: List<String> = emptyList(),
/**
* Number of unread message in this room.
*/
val notificationCount: Int = 0, val notificationCount: Int = 0,
/**
* Number of unread and highlighted message in this room.
*/
val highlightCount: Int = 0, val highlightCount: Int = 0,
/**
* True if this room has unread messages.
*/
val hasUnreadMessages: Boolean = false, val hasUnreadMessages: Boolean = false,
/**
* List of tags in this room.
*/
val tags: List<RoomTag> = emptyList(), val tags: List<RoomTag> = emptyList(),
/**
* Current user membership in this room.
*/
val membership: Membership = Membership.NONE, val membership: Membership = Membership.NONE,
/**
* Versioning state of this room.
*/
val versioningState: VersioningState = VersioningState.NONE, val versioningState: VersioningState = VersioningState.NONE,
/**
* Value of `m.fully_read` for this room.
*/
val readMarkerId: String? = null, val readMarkerId: String? = null,
/**
* Message saved as draft for this room.
*/
val userDrafts: List<UserDraft> = emptyList(), val userDrafts: List<UserDraft> = emptyList(),
/**
* True if this room is encrypted.
*/
val isEncrypted: Boolean, val isEncrypted: Boolean,
/**
* Timestamp of the `m.room.encryption` state event.
*/
val encryptionEventTs: Long?, val encryptionEventTs: Long?,
/**
* List of users who are currently typing on this room.
*/
val typingUsers: List<SenderInfo>, val typingUsers: List<SenderInfo>,
/**
* UserId of the user who has invited the current user to this room.
*/
val inviterId: String? = null, val inviterId: String? = null,
/**
* Breadcrumb index, util to sort rooms by last seen.
*/
val breadcrumbsIndex: Int = NOT_IN_BREADCRUMBS, val breadcrumbsIndex: Int = NOT_IN_BREADCRUMBS,
/**
* The room encryption trust level.
* @see [RoomEncryptionTrustLevel]
*/
val roomEncryptionTrustLevel: RoomEncryptionTrustLevel? = null, val roomEncryptionTrustLevel: RoomEncryptionTrustLevel? = null,
/**
* True if a message has not been sent in this room.
*/
val hasFailedSending: Boolean = false, val hasFailedSending: Boolean = false,
/**
* The type of the room. Null for regular room.
* @see [RoomType]
*/
val roomType: String? = null, val roomType: String? = null,
/**
* List of parent spaces.
*/
val spaceParents: List<SpaceParentInfo>? = null, val spaceParents: List<SpaceParentInfo>? = null,
/**
* List of children space.
*/
val spaceChildren: List<SpaceChildInfo>? = null, val spaceChildren: List<SpaceChildInfo>? = null,
/**
* List of all the space parents. Will be empty by default, you have to explicitly request it.
*/
val flattenParents: List<RoomSummary> = emptyList(), val flattenParents: List<RoomSummary> = emptyList(),
/**
* List of all the space parent Ids.
*/
val flattenParentIds: List<String> = emptyList(), val flattenParentIds: List<String> = emptyList(),
val roomEncryptionAlgorithm: RoomEncryptionAlgorithm? = null /**
* Information about the encryption algorithm, if this room is encrypted.
*/
val roomEncryptionAlgorithm: RoomEncryptionAlgorithm? = null,
) { ) {
/**
* True if [versioningState] is not [VersioningState.NONE].
*/
val isVersioned: Boolean val isVersioned: Boolean
get() = versioningState != VersioningState.NONE get() = versioningState != VersioningState.NONE
/**
* True if [notificationCount] is not `0`.
*/
val hasNewMessages: Boolean val hasNewMessages: Boolean
get() = notificationCount != 0 get() = notificationCount != 0
/**
* True if the room has the tag `m.lowpriority`.
*/
val isLowPriority: Boolean val isLowPriority: Boolean
get() = hasTag(RoomTag.ROOM_TAG_LOW_PRIORITY) get() = hasTag(RoomTag.ROOM_TAG_LOW_PRIORITY)
/**
* True if the room has the tag `m.favourite`.
*/
val isFavorite: Boolean val isFavorite: Boolean
get() = hasTag(RoomTag.ROOM_TAG_FAVOURITE) get() = hasTag(RoomTag.ROOM_TAG_FAVOURITE)
/**
* True if [joinRules] is [RoomJoinRules.PUBLIC].
*/
val isPublic: Boolean val isPublic: Boolean
get() = joinRules == RoomJoinRules.PUBLIC get() = joinRules == RoomJoinRules.PUBLIC
/**
* Test if the room has the provided [tag].
*/
fun hasTag(tag: String) = tags.any { it.name == tag } fun hasTag(tag: String) = tags.any { it.name == tag }
/**
* True if a 1-1 call can be started, i.e. the room has exactly 2 joined members.
*/
val canStartCall: Boolean val canStartCall: Boolean
get() = joinedMembersCount == 2 get() = joinedMembersCount == 2
companion object { companion object {
/**
* Constant to indicated that the room is not on the breadcrumbs.
* Used by [breadcrumbsIndex].
*/
const val NOT_IN_BREADCRUMBS = -1 const val NOT_IN_BREADCRUMBS = -1
} }
} }

View file

@ -16,8 +16,22 @@
package org.matrix.android.sdk.api.session.room.model package org.matrix.android.sdk.api.session.room.model
/**
* Enum for the versioning state of a room.
*/
enum class VersioningState { enum class VersioningState {
/**
* The room is not versioned.
*/
NONE, NONE,
/**
* The room has been upgraded, but the new room is not joined yet.
*/
UPGRADED_ROOM_NOT_JOINED, UPGRADED_ROOM_NOT_JOINED,
UPGRADED_ROOM_JOINED
/**
* The room has been upgraded, and the new room has been joined.
*/
UPGRADED_ROOM_JOINED,
} }