Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #13856 - Group call for 1 member #13882

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ internal object ConversationOptionsMenu {
distributionType,
threadId,
messageRequestState,
isInBubble
isInBubble,
isSingleMember
) = callback.getSnapshot()

if (recipient == null) {
Expand Down Expand Up @@ -181,6 +182,13 @@ internal object ConversationOptionsMenu {
}
})

lifecycleDisposable += isSingleMember.subscribeBy(onNext = { yes: Boolean ->
val item = menu.findItem(R.id.menu_video_secure)
if(item != null) {
item.isVisible = item.isVisible && yes
}
})

menu.findItem(R.id.menu_format_text_submenu).subMenu?.clearHeader()
menu.findItem(R.id.edittext_bold).applyTitleSpan(MessageStyler.boldStyle())
menu.findItem(R.id.edittext_italic).applyTitleSpan(MessageStyler.italicStyle())
Expand Down Expand Up @@ -258,7 +266,8 @@ internal object ConversationOptionsMenu {
val distributionType: Int,
val threadId: Long,
val messageRequestState: MessageRequestState,
val isInBubble: Boolean
val isInBubble: Boolean,
val isSingleMember: Observable<Boolean>,
)

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3336,7 +3336,8 @@ class ConversationFragment :
distributionType = args.distributionType,
threadId = args.threadId,
messageRequestState = viewModel.messageRequestState,
isInBubble = args.conversationScreenType.isInBubble
isInBubble = args.conversationScreenType.isInBubble,
isSingleMember = viewModel.isSingleMember()
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,12 @@ class ConversationViewModel(
.observeOn(AndroidSchedulers.mainThread())
}

fun isSingleMember() : Observable<Boolean> {
return groupMemberServiceIds
.map { it.isEmpty() }
.observeOn(AndroidSchedulers.mainThread())
}

fun copyToClipboard(context: Context, messageParts: Set<MultiselectPart>): Maybe<CharSequence> {
return repository.copyToClipboard(context, messageParts)
}
Expand Down