Rename SyncNotifications to SyncNotificationController

This commit is contained in:
cketti 2021-10-14 17:28:15 +02:00
parent f48ff91af8
commit ad5b9a300b
4 changed files with 15 additions and 15 deletions

View file

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

View file

@ -8,7 +8,7 @@ import com.fsck.k9.mailstore.LocalMessage
class NotificationController internal constructor(
private val certificateErrorNotificationController: CertificateErrorNotificationController,
private val authenticationErrorNotificationController: AuthenticationErrorNotificationController,
private val syncNotifications: SyncNotifications,
private val syncNotificationController: SyncNotificationController,
private val sendFailedNotificationController: SendFailedNotificationController,
private val newMailNotifications: NewMailNotifications
) {
@ -29,11 +29,11 @@ class NotificationController internal constructor(
}
fun showSendingNotification(account: Account) {
syncNotifications.showSendingNotification(account)
syncNotificationController.showSendingNotification(account)
}
fun clearSendingNotification(account: Account) {
syncNotifications.clearSendingNotification(account)
syncNotificationController.clearSendingNotification(account)
}
fun showSendFailedNotification(account: Account, exception: Exception) {
@ -45,15 +45,15 @@ class NotificationController internal constructor(
}
fun showFetchingMailNotification(account: Account, folder: LocalFolder) {
syncNotifications.showFetchingMailNotification(account, folder)
syncNotificationController.showFetchingMailNotification(account, folder)
}
fun showEmptyFetchingMailNotification(account: Account) {
syncNotifications.showEmptyFetchingMailNotification(account)
syncNotificationController.showEmptyFetchingMailNotification(account)
}
fun clearFetchingMailNotification(account: Account) {
syncNotifications.clearFetchingMailNotification(account)
syncNotificationController.clearFetchingMailNotification(account)
}
fun addNewMailNotification(account: Account, message: LocalMessage, silent: Boolean) {

View file

@ -7,7 +7,7 @@ import com.fsck.k9.mailstore.LocalFolder
private const val NOTIFICATION_LED_WHILE_SYNCING = false
internal class SyncNotifications(
internal class SyncNotificationController(
private val notificationHelper: NotificationHelper,
private val actionBuilder: NotificationActionCreator,
private val resourceProvider: NotificationResourceProvider

View file

@ -24,14 +24,14 @@ private const val ACCOUNT_NAME = "TestAccount"
private const val FOLDER_SERVER_ID = "INBOX"
private const val FOLDER_NAME = "Inbox"
class SyncNotificationsTest : RobolectricTest() {
class SyncNotificationControllerTest : RobolectricTest() {
private val resourceProvider: NotificationResourceProvider = TestNotificationResourceProvider()
private val notification = mock<Notification>()
private val notificationManager = mock<NotificationManagerCompat>()
private val builder = createFakeNotificationBuilder(notification)
private val account = createFakeAccount()
private val contentIntent = mock<PendingIntent>()
private val syncNotifications = SyncNotifications(
private val controller = SyncNotificationController(
notificationHelper = createFakeNotificationHelper(notificationManager, builder),
actionBuilder = createActionBuilder(contentIntent),
resourceProvider = resourceProvider
@ -41,7 +41,7 @@ class SyncNotificationsTest : RobolectricTest() {
fun testShowSendingNotification() {
val notificationId = getFetchingMailNotificationId(account)
syncNotifications.showSendingNotification(account)
controller.showSendingNotification(account)
verify(notificationManager).notify(notificationId, notification)
verify(builder).setSmallIcon(resourceProvider.iconSendingMail)
@ -56,7 +56,7 @@ class SyncNotificationsTest : RobolectricTest() {
fun testClearSendingNotification() {
val notificationId = getFetchingMailNotificationId(account)
syncNotifications.clearSendingNotification(account)
controller.clearSendingNotification(account)
verify(notificationManager).cancel(notificationId)
}
@ -66,7 +66,7 @@ class SyncNotificationsTest : RobolectricTest() {
val localFolder = createFakeLocalFolder()
val notificationId = getFetchingMailNotificationId(account)
syncNotifications.showFetchingMailNotification(account, localFolder)
controller.showFetchingMailNotification(account, localFolder)
verify(notificationManager).notify(notificationId, notification)
verify(builder).setSmallIcon(resourceProvider.iconCheckingMail)
@ -81,7 +81,7 @@ class SyncNotificationsTest : RobolectricTest() {
fun testShowEmptyFetchingMailNotification() {
val notificationId = getFetchingMailNotificationId(account)
syncNotifications.showEmptyFetchingMailNotification(account)
controller.showEmptyFetchingMailNotification(account)
verify(notificationManager).notify(notificationId, notification)
verify(builder).setSmallIcon(resourceProvider.iconCheckingMail)
@ -94,7 +94,7 @@ class SyncNotificationsTest : RobolectricTest() {
fun testClearSendFailedNotification() {
val notificationId = getFetchingMailNotificationId(account)
syncNotifications.clearFetchingMailNotification(account)
controller.clearFetchingMailNotification(account)
verify(notificationManager).cancel(notificationId)
}