Merge branch 'develop' of https://github.com/vector-im/element-x-android into yostyle/notifications_global_settings

This commit is contained in:
David Langley 2023-08-30 15:02:59 +01:00
commit 5e2ec8b504
315 changed files with 3724 additions and 1216 deletions

View file

@ -60,7 +60,8 @@ interface MatrixClient : Closeable {
/**
* Logout the user.
* Returns an optional URL. When the URL is there, it should be presented to the user after logout for RP initiated logout on their account page.
* Returns an optional URL. When the URL is there, it should be presented to the user after logout for
* Relying Party (RP) initiated logout on their account page.
*/
suspend fun logout(): String?
suspend fun loadUserDisplayName(): Result<String>

View file

@ -40,54 +40,53 @@ data class NotificationData(
sealed interface NotificationContent {
sealed interface MessageLike : NotificationContent {
object CallAnswer : MessageLike
object CallInvite : MessageLike
object CallHangup : MessageLike
object CallCandidates : MessageLike
object KeyVerificationReady : MessageLike
object KeyVerificationStart : MessageLike
object KeyVerificationCancel : MessageLike
object KeyVerificationAccept : MessageLike
object KeyVerificationKey : MessageLike
object KeyVerificationMac : MessageLike
object KeyVerificationDone : MessageLike
data object CallAnswer : MessageLike
data object CallInvite : MessageLike
data object CallHangup : MessageLike
data object CallCandidates : MessageLike
data object KeyVerificationReady : MessageLike
data object KeyVerificationStart : MessageLike
data object KeyVerificationCancel : MessageLike
data object KeyVerificationAccept : MessageLike
data object KeyVerificationKey : MessageLike
data object KeyVerificationMac : MessageLike
data object KeyVerificationDone : MessageLike
data class ReactionContent(
val relatedEventId: String
) : MessageLike
object RoomEncrypted : MessageLike
data object RoomEncrypted : MessageLike
data class RoomMessage(
val senderId: UserId,
val messageType: MessageType
) : MessageLike
object RoomRedaction : MessageLike
object Sticker : MessageLike
data object RoomRedaction : MessageLike
data object Sticker : MessageLike
}
sealed interface StateEvent : NotificationContent {
object PolicyRuleRoom : StateEvent
object PolicyRuleServer : StateEvent
object PolicyRuleUser : StateEvent
object RoomAliases : StateEvent
object RoomAvatar : StateEvent
object RoomCanonicalAlias : StateEvent
object RoomCreate : StateEvent
object RoomEncryption : StateEvent
object RoomGuestAccess : StateEvent
object RoomHistoryVisibility : StateEvent
object RoomJoinRules : StateEvent
data object PolicyRuleRoom : StateEvent
data object PolicyRuleServer : StateEvent
data object PolicyRuleUser : StateEvent
data object RoomAliases : StateEvent
data object RoomAvatar : StateEvent
data object RoomCanonicalAlias : StateEvent
data object RoomCreate : StateEvent
data object RoomEncryption : StateEvent
data object RoomGuestAccess : StateEvent
data object RoomHistoryVisibility : StateEvent
data object RoomJoinRules : StateEvent
data class RoomMemberContent(
val userId: String,
val membershipState: RoomMembershipState
) : StateEvent
object RoomName : StateEvent
object RoomPinnedEvents : StateEvent
object RoomPowerLevels : StateEvent
object RoomServerAcl : StateEvent
object RoomThirdPartyInvite : StateEvent
object RoomTombstone : StateEvent
object RoomTopic : StateEvent
object SpaceChild : StateEvent
object SpaceParent : StateEvent
data object RoomName : StateEvent
data object RoomPinnedEvents : StateEvent
data object RoomPowerLevels : StateEvent
data object RoomServerAcl : StateEvent
data object RoomThirdPartyInvite : StateEvent
data object RoomTombstone : StateEvent
data object RoomTopic : StateEvent
data object SpaceChild : StateEvent
data object SpaceParent : StateEvent
}
}

View file

@ -84,7 +84,7 @@ object PermalinkBuilder {
}
sealed class PermalinkBuilderError : Throwable() {
object InvalidRoomAlias : PermalinkBuilderError()
object InvalidRoomId : PermalinkBuilderError()
object InvalidUserId : PermalinkBuilderError()
data object InvalidRoomAlias : PermalinkBuilderError()
data object InvalidRoomId : PermalinkBuilderError()
data object InvalidUserId : PermalinkBuilderError()
}

View file

@ -20,5 +20,8 @@ enum class PollKind {
Disclosed,
/** Results should be only revealed when the poll is ended. */
Undisclosed
Undisclosed,
}
val PollKind.isDisclosed: Boolean
get() = this == PollKind.Disclosed

View file

@ -17,7 +17,7 @@
package io.element.android.libraries.matrix.api.room
sealed interface MatrixRoomMembersState {
object Unknown : 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

View file

@ -29,7 +29,7 @@ import kotlin.time.Duration
*/
interface RoomList {
sealed class LoadingState {
object NotLoaded : LoadingState()
data object NotLoaded : LoadingState()
data class Loaded(val numberOfRooms: Int) : LoadingState()
}

View file

@ -26,10 +26,10 @@ import kotlinx.coroutines.flow.StateFlow
interface RoomListService {
sealed class State {
object Idle : State()
object Running : State()
object Error : State()
object Terminated : State()
data object Idle : State()
data object Running : State()
data object Error : State()
data object Terminated : State()
}
/**

View file

@ -28,6 +28,6 @@ sealed interface MatrixTimelineItem {
}
data class Virtual(val uniqueId: Long, val virtual: VirtualTimelineItem) : MatrixTimelineItem
object Other : MatrixTimelineItem
data object Other : MatrixTimelineItem
}

View file

@ -17,5 +17,5 @@
package io.element.android.libraries.matrix.api.timeline
sealed class TimelineException : Exception() {
object CannotPaginate : TimelineException()
data object CannotPaginate : TimelineException()
}

View file

@ -35,13 +35,12 @@ data class MessageContent(
val type: MessageType?
) : EventContent
sealed interface InReplyTo {
/** The event details are not loaded yet. We can fetch them. */
data class NotLoaded(val eventId: EventId) : InReplyTo
/** The event details are pending to be fetched. We should **not** fetch them again. */
object Pending : InReplyTo
data object Pending : InReplyTo
/** The event details are available. */
data class Ready(
@ -60,7 +59,7 @@ sealed interface InReplyTo {
* If the reason for the failure is consistent on the server, we'd enter a loop
* where we keep trying to fetch the same event.
* */
object Error : InReplyTo
data object Error : InReplyTo
}
object RedactedContent : EventContent
@ -92,7 +91,7 @@ data class UnableToDecryptContent(
val sessionId: String
) : Data
object Unknown : Data
data object Unknown : Data
}
}
@ -205,55 +204,25 @@ enum class MembershipChange {
}
sealed interface OtherState {
object PolicyRuleRoom : OtherState
object PolicyRuleServer : OtherState
object PolicyRuleUser : OtherState
object RoomAliases : OtherState
data class RoomAvatar(
val url: String?
) : OtherState
object RoomCanonicalAlias : OtherState
object RoomCreate : OtherState
object RoomEncryption : OtherState
object RoomGuestAccess : OtherState
object RoomHistoryVisibility : OtherState
object RoomJoinRules : OtherState
data class RoomName(
val name: String?
) : OtherState
object RoomPinnedEvents : OtherState
object RoomPowerLevels : OtherState
object RoomServerAcl : OtherState
data class RoomThirdPartyInvite(
val displayName: String?
) : OtherState
object RoomTombstone : OtherState
data class RoomTopic(
val topic: String?
) : OtherState
object SpaceChild : OtherState
object SpaceParent : OtherState
data class Custom(
val eventType: String
) : OtherState
data object PolicyRuleRoom : OtherState
data object PolicyRuleServer : OtherState
data object PolicyRuleUser : OtherState
data object RoomAliases : OtherState
data class RoomAvatar(val url: String?) : OtherState
data object RoomCanonicalAlias : OtherState
data object RoomCreate : OtherState
data object RoomEncryption : OtherState
data object RoomGuestAccess : OtherState
data object RoomHistoryVisibility : OtherState
data object RoomJoinRules : OtherState
data class RoomName(val name: String?) : OtherState
data object RoomPinnedEvents : OtherState
data object RoomPowerLevels : OtherState
data object RoomServerAcl : OtherState
data class RoomThirdPartyInvite(val displayName: String?) : OtherState
data object RoomTombstone : OtherState
data class RoomTopic(val topic: String?) : OtherState
data object SpaceChild : OtherState
data object SpaceParent : OtherState
data class Custom(val eventType: String) : OtherState
}

View file

@ -19,8 +19,8 @@ package io.element.android.libraries.matrix.api.timeline.item.event
import io.element.android.libraries.matrix.api.core.EventId
sealed interface LocalEventSendState {
object NotSentYet : LocalEventSendState
object Canceled : LocalEventSendState
data object NotSentYet : LocalEventSendState
data object Canceled : LocalEventSendState
data class SendingFailed(
val error: String

View file

@ -17,9 +17,9 @@
package io.element.android.libraries.matrix.api.timeline.item.event
sealed interface ProfileTimelineDetails {
object Unavailable : ProfileTimelineDetails
data object Unavailable : ProfileTimelineDetails
object Pending : ProfileTimelineDetails
data object Pending : ProfileTimelineDetails
data class Ready(
val displayName: String?,

View file

@ -22,7 +22,7 @@ sealed interface VirtualTimelineItem {
val timestamp: Long
) : VirtualTimelineItem
object ReadMarker : VirtualTimelineItem
data object ReadMarker : VirtualTimelineItem
object EncryptedHistoryBanner : VirtualTimelineItem
data object EncryptedHistoryBanner : VirtualTimelineItem
}

View file

@ -60,11 +60,11 @@ enum class Target(open val filter: String) {
}
sealed class LogLevel(val filter: String) {
object Warn : LogLevel("warn")
object Trace : LogLevel("trace")
object Info : LogLevel("info")
object Debug : LogLevel("debug")
object Error : LogLevel("error")
data object Warn : LogLevel("warn")
data object Trace : LogLevel("trace")
data object Info : LogLevel("info")
data object Debug : LogLevel("debug")
data object Error : LogLevel("error")
}
object TracingFilterConfigurations {

View file

@ -17,6 +17,6 @@
package io.element.android.libraries.matrix.api.tracing
sealed class WriteToFilesConfiguration {
object Disabled : WriteToFilesConfiguration()
data object Disabled : WriteToFilesConfiguration()
data class Enabled(val directory: String, val filenamePrefix: String) : WriteToFilesConfiguration()
}

View file

@ -77,35 +77,35 @@ interface SessionVerificationService {
/** Verification status of the current session. */
sealed interface SessionVerifiedStatus {
/** Unknown status, we couldn't read the actual value from the SDK. */
object Unknown : SessionVerifiedStatus
data object Unknown : SessionVerifiedStatus
/** Not verified session status. */
object NotVerified : SessionVerifiedStatus
data object NotVerified : SessionVerifiedStatus
/** Verified session status. */
object Verified : SessionVerifiedStatus
data object Verified : SessionVerifiedStatus
}
/** States produced by the [SessionVerificationService]. */
sealed interface VerificationFlowState {
/** Initial state. */
object Initial : VerificationFlowState
data object Initial : VerificationFlowState
/** Session verification request was accepted by another device. */
object AcceptedVerificationRequest : VerificationFlowState
data object AcceptedVerificationRequest : VerificationFlowState
/** Short Authentication String (SAS) verification started between the 2 devices. */
object StartedSasVerification : VerificationFlowState
data object StartedSasVerification : VerificationFlowState
/** Verification data for the SAS verification (emojis) received. */
data class ReceivedVerificationData(val emoji: List<VerificationEmoji>) : VerificationFlowState
/** Verification completed successfully. */
object Finished : VerificationFlowState
data object Finished : VerificationFlowState
/** Verification was cancelled by either device. */
object Canceled : VerificationFlowState
data object Canceled : VerificationFlowState
/** Verification failed with an error. */
object Failed : VerificationFlowState
data object Failed : VerificationFlowState
}