Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify .joinToString() usage #2038

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ object ApiRoutes {
}

fun getMessagesByUids(mailboxUuid: String, folderId: String, uids: List<Int>): String {
return "${getMessages(mailboxUuid, folderId)}/messages?uids=${uids.joinToString(",")}"
return "${getMessages(mailboxUuid, folderId)}/messages?uids=${uids.joinToString(separator = ",")}"
}
//endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class MessageController @Inject constructor(private val mailboxContentRealm: Rea
}
}

val filtersQuery = queriesList.joinToString(" AND ") { it }
val filtersQuery = queriesList.joinToString(separator = " AND ")

return if (searchQuery?.isNotBlank() == true) {
val containsSubject = "${Message::subject.name} CONTAINS[c] $0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ class AiPropositionFragment : Fragment() {

private fun generateNewAiProposition() {
val formattedRecipientsString = newMessageViewModel.toLiveData.valueOrEmpty()
.joinToString(", ") { it.name }
.joinToString(separator = ", ") { it.name }
.takeIf { it.isNotBlank() }
val currentMailboxUuid = newMessageViewModel.currentMailbox.uuid
currentRequestJob = aiViewModel.generateNewAiProposition(currentMailboxUuid, formattedRecipientsString)
Expand Down
7 changes: 5 additions & 2 deletions app/src/main/java/com/infomaniak/mail/utils/SentryDebug.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package com.infomaniak.mail.utils

import android.os.Bundle
import android.util.Log
import androidx.navigation.NavController
import com.infomaniak.mail.BuildConfig
import com.infomaniak.mail.data.cache.mailboxContent.MessageController
Expand Down Expand Up @@ -115,7 +116,7 @@ object SentryDebug {
fun Int.countPadding(): String = toString().padStart(length = 2, '0')

fun addData(category: String, key: String = "", value: String) {
data[count.countPadding() + "." + (category + key).padStart(length = 19)] = value
data[count.countPadding() + "." + (category + key).padStart(length = 20)] = value
count++
}

Expand Down Expand Up @@ -159,7 +160,9 @@ object SentryDebug {
)
}

addInfoBreadcrumb(category = "Attachments_Situation", data = data)
val category = "Attachments_Situation"
Log.i(category, data.map { "${it.key}: ${it.value}" }.joinToString(separator = "\n"))
addInfoBreadcrumb(category = category, data = data)
}

private fun addInfoBreadcrumb(category: String, message: String? = null, data: Map<String, Any>? = null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class SentryRealmLogger : RealmLogger {
val breadcrumb = Breadcrumb().apply {
this.level = SentryLevel.INFO
this.category = tag
this.message = values?.joinToString(separator = "\n") { it }
this.message = values?.joinToString(separator = "\n")
}
Sentry.addBreadcrumb(breadcrumb)
messagesMap.remove(key)
Expand Down
Loading