migrate object to data object (#1135)

This commit is contained in:
Benoit Marty 2023-08-24 09:32:44 +02:00
parent 2fadaa9cf5
commit 52853101d9
98 changed files with 314 additions and 357 deletions

View file

@ -178,10 +178,10 @@ class LoggedInFlowNode @AssistedInject constructor(
sealed interface NavTarget : Parcelable { sealed interface NavTarget : Parcelable {
@Parcelize @Parcelize
object Permanent : NavTarget data object Permanent : NavTarget
@Parcelize @Parcelize
object RoomList : NavTarget data object RoomList : NavTarget
@Parcelize @Parcelize
data class Room( data class Room(
@ -190,19 +190,19 @@ class LoggedInFlowNode @AssistedInject constructor(
) : NavTarget ) : NavTarget
@Parcelize @Parcelize
object Settings : NavTarget data object Settings : NavTarget
@Parcelize @Parcelize
object CreateRoom : NavTarget data object CreateRoom : NavTarget
@Parcelize @Parcelize
object VerifySession : NavTarget data object VerifySession : NavTarget
@Parcelize @Parcelize
object InviteList : NavTarget data object InviteList : NavTarget
@Parcelize @Parcelize
object Ftue : NavTarget data object Ftue : NavTarget
} }
override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node { override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node {

View file

@ -64,7 +64,7 @@ class NotLoggedInFlowNode @AssistedInject constructor(
sealed interface NavTarget : Parcelable { sealed interface NavTarget : Parcelable {
@Parcelize @Parcelize
object OnBoarding : NavTarget data object OnBoarding : NavTarget
@Parcelize @Parcelize
data class LoginFlow( data class LoginFlow(

View file

@ -170,10 +170,10 @@ class RootFlowNode @AssistedInject constructor(
sealed interface NavTarget : Parcelable { sealed interface NavTarget : Parcelable {
@Parcelize @Parcelize
object SplashScreen : NavTarget data object SplashScreen : NavTarget
@Parcelize @Parcelize
object NotLoggedInFlow : NavTarget data object NotLoggedInFlow : NavTarget
@Parcelize @Parcelize
data class LoggedInFlow( data class LoggedInFlow(
@ -182,7 +182,7 @@ class RootFlowNode @AssistedInject constructor(
) : NavTarget ) : NavTarget
@Parcelize @Parcelize
object BugReport : NavTarget data object BugReport : NavTarget
} }
override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node { override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node {

View file

@ -17,5 +17,5 @@
package io.element.android.appnav.loggedin package io.element.android.appnav.loggedin
// sealed interface LoggedInEvents { // sealed interface LoggedInEvents {
// object MyEvent : LoggedInEvents // data object MyEvent : LoggedInEvents
// } // }

View file

@ -32,8 +32,8 @@ import kotlinx.coroutines.flow.stateIn
import javax.inject.Inject import javax.inject.Inject
sealed interface LoadingRoomState { sealed interface LoadingRoomState {
object Loading : LoadingRoomState data object Loading : LoadingRoomState
object Error : LoadingRoomState data object Error : LoadingRoomState
data class Loaded(val room: MatrixRoom) : LoadingRoomState data class Loaded(val room: MatrixRoom) : LoadingRoomState
} }

View file

@ -77,10 +77,10 @@ class RoomFlowNode @AssistedInject constructor(
sealed interface NavTarget : Parcelable { sealed interface NavTarget : Parcelable {
@Parcelize @Parcelize
object Loading : NavTarget data object Loading : NavTarget
@Parcelize @Parcelize
object Loaded : NavTarget data object Loaded : NavTarget
} }
override fun onBuilt() { override fun onBuilt() {

View file

@ -152,10 +152,10 @@ class RoomLoadedFlowNode @AssistedInject constructor(
sealed interface NavTarget : Parcelable { sealed interface NavTarget : Parcelable {
@Parcelize @Parcelize
object Messages : NavTarget data object Messages : NavTarget
@Parcelize @Parcelize
object RoomDetails : NavTarget data object RoomDetails : NavTarget
@Parcelize @Parcelize
data class RoomMemberDetails(val userId: UserId) : NavTarget data class RoomMemberDetails(val userId: UserId) : NavTarget

View file

@ -63,10 +63,10 @@ class ConfigureRoomFlowNode @AssistedInject constructor(
sealed interface NavTarget : Parcelable { sealed interface NavTarget : Parcelable {
@Parcelize @Parcelize
object Root : NavTarget data object Root : NavTarget
@Parcelize @Parcelize
object ConfigureRoom : NavTarget data object ConfigureRoom : NavTarget
} }
override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node { override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node {

View file

@ -54,10 +54,10 @@ class CreateRoomFlowNode @AssistedInject constructor(
sealed interface NavTarget : Parcelable { sealed interface NavTarget : Parcelable {
@Parcelize @Parcelize
object Root : NavTarget data object Root : NavTarget
@Parcelize @Parcelize
object NewRoom : NavTarget data object NewRoom : NavTarget
} }
override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node { override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node {

View file

@ -27,5 +27,5 @@ sealed interface ConfigureRoomEvents {
data class RemoveFromSelection(val matrixUser: MatrixUser) : ConfigureRoomEvents data class RemoveFromSelection(val matrixUser: MatrixUser) : ConfigureRoomEvents
data class CreateRoom(val config: CreateRoomConfig) : ConfigureRoomEvents data class CreateRoom(val config: CreateRoomConfig) : ConfigureRoomEvents
data class HandleAvatarAction(val action: AvatarAction) : ConfigureRoomEvents data class HandleAvatarAction(val action: AvatarAction) : ConfigureRoomEvents
object CancelCreateRoom : ConfigureRoomEvents data object CancelCreateRoom : ConfigureRoomEvents
} }

View file

@ -20,5 +20,5 @@ import io.element.android.libraries.matrix.api.user.MatrixUser
sealed interface CreateRoomRootEvents { sealed interface CreateRoomRootEvents {
data class StartDM(val matrixUser: MatrixUser) : CreateRoomRootEvents data class StartDM(val matrixUser: MatrixUser) : CreateRoomRootEvents
object CancelStartDM : CreateRoomRootEvents data object CancelStartDM : CreateRoomRootEvents
} }

View file

@ -69,13 +69,13 @@ class FtueFlowNode @AssistedInject constructor(
sealed interface NavTarget : Parcelable { sealed interface NavTarget : Parcelable {
@Parcelize @Parcelize
object Placeholder : NavTarget data object Placeholder : NavTarget
@Parcelize @Parcelize
object WelcomeScreen : NavTarget data object WelcomeScreen : NavTarget
@Parcelize @Parcelize
object AnalyticsOptIn : NavTarget data object AnalyticsOptIn : NavTarget
} }
private val callback = plugins.filterIsInstance<FtueEntryPoint.Callback>().firstOrNull() private val callback = plugins.filterIsInstance<FtueEntryPoint.Callback>().firstOrNull()

View file

@ -89,6 +89,6 @@ class DefaultFtueState @Inject constructor(
} }
sealed interface FtueStep { sealed interface FtueStep {
object WelcomeScreen : FtueStep data object WelcomeScreen : FtueStep
object AnalyticsOptIn : FtueStep data object AnalyticsOptIn : FtueStep
} }

View file

@ -19,14 +19,12 @@ package io.element.android.features.invitelist.impl
import io.element.android.features.invitelist.impl.model.InviteListInviteSummary import io.element.android.features.invitelist.impl.model.InviteListInviteSummary
sealed interface InviteListEvents { sealed interface InviteListEvents {
data class AcceptInvite(val invite: InviteListInviteSummary) : InviteListEvents data class AcceptInvite(val invite: InviteListInviteSummary) : InviteListEvents
data class DeclineInvite(val invite: InviteListInviteSummary) : InviteListEvents data class DeclineInvite(val invite: InviteListInviteSummary) : InviteListEvents
object ConfirmDeclineInvite: InviteListEvents data object ConfirmDeclineInvite: InviteListEvents
object CancelDeclineInvite: InviteListEvents data object CancelDeclineInvite: InviteListEvents
object DismissAcceptError: InviteListEvents
object DismissDeclineError: InviteListEvents
data object DismissAcceptError: InviteListEvents
data object DismissDeclineError: InviteListEvents
} }

View file

@ -32,6 +32,6 @@ data class InviteListState(
) )
sealed interface InviteDeclineConfirmationDialog { sealed interface InviteDeclineConfirmationDialog {
object Hidden : InviteDeclineConfirmationDialog data object Hidden : InviteDeclineConfirmationDialog
data class Visible(val isDirect: Boolean, val name: String) : InviteDeclineConfirmationDialog data class Visible(val isDirect: Boolean, val name: String) : InviteDeclineConfirmationDialog
} }

View file

@ -20,7 +20,7 @@ import io.element.android.libraries.matrix.api.core.RoomId
sealed interface LeaveRoomEvent { sealed interface LeaveRoomEvent {
data class ShowConfirmation(val roomId: RoomId) : LeaveRoomEvent data class ShowConfirmation(val roomId: RoomId) : LeaveRoomEvent
object HideConfirmation : LeaveRoomEvent data object HideConfirmation : LeaveRoomEvent
data class LeaveRoom(val roomId: RoomId) : LeaveRoomEvent data class LeaveRoom(val roomId: RoomId) : LeaveRoomEvent
object HideError : LeaveRoomEvent data object HideError : LeaveRoomEvent
} }

View file

@ -25,19 +25,19 @@ data class LeaveRoomState(
val eventSink: (LeaveRoomEvent) -> Unit = {}, val eventSink: (LeaveRoomEvent) -> Unit = {},
) { ) {
sealed interface Confirmation { sealed interface Confirmation {
object Hidden : Confirmation data object Hidden : Confirmation
data class Generic(val roomId: RoomId) : Confirmation data class Generic(val roomId: RoomId) : Confirmation
data class PrivateRoom(val roomId: RoomId) : Confirmation data class PrivateRoom(val roomId: RoomId) : Confirmation
data class LastUserInRoom(val roomId: RoomId) : Confirmation data class LastUserInRoom(val roomId: RoomId) : Confirmation
} }
sealed interface Progress { sealed interface Progress {
object Hidden : Progress data object Hidden : Progress
object Shown : Progress data object Shown : Progress
} }
sealed interface Error { sealed interface Error {
object Hidden : Error data object Hidden : Error
object Shown : Error data object Shown : Error
} }
} }

View file

@ -17,5 +17,5 @@
package io.element.android.features.location.impl.common.permissions package io.element.android.features.location.impl.common.permissions
sealed interface PermissionsEvents { sealed interface PermissionsEvents {
object RequestPermissions : PermissionsEvents data object RequestPermissions : PermissionsEvents
} }

View file

@ -22,9 +22,9 @@ data class PermissionsState(
val eventSink: (PermissionsEvents) -> Unit = {}, val eventSink: (PermissionsEvents) -> Unit = {},
) { ) {
sealed interface Permissions { sealed interface Permissions {
object AllGranted : Permissions data object AllGranted : Permissions
object SomeGranted : Permissions data object SomeGranted : Permissions
object NoneGranted : Permissions data object NoneGranted : Permissions
} }
val isAnyGranted: Boolean val isAnyGranted: Boolean

View file

@ -30,13 +30,9 @@ sealed interface SendLocationEvents {
) )
} }
object SwitchToMyLocationMode : SendLocationEvents data object SwitchToMyLocationMode : SendLocationEvents
data object SwitchToPinLocationMode : SendLocationEvents
object SwitchToPinLocationMode : SendLocationEvents data object DismissDialog : SendLocationEvents
data object RequestPermissions : SendLocationEvents
object DismissDialog : SendLocationEvents data object OpenAppSettings : SendLocationEvents
object RequestPermissions : SendLocationEvents
object OpenAppSettings : SendLocationEvents
} }

View file

@ -24,13 +24,13 @@ data class SendLocationState(
val eventSink: (SendLocationEvents) -> Unit = {}, val eventSink: (SendLocationEvents) -> Unit = {},
) { ) {
sealed interface Mode { sealed interface Mode {
object SenderLocation : Mode data object SenderLocation : Mode
object PinLocation : Mode data object PinLocation : Mode
} }
sealed interface Dialog { sealed interface Dialog {
object None : Dialog data object None : Dialog
object PermissionRationale : Dialog data object PermissionRationale : Dialog
object PermissionDenied : Dialog data object PermissionDenied : Dialog
} }
} }

View file

@ -17,11 +17,9 @@
package io.element.android.features.location.impl.show package io.element.android.features.location.impl.show
sealed interface ShowLocationEvents { sealed interface ShowLocationEvents {
object Share : ShowLocationEvents data object Share : ShowLocationEvents
data class TrackMyLocation(val enabled: Boolean) : ShowLocationEvents data class TrackMyLocation(val enabled: Boolean) : ShowLocationEvents
object DismissDialog : ShowLocationEvents data object DismissDialog : ShowLocationEvents
data object RequestPermissions : ShowLocationEvents
object RequestPermissions : ShowLocationEvents data object OpenAppSettings : ShowLocationEvents
object OpenAppSettings : ShowLocationEvents
} }

View file

@ -28,8 +28,8 @@ data class ShowLocationState(
val eventSink: (ShowLocationEvents) -> Unit, val eventSink: (ShowLocationEvents) -> Unit,
) { ) {
sealed interface Dialog { sealed interface Dialog {
object None : Dialog data object None : Dialog
object PermissionRationale : Dialog data object PermissionRationale : Dialog
object PermissionDenied : Dialog data object PermissionDenied : Dialog
} }
} }

View file

@ -17,6 +17,6 @@
package io.element.android.features.login.api.oidc package io.element.android.features.login.api.oidc
sealed interface OidcAction { sealed interface OidcAction {
object GoBack : OidcAction data object GoBack : OidcAction
data class Success(val url: String) : OidcAction data class Success(val url: String) : OidcAction
} }

View file

@ -85,16 +85,16 @@ class LoginFlowNode @AssistedInject constructor(
sealed interface NavTarget : Parcelable { sealed interface NavTarget : Parcelable {
@Parcelize @Parcelize
object ConfirmAccountProvider : NavTarget data object ConfirmAccountProvider : NavTarget
@Parcelize @Parcelize
object ChangeAccountProvider : NavTarget data object ChangeAccountProvider : NavTarget
@Parcelize @Parcelize
object SearchAccountProvider : NavTarget data object SearchAccountProvider : NavTarget
@Parcelize @Parcelize
object LoginPassword : NavTarget data object LoginPassword : NavTarget
@Parcelize @Parcelize
data class WaitList(val loginFormState: LoginFormState) : NavTarget data class WaitList(val loginFormState: LoginFormState) : NavTarget

View file

@ -20,5 +20,5 @@ import io.element.android.features.login.impl.accountprovider.AccountProvider
sealed interface ChangeServerEvents { sealed interface ChangeServerEvents {
data class ChangeServer(val accountProvider: AccountProvider) : ChangeServerEvents data class ChangeServer(val accountProvider: AccountProvider) : ChangeServerEvents
object ClearError : ChangeServerEvents data object ClearError : ChangeServerEvents
} }

View file

@ -27,7 +27,7 @@ sealed class ChangeServerError : Throwable() {
@Composable @Composable
fun message(): String = stringResource(messageId) fun message(): String = stringResource(messageId)
} }
object SlidingSyncAlert : ChangeServerError() data object SlidingSyncAlert : ChangeServerError()
companion object { companion object {
fun from(error: Throwable): ChangeServerError = when (error) { fun from(error: Throwable): ChangeServerError = when (error) {

View file

@ -19,7 +19,7 @@ package io.element.android.features.login.impl.oidc.webview
import io.element.android.features.login.api.oidc.OidcAction import io.element.android.features.login.api.oidc.OidcAction
sealed interface OidcEvents { sealed interface OidcEvents {
object Cancel : OidcEvents data object Cancel : OidcEvents
data class OidcActionEvent(val oidcAction: OidcAction): OidcEvents data class OidcActionEvent(val oidcAction: OidcAction): OidcEvents
object ClearError : OidcEvents data object ClearError : OidcEvents
} }

View file

@ -17,6 +17,6 @@
package io.element.android.features.login.impl.screens.confirmaccountprovider package io.element.android.features.login.impl.screens.confirmaccountprovider
sealed interface ConfirmAccountProviderEvents { sealed interface ConfirmAccountProviderEvents {
object Continue : ConfirmAccountProviderEvents data object Continue : ConfirmAccountProviderEvents
object ClearError : ConfirmAccountProviderEvents data object ClearError : ConfirmAccountProviderEvents
} }

View file

@ -31,6 +31,6 @@ data class ConfirmAccountProviderState(
} }
sealed interface LoginFlow { sealed interface LoginFlow {
object PasswordLogin : LoginFlow data object PasswordLogin : LoginFlow
data class OidcFlow(val oidcDetails: OidcDetails) : LoginFlow data class OidcFlow(val oidcDetails: OidcDetails) : LoginFlow
} }

View file

@ -19,6 +19,6 @@ package io.element.android.features.login.impl.screens.loginpassword
sealed interface LoginPasswordEvents { sealed interface LoginPasswordEvents {
data class SetLogin(val login: String) : LoginPasswordEvents data class SetLogin(val login: String) : LoginPasswordEvents
data class SetPassword(val password: String) : LoginPasswordEvents data class SetPassword(val password: String) : LoginPasswordEvents
object Submit : LoginPasswordEvents data object Submit : LoginPasswordEvents
object ClearError : LoginPasswordEvents data object ClearError : LoginPasswordEvents
} }

View file

@ -17,7 +17,7 @@
package io.element.android.features.login.impl.screens.waitlistscreen package io.element.android.features.login.impl.screens.waitlistscreen
sealed interface WaitListEvents { sealed interface WaitListEvents {
object AttemptLogin : WaitListEvents data object AttemptLogin : WaitListEvents
object ClearError : WaitListEvents data object ClearError : WaitListEvents
object Continue : WaitListEvents data object Continue : WaitListEvents
} }

View file

@ -17,5 +17,5 @@
package io.element.android.features.logout.api package io.element.android.features.logout.api
sealed interface LogoutPreferenceEvents { sealed interface LogoutPreferenceEvents {
object Logout : LogoutPreferenceEvents data object Logout : LogoutPreferenceEvents
} }

View file

@ -24,7 +24,7 @@ sealed interface MessagesEvents {
data class HandleAction(val action: TimelineItemAction, val event: TimelineItem.Event) : MessagesEvents data class HandleAction(val action: TimelineItemAction, val event: TimelineItem.Event) : MessagesEvents
data class ToggleReaction(val emoji: String, val eventId: EventId) : MessagesEvents data class ToggleReaction(val emoji: String, val eventId: EventId) : MessagesEvents
data class InviteDialogDismissed(val action: InviteDialogAction) : MessagesEvents data class InviteDialogDismissed(val action: InviteDialogAction) : MessagesEvents
object Dismiss : MessagesEvents data object Dismiss : MessagesEvents
} }
enum class InviteDialogAction { enum class InviteDialogAction {

View file

@ -75,7 +75,7 @@ class MessagesFlowNode @AssistedInject constructor(
sealed interface NavTarget : Parcelable { sealed interface NavTarget : Parcelable {
@Parcelize @Parcelize
object Messages : NavTarget data object Messages : NavTarget
@Parcelize @Parcelize
data class MediaViewer( data class MediaViewer(
@ -100,7 +100,7 @@ class MessagesFlowNode @AssistedInject constructor(
data class ReportMessage(val eventId: EventId, val senderId: UserId) : NavTarget data class ReportMessage(val eventId: EventId, val senderId: UserId) : NavTarget
@Parcelize @Parcelize
object SendLocation : NavTarget data object SendLocation : NavTarget
} }
private val callback = plugins<MessagesEntryPoint.Callback>().firstOrNull() private val callback = plugins<MessagesEntryPoint.Callback>().firstOrNull()

View file

@ -19,6 +19,6 @@ package io.element.android.features.messages.impl.actionlist
import io.element.android.features.messages.impl.timeline.model.TimelineItem import io.element.android.features.messages.impl.timeline.model.TimelineItem
sealed interface ActionListEvents { sealed interface ActionListEvents {
object Clear : ActionListEvents data object Clear : ActionListEvents
data class ComputeForMessage(val event: TimelineItem.Event, val canRedact: Boolean) : ActionListEvents data class ComputeForMessage(val event: TimelineItem.Event, val canRedact: Boolean) : ActionListEvents
} }

View file

@ -28,7 +28,7 @@ data class ActionListState(
val eventSink: (ActionListEvents) -> Unit, val eventSink: (ActionListEvents) -> Unit,
) { ) {
sealed interface Target { sealed interface Target {
object None : Target data object None : Target
data class Loading(val event: TimelineItem.Event) : Target data class Loading(val event: TimelineItem.Event) : Target
data class Success( data class Success(
val event: TimelineItem.Event, val event: TimelineItem.Event,

View file

@ -28,11 +28,11 @@ sealed class TimelineItemAction(
@DrawableRes val icon: Int, @DrawableRes val icon: Int,
val destructive: Boolean = false val destructive: Boolean = false
) { ) {
object Forward : TimelineItemAction(CommonStrings.action_forward, VectorIcons.Forward) data object Forward : TimelineItemAction(CommonStrings.action_forward, VectorIcons.Forward)
object Copy : TimelineItemAction(CommonStrings.action_copy, VectorIcons.Copy) data object Copy : TimelineItemAction(CommonStrings.action_copy, VectorIcons.Copy)
object Redact : TimelineItemAction(CommonStrings.action_remove, VectorIcons.Delete, destructive = true) data object Redact : TimelineItemAction(CommonStrings.action_remove, VectorIcons.Delete, destructive = true)
object Reply : TimelineItemAction(CommonStrings.action_reply, VectorIcons.Reply) data object Reply : TimelineItemAction(CommonStrings.action_reply, VectorIcons.Reply)
object Edit : TimelineItemAction(CommonStrings.action_edit, VectorIcons.Edit) data object Edit : TimelineItemAction(CommonStrings.action_edit, VectorIcons.Edit)
object Developer : TimelineItemAction(CommonStrings.action_view_source, VectorIcons.DeveloperMode) data object Developer : TimelineItemAction(CommonStrings.action_view_source, VectorIcons.DeveloperMode)
object ReportContent : TimelineItemAction(CommonStrings.action_report_content, VectorIcons.ReportContent, destructive = true) data object ReportContent : TimelineItemAction(CommonStrings.action_report_content, VectorIcons.ReportContent, destructive = true)
} }

View file

@ -20,6 +20,6 @@ import androidx.compose.runtime.Immutable
@Immutable @Immutable
sealed interface AttachmentsPreviewEvents { sealed interface AttachmentsPreviewEvents {
object SendAttachment : AttachmentsPreviewEvents data object SendAttachment : AttachmentsPreviewEvents
object ClearSendState : AttachmentsPreviewEvents data object ClearSendState : AttachmentsPreviewEvents
} }

View file

@ -25,13 +25,13 @@ data class AttachmentsPreviewState(
) )
sealed interface SendActionState { sealed interface SendActionState {
object Idle : SendActionState data object Idle : SendActionState
sealed interface Sending : SendActionState { sealed interface Sending : SendActionState {
object Processing : Sending data object Processing : Sending
data class Uploading(val progress: Float) : Sending data class Uploading(val progress: Float) : Sending
} }
data class Failure(val error: Throwable) : SendActionState data class Failure(val error: Throwable) : SendActionState
object Done : SendActionState data object Done : SendActionState
} }

View file

@ -21,9 +21,9 @@ import io.element.android.libraries.matrix.api.roomlist.RoomSummaryDetails
sealed interface ForwardMessagesEvents { sealed interface ForwardMessagesEvents {
data class SetSelectedRoom(val room: RoomSummaryDetails) : ForwardMessagesEvents data class SetSelectedRoom(val room: RoomSummaryDetails) : ForwardMessagesEvents
// TODO remove to restore multi-selection // TODO remove to restore multi-selection
object RemoveSelectedRoom : ForwardMessagesEvents data object RemoveSelectedRoom : ForwardMessagesEvents
object ToggleSearchActive : ForwardMessagesEvents data object ToggleSearchActive : ForwardMessagesEvents
data class UpdateQuery(val query: String) : ForwardMessagesEvents data class UpdateQuery(val query: String) : ForwardMessagesEvents
object ForwardEvent : ForwardMessagesEvents data object ForwardEvent : ForwardMessagesEvents
object ClearError : ForwardMessagesEvents data object ClearError : ForwardMessagesEvents
} }

View file

@ -17,9 +17,9 @@
package io.element.android.features.messages.impl.media.viewer package io.element.android.features.messages.impl.media.viewer
sealed interface MediaViewerEvents { sealed interface MediaViewerEvents {
object SaveOnDisk: MediaViewerEvents data object SaveOnDisk: MediaViewerEvents
object Share: MediaViewerEvents data object Share: MediaViewerEvents
object OpenWith: MediaViewerEvents data object OpenWith: MediaViewerEvents
object RetryLoading : MediaViewerEvents data object RetryLoading : MediaViewerEvents
object ClearLoadingError : MediaViewerEvents data object ClearLoadingError : MediaViewerEvents
} }

View file

@ -21,20 +21,20 @@ import io.element.android.libraries.textcomposer.MessageComposerMode
@Immutable @Immutable
sealed interface MessageComposerEvents { sealed interface MessageComposerEvents {
object ToggleFullScreenState : MessageComposerEvents data object ToggleFullScreenState : MessageComposerEvents
data class FocusChanged(val hasFocus: Boolean) : MessageComposerEvents data class FocusChanged(val hasFocus: Boolean) : MessageComposerEvents
data class SendMessage(val message: String) : MessageComposerEvents data class SendMessage(val message: String) : MessageComposerEvents
object CloseSpecialMode : MessageComposerEvents data object CloseSpecialMode : MessageComposerEvents
data class SetMode(val composerMode: MessageComposerMode) : MessageComposerEvents data class SetMode(val composerMode: MessageComposerMode) : MessageComposerEvents
data class UpdateText(val text: String) : MessageComposerEvents data class UpdateText(val text: String) : MessageComposerEvents
object AddAttachment : MessageComposerEvents data object AddAttachment : MessageComposerEvents
object DismissAttachmentMenu : MessageComposerEvents data object DismissAttachmentMenu : MessageComposerEvents
sealed interface PickAttachmentSource : MessageComposerEvents { sealed interface PickAttachmentSource : MessageComposerEvents {
object FromGallery : PickAttachmentSource data object FromGallery : PickAttachmentSource
object FromFiles : PickAttachmentSource data object FromFiles : PickAttachmentSource
object PhotoFromCamera : PickAttachmentSource data object PhotoFromCamera : PickAttachmentSource
object VideoFromCamera : PickAttachmentSource data object VideoFromCamera : PickAttachmentSource
object Location : PickAttachmentSource data object Location : PickAttachmentSource
} }
object CancelSendAttachment : MessageComposerEvents data object CancelSendAttachment : MessageComposerEvents
} }

View file

@ -37,7 +37,7 @@ data class MessageComposerState(
@Immutable @Immutable
sealed interface AttachmentsState { sealed interface AttachmentsState {
object None : AttachmentsState data object None : AttachmentsState
data class Previewing(val attachments: ImmutableList<Attachment>) : AttachmentsState data class Previewing(val attachments: ImmutableList<Attachment>) : AttachmentsState
sealed interface Sending : AttachmentsState { sealed interface Sending : AttachmentsState {
data class Processing(val attachments: ImmutableList<Attachment>) : Sending data class Processing(val attachments: ImmutableList<Attachment>) : Sending

View file

@ -18,7 +18,7 @@ package io.element.android.features.messages.impl.report
sealed interface ReportMessageEvents { sealed interface ReportMessageEvents {
data class UpdateReason(val reason: String) : ReportMessageEvents data class UpdateReason(val reason: String) : ReportMessageEvents
object ToggleBlockUser : ReportMessageEvents data object ToggleBlockUser : ReportMessageEvents
object Report : ReportMessageEvents data object Report : ReportMessageEvents
object ClearError : ReportMessageEvents data object ClearError : ReportMessageEvents
} }

View file

@ -19,7 +19,7 @@ package io.element.android.features.messages.impl.timeline
import io.element.android.libraries.matrix.api.core.EventId import io.element.android.libraries.matrix.api.core.EventId
sealed interface TimelineEvents { sealed interface TimelineEvents {
object LoadMore : TimelineEvents data object LoadMore : TimelineEvents
data class SetHighlightedEvent(val eventId: EventId?) : TimelineEvents data class SetHighlightedEvent(val eventId: EventId?) : TimelineEvents
data class OnScrollFinished(val firstIndex: Int) : TimelineEvents data class OnScrollFinished(val firstIndex: Int) : TimelineEvents
} }

View file

@ -20,6 +20,6 @@ import io.element.android.features.messages.impl.timeline.model.AggregatedReacti
import io.element.android.libraries.matrix.api.core.EventId import io.element.android.libraries.matrix.api.core.EventId
sealed interface ReactionSummaryEvents { sealed interface ReactionSummaryEvents {
object Clear : ReactionSummaryEvents data object Clear : ReactionSummaryEvents
data class ShowReactionSummary(val eventId: EventId, val reactions: List<AggregatedReaction>, val selectedKey: String) : ReactionSummaryEvents data class ShowReactionSummary(val eventId: EventId, val reactions: List<AggregatedReaction>, val selectedKey: String) : ReactionSummaryEvents
} }

View file

@ -20,7 +20,7 @@ import io.element.android.features.messages.impl.timeline.model.TimelineItem
sealed interface RetrySendMenuEvents { sealed interface RetrySendMenuEvents {
data class EventSelected(val event: TimelineItem.Event) : RetrySendMenuEvents data class EventSelected(val event: TimelineItem.Event) : RetrySendMenuEvents
object RetrySend : RetrySendMenuEvents data object RetrySend : RetrySendMenuEvents
object RemoveFailed : RetrySendMenuEvents data object RemoveFailed : RetrySendMenuEvents
object Dismiss: RetrySendMenuEvents data object Dismiss: RetrySendMenuEvents
} }

View file

@ -40,22 +40,22 @@ sealed interface TimelineItemGroupPosition {
/** /**
* The event is part of a group of events from the same sender and is the first sent Event. * The event is part of a group of events from the same sender and is the first sent Event.
*/ */
object First : TimelineItemGroupPosition data object First : TimelineItemGroupPosition
/** /**
* The event is part of a group of events from the same sender and is neither the first nor the last sent Event. * The event is part of a group of events from the same sender and is neither the first nor the last sent Event.
*/ */
object Middle : TimelineItemGroupPosition data object Middle : TimelineItemGroupPosition
/** /**
* The event is part of a group of events from the same sender and is the last sent Event. * The event is part of a group of events from the same sender and is the last sent Event.
*/ */
object Last : TimelineItemGroupPosition data object Last : TimelineItemGroupPosition
/** /**
* The event is not part of a group of events. Sender of previous event is different, and sender of next event is different. * The event is not part of a group of events. Sender of previous event is different, and sender of next event is different.
*/ */
object None : TimelineItemGroupPosition data object None : TimelineItemGroupPosition
/** /**
* Return true if the previous sender of the event is a different sender. * Return true if the previous sender of the event is a different sender.

View file

@ -48,7 +48,7 @@ class PollFlowNode @AssistedInject constructor(
sealed interface NavTarget : Parcelable { sealed interface NavTarget : Parcelable {
@Parcelize @Parcelize
object Root : NavTarget data object Root : NavTarget
} }
override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node { override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node {

View file

@ -55,16 +55,16 @@ class PreferencesFlowNode @AssistedInject constructor(
sealed interface NavTarget : Parcelable { sealed interface NavTarget : Parcelable {
@Parcelize @Parcelize
object Root : NavTarget data object Root : NavTarget
@Parcelize @Parcelize
object DeveloperSettings : NavTarget data object DeveloperSettings : NavTarget
@Parcelize @Parcelize
object AnalyticsSettings : NavTarget data object AnalyticsSettings : NavTarget
@Parcelize @Parcelize
object About : NavTarget data object About : NavTarget
} }
override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node { override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node {

View file

@ -27,9 +27,9 @@ sealed class ElementLegal(
@StringRes val titleRes: Int, @StringRes val titleRes: Int,
val url: String, val url: String,
) { ) {
object Copyright : ElementLegal(CommonStrings.common_copyright, COPYRIGHT_URL) data object Copyright : ElementLegal(CommonStrings.common_copyright, COPYRIGHT_URL)
object AcceptableUsePolicy : ElementLegal(CommonStrings.common_acceptable_use_policy, USE_POLICY_URL) data object AcceptableUsePolicy : ElementLegal(CommonStrings.common_acceptable_use_policy, USE_POLICY_URL)
object PrivacyPolicy : ElementLegal(CommonStrings.common_privacy_policy, PRIVACY_URL) data object PrivacyPolicy : ElementLegal(CommonStrings.common_privacy_policy, PRIVACY_URL)
} }
fun getAllLegals(): List<ElementLegal> { fun getAllLegals(): List<ElementLegal> {

View file

@ -20,5 +20,5 @@ import io.element.android.libraries.featureflag.ui.model.FeatureUiModel
sealed interface DeveloperSettingsEvents { sealed interface DeveloperSettingsEvents {
data class UpdateEnabledFeature(val feature: FeatureUiModel, val isEnabled: Boolean) : DeveloperSettingsEvents data class UpdateEnabledFeature(val feature: FeatureUiModel, val isEnabled: Boolean) : DeveloperSettingsEvents
object ClearCache: DeveloperSettingsEvents data object ClearCache: DeveloperSettingsEvents
} }

View file

@ -17,6 +17,6 @@
package io.element.android.features.rageshake.api.crash package io.element.android.features.rageshake.api.crash
sealed interface CrashDetectionEvents { sealed interface CrashDetectionEvents {
object ResetAllCrashData : CrashDetectionEvents data object ResetAllCrashData : CrashDetectionEvents
object ResetAppHasCrashed : CrashDetectionEvents data object ResetAppHasCrashed : CrashDetectionEvents
} }

View file

@ -19,9 +19,9 @@ package io.element.android.features.rageshake.api.detection
import io.element.android.features.rageshake.api.screenshot.ImageResult import io.element.android.features.rageshake.api.screenshot.ImageResult
sealed interface RageshakeDetectionEvents { sealed interface RageshakeDetectionEvents {
object Dismiss : RageshakeDetectionEvents data object Dismiss : RageshakeDetectionEvents
object Disable : RageshakeDetectionEvents data object Disable : RageshakeDetectionEvents
object StartDetection : RageshakeDetectionEvents data object StartDetection : RageshakeDetectionEvents
object StopDetection : RageshakeDetectionEvents data object StopDetection : RageshakeDetectionEvents
data class ProcessScreenshot(val imageResult: ImageResult) : RageshakeDetectionEvents data class ProcessScreenshot(val imageResult: ImageResult) : RageshakeDetectionEvents
} }

View file

@ -17,9 +17,9 @@
package io.element.android.features.rageshake.impl.bugreport package io.element.android.features.rageshake.impl.bugreport
sealed interface BugReportEvents { sealed interface BugReportEvents {
object SendBugReport : BugReportEvents data object SendBugReport : BugReportEvents
object ResetAll : BugReportEvents data object ResetAll : BugReportEvents
object ClearError : BugReportEvents data object ClearError : BugReportEvents
data class SetDescription(val description: String) : BugReportEvents data class SetDescription(val description: String) : BugReportEvents
data class SetSendLog(val sendLog: Boolean) : BugReportEvents data class SetSendLog(val sendLog: Boolean) : BugReportEvents

View file

@ -29,7 +29,7 @@ interface RoomDetailsEntryPoint : FeatureEntryPoint {
sealed interface InitialTarget : Parcelable { sealed interface InitialTarget : Parcelable {
@Parcelize @Parcelize
object RoomDetails : InitialTarget data object RoomDetails : InitialTarget
@Parcelize @Parcelize
data class RoomMemberDetails(val roomMemberId: UserId) : InitialTarget data class RoomMemberDetails(val roomMemberId: UserId) : InitialTarget

View file

@ -17,7 +17,6 @@
package io.element.android.features.roomdetails.impl package io.element.android.features.roomdetails.impl
sealed interface RoomDetailsAction { sealed interface RoomDetailsAction {
object Edit : RoomDetailsAction data object Edit : RoomDetailsAction
data object AddTopic : RoomDetailsAction
object AddTopic : RoomDetailsAction
} }

View file

@ -17,5 +17,5 @@
package io.element.android.features.roomdetails.impl package io.element.android.features.roomdetails.impl
sealed interface RoomDetailsEvent { sealed interface RoomDetailsEvent {
object LeaveRoom : RoomDetailsEvent data object LeaveRoom : RoomDetailsEvent
} }

View file

@ -55,16 +55,16 @@ class RoomDetailsFlowNode @AssistedInject constructor(
sealed interface NavTarget : Parcelable { sealed interface NavTarget : Parcelable {
@Parcelize @Parcelize
object RoomDetails : NavTarget data object RoomDetails : NavTarget
@Parcelize @Parcelize
object RoomMemberList : NavTarget data object RoomMemberList : NavTarget
@Parcelize @Parcelize
object RoomDetailsEdit : NavTarget data object RoomDetailsEdit : NavTarget
@Parcelize @Parcelize
object InviteMembers : NavTarget data object InviteMembers : NavTarget
@Parcelize @Parcelize
data class RoomMemberDetails(val roomMemberId: UserId) : NavTarget data class RoomMemberDetails(val roomMemberId: UserId) : NavTarget

View file

@ -37,12 +37,12 @@ data class RoomDetailsState(
) )
sealed interface RoomDetailsType { sealed interface RoomDetailsType {
object Room : RoomDetailsType data object Room : RoomDetailsType
data class Dm(val roomMember: RoomMember) : RoomDetailsType data class Dm(val roomMember: RoomMember) : RoomDetailsType
} }
sealed interface RoomTopicState { sealed interface RoomTopicState {
object Hidden : RoomTopicState data object Hidden : RoomTopicState
object CanAddTopic : RoomTopicState data object CanAddTopic : RoomTopicState
data class ExistingTopic(val topic: String) : RoomTopicState data class ExistingTopic(val topic: String) : RoomTopicState
} }

View file

@ -22,6 +22,6 @@ sealed interface RoomDetailsEditEvents {
data class HandleAvatarAction(val action: AvatarAction) : RoomDetailsEditEvents data class HandleAvatarAction(val action: AvatarAction) : RoomDetailsEditEvents
data class UpdateRoomName(val name: String) : RoomDetailsEditEvents data class UpdateRoomName(val name: String) : RoomDetailsEditEvents
data class UpdateRoomTopic(val topic: String) : RoomDetailsEditEvents data class UpdateRoomTopic(val topic: String) : RoomDetailsEditEvents
object Save : RoomDetailsEditEvents data object Save : RoomDetailsEditEvents
object CancelSaveChanges : RoomDetailsEditEvents data object CancelSaveChanges : RoomDetailsEditEvents
} }

View file

@ -19,6 +19,6 @@ package io.element.android.features.roomdetails.impl.members.details
sealed interface RoomMemberDetailsEvents { sealed interface RoomMemberDetailsEvents {
data class BlockUser(val needsConfirmation: Boolean = false) : RoomMemberDetailsEvents data class BlockUser(val needsConfirmation: Boolean = false) : RoomMemberDetailsEvents
data class UnblockUser(val needsConfirmation: Boolean = false) : RoomMemberDetailsEvents data class UnblockUser(val needsConfirmation: Boolean = false) : RoomMemberDetailsEvents
object ClearBlockUserError : RoomMemberDetailsEvents data object ClearBlockUserError : RoomMemberDetailsEvents
object ClearConfirmationDialog : RoomMemberDetailsEvents data object ClearConfirmationDialog : RoomMemberDetailsEvents
} }

View file

@ -22,9 +22,9 @@ import io.element.android.libraries.matrix.api.core.RoomId
sealed interface RoomListEvents { sealed interface RoomListEvents {
data class UpdateFilter(val newFilter: String) : RoomListEvents data class UpdateFilter(val newFilter: String) : RoomListEvents
data class UpdateVisibleRange(val range: IntRange) : RoomListEvents data class UpdateVisibleRange(val range: IntRange) : RoomListEvents
object DismissRequestVerificationPrompt : RoomListEvents data object DismissRequestVerificationPrompt : RoomListEvents
object ToggleSearchResults : RoomListEvents data object ToggleSearchResults : RoomListEvents
data class ShowContextMenu(val roomListRoomSummary: RoomListRoomSummary) : RoomListEvents data class ShowContextMenu(val roomListRoomSummary: RoomListRoomSummary) : RoomListEvents
object HideContextMenu : RoomListEvents data object HideContextMenu : RoomListEvents
data class LeaveRoom(val roomId: RoomId) : RoomListEvents data class LeaveRoom(val roomId: RoomId) : RoomListEvents
} }

View file

@ -40,7 +40,7 @@ data class RoomListState(
val eventSink: (RoomListEvents) -> Unit, val eventSink: (RoomListEvents) -> Unit,
) { ) {
sealed interface ContextMenu { sealed interface ContextMenu {
object Hidden : ContextMenu data object Hidden : ContextMenu
data class Shown( data class Shown(
val roomId: RoomId, val roomId: RoomId,
val roomName: String, val roomName: String,

View file

@ -29,11 +29,11 @@ data class VerifySelfSessionState(
@Stable @Stable
sealed interface VerificationStep { sealed interface VerificationStep {
object Initial : VerificationStep data object Initial : VerificationStep
object Canceled : VerificationStep data object Canceled : VerificationStep
object AwaitingOtherDeviceResponse : VerificationStep data object AwaitingOtherDeviceResponse : VerificationStep
object Ready : VerificationStep data object Ready : VerificationStep
data class Verifying(val emojiList: List<VerificationEmoji>, val state: Async<Unit>) : VerificationStep data class Verifying(val emojiList: List<VerificationEmoji>, val state: Async<Unit>) : VerificationStep
object Completed : VerificationStep data object Completed : VerificationStep
} }
} }

View file

@ -125,19 +125,19 @@ class VerifySelfSessionStateMachine @Inject constructor(
sealed interface State { sealed interface State {
/** The initial state, before verification started. */ /** The initial state, before verification started. */
object Initial : State data object Initial : State
/** Waiting for verification acceptance. */ /** Waiting for verification acceptance. */
object RequestingVerification : State data object RequestingVerification : State
/** Verification request accepted. Waiting for start. */ /** Verification request accepted. Waiting for start. */
object VerificationRequestAccepted : State data object VerificationRequestAccepted : State
/** Waiting for SaS verification start. */ /** Waiting for SaS verification start. */
object StartingSasVerification : State data object StartingSasVerification : State
/** A SaS verification flow has been started. */ /** A SaS verification flow has been started. */
object SasVerificationStarted : State data object SasVerificationStarted : State
sealed class Verifying(open val emojis: List<VerificationEmoji>) : State { sealed class Verifying(open val emojis: List<VerificationEmoji>) : State {
/** Verification accepted and emojis received. */ /** Verification accepted and emojis received. */
@ -148,50 +148,50 @@ class VerifySelfSessionStateMachine @Inject constructor(
} }
/** The verification is being canceled. */ /** The verification is being canceled. */
object Canceling : State data object Canceling : State
/** The verification has been canceled, remotely or locally. */ /** The verification has been canceled, remotely or locally. */
object Canceled : State data object Canceled : State
/** Verification successful. */ /** Verification successful. */
object Completed : State data object Completed : State
} }
sealed interface Event { sealed interface Event {
/** Request verification. */ /** Request verification. */
object RequestVerification : Event data object RequestVerification : Event
/** The current verification request has been accepted. */ /** The current verification request has been accepted. */
object DidAcceptVerificationRequest : Event data object DidAcceptVerificationRequest : Event
/** Start a SaS verification flow. */ /** Start a SaS verification flow. */
object StartSasVerification : Event data object StartSasVerification : Event
/** Started a SaS verification flow. */ /** Started a SaS verification flow. */
object DidStartSasVerification : Event data object DidStartSasVerification : Event
/** Has received emojis. */ /** Has received emojis. */
data class DidReceiveChallenge(val emojis: List<VerificationEmoji>) : Event data class DidReceiveChallenge(val emojis: List<VerificationEmoji>) : Event
/** Emojis match. */ /** Emojis match. */
object AcceptChallenge : Event data object AcceptChallenge : Event
/** Emojis do not match. */ /** Emojis do not match. */
object DeclineChallenge : Event data object DeclineChallenge : Event
/** Remote accepted challenge. */ /** Remote accepted challenge. */
object DidAcceptChallenge : Event data object DidAcceptChallenge : Event
/** Request cancellation. */ /** Request cancellation. */
object Cancel : Event data object Cancel : Event
/** Verification cancelled. */ /** Verification cancelled. */
object DidCancel : Event data object DidCancel : Event
/** Request failed. */ /** Request failed. */
object DidFail : Event data object DidFail : Event
/** Restart the verification flow. */ /** Restart the verification flow. */
object Restart : Event data object Restart : Event
} }
} }

View file

@ -17,10 +17,10 @@
package io.element.android.features.verifysession.impl package io.element.android.features.verifysession.impl
sealed interface VerifySelfSessionViewEvents { sealed interface VerifySelfSessionViewEvents {
object RequestVerification: VerifySelfSessionViewEvents data object RequestVerification: VerifySelfSessionViewEvents
object StartSasVerification: VerifySelfSessionViewEvents data object StartSasVerification: VerifySelfSessionViewEvents
object Restart: VerifySelfSessionViewEvents data object Restart: VerifySelfSessionViewEvents
object ConfirmVerification: VerifySelfSessionViewEvents data object ConfirmVerification: VerifySelfSessionViewEvents
object DeclineVerification: VerifySelfSessionViewEvents data object DeclineVerification: VerifySelfSessionViewEvents
object CancelAndClose: VerifySelfSessionViewEvents data object CancelAndClose: VerifySelfSessionViewEvents
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -140,9 +140,9 @@ fun ListItem(
* The style to use for a [ListItem]. * The style to use for a [ListItem].
*/ */
sealed interface ListItemStyle { sealed interface ListItemStyle {
object Default : ListItemStyle data object Default : ListItemStyle
object Primary: ListItemStyle data object Primary: ListItemStyle
object Destructive : ListItemStyle data object Destructive : ListItemStyle
} }
// region: Simple list item // region: Simple list item

View file

@ -120,13 +120,13 @@ object ListSupportingTextDefaults {
/** Specifies the padding to use for the supporting text. */ /** Specifies the padding to use for the supporting text. */
sealed interface Padding { sealed interface Padding {
/** No padding. */ /** No padding. */
object None : Padding data object None : Padding
/** Default padding, it will align fine with a [ListItem] with no leading content. */ /** 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. */ /** 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. */ /** 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]. */ /** It will align to with a [ListItem] with a custom start [padding]. */
data class Custom(val padding: Dp) : Padding data class Custom(val padding: Dp) : Padding

View file

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

View file

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

View file

@ -17,7 +17,7 @@
package io.element.android.libraries.matrix.api.room package io.element.android.libraries.matrix.api.room
sealed interface MatrixRoomMembersState { sealed interface MatrixRoomMembersState {
object Unknown : MatrixRoomMembersState data object Unknown : MatrixRoomMembersState
data class Pending(val prevRoomMembers: List<RoomMember>? = null) : MatrixRoomMembersState data class Pending(val prevRoomMembers: List<RoomMember>? = null) : MatrixRoomMembersState
data class Error(val failure: Throwable, 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 Ready(val roomMembers: List<RoomMember>) : MatrixRoomMembersState

View file

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

View file

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

View file

@ -28,6 +28,6 @@ sealed interface MatrixTimelineItem {
} }
data class Virtual(val uniqueId: Long, val virtual: VirtualTimelineItem) : 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 package io.element.android.libraries.matrix.api.timeline
sealed class TimelineException : Exception() { sealed class TimelineException : Exception() {
object CannotPaginate : TimelineException() data object CannotPaginate : TimelineException()
} }

View file

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

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 import io.element.android.libraries.matrix.api.core.EventId
sealed interface LocalEventSendState { sealed interface LocalEventSendState {
object NotSentYet : LocalEventSendState data object NotSentYet : LocalEventSendState
object Canceled : LocalEventSendState data object Canceled : LocalEventSendState
data class SendingFailed( data class SendingFailed(
val error: String val error: String

View file

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

View file

@ -22,7 +22,7 @@ sealed interface VirtualTimelineItem {
val timestamp: Long val timestamp: Long
) : VirtualTimelineItem ) : 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) { sealed class LogLevel(val filter: String) {
object Warn : LogLevel("warn") data object Warn : LogLevel("warn")
object Trace : LogLevel("trace") data object Trace : LogLevel("trace")
object Info : LogLevel("info") data object Info : LogLevel("info")
object Debug : LogLevel("debug") data object Debug : LogLevel("debug")
object Error : LogLevel("error") data object Error : LogLevel("error")
} }
object TracingFilterConfigurations { object TracingFilterConfigurations {

View file

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

View file

@ -71,35 +71,35 @@ interface SessionVerificationService {
/** Verification status of the current session. */ /** Verification status of the current session. */
sealed interface SessionVerifiedStatus { sealed interface SessionVerifiedStatus {
/** Unknown status, we couldn't read the actual value from the SDK. */ /** Unknown status, we couldn't read the actual value from the SDK. */
object Unknown : SessionVerifiedStatus data object Unknown : SessionVerifiedStatus
/** Not verified session status. */ /** Not verified session status. */
object NotVerified : SessionVerifiedStatus data object NotVerified : SessionVerifiedStatus
/** Verified session status. */ /** Verified session status. */
object Verified : SessionVerifiedStatus data object Verified : SessionVerifiedStatus
} }
/** States produced by the [SessionVerificationService]. */ /** States produced by the [SessionVerificationService]. */
sealed interface VerificationFlowState { sealed interface VerificationFlowState {
/** Initial state. */ /** Initial state. */
object Initial : VerificationFlowState data object Initial : VerificationFlowState
/** Session verification request was accepted by another device. */ /** 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. */ /** 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. */ /** Verification data for the SAS verification (emojis) received. */
data class ReceivedVerificationData(val emoji: List<VerificationEmoji>) : VerificationFlowState data class ReceivedVerificationData(val emoji: List<VerificationEmoji>) : VerificationFlowState
/** Verification completed successfully. */ /** Verification completed successfully. */
object Finished : VerificationFlowState data object Finished : VerificationFlowState
/** Verification was cancelled by either device. */ /** Verification was cancelled by either device. */
object Canceled : VerificationFlowState data object Canceled : VerificationFlowState
/** Verification failed with an error. */ /** 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 icon: ImageVector,
val destructive: Boolean = false, val destructive: Boolean = false,
) { ) {
object TakePhoto : AvatarAction(titleResId = CommonStrings.action_take_photo, icon = Icons.Outlined.PhotoCamera) data object TakePhoto : AvatarAction(titleResId = CommonStrings.action_take_photo, icon = Icons.Outlined.PhotoCamera)
object ChoosePhoto : AvatarAction(titleResId = CommonStrings.action_choose_photo, icon = Icons.Outlined.PhotoLibrary) data 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 Remove : AvatarAction(titleResId = CommonStrings.action_remove, icon = Icons.Outlined.Delete, destructive = true)
} }

View file

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

View file

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

View file

@ -114,7 +114,7 @@ data class ImageCompressionResult(
) )
sealed interface ResizeMode { sealed interface ResizeMode {
object None : ResizeMode data object None : ResizeMode
data class Approximate(val desiredWidth: Int, val desiredHeight: Int) : ResizeMode data class Approximate(val desiredWidth: Int, val desiredHeight: Int) : ResizeMode
data class Strict(val maxWidth: Int, val maxHeight: 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 package io.element.android.libraries.permissions.api
sealed interface PermissionsEvents { sealed interface PermissionsEvents {
object OpenSystemDialog : PermissionsEvents data object OpenSystemDialog : PermissionsEvents
object CloseDialog : PermissionsEvents data object CloseDialog : PermissionsEvents
} }

View file

@ -17,5 +17,5 @@
package io.element.android.libraries.push.api.gateway package io.element.android.libraries.push.api.gateway
sealed class PushGatewayFailure : Throwable(cause = null) { 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 { sealed interface SummaryNotification {
object Removed : SummaryNotification data object Removed : SummaryNotification
data class Update(val notification: Notification) : SummaryNotification data class Update(val notification: Notification) : SummaryNotification
} }

View file

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

View file

@ -17,13 +17,11 @@
package io.element.android.services.apperror.api package io.element.android.services.apperror.api
sealed interface AppErrorState { sealed interface AppErrorState {
data object NoError : AppErrorState
object NoError : AppErrorState
data class Error( data class Error(
val title: String, val title: String,
val body: String, val body: String,
val dismiss: () -> Unit, val dismiss: () -> Unit,
) : AppErrorState ) : AppErrorState
} }

View file

@ -30,7 +30,7 @@ import io.element.android.libraries.matrix.api.core.ThreadId
* So we assume if we don't get the same owner, we can skip the onLeaving action as we already replaced it. * So we assume if we don't get the same owner, we can skip the onLeaving action as we already replaced it.
*/ */
sealed class NavigationState(open val owner: String) { sealed class NavigationState(open val owner: String) {
object Root : NavigationState("ROOT") data object Root : NavigationState("ROOT")
data class Session( data class Session(
override val owner: String, override val owner: String,