Rename SendFailedNotifications to SendFailedNotificationController

This commit is contained in:
cketti 2021-10-14 17:22:51 +02:00
parent 05a75b898e
commit f48ff91af8
4 changed files with 9 additions and 9 deletions

View file

@ -29,7 +29,7 @@ val coreNotificationModule = module {
single { CertificateErrorNotificationController(get(), get(), get()) }
single { AuthenticationErrorNotificationController(get(), get(), get()) }
single { SyncNotifications(get(), get(), get()) }
single { SendFailedNotifications(get(), get(), get()) }
single { SendFailedNotificationController(get(), get(), get()) }
single { NewMailNotifications(get(), get(), get(), get()) }
single { NotificationContentCreator(get(), get()) }
single { SingleMessageNotifications(get(), get(), get(), get()) }

View file

@ -9,7 +9,7 @@ class NotificationController internal constructor(
private val certificateErrorNotificationController: CertificateErrorNotificationController,
private val authenticationErrorNotificationController: AuthenticationErrorNotificationController,
private val syncNotifications: SyncNotifications,
private val sendFailedNotifications: SendFailedNotifications,
private val sendFailedNotificationController: SendFailedNotificationController,
private val newMailNotifications: NewMailNotifications
) {
fun showCertificateErrorNotification(account: Account, incoming: Boolean) {
@ -37,11 +37,11 @@ class NotificationController internal constructor(
}
fun showSendFailedNotification(account: Account, exception: Exception) {
sendFailedNotifications.showSendFailedNotification(account, exception)
sendFailedNotificationController.showSendFailedNotification(account, exception)
}
fun clearSendFailedNotification(account: Account) {
sendFailedNotifications.clearSendFailedNotification(account)
sendFailedNotificationController.clearSendFailedNotification(account)
}
fun showFetchingMailNotification(account: Account, folder: LocalFolder) {

View file

@ -5,7 +5,7 @@ import androidx.core.app.NotificationManagerCompat
import com.fsck.k9.Account
import com.fsck.k9.helper.ExceptionHelper
internal class SendFailedNotifications(
internal class SendFailedNotificationController(
private val notificationHelper: NotificationHelper,
private val actionBuilder: NotificationActionCreator,
private val resourceProvider: NotificationResourceProvider

View file

@ -18,7 +18,7 @@ import org.mockito.kotlin.mock
private const val ACCOUNT_NUMBER = 1
private const val ACCOUNT_NAME = "TestAccount"
class SendFailedNotificationsTest : RobolectricTest() {
class SendFailedNotificationControllerTest : RobolectricTest() {
private val resourceProvider: NotificationResourceProvider = TestNotificationResourceProvider()
private val notification = mock<Notification>()
private val notificationManager = mock<NotificationManagerCompat>()
@ -26,7 +26,7 @@ class SendFailedNotificationsTest : RobolectricTest() {
private val account = createFakeAccount()
private val contentIntent = mock<PendingIntent>()
private val notificationId = NotificationIds.getSendFailedNotificationId(account)
private val sendFailedNotifications = SendFailedNotifications(
private val controller = SendFailedNotificationController(
notificationHelper = createFakeNotificationHelper(notificationManager, builder),
actionBuilder = createActionBuilder(contentIntent),
resourceProvider = resourceProvider
@ -36,7 +36,7 @@ class SendFailedNotificationsTest : RobolectricTest() {
fun testShowSendFailedNotification() {
val exception = Exception()
sendFailedNotifications.showSendFailedNotification(account, exception)
controller.showSendFailedNotification(account, exception)
verify(notificationManager).notify(notificationId, notification)
verify(builder).setSmallIcon(resourceProvider.iconWarning)
@ -49,7 +49,7 @@ class SendFailedNotificationsTest : RobolectricTest() {
@Test
fun testClearSendFailedNotification() {
sendFailedNotifications.clearSendFailedNotification(account)
controller.clearSendFailedNotification(account)
verify(notificationManager).cancel(notificationId)
}