Merge branch 'develop' into feature/bma/settingUpAccount

This commit is contained in:
Benoit Marty 2023-08-28 13:02:44 +02:00 committed by GitHub
commit f80eece489
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
100 changed files with 317 additions and 359 deletions

View file

@ -25,7 +25,7 @@ class FirstThrottler(private val minimumInterval: Long = 800) {
private var lastDate = 0L
sealed class CanHandleResult {
object Yes : CanHandleResult()
data object Yes : CanHandleResult()
data class No(val shouldWaitMillis: Long) : CanHandleResult()
fun waitMillis(): Long {

View file

@ -63,7 +63,7 @@ sealed interface Async<out T> {
/**
* Represents an uninitialized operation (i.e. yet to be run).
*/
object Uninitialized : Async<Nothing>
data object Uninitialized : Async<Nothing>
/**
* Returns the data returned by the operation, or null otherwise.

View file

@ -105,7 +105,7 @@ sealed class ElementLogoAtomSize(
val shadowColorLight: Color,
val shadowRadius: Dp,
) {
object Medium : ElementLogoAtomSize(
data object Medium : ElementLogoAtomSize(
outerSize = 120.dp,
logoSize = 83.5.dp,
cornerRadius = 33.dp,
@ -115,7 +115,7 @@ sealed class ElementLogoAtomSize(
shadowRadius = 32.dp,
)
object Large : ElementLogoAtomSize(
data object Large : ElementLogoAtomSize(
outerSize = 158.dp,
logoSize = 110.dp,
cornerRadius = 44.dp,

View file

@ -88,7 +88,7 @@ fun ProgressDialog(
@Immutable
sealed interface ProgressDialogType {
data class Determinate(val progress: Float) : ProgressDialogType
object Indeterminate : ProgressDialogType
data object Indeterminate : ProgressDialogType
}
@Composable

View file

@ -134,9 +134,9 @@ fun ListItem(
* The style to use for a [ListItem].
*/
sealed interface ListItemStyle {
object Default : ListItemStyle
object Primary: ListItemStyle
object Destructive : ListItemStyle
data object Default : ListItemStyle
data object Primary: ListItemStyle
data object Destructive : ListItemStyle
@Composable fun headlineColor() = when (this) {
Default, Primary -> ListItemDefaultColors.headline

View file

@ -122,13 +122,13 @@ object ListSupportingTextDefaults {
/** Specifies the padding to use for the supporting text. */
sealed interface Padding {
/** No padding. */
object None : Padding
data object None : Padding
/** Default padding, it will align fine with a [ListItem] with no leading content. */
object Default : Padding
data object Default : Padding
/** It will align to a [ListItem] with an [Icon] or [Checkbox] as leading content. */
object SmallLeadingContent : Padding
data object SmallLeadingContent : Padding
/** It will align to with a [ListItem] with a [Switch] as leading content. */
object LargeLeadingContent : Padding
data object LargeLeadingContent : Padding
/** It will align to with a [ListItem] with a custom start [padding]. */
data class Custom(val padding: Dp) : Padding

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

@ -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
}

View file

@ -31,7 +31,7 @@ sealed class AvatarAction(
val icon: ImageVector,
val destructive: Boolean = false,
) {
object TakePhoto : AvatarAction(titleResId = CommonStrings.action_take_photo, icon = Icons.Outlined.PhotoCamera)
object ChoosePhoto : AvatarAction(titleResId = CommonStrings.action_choose_photo, icon = Icons.Outlined.PhotoLibrary)
object Remove : AvatarAction(titleResId = CommonStrings.action_remove, icon = Icons.Outlined.Delete, destructive = true)
data object TakePhoto : AvatarAction(titleResId = CommonStrings.action_take_photo, icon = Icons.Outlined.PhotoCamera)
data object ChoosePhoto : AvatarAction(titleResId = CommonStrings.action_choose_photo, icon = Icons.Outlined.PhotoLibrary)
data object Remove : AvatarAction(titleResId = CommonStrings.action_remove, icon = Icons.Outlined.Delete, destructive = true)
}

View file

@ -35,7 +35,7 @@ data class MediaRequestData(
) {
sealed interface Kind {
object Content : Kind
data object Content : Kind
data class File(val body: String?, val mimeType: String) : Kind
data class Thumbnail(val width: Long, val height: Long) : Kind {
constructor(size: Long) : this(size, size)

View file

@ -26,14 +26,14 @@ sealed interface PickerType<Input, Output> {
fun getContract(): ActivityResultContract<Input, Output>
fun getDefaultRequest(): Input
object Image : PickerType<PickVisualMediaRequest, Uri?> {
data object Image : PickerType<PickVisualMediaRequest, Uri?> {
override fun getContract() = ActivityResultContracts.PickVisualMedia()
override fun getDefaultRequest(): PickVisualMediaRequest {
return PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly)
}
}
object ImageAndVideo : PickerType<PickVisualMediaRequest, Uri?> {
data object ImageAndVideo : PickerType<PickVisualMediaRequest, Uri?> {
override fun getContract() = ActivityResultContracts.PickVisualMedia()
override fun getDefaultRequest(): PickVisualMediaRequest {
return PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageAndVideo)

View file

@ -114,7 +114,7 @@ data class ImageCompressionResult(
)
sealed interface ResizeMode {
object None : ResizeMode
data object None : ResizeMode
data class Approximate(val desiredWidth: Int, val desiredHeight: Int) : ResizeMode
data class Strict(val maxWidth: Int, val maxHeight: Int) : ResizeMode
}

View file

@ -17,6 +17,6 @@
package io.element.android.libraries.permissions.api
sealed interface PermissionsEvents {
object OpenSystemDialog : PermissionsEvents
object CloseDialog : PermissionsEvents
data object OpenSystemDialog : PermissionsEvents
data object CloseDialog : PermissionsEvents
}

View file

@ -17,5 +17,5 @@
package io.element.android.libraries.push.api.gateway
sealed class PushGatewayFailure : Throwable(cause = null) {
object PusherRejected : PushGatewayFailure()
data object PusherRejected : PushGatewayFailure()
}

View file

@ -166,6 +166,6 @@ sealed interface OneShotNotification {
}
sealed interface SummaryNotification {
object Removed : SummaryNotification
data object Removed : SummaryNotification
data class Update(val notification: Notification) : SummaryNotification
}

View file

@ -31,9 +31,9 @@ class RegisterUnifiedPushUseCase @Inject constructor(
) {
sealed interface RegisterUnifiedPushResult {
object Success : RegisterUnifiedPushResult
object NeedToAskUserForDistributor : RegisterUnifiedPushResult
object Error : RegisterUnifiedPushResult
data object Success : RegisterUnifiedPushResult
data object NeedToAskUserForDistributor : RegisterUnifiedPushResult
data object Error : RegisterUnifiedPushResult
}
suspend fun execute(matrixClient: MatrixClient, distributor: Distributor, clientSecret: String): RegisterUnifiedPushResult {