set values to not nullable in ConversationEntity.kt wherever this makes sense

remove roomId from Conversation (deprecated. only token should be used)

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2024-08-12 12:40:05 +02:00
Родитель 9892613984
Коммит a632765cce
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: C793F8B59F43CE7B
18 изменённых файлов: 134 добавлений и 131 удалений

Просмотреть файл

@ -1734,7 +1734,7 @@ class CallActivity : CallBaseActivity() {
private fun setInitialApplicationWideCurrentRoomHolderValues(conversation: Conversation) {
ApplicationWideCurrentRoomHolder.getInstance().userInRoom = conversationUser
ApplicationWideCurrentRoomHolder.getInstance().session = conversation.sessionId
ApplicationWideCurrentRoomHolder.getInstance().currentRoomId = conversation.roomId
// ApplicationWideCurrentRoomHolder.getInstance().currentRoomId = conversation.roomId
ApplicationWideCurrentRoomHolder.getInstance().currentRoomToken = conversation.token
ApplicationWideCurrentRoomHolder.getInstance().callStartTime = conversation.callStartTime
}

Просмотреть файл

@ -54,7 +54,7 @@ class ConversationItem(
ISectionable<ConversationItemViewHolder, GenericTextHeaderItem?>,
IFilterable<String?> {
private var header: GenericTextHeaderItem? = null
private val chatMessage = model.lastMessageViaConversationList?.asModel()
private val chatMessage = model.lastMessage?.asModel()
constructor(
conversation: ConversationModel,

Просмотреть файл

@ -291,7 +291,7 @@ class ChatActivity :
var newMessagesCount = 0
var startCallFromNotification: Boolean = false
var startCallFromRoomSwitch: Boolean = false
lateinit var roomId: String
// lateinit var roomId: String
var voiceOnly: Boolean = true
private lateinit var path: String
@ -460,7 +460,7 @@ class ChatActivity :
private fun handleIntent(intent: Intent) {
val extras: Bundle? = intent.extras
roomId = extras?.getString(KEY_ROOM_ID).orEmpty()
// roomId = extras?.getString(KEY_ROOM_ID).orEmpty()
roomToken = extras?.getString(KEY_ROOM_TOKEN).orEmpty()
sharedText = extras?.getString(BundleKeys.KEY_SHARED_TEXT).orEmpty()
@ -619,7 +619,7 @@ class ChatActivity :
sessionIdAfterRoomJoined = currentConversation!!.sessionId
ApplicationWideCurrentRoomHolder.getInstance().session = currentConversation!!.sessionId
ApplicationWideCurrentRoomHolder.getInstance().currentRoomId = currentConversation!!.roomId
// ApplicationWideCurrentRoomHolder.getInstance().currentRoomId = currentConversation!!.roomId
ApplicationWideCurrentRoomHolder.getInstance().currentRoomToken = currentConversation!!.token
ApplicationWideCurrentRoomHolder.getInstance().userInRoom = conversationUser
@ -738,7 +738,7 @@ class ChatActivity :
is ChatViewModel.CreateRoomSuccessState -> {
val bundle = Bundle()
bundle.putString(KEY_ROOM_TOKEN, state.roomOverall.ocs!!.data!!.token)
bundle.putString(KEY_ROOM_ID, state.roomOverall.ocs!!.data!!.roomId)
// bundle.putString(KEY_ROOM_ID, state.roomOverall.ocs!!.data!!.roomId)
leaveRoom {
val chatIntent = Intent(context, ChatActivity::class.java)
@ -2345,12 +2345,12 @@ class ChatActivity :
private fun joinRoomWithPassword() {
// if ApplicationWideCurrentRoomHolder contains a session (because a call is active), then keep the sessionId
if (ApplicationWideCurrentRoomHolder.getInstance().currentRoomId ==
currentConversation!!.roomId
if (ApplicationWideCurrentRoomHolder.getInstance().currentRoomToken ==
currentConversation!!.token
) {
sessionIdAfterRoomJoined = ApplicationWideCurrentRoomHolder.getInstance().session
ApplicationWideCurrentRoomHolder.getInstance().currentRoomId = roomId
// ApplicationWideCurrentRoomHolder.getInstance().currentRoomId = roomId
ApplicationWideCurrentRoomHolder.getInstance().currentRoomToken = roomToken
ApplicationWideCurrentRoomHolder.getInstance().userInRoom = conversationUser
}
@ -2908,7 +2908,7 @@ class ChatActivity :
currentConversation?.let {
val bundle = Bundle()
bundle.putString(KEY_ROOM_TOKEN, roomToken)
bundle.putString(KEY_ROOM_ID, roomId)
// bundle.putString(KEY_ROOM_ID, roomId)
bundle.putString(BundleKeys.KEY_CONVERSATION_PASSWORD, roomPassword)
bundle.putString(BundleKeys.KEY_MODIFIED_BASE_URL, conversationUser?.baseUrl!!)
bundle.putString(KEY_CONVERSATION_NAME, it.displayName)
@ -3043,7 +3043,7 @@ class ChatActivity :
val bundle = Bundle()
bundle.putBoolean(BundleKeys.KEY_FORWARD_MSG_FLAG, true)
bundle.putString(BundleKeys.KEY_FORWARD_MSG_TEXT, message?.text)
bundle.putString(BundleKeys.KEY_FORWARD_HIDE_SOURCE_ROOM, roomId)
bundle.putString(BundleKeys.KEY_FORWARD_HIDE_SOURCE_ROOM, roomToken)
val intent = Intent(this, ConversationsListActivity::class.java)
intent.putExtras(bundle)

Просмотреть файл

@ -338,7 +338,7 @@ class ContactsActivity :
override fun onNext(roomOverall: RoomOverall) {
val bundle = Bundle()
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomOverall.ocs!!.data!!.token)
bundle.putString(BundleKeys.KEY_ROOM_ID, roomOverall.ocs!!.data!!.roomId)
// bundle.putString(BundleKeys.KEY_ROOM_ID, roomOverall.ocs!!.data!!.roomId)
val chatIntent = Intent(context, ChatActivity::class.java)
chatIntent.putExtras(bundle)
@ -804,7 +804,7 @@ class ContactsActivity :
override fun onNext(roomOverall: RoomOverall) {
val bundle = Bundle()
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomOverall.ocs!!.data!!.token)
bundle.putString(BundleKeys.KEY_ROOM_ID, roomOverall.ocs!!.data!!.roomId)
// bundle.putString(BundleKeys.KEY_ROOM_ID, roomOverall.ocs!!.data!!.roomId)
val chatIntent = Intent(context, ChatActivity::class.java)
chatIntent.putExtras(bundle)

Просмотреть файл

@ -220,7 +220,7 @@ fun ContactItemRow(contact: AutocompleteUser, contactsViewModel: ContactsViewMod
val conversation = (roomUiState as RoomUiState.Success).conversation
val bundle = Bundle()
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, conversation?.token)
bundle.putString(BundleKeys.KEY_ROOM_ID, conversation?.roomId)
// bundle.putString(BundleKeys.KEY_ROOM_ID, conversation?.roomId)
val chatIntent = Intent(context, ChatActivity::class.java)
chatIntent.putExtras(bundle)
chatIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)

Просмотреть файл

@ -775,7 +775,7 @@ class ConversationsListActivity :
private fun addToConversationItems(conversation: ConversationModel) {
if (intent.getStringExtra(KEY_FORWARD_HIDE_SOURCE_ROOM) != null &&
intent.getStringExtra(KEY_FORWARD_HIDE_SOURCE_ROOM) == conversation.roomId
intent.getStringExtra(KEY_FORWARD_HIDE_SOURCE_ROOM) == conversation.token
) {
return
}
@ -1456,7 +1456,7 @@ class ConversationsListActivity :
val bundle = Bundle()
bundle.putString(KEY_ROOM_TOKEN, selectedConversation!!.token)
bundle.putString(KEY_ROOM_ID, selectedConversation!!.roomId)
// bundle.putString(KEY_ROOM_ID, selectedConversation!!.roomId)
bundle.putString(KEY_SHARED_TEXT, textToPaste)
if (selectedMessageId != null) {
bundle.putString(BundleKeys.KEY_MESSAGE_ID, selectedMessageId)

Просмотреть файл

@ -32,7 +32,7 @@ fun ConversationModel.asEntity() =
lastActivity = lastActivity,
unreadMessages = unreadMessages,
unreadMention = unreadMention,
// lastMessageId = lastMessage?.id?.toLong(),
lastMessage = lastMessage?.let { LoganSquare.serialize(lastMessage) },
objectType = objectType,
notificationLevel = notificationLevel,
conversationReadOnlyState = conversationReadOnlyState,
@ -81,8 +81,8 @@ fun ConversationEntity.asModel() =
lastActivity = lastActivity,
unreadMessages = unreadMessages,
unreadMention = unreadMention,
lastMessageViaConversationList = lastMessageJson?.let
{ LoganSquare.parse(lastMessageJson, ChatMessageJson::class.java) },
lastMessage = lastMessage?.let
{ LoganSquare.parse(lastMessage, ChatMessageJson::class.java) },
objectType = objectType,
notificationLevel = notificationLevel,
conversationReadOnlyState = conversationReadOnlyState,
@ -116,36 +116,36 @@ fun Conversation.asEntity(accountId: Long) =
ConversationEntity(
internalId = "$accountId@$token",
accountId = accountId,
token = token,
name = name,
displayName = displayName,
description = description,
type = type,
token = token!!,
name = name!!,
displayName = displayName!!,
description = description!!,
type = type!!,
lastPing = lastPing,
participantType = participantType,
participantType = participantType!!,
hasPassword = hasPassword,
sessionId = sessionId,
actorId = actorId,
actorType = actorType,
sessionId = sessionId!!,
actorId = actorId!!,
actorType = actorType!!,
favorite = favorite,
lastActivity = lastActivity,
unreadMessages = unreadMessages,
unreadMention = unreadMention,
lastMessageJson = lastMessage?.let { LoganSquare.serialize(lastMessage) },
objectType = objectType,
notificationLevel = notificationLevel,
conversationReadOnlyState = conversationReadOnlyState,
lobbyState = lobbyState,
lobbyTimer = lobbyTimer,
lastMessage = lastMessage?.let { LoganSquare.serialize(lastMessage) },
objectType = objectType!!,
notificationLevel = notificationLevel!!,
conversationReadOnlyState = conversationReadOnlyState!!,
lobbyState = lobbyState!!,
lobbyTimer = lobbyTimer!!,
lastReadMessage = lastReadMessage,
lastCommonReadMessage = lastCommonReadMessage,
hasCall = hasCall,
callFlag = callFlag,
canStartCall = canStartCall,
canLeaveConversation = canLeaveConversation,
canDeleteConversation = canDeleteConversation,
unreadMentionDirect = unreadMentionDirect,
notificationCalls = notificationCalls,
canLeaveConversation = canLeaveConversation!!,
canDeleteConversation = canDeleteConversation!!,
unreadMentionDirect = unreadMentionDirect!!,
notificationCalls = notificationCalls!!,
permissions = permissions,
messageExpiration = messageExpiration,
status = status,
@ -153,9 +153,9 @@ fun Conversation.asEntity(accountId: Long) =
statusMessage = statusMessage,
statusClearAt = statusClearAt,
callRecording = callRecording,
avatarVersion = avatarVersion,
hasCustomAvatar = hasCustomAvatar,
callStartTime = callStartTime,
avatarVersion = avatarVersion!!,
hasCustomAvatar = hasCustomAvatar!!,
callStartTime = callStartTime!!,
recordingConsentRequired = recordingConsentRequired,
remoteServer = remoteServer,
remoteToken = remoteToken

Просмотреть файл

@ -11,6 +11,8 @@ import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
// ChatBlockEntity.kt:26: internalConversationId column references a foreign key but it is not part of an index. This may trigger full table scans whenever parent table is modified so you are highly advised to create an index that covers this column.
@Entity(
tableName = "ChatBlocks",
foreignKeys = [

Просмотреть файл

@ -47,7 +47,7 @@ data class ChatMessageEntity(
@ColumnInfo(name = "systemMessage") var systemMessageType: ChatMessage.SystemMessageType? = null,
@ColumnInfo(name = "messageType") var messageType: String? = null,
@ColumnInfo(name = "isReplyable") var replyable: Boolean = false,
// TODO: add "referenceId"
// missing/not needed: referenceId
@ColumnInfo(name = "message") var message: String? = null,
@ColumnInfo(name = "messageParameters") var messageParameters: HashMap<String?, HashMap<String?, String?>>? = null,
@ColumnInfo(name = "expirationTimestamp") var expirationTimestamp: Int = 0,
@ -60,5 +60,5 @@ data class ChatMessageEntity(
@ColumnInfo(name = "lastEditActorDisplayName") var lastEditActorDisplayName: String? = null,
@ColumnInfo(name = "lastEditTimestamp") var lastEditTimestamp: Long? = 0,
@ColumnInfo(name = "deleted") var deleted: Boolean = false,
// TODO: add "silent"
// missing/not needed: silent
)

Просмотреть файл

@ -44,49 +44,49 @@ data class ConversationEntity(
// "unread message" etc only match a specific account.
// If multiple talk app accounts have the same conversation, it is stored as another dataset, which is
// exactly what we want for this case.
@ColumnInfo(name = "token") var token: String?,
@ColumnInfo(name = "type") var type: ConversationEnums.ConversationType? = null,
@ColumnInfo(name = "name") var name: String? = null,
@ColumnInfo(name = "displayName") var displayName: String? = null,
@ColumnInfo(name = "description") var description: String? = null,
@ColumnInfo(name = "participantType") var participantType: Participant.ParticipantType? = null,
@ColumnInfo(name = "token") var token: String,
@ColumnInfo(name = "type") var type: ConversationEnums.ConversationType,
@ColumnInfo(name = "name") var name: String,
@ColumnInfo(name = "displayName") var displayName: String,
@ColumnInfo(name = "description") var description: String,
@ColumnInfo(name = "participantType") var participantType: Participant.ParticipantType,
// missing/not needed: attendeeId
// missing/not needed: attendeePin
@ColumnInfo(name = "actorType") var actorType: String? = null,
@ColumnInfo(name = "actorId") var actorId: String? = null,
@ColumnInfo(name = "actorType") var actorType: String,
@ColumnInfo(name = "actorId") var actorId: String,
@ColumnInfo(name = "permissions") var permissions: Int = 0,
// missing/not needed: attendeePermissions
// missing/not needed: callPermissions
// missing/not needed: defaultPermissions
// missing/not needed: participantInCall
// missing/not needed: participantFlags
@ColumnInfo(name = "readOnly") var conversationReadOnlyState: ConversationEnums.ConversationReadOnlyState? = null,
@ColumnInfo(name = "readOnly") var conversationReadOnlyState: ConversationEnums.ConversationReadOnlyState,
// missing/not needed: listable
@ColumnInfo(name = "messageExpiration") var messageExpiration: Int = 0,
// missing/not needed: count
// missing/not needed: numGuests
@ColumnInfo(name = "lastPing") var lastPing: Long = 0,
@ColumnInfo(name = "sessionId") var sessionId: String? = null,
@ColumnInfo(name = "sessionId") var sessionId: String,
@ColumnInfo(name = "hasPassword") var hasPassword: Boolean = false,
@ColumnInfo(name = "hasCall") var hasCall: Boolean = false,
@ColumnInfo(name = "callFlag") var callFlag: Int = 0,
@ColumnInfo(name = "canStartCall") var canStartCall: Boolean = false,
@ColumnInfo(name = "canDeleteConversation") var canDeleteConversation: Boolean? = null,
@ColumnInfo(name = "canLeaveConversation") var canLeaveConversation: Boolean? = null,
@ColumnInfo(name = "canDeleteConversation") var canDeleteConversation: Boolean,
@ColumnInfo(name = "canLeaveConversation") var canLeaveConversation: Boolean,
@ColumnInfo(name = "lastActivity") var lastActivity: Long = 0,
@ColumnInfo(name = "isFavorite") var favorite: Boolean = false,
@ColumnInfo(name = "notificationLevel") var notificationLevel: ConversationEnums.NotificationLevel? = null,
@ColumnInfo(name = "lobbyState") var lobbyState: ConversationEnums.LobbyState? = null,
@ColumnInfo(name = "lobbyTimer") var lobbyTimer: Long? = null,
@ColumnInfo(name = "notificationLevel") var notificationLevel: ConversationEnums.NotificationLevel,
@ColumnInfo(name = "lobbyState") var lobbyState: ConversationEnums.LobbyState,
@ColumnInfo(name = "lobbyTimer") var lobbyTimer: Long = 0,
// missing/not needed: sipEnabled
// missing/not needed: canEnableSIP
@ColumnInfo(name = "unreadMessages") var unreadMessages: Int = 0,
@ColumnInfo(name = "unreadMention") var unreadMention: Boolean = false,
@ColumnInfo(name = "unreadMentionDirect") var unreadMentionDirect: Boolean? = null,
@ColumnInfo(name = "unreadMentionDirect") var unreadMentionDirect: Boolean,
@ColumnInfo(name = "lastReadMessage") var lastReadMessage: Int = 0,
@ColumnInfo(name = "lastCommonReadMessage") var lastCommonReadMessage: Int = 0,
@ColumnInfo(name = "lastMessageJson") var lastMessageJson: String? = null,
@ColumnInfo(name = "objectType") var objectType: ConversationEnums.ObjectType? = null,
@ColumnInfo(name = "lastMessage") var lastMessage: String? = null,
@ColumnInfo(name = "objectType") var objectType: ConversationEnums.ObjectType,
// missing/not needed: objectId
// missing/not needed: breakoutRoomMode
// missing/not needed: breakoutRoomStatus
@ -94,13 +94,13 @@ data class ConversationEntity(
@ColumnInfo(name = "statusIcon") var statusIcon: String? = null,
@ColumnInfo(name = "statusMessage") var statusMessage: String? = null,
@ColumnInfo(name = "statusClearAt") var statusClearAt: Long? = 0,
@ColumnInfo(name = "avatarVersion") var avatarVersion: String? = null,
@ColumnInfo(name = "isCustomAvatar") var hasCustomAvatar: Boolean? = null,
@ColumnInfo(name = "callStartTime") var callStartTime: Long? = null,
@ColumnInfo(name = "avatarVersion") var avatarVersion: String,
@ColumnInfo(name = "isCustomAvatar") var hasCustomAvatar: Boolean,
@ColumnInfo(name = "callStartTime") var callStartTime: Long = 0,
@ColumnInfo(name = "callRecording") var callRecording: Int = 0,
@ColumnInfo(name = "recordingConsent") var recordingConsentRequired: Int = 0,
@ColumnInfo(name = "notificationCalls") var notificationCalls: Int? = null,
@ColumnInfo(name = "notificationCalls") var notificationCalls: Int = 0,
@ColumnInfo(name = "remoteServer") var remoteServer: String? = null,
@ColumnInfo(name = "remoteToken") var remoteToken: String? = null
)

Просмотреть файл

@ -16,38 +16,37 @@ import com.nextcloud.talk.models.json.participants.Participant
class ConversationModel(
var internalId: String,
var accountId: Long,
var roomId: String? = null,
var token: String? = null,
var name: String? = null,
var displayName: String? = null,
var description: String? = null,
var type: ConversationEnums.ConversationType? = null,
// var roomId: String? = null,
var token: String,
var name: String,
var displayName: String,
var description: String,
var type: ConversationEnums.ConversationType,
var lastPing: Long = 0,
var participantType: Participant.ParticipantType? = null,
var participantType: Participant.ParticipantType,
var hasPassword: Boolean = false,
var sessionId: String? = null,
var actorId: String? = null,
var actorType: String? = null,
var password: String? = null,
var sessionId: String,
var actorId: String,
var actorType: String,
var favorite: Boolean = false,
var lastActivity: Long = 0,
var unreadMessages: Int = 0,
var unreadMention: Boolean = false,
var lastMessageViaConversationList: ChatMessageJson? = null,
var objectType: ConversationEnums.ObjectType? = null,
var notificationLevel: ConversationEnums.NotificationLevel? = null,
var conversationReadOnlyState: ConversationEnums.ConversationReadOnlyState? = null,
var lobbyState: ConversationEnums.LobbyState? = null,
var lobbyTimer: Long? = null,
var lastMessage: ChatMessageJson? = null,
var objectType: ConversationEnums.ObjectType,
var notificationLevel: ConversationEnums.NotificationLevel,
var conversationReadOnlyState: ConversationEnums.ConversationReadOnlyState,
var lobbyState: ConversationEnums.LobbyState,
var lobbyTimer: Long,
var lastReadMessage: Int = 0,
var lastCommonReadMessage: Int = 0,
var hasCall: Boolean = false,
var callFlag: Int = 0,
var canStartCall: Boolean = false,
var canLeaveConversation: Boolean? = null,
var canDeleteConversation: Boolean? = null,
var unreadMentionDirect: Boolean? = null,
var notificationCalls: Int? = null,
var canLeaveConversation: Boolean,
var canDeleteConversation: Boolean,
var unreadMentionDirect: Boolean,
var notificationCalls: Int,
var permissions: Int = 0,
var messageExpiration: Int = 0,
var status: String? = null,
@ -55,12 +54,15 @@ class ConversationModel(
var statusMessage: String? = null,
var statusClearAt: Long? = 0,
var callRecording: Int = 0,
var avatarVersion: String? = null,
var hasCustomAvatar: Boolean? = null,
var callStartTime: Long? = null,
var avatarVersion: String,
var hasCustomAvatar: Boolean,
var callStartTime: Long,
var recordingConsentRequired: Int = 0,
var remoteServer: String? = null,
var remoteToken: String? = null,
// attributes that don't come from API. This should be changed?!
var password: String? = null,
) {
companion object {
@ -68,46 +70,46 @@ class ConversationModel(
return ConversationModel(
internalId = user.id!!.toString() + "@" + conversation.token,
accountId = user.id!!,
roomId = conversation.roomId,
token = conversation.token,
name = conversation.name,
displayName = conversation.displayName,
description = conversation.description,
type = conversation.type?.let { ConversationEnums.ConversationType.valueOf(it.name) },
// roomId = conversation.roomId,
token = conversation.token!!,
name = conversation.name!!,
displayName = conversation.displayName!!,
description = conversation.description!!,
type = conversation.type.let { ConversationEnums.ConversationType.valueOf(it!!.name) },
lastPing = conversation.lastPing,
participantType = conversation.participantType?.let { Participant.ParticipantType.valueOf(it.name) },
participantType = conversation.participantType.let { Participant.ParticipantType.valueOf(it!!.name) },
hasPassword = conversation.hasPassword,
sessionId = conversation.sessionId,
actorId = conversation.actorId,
actorType = conversation.actorType,
sessionId = conversation.sessionId!!,
actorId = conversation.actorId!!,
actorType = conversation.actorType!!,
password = conversation.password,
favorite = conversation.favorite,
lastActivity = conversation.lastActivity,
unreadMessages = conversation.unreadMessages,
unreadMention = conversation.unreadMention,
// lastMessage = conversation.lastMessage, to do...
objectType = conversation.objectType?.let { ConversationEnums.ObjectType.valueOf(it.name) },
notificationLevel = conversation.notificationLevel?.let {
lastMessage = conversation.lastMessage,
objectType = conversation.objectType.let { ConversationEnums.ObjectType.valueOf(it!!.name) },
notificationLevel = conversation.notificationLevel.let {
ConversationEnums.NotificationLevel.valueOf(
it.name
it!!.name
)
},
conversationReadOnlyState = conversation.conversationReadOnlyState?.let {
conversationReadOnlyState = conversation.conversationReadOnlyState.let {
ConversationEnums.ConversationReadOnlyState.valueOf(
it.name
it!!.name
)
},
lobbyState = conversation.lobbyState?.let { ConversationEnums.LobbyState.valueOf(it.name) },
lobbyTimer = conversation.lobbyTimer,
lobbyState = conversation.lobbyState.let { ConversationEnums.LobbyState.valueOf(it!!.name) },
lobbyTimer = conversation.lobbyTimer!!,
lastReadMessage = conversation.lastReadMessage,
lastCommonReadMessage = conversation.lastCommonReadMessage,
hasCall = conversation.hasCall,
callFlag = conversation.callFlag,
canStartCall = conversation.canStartCall,
canLeaveConversation = conversation.canLeaveConversation,
canDeleteConversation = conversation.canDeleteConversation,
unreadMentionDirect = conversation.unreadMentionDirect,
notificationCalls = conversation.notificationCalls,
canLeaveConversation = conversation.canLeaveConversation!!,
canDeleteConversation = conversation.canDeleteConversation!!,
unreadMentionDirect = conversation.unreadMentionDirect!!,
notificationCalls = conversation.notificationCalls!!,
permissions = conversation.permissions,
messageExpiration = conversation.messageExpiration,
status = conversation.status,
@ -115,9 +117,9 @@ class ConversationModel(
statusMessage = conversation.statusMessage,
statusClearAt = conversation.statusClearAt,
callRecording = conversation.callRecording,
avatarVersion = conversation.avatarVersion,
hasCustomAvatar = conversation.hasCustomAvatar,
callStartTime = conversation.callStartTime,
avatarVersion = conversation.avatarVersion!!,
hasCustomAvatar = conversation.hasCustomAvatar!!,
callStartTime = conversation.callStartTime!!,
recordingConsentRequired = conversation.recordingConsentRequired,
remoteServer = conversation.remoteServer,
remoteToken = conversation.remoteToken

Просмотреть файл

@ -28,8 +28,8 @@ import kotlinx.parcelize.Parcelize
@Parcelize
@JsonObject
data class Conversation(
@JsonField(name = ["id"])
var roomId: String? = null,
// @JsonField(name = ["id"])
// var roomId: String? = null,
@JsonField(name = ["token"])
var token: String? = null,
@JsonField(name = ["name"])
@ -67,7 +67,6 @@ data class Conversation(
@JsonField(name = ["unreadMention"])
var unreadMention: Boolean = false,
// TODO get this from Json -> map to ChatMessage and fix error
@JsonField(name = ["lastMessage"])
var lastMessage: ChatMessageJson? = null,

Просмотреть файл

@ -76,6 +76,6 @@ object ConversationsCallback : DiffUtil.ItemCallback<OpenConversation>() {
}
override fun areContentsTheSame(oldItem: OpenConversation, newItem: OpenConversation): Boolean {
return oldItem.roomId == newItem.roomId
return oldItem.roomToken == newItem.roomToken
}
}

Просмотреть файл

@ -7,7 +7,7 @@
package com.nextcloud.talk.openconversations.data
data class OpenConversation(
var roomId: String,
// var roomId: String,
var roomToken: String,
var displayName: String,
var description: String?

Просмотреть файл

@ -32,7 +32,7 @@ class OpenConversationsRepositoryImpl(private val ncApi: NcApi, currentUserProvi
return OpenConversationsModel(
conversations.map { conversation ->
OpenConversation(
conversation.roomId!!,
// conversation.roomId!!,
conversation.token!!,
conversation.name!!,
conversation.description ?: ""

Просмотреть файл

@ -140,7 +140,7 @@ class ProfileBottomSheet(val ncApi: NcApi, val userModel: User, val viewThemeUti
override fun onNext(roomOverall: RoomOverall) {
val bundle = Bundle()
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomOverall.ocs!!.data!!.token)
bundle.putString(BundleKeys.KEY_ROOM_ID, roomOverall.ocs!!.data!!.roomId)
// bundle.putString(BundleKeys.KEY_ROOM_ID, roomOverall.ocs!!.data!!.roomId)
val chatIntent = Intent(context, ChatActivity::class.java)
chatIntent.putExtras(bundle)

Просмотреть файл

@ -312,7 +312,7 @@ class ConversationsListBottomDialog(
private fun markConversationAsRead() {
val messageId = if (conversation.remoteServer.isNullOrEmpty()) {
conversation.lastMessageViaConversationList?.id
conversation.lastMessage?.id
} else {
null
}

Просмотреть файл

@ -14,7 +14,7 @@ public class ApplicationWideCurrentRoomHolder {
public static final String TAG = "ApplicationWideCurrentRoomHolder";
private static final ApplicationWideCurrentRoomHolder holder = new ApplicationWideCurrentRoomHolder();
private String currentRoomId = "";
// private String currentRoomId = "";
private String currentRoomToken = "";
private User userInRoom = new User();
private boolean inCall = false;
@ -29,7 +29,7 @@ public class ApplicationWideCurrentRoomHolder {
public void clear() {
Log.d(TAG, "ApplicationWideCurrentRoomHolder was cleared");
currentRoomId = "";
// currentRoomId = "";
userInRoom = new User();
inCall = false;
isDialing = false;
@ -45,13 +45,13 @@ public class ApplicationWideCurrentRoomHolder {
this.currentRoomToken = currentRoomToken;
}
public String getCurrentRoomId() {
return currentRoomId;
}
public void setCurrentRoomId(String currentRoomId) {
this.currentRoomId = currentRoomId;
}
// public String getCurrentRoomId() {
// return currentRoomId;
// }
//
// public void setCurrentRoomId(String currentRoomId) {
// this.currentRoomId = currentRoomId;
// }
public User getUserInRoom() {
return userInRoom;