Merge branch 'develop' into feature/fga/user_detail_direct_chat
This commit is contained in:
commit
1921b4f18f
76 changed files with 329 additions and 148 deletions
|
|
@ -16,6 +16,9 @@
|
|||
|
||||
package io.element.android.libraries.matrix.api.encryption
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
|
||||
@Immutable
|
||||
sealed interface BackupUploadState {
|
||||
data object Unknown : BackupUploadState
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@
|
|||
|
||||
package io.element.android.libraries.matrix.api.encryption
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
|
||||
@Immutable
|
||||
sealed interface SteadyStateException {
|
||||
/**
|
||||
* The backup can be deleted.
|
||||
|
|
|
|||
|
|
@ -16,9 +16,10 @@
|
|||
|
||||
package io.element.android.libraries.matrix.api.media
|
||||
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlin.time.Duration
|
||||
|
||||
data class AudioDetails(
|
||||
val duration: Duration,
|
||||
val waveform: List<Float>,
|
||||
val waveform: ImmutableList<Float>,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,18 +17,21 @@
|
|||
package io.element.android.libraries.matrix.api.permalink
|
||||
|
||||
import android.net.Uri
|
||||
import androidx.compose.runtime.Immutable
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
|
||||
/**
|
||||
* This sealed class represents all the permalink cases.
|
||||
* You don't have to instantiate yourself but should use [PermalinkParser] instead.
|
||||
*/
|
||||
@Immutable
|
||||
sealed interface PermalinkData {
|
||||
|
||||
data class RoomLink(
|
||||
val roomIdOrAlias: String,
|
||||
val isRoomAlias: Boolean,
|
||||
val eventId: String?,
|
||||
val viaParameters: List<String>
|
||||
val viaParameters: ImmutableList<String>
|
||||
) : PermalinkData
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package io.element.android.libraries.matrix.api.permalink
|
|||
import android.net.Uri
|
||||
import android.net.UrlQuerySanitizer
|
||||
import io.element.android.libraries.matrix.api.core.MatrixPatterns
|
||||
import kotlinx.collections.immutable.toImmutableList
|
||||
import timber.log.Timber
|
||||
import java.net.URLDecoder
|
||||
|
||||
|
|
@ -80,7 +81,7 @@ object PermalinkParser {
|
|||
roomIdOrAlias = decodedIdentifier,
|
||||
isRoomAlias = true,
|
||||
eventId = extraParameter.takeIf { !it.isNullOrEmpty() && MatrixPatterns.isEventId(it) },
|
||||
viaParameters = viaQueryParameters
|
||||
viaParameters = viaQueryParameters.toImmutableList()
|
||||
)
|
||||
}
|
||||
else -> PermalinkData.FallbackLink(uri, MatrixPatterns.isGroupId(identifier))
|
||||
|
|
@ -119,7 +120,7 @@ object PermalinkParser {
|
|||
roomIdOrAlias = identifier,
|
||||
isRoomAlias = false,
|
||||
eventId = extraParameter.takeIf { !it.isNullOrEmpty() && MatrixPatterns.isEventId(it) },
|
||||
viaParameters = viaQueryParameters
|
||||
viaParameters = viaQueryParameters.toImmutableList()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,6 +132,8 @@ interface MatrixRoom : Closeable {
|
|||
|
||||
suspend fun canUserTriggerRoomNotification(userId: UserId): Result<Boolean>
|
||||
|
||||
suspend fun canUserJoinCall(userId: UserId): Result<Boolean>
|
||||
|
||||
suspend fun updateAvatar(mimeType: String, data: ByteArray): Result<Unit>
|
||||
|
||||
suspend fun removeAvatar(): Result<Unit>
|
||||
|
|
|
|||
|
|
@ -16,8 +16,11 @@
|
|||
|
||||
package io.element.android.libraries.matrix.api.room
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import io.element.android.libraries.matrix.api.timeline.item.event.EventTimelineItem
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
|
||||
@Immutable
|
||||
data class MatrixRoomInfo(
|
||||
val id: String,
|
||||
val name: String?,
|
||||
|
|
@ -28,7 +31,7 @@ data class MatrixRoomInfo(
|
|||
val isSpace: Boolean,
|
||||
val isTombstoned: Boolean,
|
||||
val canonicalAlias: String?,
|
||||
val alternativeAliases: List<String>,
|
||||
val alternativeAliases: ImmutableList<String>,
|
||||
val currentUserMembership: CurrentUserMembership,
|
||||
val latestEvent: EventTimelineItem?,
|
||||
val inviter: RoomMember?,
|
||||
|
|
@ -39,5 +42,5 @@ data class MatrixRoomInfo(
|
|||
val notificationCount: Long,
|
||||
val userDefinedNotificationMode: RoomNotificationMode?,
|
||||
val hasRoomCall: Boolean,
|
||||
val activeRoomCallParticipants: List<String>
|
||||
val activeRoomCallParticipants: ImmutableList<String>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,13 +17,14 @@
|
|||
package io.element.android.libraries.matrix.api.room
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
|
||||
@Immutable
|
||||
sealed interface MatrixRoomMembersState {
|
||||
data object Unknown : MatrixRoomMembersState
|
||||
data class Pending(val prevRoomMembers: List<RoomMember>? = null) : MatrixRoomMembersState
|
||||
data class Error(val failure: Throwable, val prevRoomMembers: List<RoomMember>? = null) : MatrixRoomMembersState
|
||||
data class Ready(val roomMembers: List<RoomMember>) : MatrixRoomMembersState
|
||||
data class Pending(val prevRoomMembers: ImmutableList<RoomMember>? = null) : MatrixRoomMembersState
|
||||
data class Error(val failure: Throwable, val prevRoomMembers: ImmutableList<RoomMember>? = null) : MatrixRoomMembersState
|
||||
data class Ready(val roomMembers: ImmutableList<RoomMember>) : MatrixRoomMembersState
|
||||
}
|
||||
|
||||
fun MatrixRoomMembersState.roomMembers(): List<RoomMember>? {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package io.element.android.libraries.matrix.api.roomlist
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
/**
|
||||
|
|
@ -25,6 +26,7 @@ import kotlinx.coroutines.flow.StateFlow
|
|||
*/
|
||||
interface RoomListService {
|
||||
|
||||
@Immutable
|
||||
sealed interface State {
|
||||
data object Idle : State
|
||||
data object Running : State
|
||||
|
|
@ -32,6 +34,7 @@ interface RoomListService {
|
|||
data object Terminated : State
|
||||
}
|
||||
|
||||
@Immutable
|
||||
sealed interface SyncIndicator {
|
||||
data object Show : SyncIndicator
|
||||
data object Hide : SyncIndicator
|
||||
|
|
|
|||
|
|
@ -16,11 +16,15 @@
|
|||
|
||||
package io.element.android.libraries.matrix.api.timeline.item.event
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import io.element.android.libraries.matrix.api.core.UserId
|
||||
import io.element.android.libraries.matrix.api.media.ImageInfo
|
||||
import io.element.android.libraries.matrix.api.poll.PollAnswer
|
||||
import io.element.android.libraries.matrix.api.poll.PollKind
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.ImmutableMap
|
||||
|
||||
@Immutable
|
||||
sealed interface EventContent
|
||||
|
||||
data class MessageContent(
|
||||
|
|
@ -43,14 +47,16 @@ data class PollContent(
|
|||
val question: String,
|
||||
val kind: PollKind,
|
||||
val maxSelections: ULong,
|
||||
val answers: List<PollAnswer>,
|
||||
val votes: Map<String, List<UserId>>,
|
||||
val answers: ImmutableList<PollAnswer>,
|
||||
val votes: ImmutableMap<String, ImmutableList<UserId>>,
|
||||
val endTime: ULong?
|
||||
) : EventContent
|
||||
|
||||
data class UnableToDecryptContent(
|
||||
val data: Data
|
||||
) : EventContent {
|
||||
|
||||
@Immutable
|
||||
sealed interface Data {
|
||||
data class OlmV1Curve25519AesSha2(
|
||||
val senderKey: String
|
||||
|
|
|
|||
|
|
@ -16,7 +16,11 @@
|
|||
|
||||
package io.element.android.libraries.matrix.api.timeline.item.event
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
|
||||
@Immutable
|
||||
data class EventReaction(
|
||||
val key: String,
|
||||
val senders: List<ReactionSender>
|
||||
val senders: ImmutableList<ReactionSender>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import io.element.android.libraries.matrix.api.core.EventId
|
|||
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
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
|
||||
data class EventTimelineItem(
|
||||
val eventId: EventId?,
|
||||
|
|
@ -29,8 +30,8 @@ data class EventTimelineItem(
|
|||
val isOwn: Boolean,
|
||||
val isRemote: Boolean,
|
||||
val localSendState: LocalEventSendState?,
|
||||
val reactions: List<EventReaction>,
|
||||
val receipts: List<Receipt>,
|
||||
val reactions: ImmutableList<EventReaction>,
|
||||
val receipts: ImmutableList<Receipt>,
|
||||
val sender: UserId,
|
||||
val senderProfile: ProfileTimelineDetails,
|
||||
val timestamp: Long,
|
||||
|
|
|
|||
|
|
@ -16,9 +16,11 @@
|
|||
|
||||
package io.element.android.libraries.matrix.api.timeline.item.event
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import io.element.android.libraries.matrix.api.core.EventId
|
||||
import io.element.android.libraries.matrix.api.core.UserId
|
||||
|
||||
@Immutable
|
||||
sealed interface InReplyTo {
|
||||
/** The event details are not loaded yet. We can fetch them. */
|
||||
data class NotLoaded(val eventId: EventId) : InReplyTo
|
||||
|
|
|
|||
|
|
@ -16,8 +16,10 @@
|
|||
|
||||
package io.element.android.libraries.matrix.api.timeline.item.event
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import io.element.android.libraries.matrix.api.core.EventId
|
||||
|
||||
@Immutable
|
||||
sealed interface LocalEventSendState {
|
||||
data object NotSentYet : LocalEventSendState
|
||||
data object Canceled : LocalEventSendState
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package io.element.android.libraries.matrix.api.timeline.item.event
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import io.element.android.libraries.matrix.api.media.AudioDetails
|
||||
import io.element.android.libraries.matrix.api.media.AudioInfo
|
||||
import io.element.android.libraries.matrix.api.media.FileInfo
|
||||
|
|
@ -23,6 +24,7 @@ import io.element.android.libraries.matrix.api.media.ImageInfo
|
|||
import io.element.android.libraries.matrix.api.media.MediaSource
|
||||
import io.element.android.libraries.matrix.api.media.VideoInfo
|
||||
|
||||
@Immutable
|
||||
sealed interface MessageType
|
||||
|
||||
data class EmoteMessageType(
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@
|
|||
|
||||
package io.element.android.libraries.matrix.api.timeline.item.event
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
|
||||
@Immutable
|
||||
sealed interface OtherState {
|
||||
data object PolicyRuleRoom : OtherState
|
||||
data object PolicyRuleServer : OtherState
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@
|
|||
|
||||
package io.element.android.libraries.matrix.api.timeline.item.event
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
|
||||
@Immutable
|
||||
sealed interface ProfileTimelineDetails {
|
||||
data object Unavailable : ProfileTimelineDetails
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@
|
|||
|
||||
package io.element.android.libraries.matrix.api.user
|
||||
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
|
||||
data class MatrixSearchUserResults(
|
||||
val results: List<MatrixUser>,
|
||||
val results: ImmutableList<MatrixUser>,
|
||||
val limited: Boolean,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package io.element.android.libraries.matrix.api.verification
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
|
|
@ -75,6 +77,7 @@ interface SessionVerificationService {
|
|||
}
|
||||
|
||||
/** Verification status of the current session. */
|
||||
@Immutable
|
||||
sealed interface SessionVerifiedStatus {
|
||||
/** Unknown status, we couldn't read the actual value from the SDK. */
|
||||
data object Unknown : SessionVerifiedStatus
|
||||
|
|
@ -87,6 +90,7 @@ sealed interface SessionVerifiedStatus {
|
|||
}
|
||||
|
||||
/** States produced by the [SessionVerificationService]. */
|
||||
@Immutable
|
||||
sealed interface VerificationFlowState {
|
||||
/** Initial state. */
|
||||
data object Initial : VerificationFlowState
|
||||
|
|
@ -98,7 +102,7 @@ sealed interface VerificationFlowState {
|
|||
data object StartedSasVerification : VerificationFlowState
|
||||
|
||||
/** Verification data for the SAS verification (emojis) received. */
|
||||
data class ReceivedVerificationData(val emoji: List<VerificationEmoji>) : VerificationFlowState
|
||||
data class ReceivedVerificationData(val emoji: ImmutableList<VerificationEmoji>) : VerificationFlowState
|
||||
|
||||
/** Verification completed successfully. */
|
||||
data object Finished : VerificationFlowState
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package io.element.android.libraries.matrix.api.permalink
|
||||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
|
|
@ -66,7 +67,7 @@ class PermalinkParserTest {
|
|||
roomIdOrAlias = "!aBCD1234:matrix.org",
|
||||
isRoomAlias = false,
|
||||
eventId = null,
|
||||
viaParameters = emptyList(),
|
||||
viaParameters = persistentListOf(),
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
@ -79,7 +80,7 @@ class PermalinkParserTest {
|
|||
roomIdOrAlias = "!aBCD1234:matrix.org",
|
||||
isRoomAlias = false,
|
||||
eventId = "\$1234567890abcdef:matrix.org",
|
||||
viaParameters = emptyList(),
|
||||
viaParameters = persistentListOf(),
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
@ -92,7 +93,7 @@ class PermalinkParserTest {
|
|||
roomIdOrAlias = "!aBCD1234:matrix.org",
|
||||
isRoomAlias = false,
|
||||
eventId = null,
|
||||
viaParameters = emptyList(),
|
||||
viaParameters = persistentListOf(),
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
@ -105,7 +106,7 @@ class PermalinkParserTest {
|
|||
roomIdOrAlias = "!aBCD1234:matrix.org",
|
||||
isRoomAlias = false,
|
||||
eventId = "\$1234567890abcdef:matrix.org",
|
||||
viaParameters = listOf("matrix.org", "matrix.com"),
|
||||
viaParameters = persistentListOf("matrix.org", "matrix.com"),
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
@ -118,7 +119,7 @@ class PermalinkParserTest {
|
|||
roomIdOrAlias = "#element-android:matrix.org",
|
||||
isRoomAlias = true,
|
||||
eventId = null,
|
||||
viaParameters = emptyList(),
|
||||
viaParameters = persistentListOf(),
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue