mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-04 01:19:33 +00:00
Add KDoc to the libraries/emoji API interfaces
Document AddRecentEmoji, GetRecentEmojis.invoke, the EmojiPickerRenderer interface and the EmojiPickerPresenter factory, pointing at the no-op renderer and the empty recent-emoji source so callers know how to opt out of each. EmojiPickerPresenter itself is a Presenter and therefore out of scope. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+7
@@ -11,7 +11,14 @@ import io.element.android.libraries.architecture.Presenter
|
|||||||
import io.element.android.libraries.emoji.api.recentemojis.GetRecentEmojis
|
import io.element.android.libraries.emoji.api.recentemojis.GetRecentEmojis
|
||||||
|
|
||||||
fun interface EmojiPickerPresenter : Presenter<EmojiPickerState> {
|
fun interface EmojiPickerPresenter : Presenter<EmojiPickerState> {
|
||||||
|
/**
|
||||||
|
* Creates a presenter for one picker instance.
|
||||||
|
*/
|
||||||
fun interface Factory {
|
fun interface Factory {
|
||||||
|
/**
|
||||||
|
* @param getRecentEmojis how the picker sources its recent tab; pass [io.element.android.libraries.emoji.api.recentemojis.EmptyGetRecentEmojis]
|
||||||
|
* for a picker that should have no recent tab at all.
|
||||||
|
*/
|
||||||
fun create(getRecentEmojis: GetRecentEmojis): EmojiPickerPresenter
|
fun create(getRecentEmojis: GetRecentEmojis): EmojiPickerPresenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
@@ -13,9 +13,16 @@ import androidx.compose.ui.Modifier
|
|||||||
import io.element.android.emojibasebindings.Emoji
|
import io.element.android.emojibasebindings.Emoji
|
||||||
import kotlinx.collections.immutable.ImmutableSet
|
import kotlinx.collections.immutable.ImmutableSet
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders the emoji picker, so that callers can embed it without depending on its implementation.
|
||||||
|
*
|
||||||
|
* See [NoOpEmojiPickerRenderer] for a renderer that draws nothing, used where the picker is disabled.
|
||||||
|
*/
|
||||||
@Immutable
|
@Immutable
|
||||||
interface EmojiPickerRenderer {
|
interface EmojiPickerRenderer {
|
||||||
/**
|
/**
|
||||||
|
* Draws the picker.
|
||||||
|
*
|
||||||
* @param state opaque state produced by [EmojiPickerPresenter.present].
|
* @param state opaque state produced by [EmojiPickerPresenter.present].
|
||||||
* @param onSelectEmoji invoked when the user taps an emoji (including a skin-tone variant).
|
* @param onSelectEmoji invoked when the user taps an emoji (including a skin-tone variant).
|
||||||
* @param selectedEmojis emojis to visually mark as already selected.
|
* @param selectedEmojis emojis to visually mark as already selected.
|
||||||
|
|||||||
+6
@@ -8,6 +8,12 @@
|
|||||||
|
|
||||||
package io.element.android.libraries.emoji.api.recentemojis
|
package io.element.android.libraries.emoji.api.recentemojis
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Records that an emoji was just used, so it surfaces in the picker's recent list; see [GetRecentEmojis] for the read side.
|
||||||
|
*/
|
||||||
fun interface AddRecentEmoji {
|
fun interface AddRecentEmoji {
|
||||||
|
/**
|
||||||
|
* @param emoji the emoji that was just used, as its unicode representation.
|
||||||
|
*/
|
||||||
suspend operator fun invoke(emoji: String): Result<Unit>
|
suspend operator fun invoke(emoji: String): Result<Unit>
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -15,6 +15,7 @@ import kotlinx.collections.immutable.persistentListOf
|
|||||||
* Returns the list of recently used emojis for reactions.
|
* Returns the list of recently used emojis for reactions.
|
||||||
*/
|
*/
|
||||||
fun interface GetRecentEmojis {
|
fun interface GetRecentEmojis {
|
||||||
|
/** Returns the recently used emojis, most recent first; see [EmptyGetRecentEmojis] for a picker with no recent tab. */
|
||||||
suspend operator fun invoke(): Result<ImmutableList<String>>
|
suspend operator fun invoke(): Result<ImmutableList<String>>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user