Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit c37553f8 authored by Rafael Tonholo's avatar Rafael Tonholo
Browse files

refactor(outbox): use OutboxFolderManager to retrieve the outbox id in...

refactor(outbox): use OutboxFolderManager to retrieve the outbox id in SendFailedNotificationController
parent 85c6f7f1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ val coreNotificationModule = module {
            actionBuilder = get(),
            resourceProvider = get(),
            generalSettingsManager = get(),
            outboxFolderManager = get(),
        )
    }
    single {
+4 −2
Original line number Diff line number Diff line
@@ -6,12 +6,14 @@ import androidx.core.app.NotificationManagerCompat
import com.fsck.k9.helper.ExceptionHelper
import net.thunderbird.core.android.account.LegacyAccountDto
import net.thunderbird.core.preference.GeneralSettingsManager
import net.thunderbird.feature.mail.folder.api.OutboxFolderManager

internal class SendFailedNotificationController(
    private val notificationHelper: NotificationHelper,
    private val actionBuilder: NotificationActionCreator,
    private val resourceProvider: NotificationResourceProvider,
    private val generalSettingsManager: GeneralSettingsManager,
    private val outboxFolderManager: OutboxFolderManager,
) {
    fun showSendFailedNotification(account: LegacyAccountDto, exception: Exception) {
        val title = resourceProvider.sendFailedTitle()
@@ -19,8 +21,8 @@ internal class SendFailedNotificationController(

        val notificationId = NotificationIds.getSendFailedNotificationId(account)

        val pendingIntent = account.outboxFolderId.let { outboxFolderId ->
            if (outboxFolderId != null) {
        val pendingIntent = outboxFolderManager.getOutboxFolderIdSync(account.id).let { outboxFolderId ->
            if (outboxFolderId != -1L) {
                actionBuilder.createViewFolderPendingIntent(account, outboxFolderId)
            } else {
                actionBuilder.createViewFolderListPendingIntent(account)
+1 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ class SendFailedNotificationControllerTest : RobolectricTest() {
                privacy = PrivacySettings(),
            )
        },
        outboxFolderManager = mock(),
    )

    @OptIn(ExperimentalTime::class)