Skip to content
Open
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
2 changes: 1 addition & 1 deletion app/src/main/java/com/infomaniak/mail/MatomoMail.kt
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ object MatomoMail : Matomo {
SpamFolder("spamFolder"),
SpamSwipe("spamSwipe"),
StrikeThrough("strikeThrough"),
Summary("summary"),
Summarize("summarize"),
Translate("translate"),
Switch("switch"),
SwitchAccount("switchAccount"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,12 +497,11 @@ object ApiRepository : ApiRepositoryCore() {
)
}

suspend fun aiSummary(languageCode: String, content: String): ApiResponse<String> {
// TODO: Adapt aiSummary to accept an additional messageUid parameter once the backend supports it
suspend fun aiSummary(languageCode: String, mailboxUuid: String, msgUid: String): ApiResponse<String> {
return callApi(
url = ApiRoutes.aiSummary(),
method = POST,
body = mapOf("destination_language" to languageCode, "content" to content),
body = mapOf("destination_language" to languageCode, "mailbox_uuid" to mailboxUuid, "msg_uid" to msgUid),
okHttpClient = HttpClient.okHttpClientLongTimeoutWithTokenInterceptor,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ object ApiRoutes {
}

fun aiSummary(): String {
return "$MAIL_API/api/resume"
return "$MAIL_API/api/summarize"
}

fun aiTranslate(): String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import com.infomaniak.mail.data.models.message.Message
import com.infomaniak.mail.databinding.ItemMessageBinding
import com.infomaniak.mail.databinding.ItemSuperCollapsedBlockBinding
import com.infomaniak.mail.ui.main.thread.ThreadAdapter.ThreadAdapterViewHolder
import com.infomaniak.mail.ui.main.thread.ThreadFragment.AiAction
import com.infomaniak.mail.ui.main.thread.ThreadViewModel.AiAction
import com.infomaniak.mail.ui.main.thread.models.MessageUi
import com.infomaniak.mail.ui.main.thread.models.MessageUi.UnsubscribeState
import com.infomaniak.mail.ui.main.thread.webViewClient.MessageDisplayWebViewClient
Expand Down Expand Up @@ -99,7 +99,6 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import java.time.format.FormatStyle
import java.util.Date
import kotlin.context
import androidx.appcompat.R as RAndroid
import com.google.android.material.R as RMaterial

Expand Down Expand Up @@ -480,7 +479,7 @@ class ThreadAdapter(
AiAction.TRANSLATE -> threadAdapterState.aiTranslateStateMap[messageUid]
}

private fun MessageViewHolder.bindAiAction(message: Message, aiAction: ThreadFragment.AiAction? = null) {
private fun MessageViewHolder.bindAiAction(message: Message, aiAction: AiAction? = null) {
if (aiAction == null) {
bindAiAction(message, AiAction.SUMMARY)
bindAiAction(message, AiAction.TRANSLATE)
Expand Down Expand Up @@ -620,7 +619,7 @@ class ThreadAdapter(
isButtonEnabled = true
hideButtonProgress(R.string.aiButtonRetry)

if (state.isRetry && !state.wasLoaderShown) {
if (state.asAlreadyRetried && !state.wasLoaderShown) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean hasAlreadyRetried ?

threadAdapterCallbacks?.showSnackbarRetry?.invoke(errorMessageRes)
}
} else {
Expand Down
Loading
Loading