Feature/mentions (#197)

* mention initial implementation

* Message conservation
This commit is contained in:
Francisco Hola
2025-08-05 23:32:16 +02:00
committed by GitHub
parent 7ee0e8f2f4
commit 325ce1730d
5 changed files with 243 additions and 4 deletions
@@ -79,6 +79,13 @@ class ChatState {
private val _commandSuggestions = MutableLiveData<List<CommandSuggestion>>(emptyList())
val commandSuggestions: LiveData<List<CommandSuggestion>> = _commandSuggestions
// Mention autocomplete
private val _showMentionSuggestions = MutableLiveData(false)
val showMentionSuggestions: LiveData<Boolean> = _showMentionSuggestions
private val _mentionSuggestions = MutableLiveData<List<String>>(emptyList())
val mentionSuggestions: LiveData<List<String>> = _mentionSuggestions
// Favorites
private val _favoritePeers = MutableLiveData<Set<String>>(emptySet())
val favoritePeers: LiveData<Set<String>> = _favoritePeers
@@ -129,6 +136,8 @@ class ChatState {
fun getShowSidebarValue() = _showSidebar.value ?: false
fun getShowCommandSuggestionsValue() = _showCommandSuggestions.value ?: false
fun getCommandSuggestionsValue() = _commandSuggestions.value ?: emptyList()
fun getShowMentionSuggestionsValue() = _showMentionSuggestions.value ?: false
fun getMentionSuggestionsValue() = _mentionSuggestions.value ?: emptyList()
fun getFavoritePeersValue() = _favoritePeers.value ?: emptySet()
fun getPeerSessionStatesValue() = _peerSessionStates.value ?: emptyMap()
fun getPeerFingerprintsValue() = _peerFingerprints.value ?: emptyMap()
@@ -202,6 +211,14 @@ class ChatState {
fun setCommandSuggestions(suggestions: List<CommandSuggestion>) {
_commandSuggestions.value = suggestions
}
fun setShowMentionSuggestions(show: Boolean) {
_showMentionSuggestions.value = show
}
fun setMentionSuggestions(suggestions: List<String>) {
_mentionSuggestions.value = suggestions
}
fun setFavoritePeers(favorites: Set<String>) {
val currentValue = _favoritePeers.value ?: emptySet()