mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-21 12:39:58 +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(
|
private fun shouldLoadAvatar(
|
||||||
holder: ConversationItemViewHolder
|
holder: ConversationItemViewHolder
|
||||||
): Boolean {
|
): Boolean {
|
||||||
var objectType: String?
|
return when (model.objectType) {
|
||||||
var returnValue = true
|
Conversation.ObjectType.SHARE_PASSWORD -> {
|
||||||
if (!TextUtils.isEmpty(model.objectType.also { objectType = it })) {
|
holder.binding.dialogAvatar.setImageDrawable(
|
||||||
when (objectType) {
|
ContextCompat.getDrawable(
|
||||||
"share:password" -> {
|
context,
|
||||||
holder.binding.dialogAvatar.setImageDrawable(
|
R.drawable.ic_circular_lock
|
||||||
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
|
} else {
|
||||||
}
|
holder.binding.dialogAvatar.loadAvatar(
|
||||||
"file" -> {
|
R.drawable.ic_circular_document
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
false
|
||||||
}
|
}
|
||||||
|
else -> true
|
||||||
}
|
}
|
||||||
return returnValue
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setLastMessage(
|
private fun setLastMessage(
|
||||||
|
@ -926,7 +926,7 @@ class ChatController(args: Bundle) :
|
|||||||
|
|
||||||
if (conversationUser != null) {
|
if (conversationUser != null) {
|
||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
if (currentConversation?.objectType == BREAKOUT_ROOM_TYPE) {
|
if (currentConversation?.objectType == Conversation.ObjectType.ROOM) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
context,
|
context,
|
||||||
context.resources.getString(R.string.switch_to_main_room),
|
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)
|
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)
|
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 LOOKING_INTO_FUTURE_TIMEOUT = 30
|
||||||
private const val CHUNK_SIZE: Int = 10
|
private const val CHUNK_SIZE: Int = 10
|
||||||
private const val ONE_SECOND_IN_MILLIS = 1000
|
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) {
|
private fun addToConversationItems(conversation: Conversation) {
|
||||||
if (bundle.containsKey(KEY_FORWARD_HIDE_SOURCE_ROOM) && conversation.roomId == bundle.getString(
|
if (bundle.containsKey(KEY_FORWARD_HIDE_SOURCE_ROOM) && conversation.roomId ==
|
||||||
KEY_FORWARD_HIDE_SOURCE_ROOM
|
bundle.getString(KEY_FORWARD_HIDE_SOURCE_ROOM)
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
return
|
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 headerTitle: String = resources!!.getString(R.string.conversations)
|
||||||
val genericTextHeaderItem: GenericTextHeaderItem
|
val genericTextHeaderItem: GenericTextHeaderItem
|
||||||
if (!callHeaderItems.containsKey(headerTitle)) {
|
if (!callHeaderItems.containsKey(headerTitle)) {
|
||||||
|
@ -30,6 +30,7 @@ import com.bluelinelabs.logansquare.annotation.JsonField
|
|||||||
import com.bluelinelabs.logansquare.annotation.JsonObject
|
import com.bluelinelabs.logansquare.annotation.JsonObject
|
||||||
import com.nextcloud.talk.data.user.model.User
|
import com.nextcloud.talk.data.user.model.User
|
||||||
import com.nextcloud.talk.models.json.chat.ChatMessage
|
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.EnumLobbyStateConverter
|
||||||
import com.nextcloud.talk.models.json.converters.EnumNotificationLevelConverter
|
import com.nextcloud.talk.models.json.converters.EnumNotificationLevelConverter
|
||||||
import com.nextcloud.talk.models.json.converters.EnumParticipantTypeConverter
|
import com.nextcloud.talk.models.json.converters.EnumParticipantTypeConverter
|
||||||
@ -84,8 +85,8 @@ data class Conversation(
|
|||||||
@JsonField(name = ["lastMessage"])
|
@JsonField(name = ["lastMessage"])
|
||||||
var lastMessage: ChatMessage? = null,
|
var lastMessage: ChatMessage? = null,
|
||||||
|
|
||||||
@JsonField(name = ["objectType"])
|
@JsonField(name = ["objectType"], typeConverter = ConversationObjectTypeConverter::class)
|
||||||
var objectType: String? = null,
|
var objectType: ObjectType? = null,
|
||||||
|
|
||||||
@JsonField(name = ["notificationLevel"], typeConverter = EnumNotificationLevelConverter::class)
|
@JsonField(name = ["notificationLevel"], typeConverter = EnumNotificationLevelConverter::class)
|
||||||
var notificationLevel: NotificationLevel? = null,
|
var notificationLevel: NotificationLevel? = null,
|
||||||
@ -221,4 +222,11 @@ data class Conversation(
|
|||||||
ROOM_SYSTEM,
|
ROOM_SYSTEM,
|
||||||
FORMER_ONE_TO_ONE
|
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