mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 20:19:42 +01:00
Merge pull request #2820 from nextcloud/feature/2794/hideBreakoutRoomsFromConvList
Hide inactive breakout rooms from conversation list
This commit is contained in:
commit
2fcd5e97c9
@ -188,37 +188,33 @@ class ConversationItem(
|
||||
private fun shouldLoadAvatar(
|
||||
holder: ConversationItemViewHolder
|
||||
): Boolean {
|
||||
var objectType: String?
|
||||
var returnValue = true
|
||||
if (!TextUtils.isEmpty(model.objectType.also { objectType = it })) {
|
||||
when (objectType) {
|
||||
"share:password" -> {
|
||||
holder.binding.dialogAvatar.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.ic_circular_lock
|
||||
return when (model.objectType) {
|
||||
Conversation.ObjectType.SHARE_PASSWORD -> {
|
||||
holder.binding.dialogAvatar.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.ic_circular_lock
|
||||
)
|
||||
)
|
||||
false
|
||||
}
|
||||
Conversation.ObjectType.FILE -> {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
holder.binding.dialogAvatar.loadAvatar(
|
||||
viewThemeUtils.talk.themePlaceholderAvatar(
|
||||
holder.binding.dialogAvatar,
|
||||
R.drawable.ic_avatar_document
|
||||
)
|
||||
)
|
||||
returnValue = false
|
||||
}
|
||||
"file" -> {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
holder.binding.dialogAvatar.loadAvatar(
|
||||
viewThemeUtils.talk.themePlaceholderAvatar(
|
||||
holder.binding.dialogAvatar,
|
||||
R.drawable.ic_avatar_document
|
||||
)
|
||||
)
|
||||
} else {
|
||||
holder.binding.dialogAvatar.loadAvatar(
|
||||
R.drawable.ic_circular_document
|
||||
)
|
||||
}
|
||||
returnValue = false
|
||||
} else {
|
||||
holder.binding.dialogAvatar.loadAvatar(
|
||||
R.drawable.ic_circular_document
|
||||
)
|
||||
}
|
||||
false
|
||||
}
|
||||
else -> true
|
||||
}
|
||||
return returnValue
|
||||
}
|
||||
|
||||
private fun setLastMessage(
|
||||
|
@ -926,7 +926,7 @@ class ChatController(args: Bundle) :
|
||||
|
||||
if (conversationUser != null) {
|
||||
activity?.runOnUiThread {
|
||||
if (currentConversation?.objectType == BREAKOUT_ROOM_TYPE) {
|
||||
if (currentConversation?.objectType == Conversation.ObjectType.ROOM) {
|
||||
Toast.makeText(
|
||||
context,
|
||||
context.resources.getString(R.string.switch_to_main_room),
|
||||
@ -2849,7 +2849,7 @@ class ChatController(args: Bundle) :
|
||||
bundle.putBoolean(BundleKeys.KEY_CALL_WITHOUT_NOTIFICATION, true)
|
||||
}
|
||||
|
||||
if (it.objectType == BREAKOUT_ROOM_TYPE) {
|
||||
if (it.objectType == Conversation.ObjectType.ROOM) {
|
||||
bundle.putBoolean(KEY_IS_BREAKOUT_ROOM, true)
|
||||
}
|
||||
|
||||
@ -3552,6 +3552,5 @@ class ChatController(args: Bundle) :
|
||||
private const val LOOKING_INTO_FUTURE_TIMEOUT = 30
|
||||
private const val CHUNK_SIZE: Int = 10
|
||||
private const val ONE_SECOND_IN_MILLIS = 1000
|
||||
private const val BREAKOUT_ROOM_TYPE = "room"
|
||||
}
|
||||
}
|
||||
|
@ -543,12 +543,18 @@ class ConversationsListController(bundle: Bundle) :
|
||||
}
|
||||
|
||||
private fun addToConversationItems(conversation: Conversation) {
|
||||
if (bundle.containsKey(KEY_FORWARD_HIDE_SOURCE_ROOM) && conversation.roomId == bundle.getString(
|
||||
KEY_FORWARD_HIDE_SOURCE_ROOM
|
||||
)
|
||||
if (bundle.containsKey(KEY_FORWARD_HIDE_SOURCE_ROOM) && conversation.roomId ==
|
||||
bundle.getString(KEY_FORWARD_HIDE_SOURCE_ROOM)
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
if (conversation.objectType == Conversation.ObjectType.ROOM &&
|
||||
conversation.lobbyState == Conversation.LobbyState.LOBBY_STATE_MODERATORS_ONLY
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
val headerTitle: String = resources!!.getString(R.string.conversations)
|
||||
val genericTextHeaderItem: GenericTextHeaderItem
|
||||
if (!callHeaderItems.containsKey(headerTitle)) {
|
||||
|
@ -30,6 +30,7 @@ import com.bluelinelabs.logansquare.annotation.JsonField
|
||||
import com.bluelinelabs.logansquare.annotation.JsonObject
|
||||
import com.nextcloud.talk.data.user.model.User
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage
|
||||
import com.nextcloud.talk.models.json.converters.ConversationObjectTypeConverter
|
||||
import com.nextcloud.talk.models.json.converters.EnumLobbyStateConverter
|
||||
import com.nextcloud.talk.models.json.converters.EnumNotificationLevelConverter
|
||||
import com.nextcloud.talk.models.json.converters.EnumParticipantTypeConverter
|
||||
@ -84,8 +85,8 @@ data class Conversation(
|
||||
@JsonField(name = ["lastMessage"])
|
||||
var lastMessage: ChatMessage? = null,
|
||||
|
||||
@JsonField(name = ["objectType"])
|
||||
var objectType: String? = null,
|
||||
@JsonField(name = ["objectType"], typeConverter = ConversationObjectTypeConverter::class)
|
||||
var objectType: ObjectType? = null,
|
||||
|
||||
@JsonField(name = ["notificationLevel"], typeConverter = EnumNotificationLevelConverter::class)
|
||||
var notificationLevel: NotificationLevel? = null,
|
||||
@ -221,4 +222,11 @@ data class Conversation(
|
||||
ROOM_SYSTEM,
|
||||
FORMER_ONE_TO_ONE
|
||||
}
|
||||
|
||||
enum class ObjectType {
|
||||
DEFAULT,
|
||||
SHARE_PASSWORD,
|
||||
FILE,
|
||||
ROOM
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Nextcloud Talk application
|
||||
*
|
||||
* @author Marcel Hibbe
|
||||
* Copyright (C) 2023 Marcel Hibbe <dev@mhibbe.de>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.nextcloud.talk.models.json.converters
|
||||
|
||||
import com.bluelinelabs.logansquare.typeconverters.StringBasedTypeConverter
|
||||
import com.nextcloud.talk.models.json.conversations.Conversation
|
||||
|
||||
class ConversationObjectTypeConverter : StringBasedTypeConverter<Conversation.ObjectType>() {
|
||||
override fun getFromString(string: String?): Conversation.ObjectType {
|
||||
return when (string) {
|
||||
"share:password" -> Conversation.ObjectType.SHARE_PASSWORD
|
||||
"room" -> Conversation.ObjectType.ROOM
|
||||
"file" -> Conversation.ObjectType.FILE
|
||||
else -> Conversation.ObjectType.DEFAULT
|
||||
}
|
||||
}
|
||||
|
||||
override fun convertToString(`object`: Conversation.ObjectType?): String {
|
||||
if (`object` == null) {
|
||||
return ""
|
||||
}
|
||||
|
||||
return when (`object`) {
|
||||
Conversation.ObjectType.SHARE_PASSWORD -> "share:password"
|
||||
Conversation.ObjectType.ROOM -> "room"
|
||||
Conversation.ObjectType.FILE -> "file"
|
||||
else -> ""
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user