From b4dad81019f94ac28c0fb9c4b619f0bc6c0838c2 Mon Sep 17 00:00:00 2001 From: rapterjet2004 Date: Fri, 17 Jul 2026 11:04:31 -0500 Subject: [PATCH] Adding Announcements and Channels 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 --- .gitignore | 1 + .idea/codeStyles/Project.xml | 25 ---- .../nextcloud/talk/activities/CallActivity.kt | 2 +- .../com/nextcloud/talk/api/NcApiCoroutines.kt | 11 +- .../com/nextcloud/talk/chat/ChatActivity.kt | 12 +- .../talk/chat/MessageInputFragment.kt | 35 ++++- .../talk/chat/ui/MessageActionsBottomSheet.kt | 3 +- .../talk/chat/viewmodels/ChatViewModel.kt | 21 ++- .../ConversationCreationActivity.kt | 97 ++++++++++--- .../data/ConversationCreationRepository.kt | 2 + .../ConversationCreationRepositoryImpl.kt | 8 +- .../ConversationCreationViewModel.kt | 129 ++++++++---------- .../conversationinfo/CreateRoomRequest.kt | 41 ++---- .../viewmodel/ConversationInfoViewModel.kt | 8 +- .../ConversationsListActivity.kt | 2 +- .../talk/models/domain/ConversationModel.kt | 5 - .../json/conversations/ConversationEnums.kt | 8 +- .../nextcloud/talk/utils/CapabilitiesUtil.kt | 11 ++ .../nextcloud/talk/utils/ConversationUtils.kt | 25 +++- .../talk/utils/ParticipantPermissions.kt | 3 + .../res/layout/fragment_message_input.xml | 11 ++ app/src/main/res/values/strings.xml | 6 + 22 files changed, 284 insertions(+), 182 deletions(-) diff --git a/.gitignore b/.gitignore index 98b5bf608e..4235132098 100644 --- a/.gitignore +++ b/.gitignore @@ -89,3 +89,4 @@ freeline_project_description.json /gradle/verification-keyring.gpg /.claude/settings.local.json +/.artifacts/ diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index 28b11af49d..1ae96897a2 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -2,31 +2,6 @@ -