Fix chat folder to not show mute option if there isn't any chat.

This commit is contained in:
lisa-signal
2025-06-04 15:16:14 -04:00
committed by Cody Henthorne
parent cf0dfdceb1
commit a66031cfce
7 changed files with 40 additions and 10 deletions

View File

@@ -19,6 +19,7 @@ object ChatFolderContextMenu {
rootView: ViewGroup = anchorView.rootView as ViewGroup,
folderType: ChatFolderRecord.FolderType,
unreadCount: Int,
isEmpty: Boolean,
isMuted: Boolean,
onEdit: () -> Unit = {},
onMuteAll: () -> Unit = {},
@@ -32,6 +33,7 @@ object ChatFolderContextMenu {
rootView = rootView,
folderType = folderType,
unreadCount = unreadCount,
isEmpty = isEmpty,
isMuted = isMuted,
callbacks = object : Callbacks {
override fun onEdit() = onEdit()
@@ -48,6 +50,7 @@ object ChatFolderContextMenu {
anchorView: View,
rootView: ViewGroup,
unreadCount: Int,
isEmpty: Boolean,
isMuted: Boolean,
folderType: ChatFolderRecord.FolderType,
callbacks: Callbacks
@@ -61,13 +64,13 @@ object ChatFolderContextMenu {
)
}
if (isMuted) {
if (isMuted && !isEmpty) {
add(
ActionItem(R.drawable.symbol_bell_24, context.getString(R.string.ChatFoldersFragment__unmute_all)) {
callbacks.onUnmuteAll()
}
)
} else {
} else if (!isEmpty) {
add(
ActionItem(R.drawable.symbol_bell_slash_24, context.getString(R.string.ChatFoldersFragment__mute_all)) {
callbacks.onMuteAll()

View File

@@ -13,8 +13,8 @@ object ChatFoldersRepository {
return SignalDatabase.chatFolders.getCurrentChatFolders()
}
fun getUnreadCountAndMutedStatusForFolders(folders: List<ChatFolderRecord>): HashMap<Long, Pair<Int, Boolean>> {
return SignalDatabase.chatFolders.getUnreadCountAndMutedStatusForFolders(folders)
fun getUnreadCountAndEmptyAndMutedStatusForFolders(folders: List<ChatFolderRecord>): HashMap<Long, Triple<Int, Boolean, Boolean>> {
return SignalDatabase.chatFolders.getUnreadCountAndEmptyAndMutedStatusForFolders(folders)
}
fun createFolder(folder: ChatFolderRecord, includedRecipients: Set<Recipient>, excludedRecipients: Set<Recipient>) {