Rename AuthenticationErrorNotifications to AuthenticationErrorNotificationController
This commit is contained in:
parent
8836ed4dec
commit
50187f8b53
4 changed files with 13 additions and 13 deletions
|
@ -5,7 +5,7 @@ import androidx.core.app.NotificationCompat
|
|||
import androidx.core.app.NotificationManagerCompat
|
||||
import com.fsck.k9.Account
|
||||
|
||||
internal open class AuthenticationErrorNotifications(
|
||||
internal open class AuthenticationErrorNotificationController(
|
||||
private val notificationHelper: NotificationHelper,
|
||||
private val actionCreator: NotificationActionCreator,
|
||||
private val resourceProvider: NotificationResourceProvider
|
|
@ -27,7 +27,7 @@ val coreNotificationModule = module {
|
|||
)
|
||||
}
|
||||
single { CertificateErrorNotifications(get(), get(), get()) }
|
||||
single { AuthenticationErrorNotifications(get(), get(), get()) }
|
||||
single { AuthenticationErrorNotificationController(get(), get(), get()) }
|
||||
single { SyncNotifications(get(), get(), get()) }
|
||||
single { SendFailedNotifications(get(), get(), get()) }
|
||||
single { NewMailNotifications(get(), get(), get(), get()) }
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.fsck.k9.mailstore.LocalMessage
|
|||
|
||||
class NotificationController internal constructor(
|
||||
private val certificateErrorNotifications: CertificateErrorNotifications,
|
||||
private val authenticationErrorNotifications: AuthenticationErrorNotifications,
|
||||
private val authenticationErrorNotificationController: AuthenticationErrorNotificationController,
|
||||
private val syncNotifications: SyncNotifications,
|
||||
private val sendFailedNotifications: SendFailedNotifications,
|
||||
private val newMailNotifications: NewMailNotifications
|
||||
|
@ -21,11 +21,11 @@ class NotificationController internal constructor(
|
|||
}
|
||||
|
||||
fun showAuthenticationErrorNotification(account: Account, incoming: Boolean) {
|
||||
authenticationErrorNotifications.showAuthenticationErrorNotification(account, incoming)
|
||||
authenticationErrorNotificationController.showAuthenticationErrorNotification(account, incoming)
|
||||
}
|
||||
|
||||
fun clearAuthenticationErrorNotification(account: Account, incoming: Boolean) {
|
||||
authenticationErrorNotifications.clearAuthenticationErrorNotification(account, incoming)
|
||||
authenticationErrorNotificationController.clearAuthenticationErrorNotification(account, incoming)
|
||||
}
|
||||
|
||||
fun showSendingNotification(account: Account) {
|
||||
|
|
|
@ -19,21 +19,21 @@ private const val OUTGOING = false
|
|||
private const val ACCOUNT_NUMBER = 1
|
||||
private const val ACCOUNT_NAME = "TestAccount"
|
||||
|
||||
class AuthenticationErrorNotificationsTest : RobolectricTest() {
|
||||
class AuthenticationErrorNotificationControllerTest : RobolectricTest() {
|
||||
private val resourceProvider = TestNotificationResourceProvider()
|
||||
private val notification = mock<Notification>()
|
||||
private val notificationManager = mock<NotificationManagerCompat>()
|
||||
private val builder = createFakeNotificationBuilder(notification)
|
||||
private val notificationHelper = createFakeNotificationHelper(notificationManager, builder)
|
||||
private val account = createFakeAccount()
|
||||
private val authenticationErrorNotifications = TestAuthenticationErrorNotifications()
|
||||
private val controller = TestAuthenticationErrorNotificationController()
|
||||
private val contentIntent = mock<PendingIntent>()
|
||||
|
||||
@Test
|
||||
fun showAuthenticationErrorNotification_withIncomingServer_shouldCreateNotification() {
|
||||
val notificationId = NotificationIds.getAuthenticationErrorNotificationId(account, INCOMING)
|
||||
|
||||
authenticationErrorNotifications.showAuthenticationErrorNotification(account, INCOMING)
|
||||
controller.showAuthenticationErrorNotification(account, INCOMING)
|
||||
|
||||
verify(notificationManager).notify(notificationId, notification)
|
||||
assertAuthenticationErrorNotificationContents()
|
||||
|
@ -43,7 +43,7 @@ class AuthenticationErrorNotificationsTest : RobolectricTest() {
|
|||
fun clearAuthenticationErrorNotification_withIncomingServer_shouldCancelNotification() {
|
||||
val notificationId = NotificationIds.getAuthenticationErrorNotificationId(account, INCOMING)
|
||||
|
||||
authenticationErrorNotifications.clearAuthenticationErrorNotification(account, INCOMING)
|
||||
controller.clearAuthenticationErrorNotification(account, INCOMING)
|
||||
|
||||
verify(notificationManager).cancel(notificationId)
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class AuthenticationErrorNotificationsTest : RobolectricTest() {
|
|||
fun showAuthenticationErrorNotification_withOutgoingServer_shouldCreateNotification() {
|
||||
val notificationId = NotificationIds.getAuthenticationErrorNotificationId(account, OUTGOING)
|
||||
|
||||
authenticationErrorNotifications.showAuthenticationErrorNotification(account, OUTGOING)
|
||||
controller.showAuthenticationErrorNotification(account, OUTGOING)
|
||||
|
||||
verify(notificationManager).notify(notificationId, notification)
|
||||
assertAuthenticationErrorNotificationContents()
|
||||
|
@ -62,7 +62,7 @@ class AuthenticationErrorNotificationsTest : RobolectricTest() {
|
|||
fun clearAuthenticationErrorNotification_withOutgoingServer_shouldCancelNotification() {
|
||||
val notificationId = NotificationIds.getAuthenticationErrorNotificationId(account, OUTGOING)
|
||||
|
||||
authenticationErrorNotifications.clearAuthenticationErrorNotification(account, OUTGOING)
|
||||
controller.clearAuthenticationErrorNotification(account, OUTGOING)
|
||||
|
||||
verify(notificationManager).cancel(notificationId)
|
||||
}
|
||||
|
@ -100,8 +100,8 @@ class AuthenticationErrorNotificationsTest : RobolectricTest() {
|
|||
}
|
||||
}
|
||||
|
||||
internal inner class TestAuthenticationErrorNotifications :
|
||||
AuthenticationErrorNotifications(notificationHelper, mock(), resourceProvider) {
|
||||
internal inner class TestAuthenticationErrorNotificationController :
|
||||
AuthenticationErrorNotificationController(notificationHelper, mock(), resourceProvider) {
|
||||
|
||||
override fun createContentIntent(account: Account, incoming: Boolean): PendingIntent {
|
||||
return contentIntent
|
Loading…
Reference in a new issue