Add UserStatusState and UserStatusEvent

This commit is contained in:
ganfra
2026-06-12 14:57:39 +02:00
parent 1640adcf9d
commit eca45b574e
2 changed files with 50 additions and 0 deletions
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2026 Element Creations Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
* Please see LICENSE files in the repository root for full details.
*/
package io.element.android.features.preferences.impl.userstatus
import io.element.android.libraries.matrix.api.user.UserStatus
sealed interface UserStatusEvent {
/** User tapped the status row — open the picker bottom sheet. */
data object Open : UserStatusEvent
/** User dismissed the bottom sheet without selecting. */
data object Dismiss : UserStatusEvent
/** User selected a predefined or confirmed a custom status. */
data class Set(val status: UserStatus) : UserStatusEvent
/** User tapped "Custom…" in the bottom sheet. */
data object OpenCustomInput : UserStatusEvent
/** User tapped Cancel in the inline custom input row. */
data object CancelCustomInput : UserStatusEvent
/** User tapped the clear action on an existing status. */
data object Clear : UserStatusEvent
}
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2026 Element Creations Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
* Please see LICENSE files in the repository root for full details.
*/
package io.element.android.features.preferences.impl.userstatus
import io.element.android.libraries.matrix.api.user.DisplayedStatus
data class UserStatusState(
val displayedStatus: DisplayedStatus?,
val pickerState: UserStatusPickerState,
val eventSink: (UserStatusEvent) -> Unit,
)
sealed interface UserStatusPickerState {
data object Hidden : UserStatusPickerState
data object ShowingPicker : UserStatusPickerState
data class CustomInput(
val initialEmoji: String = "😀",
val initialText: String = "",
) : UserStatusPickerState
}