Open Outbox from 'send failed' notification (#5887)
This commit is contained in:
parent
cfc4c0bb71
commit
1265d0724b
2 changed files with 15 additions and 4 deletions
|
@ -16,9 +16,18 @@ internal class SendFailedNotificationController(
|
|||
val text = ExceptionHelper.getRootCauseMessage(exception)
|
||||
|
||||
val notificationId = NotificationIds.getSendFailedNotificationId(account)
|
||||
val folderListPendingIntent = actionBuilder.createViewFolderListPendingIntent(
|
||||
account, notificationId
|
||||
)
|
||||
|
||||
val pendingIntent = account.outboxFolderId.let { outboxFolderId ->
|
||||
if (outboxFolderId != null) {
|
||||
actionBuilder.createViewFolderPendingIntent(
|
||||
account, outboxFolderId, notificationId
|
||||
)
|
||||
} else {
|
||||
actionBuilder.createViewFolderListPendingIntent(
|
||||
account, notificationId
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
val notificationBuilder = notificationHelper
|
||||
.createNotificationBuilder(account, NotificationChannelManager.ChannelType.MISCELLANEOUS)
|
||||
|
@ -29,7 +38,7 @@ internal class SendFailedNotificationController(
|
|||
.setTicker(title)
|
||||
.setContentTitle(title)
|
||||
.setContentText(text)
|
||||
.setContentIntent(folderListPendingIntent)
|
||||
.setContentIntent(pendingIntent)
|
||||
.setStyle(NotificationCompat.BigTextStyle().bigText(text))
|
||||
.setPublicVersion(createLockScreenNotification(account))
|
||||
.setCategory(NotificationCompat.CATEGORY_ERROR)
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.fsck.k9.RobolectricTest
|
|||
import com.fsck.k9.testing.MockHelper.mockBuilder
|
||||
import org.junit.Test
|
||||
import org.mockito.ArgumentMatchers.anyInt
|
||||
import org.mockito.ArgumentMatchers.anyLong
|
||||
import org.mockito.Mockito.verify
|
||||
import org.mockito.kotlin.any
|
||||
import org.mockito.kotlin.doReturn
|
||||
|
@ -88,6 +89,7 @@ class SendFailedNotificationControllerTest : RobolectricTest() {
|
|||
private fun createActionBuilder(contentIntent: PendingIntent): NotificationActionCreator {
|
||||
return mock {
|
||||
on { createViewFolderListPendingIntent(any(), anyInt()) } doReturn contentIntent
|
||||
on { createViewFolderPendingIntent(any(), anyLong(), anyInt()) } doReturn contentIntent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue