Merge pull request #4052 from nextcloud/renovate/com.google.devtools.ksp-2.x

chore(deps): update plugin com.google.devtools.ksp to v2.0.10-1.0.24
This commit is contained in:
Andy Scherzinger 2024-08-17 20:43:02 +02:00 committed by GitHub
commit b5806df2f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
29 changed files with 104 additions and 125 deletions

View File

@ -15,7 +15,7 @@ import com.github.spotbugs.snom.SpotBugsTask
plugins {
id "org.jetbrains.kotlin.plugin.compose" version "2.0.10"
id "org.jetbrains.kotlin.kapt"
id 'com.google.devtools.ksp' version '2.0.0-1.0.24'
id 'com.google.devtools.ksp' version '2.0.10-1.0.24'
}
apply plugin: 'com.android.application'

View File

@ -52,7 +52,6 @@ class ChatBlocksDaoTest {
@Test
fun testGetConnectedChatBlocks() =
runTest {
usersDao.saveUser(createUserEntity("account1", "Account 1"))
val account1 = usersDao.getUserWithUserId("account1").blockingGet()
@ -67,7 +66,7 @@ class ChatBlocksDaoTest {
accountId = account1.id,
"def",
roomName = "Conversation Two"
),
)
)
)

View File

@ -13,21 +13,19 @@ import android.text.TextUtils
import android.util.Log
import android.view.View
import androidx.core.content.ContextCompat
import androidx.lifecycle.lifecycleScope
import autodagger.AutoInjector
import coil.load
import com.nextcloud.android.common.ui.theme.utils.ColorRole
import com.nextcloud.talk.R
import com.nextcloud.talk.adapters.messages.OutcomingPollMessageViewHolder.Companion
import com.nextcloud.talk.api.NcApi
import com.nextcloud.talk.application.NextcloudTalkApplication
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
import com.nextcloud.talk.chat.ChatActivity
import com.nextcloud.talk.chat.data.model.ChatMessage
import com.nextcloud.talk.databinding.ItemCustomIncomingLinkPreviewMessageBinding
import com.nextcloud.talk.extensions.loadBotsAvatar
import com.nextcloud.talk.extensions.loadChangelogBotAvatar
import com.nextcloud.talk.extensions.loadFederatedUserAvatar
import com.nextcloud.talk.chat.data.model.ChatMessage
import com.nextcloud.talk.ui.theme.ViewThemeUtils
import com.nextcloud.talk.utils.ApiUtils
import com.nextcloud.talk.utils.DateUtils

View File

@ -20,21 +20,19 @@ import android.view.MotionEvent
import android.view.View
import android.webkit.WebView
import android.webkit.WebViewClient
import androidx.lifecycle.lifecycleScope
import autodagger.AutoInjector
import coil.load
import com.google.android.material.snackbar.Snackbar
import com.nextcloud.android.common.ui.theme.utils.ColorRole
import com.nextcloud.talk.R
import com.nextcloud.talk.adapters.messages.IncomingPollMessageViewHolder.Companion
import com.nextcloud.talk.application.NextcloudTalkApplication
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
import com.nextcloud.talk.chat.ChatActivity
import com.nextcloud.talk.chat.data.model.ChatMessage
import com.nextcloud.talk.databinding.ItemCustomIncomingLocationMessageBinding
import com.nextcloud.talk.extensions.loadBotsAvatar
import com.nextcloud.talk.extensions.loadChangelogBotAvatar
import com.nextcloud.talk.extensions.loadFederatedUserAvatar
import com.nextcloud.talk.chat.data.model.ChatMessage
import com.nextcloud.talk.ui.theme.ViewThemeUtils
import com.nextcloud.talk.utils.ApiUtils
import com.nextcloud.talk.utils.DateUtils

View File

@ -12,21 +12,19 @@ import android.text.TextUtils
import android.util.Log
import android.view.View
import androidx.core.content.ContextCompat
import androidx.lifecycle.lifecycleScope
import autodagger.AutoInjector
import coil.load
import com.nextcloud.android.common.ui.theme.utils.ColorRole
import com.nextcloud.talk.R
import com.nextcloud.talk.adapters.messages.IncomingTextMessageViewHolder.Companion
import com.nextcloud.talk.api.NcApi
import com.nextcloud.talk.application.NextcloudTalkApplication
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
import com.nextcloud.talk.chat.ChatActivity
import com.nextcloud.talk.chat.data.model.ChatMessage
import com.nextcloud.talk.databinding.ItemCustomIncomingPollMessageBinding
import com.nextcloud.talk.extensions.loadBotsAvatar
import com.nextcloud.talk.extensions.loadChangelogBotAvatar
import com.nextcloud.talk.extensions.loadFederatedUserAvatar
import com.nextcloud.talk.chat.data.model.ChatMessage
import com.nextcloud.talk.polls.ui.PollMainDialogFragment
import com.nextcloud.talk.ui.theme.ViewThemeUtils
import com.nextcloud.talk.utils.ApiUtils

View File

@ -15,7 +15,6 @@ import android.util.Log
import android.util.TypedValue
import android.view.View
import androidx.core.content.ContextCompat
import androidx.lifecycle.lifecycleScope
import autodagger.AutoInjector
import coil.load
import com.nextcloud.android.common.ui.theme.utils.ColorRole
@ -23,11 +22,11 @@ import com.nextcloud.talk.R
import com.nextcloud.talk.application.NextcloudTalkApplication
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
import com.nextcloud.talk.chat.ChatActivity
import com.nextcloud.talk.chat.data.model.ChatMessage
import com.nextcloud.talk.databinding.ItemCustomIncomingTextMessageBinding
import com.nextcloud.talk.extensions.loadBotsAvatar
import com.nextcloud.talk.extensions.loadChangelogBotAvatar
import com.nextcloud.talk.extensions.loadFederatedUserAvatar
import com.nextcloud.talk.chat.data.model.ChatMessage
import com.nextcloud.talk.ui.theme.ViewThemeUtils
import com.nextcloud.talk.utils.ApiUtils
import com.nextcloud.talk.utils.DateUtils
@ -37,9 +36,7 @@ import com.nextcloud.talk.utils.preferences.AppPreferences
import com.stfalcon.chatkit.messages.MessageHolders
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import javax.inject.Inject

View File

@ -12,18 +12,16 @@ import android.content.Context
import android.util.Log
import android.view.View
import androidx.appcompat.content.res.AppCompatResources
import androidx.lifecycle.lifecycleScope
import autodagger.AutoInjector
import coil.load
import com.nextcloud.android.common.ui.theme.utils.ColorRole
import com.nextcloud.talk.R
import com.nextcloud.talk.adapters.messages.OutcomingPollMessageViewHolder.Companion
import com.nextcloud.talk.api.NcApi
import com.nextcloud.talk.application.NextcloudTalkApplication
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
import com.nextcloud.talk.chat.ChatActivity
import com.nextcloud.talk.databinding.ItemCustomOutcomingLinkPreviewMessageBinding
import com.nextcloud.talk.chat.data.model.ChatMessage
import com.nextcloud.talk.databinding.ItemCustomOutcomingLinkPreviewMessageBinding
import com.nextcloud.talk.models.json.chat.ReadStatus
import com.nextcloud.talk.ui.theme.ViewThemeUtils
import com.nextcloud.talk.utils.ApiUtils
@ -164,32 +162,32 @@ class OutcomingLinkPreviewMessageViewHolder(outcomingView: View, payload: Any) :
message.parentMessageId!!
).first()
}
parentChatMessage.activeUser = message.activeUser
parentChatMessage.imageUrl?.let {
binding.messageQuote.quotedMessageImage.visibility = View.VISIBLE
binding.messageQuote.quotedMessageImage.load(it) {
addHeader(
"Authorization",
ApiUtils.getCredentials(message.activeUser!!.username, message.activeUser!!.token)!!
)
}
} ?: run {
binding.messageQuote.quotedMessageImage.visibility = View.GONE
}
binding.messageQuote.quotedMessageAuthor.text = parentChatMessage.actorDisplayName
?: context.getText(R.string.nc_nick_guest)
binding.messageQuote.quotedMessage.text = messageUtils
.enrichChatReplyMessageText(
binding.messageQuote.quotedMessage.context,
parentChatMessage,
false,
viewThemeUtils
parentChatMessage.activeUser = message.activeUser
parentChatMessage.imageUrl?.let {
binding.messageQuote.quotedMessageImage.visibility = View.VISIBLE
binding.messageQuote.quotedMessageImage.load(it) {
addHeader(
"Authorization",
ApiUtils.getCredentials(message.activeUser!!.username, message.activeUser!!.token)!!
)
viewThemeUtils.talk.colorOutgoingQuoteText(binding.messageQuote.quotedMessage)
viewThemeUtils.talk.colorOutgoingQuoteAuthorText(binding.messageQuote.quotedMessageAuthor)
viewThemeUtils.talk.colorOutgoingQuoteBackground(binding.messageQuote.quoteColoredView)
}
} ?: run {
binding.messageQuote.quotedMessageImage.visibility = View.GONE
}
binding.messageQuote.quotedMessageAuthor.text = parentChatMessage.actorDisplayName
?: context.getText(R.string.nc_nick_guest)
binding.messageQuote.quotedMessage.text = messageUtils
.enrichChatReplyMessageText(
binding.messageQuote.quotedMessage.context,
parentChatMessage,
false,
viewThemeUtils
)
viewThemeUtils.talk.colorOutgoingQuoteText(binding.messageQuote.quotedMessage)
viewThemeUtils.talk.colorOutgoingQuoteAuthorText(binding.messageQuote.quotedMessageAuthor)
viewThemeUtils.talk.colorOutgoingQuoteBackground(binding.messageQuote.quoteColoredView)
binding.messageQuote.quotedChatMessageView.visibility = View.VISIBLE
binding.messageQuote.quotedChatMessageView.visibility = View.VISIBLE
} catch (e: Exception) {
Log.d(TAG, "Error when processing parent message in view holder", e)
}

View File

@ -18,19 +18,17 @@ import android.view.View
import android.webkit.WebView
import android.webkit.WebViewClient
import androidx.appcompat.content.res.AppCompatResources
import androidx.lifecycle.lifecycleScope
import autodagger.AutoInjector
import coil.load
import com.google.android.flexbox.FlexboxLayout
import com.google.android.material.snackbar.Snackbar
import com.nextcloud.android.common.ui.theme.utils.ColorRole
import com.nextcloud.talk.R
import com.nextcloud.talk.adapters.messages.IncomingPollMessageViewHolder.Companion
import com.nextcloud.talk.application.NextcloudTalkApplication
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
import com.nextcloud.talk.chat.ChatActivity
import com.nextcloud.talk.databinding.ItemCustomOutcomingLocationMessageBinding
import com.nextcloud.talk.chat.data.model.ChatMessage
import com.nextcloud.talk.databinding.ItemCustomOutcomingLocationMessageBinding
import com.nextcloud.talk.models.json.chat.ReadStatus
import com.nextcloud.talk.ui.theme.ViewThemeUtils
import com.nextcloud.talk.utils.ApiUtils

View File

@ -12,18 +12,16 @@ import android.content.Context
import android.util.Log
import android.view.View
import androidx.appcompat.content.res.AppCompatResources
import androidx.lifecycle.lifecycleScope
import autodagger.AutoInjector
import coil.load
import com.nextcloud.android.common.ui.theme.utils.ColorRole
import com.nextcloud.talk.R
import com.nextcloud.talk.adapters.messages.IncomingPollMessageViewHolder.Companion
import com.nextcloud.talk.api.NcApi
import com.nextcloud.talk.application.NextcloudTalkApplication
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
import com.nextcloud.talk.chat.ChatActivity
import com.nextcloud.talk.databinding.ItemCustomOutcomingPollMessageBinding
import com.nextcloud.talk.chat.data.model.ChatMessage
import com.nextcloud.talk.databinding.ItemCustomOutcomingPollMessageBinding
import com.nextcloud.talk.models.json.chat.ReadStatus
import com.nextcloud.talk.polls.ui.PollMainDialogFragment
import com.nextcloud.talk.ui.theme.ViewThemeUtils

View File

@ -17,19 +17,17 @@ import android.view.View
import android.widget.SeekBar
import androidx.appcompat.content.res.AppCompatResources
import androidx.core.content.ContextCompat
import androidx.lifecycle.lifecycleScope
import androidx.work.WorkInfo
import androidx.work.WorkManager
import autodagger.AutoInjector
import coil.load
import com.nextcloud.android.common.ui.theme.utils.ColorRole
import com.nextcloud.talk.R
import com.nextcloud.talk.adapters.messages.IncomingPollMessageViewHolder.Companion
import com.nextcloud.talk.application.NextcloudTalkApplication
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
import com.nextcloud.talk.chat.ChatActivity
import com.nextcloud.talk.databinding.ItemCustomOutcomingVoiceMessageBinding
import com.nextcloud.talk.chat.data.model.ChatMessage
import com.nextcloud.talk.databinding.ItemCustomOutcomingVoiceMessageBinding
import com.nextcloud.talk.models.json.chat.ReadStatus
import com.nextcloud.talk.ui.theme.ViewThemeUtils
import com.nextcloud.talk.utils.ApiUtils

View File

@ -162,7 +162,6 @@ import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_INTERNAL_USER_ID
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_BREAKOUT_ROOM
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_MODERATOR
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_RECORDING_STATE
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_ID
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_START_CALL_AFTER_ROOM_SWITCH
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_SWITCH_TO_ROOM
@ -187,7 +186,6 @@ import kotlinx.coroutines.withContext
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import retrofit2.HttpException
import retrofit2.Response
import java.io.File
import java.io.IOException
import java.net.HttpURLConnection
@ -291,6 +289,7 @@ class ChatActivity :
var newMessagesCount = 0
var startCallFromNotification: Boolean = false
var startCallFromRoomSwitch: Boolean = false
// lateinit var roomId: String
var voiceOnly: Boolean = true
private lateinit var path: String
@ -600,7 +599,7 @@ class ChatActivity :
chatViewModel.loadMessages(
withCredentials = credentials!!,
withUrl = urlForChatting,
withUrl = urlForChatting
)
}
@ -985,7 +984,8 @@ class ChatActivity :
if (newState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE) {
if (layoutManager!!.findFirstCompletelyVisibleItemPosition() > 0 &&
!binding.unreadMessagesPopup.isShown) {
!binding.unreadMessagesPopup.isShown
) {
binding.scrollDownButton.visibility = View.VISIBLE
} else {
binding.scrollDownButton.visibility = View.GONE
@ -2504,7 +2504,6 @@ class ChatActivity :
unreadChatMessage.message = context.getString(R.string.nc_new_messages)
adapter?.addToStart(unreadChatMessage, false)
if (scrollToEndOnUpdate) {
binding.scrollDownButton.visibility = View.GONE
newMessagesCount = 0
@ -2519,7 +2518,6 @@ class ChatActivity :
}
}
for (chatMessage in chatMessageList) {
chatMessage.activeUser = conversationUser
@ -2630,7 +2628,6 @@ class ChatActivity :
// see getImageUrl() source code
setUpWaveform(currentlyPlayedVoiceMessage!!, voiceMessageToRestoreWasPlaying)
Log.d(RESUME_AUDIO_TAG, "resume audio procedure completed")
} else {
Log.d(RESUME_AUDIO_TAG, "No voice message to restore")
}
@ -2639,7 +2636,7 @@ class ChatActivity :
voiceMessageToRestoreWasPlaying = false
}
private fun getItemFromAdapter(messageId: String): Pair<ChatMessage,Int>? {
private fun getItemFromAdapter(messageId: String): Pair<ChatMessage, Int>? {
if (adapter != null) {
val messagePosition = adapter!!.items!!.indexOfFirst {
it.item is ChatMessage && (it.item as ChatMessage).id == messageId
@ -2652,9 +2649,7 @@ class ChatActivity :
Log.d(TAG, "currentItem retrieved was not chatmessage or its id was not correct")
}
} else {
Log.d(
TAG, "messagePosition is -1, adapter # of items: " + adapter!!.itemCount
)
Log.d(TAG, "messagePosition is -1, adapter # of items: " + adapter!!.itemCount)
}
} else {
Log.d(TAG, "TalkMessagesListAdapter is null")
@ -2831,7 +2826,6 @@ class ChatActivity :
while (chatMessageIterator.hasNext()) {
val currentMessage = chatMessageIterator.next()
if (isInfoMessageAboutDeletion(currentMessage) ||
isReactionsMessage(currentMessage) ||
isPollVotedMessage(currentMessage) ||
@ -3176,7 +3170,7 @@ class ChatActivity :
val lon = data["longitude"]!!
metaData =
"{\"type\":\"geo-location\",\"id\":\"geo:$lat,$lon\",\"latitude\":\"$lat\"," +
"\"longitude\":\"$lon\",\"name\":\"$name\"}"
"\"longitude\":\"$lon\",\"name\":\"$name\"}"
}
when (type) {

View File

@ -32,11 +32,7 @@ interface ChatMessageRepository : LifecycleAwareManager {
val lastCommonReadFlow: Flow<Int>
fun setData(
conversationModel: ConversationModel,
credentials: String,
urlForChatting: String
)
fun setData(conversationModel: ConversationModel, credentials: String, urlForChatting: String)
fun loadInitialMessages(withNetworkParams: Bundle): Job

View File

@ -90,11 +90,7 @@ class OfflineFirstChatRepository @Inject constructor(
private lateinit var credentials: String
private lateinit var urlForChatting: String
override fun setData(
conversationModel: ConversationModel,
credentials: String,
urlForChatting: String
) {
override fun setData(conversationModel: ConversationModel, credentials: String, urlForChatting: String) {
this.conversationModel = conversationModel
this.credentials = credentials
this.urlForChatting = urlForChatting
@ -213,9 +209,7 @@ class OfflineFirstChatRepository @Inject constructor(
}
}
private suspend fun hasToLoadPreviousMessagesFromServer(
beforeMessageId: Long
): Boolean {
private suspend fun hasToLoadPreviousMessagesFromServer(beforeMessageId: Long): Boolean {
val loadFromServer: Boolean
val blockForMessage = getBlockOfMessage(beforeMessageId.toInt())
@ -239,7 +233,8 @@ class OfflineFirstChatRepository @Inject constructor(
loadFromServer = amountBetween < 100
Log.d(
TAG, "Amount between messageId " + beforeMessageId + " and " + blockForMessage.oldestMessageId +
TAG,
"Amount between messageId " + beforeMessageId + " and " + blockForMessage.oldestMessageId +
" is: " + amountBetween + " so 'loadFromServer' is " + loadFromServer
)
}
@ -272,9 +267,7 @@ class OfflineFirstChatRepository @Inject constructor(
return fieldMap
}
override suspend fun getMessage(messageId: Long, bundle: Bundle):
Flow<ChatMessage> {
override suspend fun getMessage(messageId: Long, bundle: Bundle): Flow<ChatMessage> {
Log.d(TAG, "Get message with id $messageId")
val loadFromServer = hasToLoadPreviousMessagesFromServer(messageId)
@ -511,12 +504,12 @@ class OfflineFirstChatRepository @Inject constructor(
chatBlock.newestMessageId
).first()
if (connectedChatBlocks.size == 1) {
return if (connectedChatBlocks.size == 1) {
Log.d(TAG, "This chatBlock is not connected to others")
val chatBlockFromDb = connectedChatBlocks[0]
Log.d(TAG, "chatBlockFromDb.oldestMessageId: " + chatBlockFromDb.oldestMessageId)
Log.d(TAG, "chatBlockFromDb.newestMessageId: " + chatBlockFromDb.newestMessageId)
return chatBlockFromDb
chatBlockFromDb
} else if (connectedChatBlocks.size > 1) {
Log.d(TAG, "Found " + connectedChatBlocks.size + " chat blocks that are connected")
val oldestIdFromDbChatBlocks =
@ -543,10 +536,10 @@ class OfflineFirstChatRepository @Inject constructor(
Log.d(TAG, "A new chat block was created that covers all the range of the found chatblocks")
Log.d(TAG, "new chatBlock - oldest MessageId: $oldestIdFromDbChatBlocks")
Log.d(TAG, "new chatBlock - newest MessageId: $newestIdFromDbChatBlocks")
return newChatBlock
newChatBlock
} else {
Log.d(TAG, "No chat block found ....")
return null
null
}
}

View File

@ -217,16 +217,8 @@ class ChatViewModel @Inject constructor(
val reactionDeletedViewState: LiveData<ViewState>
get() = _reactionDeletedViewState
fun setData(
conversationModel: ConversationModel,
credentials: String,
urlForChatting: String
) {
chatRepository.setData(
conversationModel,
credentials,
urlForChatting
)
fun setData(conversationModel: ConversationModel, credentials: String, urlForChatting: String) {
chatRepository.setData(conversationModel, credentials, urlForChatting)
}
fun getRoom(user: User, token: String) {

View File

@ -121,7 +121,6 @@ import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_FORWARD_MSG_FLAG
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_FORWARD_MSG_TEXT
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_INTERNAL_USER_ID
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_NEW_CONVERSATION
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_ID
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_SHARED_TEXT
import com.nextcloud.talk.utils.permissions.PlatformPermissionUtil

View File

@ -57,7 +57,6 @@ interface ChatBlocksDao {
)
fun getChatBlocksContainingMessageId(internalConversationId: String, messageId: Long): Flow<List<ChatBlockEntity?>>
@Query(
"""
SELECT *

View File

@ -7,11 +7,9 @@
package com.nextcloud.talk.data.database.mappers
import com.nextcloud.talk.models.json.chat.ChatMessageJson
import com.nextcloud.talk.data.database.model.ChatMessageEntity
import com.nextcloud.talk.chat.data.model.ChatMessage
import com.nextcloud.talk.data.database.dao.ChatMessagesDao
import kotlinx.coroutines.flow.first
import com.nextcloud.talk.data.database.model.ChatMessageEntity
import com.nextcloud.talk.models.json.chat.ChatMessageJson
fun ChatMessageJson.asEntity(accountId: Long) =
ChatMessageEntity(

View File

@ -63,7 +63,7 @@ data class ChatMessageEntity(
@ColumnInfo(name = "reactions") var reactions: LinkedHashMap<String, Int>? = null,
@ColumnInfo(name = "reactionsSelf") var reactionsSelf: ArrayList<String>? = null,
@ColumnInfo(name = "systemMessage") var systemMessageType: ChatMessage.SystemMessageType,
@ColumnInfo(name = "timestamp") var timestamp: Long = 0,
@ColumnInfo(name = "timestamp") var timestamp: Long = 0
// missing/not needed: referenceId
// missing/not needed: silent
)

View File

@ -92,7 +92,7 @@ data class ConversationEntity(
@ColumnInfo(name = "type") var type: ConversationEnums.ConversationType,
@ColumnInfo(name = "unreadMention") var unreadMention: Boolean = false,
@ColumnInfo(name = "unreadMentionDirect") var unreadMentionDirect: Boolean,
@ColumnInfo(name = "unreadMessages") var unreadMessages: Int = 0,
@ColumnInfo(name = "unreadMessages") var unreadMessages: Int = 0
// missing/not needed: attendeeId
// missing/not needed: attendeePin
// missing/not needed: attendeePermissions

View File

@ -210,11 +210,13 @@ object Migrations {
)
db.execSQL(
"CREATE UNIQUE INDEX IF NOT EXISTS `index_ChatMessages_internalId` ON `ChatMessages` (`internalId`)"
"CREATE UNIQUE INDEX IF NOT EXISTS `index_ChatMessages_internalId` " +
"ON `ChatMessages` (`internalId`)"
)
db.execSQL(
"CREATE INDEX IF NOT EXISTS `index_ChatMessages_internalConversationId` ON `ChatMessages` (`internalConversationId`)"
"CREATE INDEX IF NOT EXISTS `index_ChatMessages_internalConversationId` " +
"ON `ChatMessages` (`internalConversationId`)"
)
db.execSQL(
@ -231,7 +233,8 @@ object Migrations {
)
db.execSQL(
"CREATE INDEX IF NOT EXISTS `index_ChatBlocks_internalConversationId` ON `ChatBlocks` (`internalConversationId`)"
"CREATE INDEX IF NOT EXISTS `index_ChatBlocks_internalConversationId` " +
"ON `ChatBlocks` (`internalConversationId`)"
)
}
}

View File

@ -51,7 +51,7 @@ import java.util.Locale
],
version = 11,
autoMigrations = [
AutoMigration(from = 9, to = 10),
AutoMigration(from = 9, to = 10)
],
exportSchema = true
)

View File

@ -62,7 +62,7 @@ class ConversationModel(
var remoteToken: String? = null,
// attributes that don't come from API. This should be changed?!
var password: String? = null,
var password: String? = null
) {
companion object {

View File

@ -42,5 +42,5 @@ data class ChatMessageJson(
@JsonField(name = ["lastEditActorId"]) var lastEditActorId: String? = null,
@JsonField(name = ["lastEditActorType"]) var lastEditActorType: String? = null,
@JsonField(name = ["lastEditTimestamp"]) var lastEditTimestamp: Long? = 0,
@JsonField(name = ["deleted"]) var deleted: Boolean = false,
@JsonField(name = ["deleted"]) var deleted: Boolean = false
) : Parcelable

View File

@ -32,24 +32,34 @@ data class Conversation(
// var roomId: String? = null,
@JsonField(name = ["token"])
var token: String? = null,
@JsonField(name = ["name"])
var name: String? = null,
@JsonField(name = ["displayName"])
var displayName: String? = null,
@JsonField(name = ["description"])
var description: String? = null,
@JsonField(name = ["type"], typeConverter = EnumRoomTypeConverter::class)
var type: ConversationEnums.ConversationType? = null,
@JsonField(name = ["lastPing"])
var lastPing: Long = 0,
@JsonField(name = ["participantType"], typeConverter = EnumParticipantTypeConverter::class)
var participantType: ParticipantType? = null,
@JsonField(name = ["hasPassword"])
var hasPassword: Boolean = false,
@JsonField(name = ["sessionId"])
var sessionId: String? = null,
@JsonField(name = ["actorId"])
var actorId: String? = null,
@JsonField(name = ["actorType"])
var actorType: String? = null,
@ -152,8 +162,7 @@ data class Conversation(
var remoteServer: String? = null,
@JsonField(name = ["remoteToken"])
var remoteToken: String? = null,
var remoteToken: String? = null
) : Parcelable {
@Deprecated("Use ConversationUtil")
val isPublic: Boolean

View File

@ -82,7 +82,7 @@ class DialogBanListFragment(val roomToken: String) : DialogFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
NextcloudTalkApplication.sharedApplication!!.componentApplication.inject(this)
binding = FragmentDialogBanListBinding.inflate(LayoutInflater.from(context))
binding = FragmentDialogBanListBinding.inflate(layoutInflater)
viewModel =
ViewModelProvider(this, viewModelFactory)[ConversationInfoViewModel::class.java]
conversationUser = currentUserProvider.currentUser.blockingGet()

View File

@ -77,6 +77,8 @@ object DisplayUtils {
private const val TWITTER_HANDLE_PREFIX = "@"
private const val HTTP_PROTOCOL = "http://"
private const val HTTPS_PROTOCOL = "https://"
private const val HTTP_MIN_LENGTH: Int = 7
private const val HTTPS_MIN_LENGTH: Int = 7
private const val DATE_TIME_PARTS_SIZE = 2
fun isDarkModeOn(context: Context): Boolean {
val currentNightMode = context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
@ -394,10 +396,14 @@ object DisplayUtils {
if (TextUtils.isEmpty(url)) {
return ""
}
if (url!!.length >= 7 && HTTP_PROTOCOL.equals(url.substring(0, 7), ignoreCase = true)) {
if (url!!.length >= HTTP_MIN_LENGTH &&
HTTP_PROTOCOL.equals(url.substring(0, HTTP_MIN_LENGTH), ignoreCase = true)
) {
return url.substring(HTTP_PROTOCOL.length).trim { it <= ' ' }
}
return if (url.length >= 8 && HTTPS_PROTOCOL.equals(url.substring(0, 8), ignoreCase = true)) {
return if (url.length >= HTTPS_MIN_LENGTH &&
HTTPS_PROTOCOL.equals(url.substring(0, HTTPS_MIN_LENGTH), ignoreCase = true)
) {
url.substring(HTTPS_PROTOCOL.length).trim { it <= ' ' }
} else {
url.trim { it <= ' ' }

View File

@ -162,26 +162,26 @@ class PushUtils {
var keyGen: KeyPairGenerator? = null
try {
keyGen = KeyPairGenerator.getInstance("RSA")
keyGen.initialize(2048)
keyGen.initialize(RSA_KEY_SIZE)
val pair = keyGen.generateKeyPair()
val statusPrivate = saveKeyToFile(pair.private, privateKeyFile.absolutePath)
val statusPublic = saveKeyToFile(pair.public, publicKeyFile.absolutePath)
return if (statusPrivate == 0 && statusPublic == 0) {
// all went well
0
RETURN_CODE_KEY_GENERATION_SUCCESSFUL
} else {
-2
RETURN_CODE_KEY_GENERATION_FAILED
}
} catch (e: NoSuchAlgorithmException) {
Log.d(TAG, "RSA algorithm not supported")
}
} else {
// We already have the key
return -1
return RETURN_CODE_KEY_ALREADY_EXISTS
}
// we failed to generate the key
return -2
return RETURN_CODE_KEY_GENERATION_FAILED
}
fun pushRegistrationToServer(ncApi: NcApi) {
@ -399,6 +399,10 @@ class PushUtils {
companion object {
private const val TAG = "PushUtils"
private const val RSA_KEY_SIZE: Int = 2048
private const val RETURN_CODE_KEY_GENERATION_SUCCESSFUL: Int = 0
private const val RETURN_CODE_KEY_ALREADY_EXISTS: Int = -1
private const val RETURN_CODE_KEY_GENERATION_FAILED: Int = -2
const val LATEST_PUSH_REGISTRATION_AT_SERVER: String = "LATEST_PUSH_REGISTRATION_AT_SERVER"
const val LATEST_PUSH_REGISTRATION_AT_PUSH_PROXY: String = "LATEST_PUSH_REGISTRATION_AT_PUSH_PROXY"
}

View File

@ -503,10 +503,10 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
for (msgStr in queueStr.split("]")) {
try {
val msgArray = msgStr.replace("[", "").split(",")
val message = msgArray[0]
val replyTo = msgArray[1].toInt()
val displayName = msgArray[2]
val silent = msgArray[3].toBoolean()
val message = msgArray[MESSAGE_INDEX]
val replyTo = msgArray[REPLY_TO_INDEX].toInt()
val displayName = msgArray[DISPLY_NAME_INDEX]
val silent = msgArray[SILENT_INDEX].toBoolean()
val qMsg = MessageInputViewModel.QueuedMessage(message, displayName, replyTo, silent)
queue.add(qMsg)
@ -570,6 +570,10 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
@Suppress("UnusedPrivateProperty")
private val TAG = AppPreferencesImpl::class.simpleName
private val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = "settings")
private const val MESSAGE_INDEX: Int = 0
private const val REPLY_TO_INDEX: Int = 1
private const val DISPLY_NAME_INDEX: Int = 2
private const val SILENT_INDEX: Int = 3
const val PROXY_TYPE = "proxy_type"
const val PROXY_SERVER = "proxy_server"
const val PROXY_HOST = "proxy_host"

View File

@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: GPL-3.0-or-later
build:
maxIssues: 138
maxIssues: 166
weights:
# complexity: 2
# LongParameterList: 1