mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-23 13:35:33 +03:00
add support for FORMER_ONE_TO_ONE conversations
resolve #8517 Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
7a2a67dfb5
commit
152c0b7ece
10 changed files with 32 additions and 12 deletions
|
@ -175,6 +175,8 @@ class ConversationItem(
|
|||
}
|
||||
ConversationType.ROOM_GROUP_CALL ->
|
||||
holder.binding.dialogAvatar.loadGroupCallAvatar(viewThemeUtils)
|
||||
ConversationType.FORMER_ONE_TO_ONE ->
|
||||
holder.binding.dialogAvatar.loadGroupCallAvatar(viewThemeUtils)
|
||||
ConversationType.ROOM_PUBLIC_CALL ->
|
||||
holder.binding.dialogAvatar.loadPublicCallAvatar(viewThemeUtils)
|
||||
else -> holder.binding.dialogAvatar.visibility = View.GONE
|
||||
|
|
|
@ -131,10 +131,10 @@ class IncomingLinkPreviewMessageViewHolder(incomingView: View, payload: Any) : M
|
|||
binding.messageAuthor.setText(R.string.nc_nick_guest)
|
||||
}
|
||||
|
||||
if (!message.isGrouped && !message.isOneToOneConversation) {
|
||||
if (!message.isGrouped && !message.isOneToOneConversation && !message.isFormerOneToOneConversation) {
|
||||
setAvatarOnMessage(message)
|
||||
} else {
|
||||
if (message.isOneToOneConversation) {
|
||||
if (message.isOneToOneConversation || message.isFormerOneToOneConversation) {
|
||||
binding.messageUserAvatar.visibility = View.GONE
|
||||
} else {
|
||||
binding.messageUserAvatar.visibility = View.INVISIBLE
|
||||
|
|
|
@ -135,7 +135,7 @@ class IncomingLocationMessageViewHolder(incomingView: View, payload: Any) : Mess
|
|||
binding.messageAuthor.setText(R.string.nc_nick_guest)
|
||||
}
|
||||
|
||||
if (!message.isGrouped && !message.isOneToOneConversation) {
|
||||
if (!message.isGrouped && !message.isOneToOneConversation && !message.isFormerOneToOneConversation) {
|
||||
binding.messageUserAvatar.visibility = View.VISIBLE
|
||||
if (message.actorType == "guests") {
|
||||
// do nothing, avatar is set
|
||||
|
@ -145,7 +145,7 @@ class IncomingLocationMessageViewHolder(incomingView: View, payload: Any) : Mess
|
|||
binding.messageUserAvatar.loadBotsAvatar()
|
||||
}
|
||||
} else {
|
||||
if (message.isOneToOneConversation) {
|
||||
if (message.isOneToOneConversation || message.isFormerOneToOneConversation) {
|
||||
binding.messageUserAvatar.visibility = View.GONE
|
||||
} else {
|
||||
binding.messageUserAvatar.visibility = View.INVISIBLE
|
||||
|
|
|
@ -155,10 +155,10 @@ class IncomingPollMessageViewHolder(incomingView: View, payload: Any) : MessageH
|
|||
binding.messageAuthor.setText(R.string.nc_nick_guest)
|
||||
}
|
||||
|
||||
if (!message.isGrouped && !message.isOneToOneConversation) {
|
||||
if (!message.isGrouped && !message.isOneToOneConversation && !message.isFormerOneToOneConversation) {
|
||||
setAvatarOnMessage(message)
|
||||
} else {
|
||||
if (message.isOneToOneConversation) {
|
||||
if (message.isOneToOneConversation || message.isFormerOneToOneConversation) {
|
||||
binding.messageUserAvatar.visibility = View.GONE
|
||||
} else {
|
||||
binding.messageUserAvatar.visibility = View.INVISIBLE
|
||||
|
|
|
@ -143,10 +143,10 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) : MessageHolde
|
|||
binding.messageAuthor.setText(R.string.nc_nick_guest)
|
||||
}
|
||||
|
||||
if (!message.isGrouped && !message.isOneToOneConversation) {
|
||||
if (!message.isGrouped && !message.isOneToOneConversation && !message.isFormerOneToOneConversation) {
|
||||
setAvatarOnMessage(message)
|
||||
} else {
|
||||
if (message.isOneToOneConversation) {
|
||||
if (message.isOneToOneConversation || message.isFormerOneToOneConversation) {
|
||||
binding.messageUserAvatar.visibility = View.GONE
|
||||
} else {
|
||||
binding.messageUserAvatar.visibility = View.INVISIBLE
|
||||
|
|
|
@ -232,10 +232,10 @@ class IncomingVoiceMessageViewHolder(incomingView: View, payload: Any) : Message
|
|||
binding.messageAuthor.setText(R.string.nc_nick_guest)
|
||||
}
|
||||
|
||||
if (!message.isGrouped && !message.isOneToOneConversation) {
|
||||
if (!message.isGrouped && !message.isOneToOneConversation && !message.isFormerOneToOneConversation) {
|
||||
setAvatarOnMessage(message)
|
||||
} else {
|
||||
if (message.isOneToOneConversation) {
|
||||
if (message.isOneToOneConversation || message.isFormerOneToOneConversation) {
|
||||
binding.messageUserAvatar.visibility = View.GONE
|
||||
} else {
|
||||
binding.messageUserAvatar.visibility = View.INVISIBLE
|
||||
|
|
|
@ -2460,6 +2460,8 @@ class ChatController(args: Bundle) :
|
|||
)
|
||||
chatMessage.isOneToOneConversation =
|
||||
(currentConversation?.type == Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL)
|
||||
chatMessage.isFormerOneToOneConversation =
|
||||
(currentConversation?.type == Conversation.ConversationType.FORMER_ONE_TO_ONE)
|
||||
it.addToStart(chatMessage, shouldScroll)
|
||||
}
|
||||
}
|
||||
|
@ -2499,6 +2501,8 @@ class ChatController(args: Bundle) :
|
|||
val chatMessage = chatMessageList[i]
|
||||
chatMessage.isOneToOneConversation =
|
||||
currentConversation?.type == Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL
|
||||
chatMessage.isFormerOneToOneConversation =
|
||||
(currentConversation?.type == Conversation.ConversationType.FORMER_ONE_TO_ONE)
|
||||
chatMessage.activeUser = conversationUser
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,9 @@ data class ChatMessage(
|
|||
@JsonIgnore
|
||||
var isOneToOneConversation: Boolean = false,
|
||||
|
||||
@JsonIgnore
|
||||
var isFormerOneToOneConversation: Boolean = false,
|
||||
|
||||
@JsonIgnore
|
||||
var activeUser: User? = null,
|
||||
|
||||
|
|
|
@ -167,7 +167,9 @@ data class Conversation(
|
|||
}
|
||||
|
||||
fun canModerate(conversationUser: User): Boolean {
|
||||
return isParticipantOwnerOrModerator && !isLockedOneToOne(conversationUser)
|
||||
return isParticipantOwnerOrModerator &&
|
||||
!isLockedOneToOne(conversationUser) &&
|
||||
type != ConversationType.FORMER_ONE_TO_ONE
|
||||
}
|
||||
|
||||
fun isLobbyViewApplicable(conversationUser: User): Boolean {
|
||||
|
@ -210,6 +212,11 @@ data class Conversation(
|
|||
|
||||
@Parcelize
|
||||
enum class ConversationType : Parcelable {
|
||||
DUMMY, ROOM_TYPE_ONE_TO_ONE_CALL, ROOM_GROUP_CALL, ROOM_PUBLIC_CALL, ROOM_SYSTEM
|
||||
DUMMY,
|
||||
ROOM_TYPE_ONE_TO_ONE_CALL,
|
||||
ROOM_GROUP_CALL,
|
||||
ROOM_PUBLIC_CALL,
|
||||
ROOM_SYSTEM,
|
||||
FORMER_ONE_TO_ONE
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,8 @@ public class EnumRoomTypeConverter extends IntBasedTypeConverter<Conversation.Co
|
|||
return Conversation.ConversationType.ROOM_PUBLIC_CALL;
|
||||
case 4:
|
||||
return Conversation.ConversationType.ROOM_SYSTEM;
|
||||
case 5:
|
||||
return Conversation.ConversationType.FORMER_ONE_TO_ONE;
|
||||
default:
|
||||
return Conversation.ConversationType.DUMMY;
|
||||
}
|
||||
|
@ -53,6 +55,8 @@ public class EnumRoomTypeConverter extends IntBasedTypeConverter<Conversation.Co
|
|||
return 3;
|
||||
case ROOM_SYSTEM:
|
||||
return 4;
|
||||
case FORMER_ONE_TO_ONE:
|
||||
return 5;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue