Fixing state spreed capability bug with MessageInputFragment.kt
Channel creation now works
unify conversation attributes
Reuse classified-attribute check via ConversationModel helper
Adds isClassifiedAttribute() next to isChannel()/isAnnouncement() on
ConversationModel, and has ConversationUtils.isClassified() compose it
instead of re-deriving the attribute bitmask check. The Conversation
(json model) overload is kept for CallActivity but marked deprecated
in favor of the ConversationModel one.
checkIfVoiceRoom()/isChannel()/isAnnouncement()/isClassifiedAttribute()
were declared on ConversationModel even though every other "does this
conversation satisfy X" predicate already lives in ConversationUtils.
Keeps the extension-function call syntax at all call sites, only the
import path changes. ConversationModel keeps mapToConversationModel(),
which is model construction rather than a business-rule predicate.
Move channel-preset capability check into ConversationUtils.isChannel
isChannel() was a raw attribute check, so every caller had to repeat
"conversation.isChannel() && hasSpreedFeatureCapability(..., ANNOUNCEMENT_PRESET)"
themselves. Renamed the raw checks to isChannelAttribute()/
isAnnouncementAttribute() (mirroring isClassifiedAttribute()) and added
a capability-gated isChannel(conversation, spreedCapabilities), mirroring
the existing isClassified()/isClassifiedAttribute() split. Callers now
call ConversationUtils.isChannel(...) directly.
Simplify capability handling in ChatViewModel.messagesFlow
spreedCapabilities was only needed inside the terminal map step of
messagesFlow (to filter system messages for channels), but it was
being combined into the outer flatMapLatest trigger. Any capabilities
emission unrelated to the conversation forced the whole message
source subscription to cancel and restart.
Move the capabilities dependency to a dedicated isChannelFlow
(conversationAndUserFlow + spreedCapabilities -> Boolean, with
distinctUntilChanged), and combine only that into the innermost step.
handleSystemMessages() now takes a plain Boolean instead of
ConversationModel/SpreedCapability, making it simpler to reason about
and test.
Implementing suggestions
Signed-off-by: rapterjet2004 <[email protected]>