Rename SingleMessageNotifications to SingleMessageNotificationCreator
This commit is contained in:
parent
13f64bd0d7
commit
5aa465a68e
7 changed files with 25 additions and 25 deletions
|
@ -32,7 +32,7 @@ val coreNotificationModule = module {
|
|||
single { SendFailedNotificationController(get(), get(), get()) }
|
||||
single { NewMailNotifications(get(), get(), get(), get()) }
|
||||
single { NotificationContentCreator(get(), get()) }
|
||||
single { SingleMessageNotifications(get(), get(), get(), get()) }
|
||||
single { SingleMessageNotificationCreator(get(), get(), get(), get()) }
|
||||
single { MessageSummaryNotifications(get(), get(), get(), get(), get()) }
|
||||
single { LockScreenNotificationCreator(get(), get()) }
|
||||
single {
|
||||
|
|
|
@ -13,7 +13,7 @@ internal open class MessageSummaryNotifications(
|
|||
private val notificationHelper: NotificationHelper,
|
||||
private val actionCreator: NotificationActionCreator,
|
||||
private val lockScreenNotificationCreator: LockScreenNotificationCreator,
|
||||
private val singleMessageNotifications: SingleMessageNotifications,
|
||||
private val singleMessageNotificationCreator: SingleMessageNotificationCreator,
|
||||
private val resourceProvider: NotificationResourceProvider
|
||||
) {
|
||||
|
||||
|
@ -56,7 +56,7 @@ internal open class MessageSummaryNotifications(
|
|||
holder: NotificationHolder
|
||||
): NotificationCompat.Builder {
|
||||
val notificationId = getNewMailSummaryNotificationId(account)
|
||||
val builder = singleMessageNotifications.createSingleMessageNotificationBuilder(account, holder, notificationId)
|
||||
val builder = singleMessageNotificationCreator.createSingleMessageNotificationBuilder(account, holder, notificationId)
|
||||
builder.setGroupSummary(true)
|
||||
|
||||
return builder
|
||||
|
|
|
@ -13,7 +13,7 @@ internal open class NewMailNotifications(
|
|||
private val notificationHelper: NotificationHelper,
|
||||
private val contentCreator: NotificationContentCreator,
|
||||
private val messageSummaryNotifications: MessageSummaryNotifications,
|
||||
private val singleMessageNotifications: SingleMessageNotifications
|
||||
private val singleMessageNotificationCreator: SingleMessageNotificationCreator
|
||||
) {
|
||||
private val notifications = SparseArray<NotificationData>()
|
||||
private val lock = Any()
|
||||
|
@ -116,7 +116,7 @@ internal open class NewMailNotifications(
|
|||
}
|
||||
|
||||
private fun createSingleMessageNotification(account: Account, holder: NotificationHolder) {
|
||||
val notification = singleMessageNotifications.buildSingleMessageNotification(account, holder)
|
||||
val notification = singleMessageNotificationCreator.buildSingleMessageNotification(account, holder)
|
||||
val notificationId = holder.notificationId
|
||||
notificationManager.notify(notificationId, notification)
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ internal open class NewMailNotifications(
|
|||
notificationData: NotificationData
|
||||
) {
|
||||
val holder = notificationData.holderForLatestNotification
|
||||
val notification = singleMessageNotifications.buildSingleMessageNotificationWithLockScreenNotification(
|
||||
val notification = singleMessageNotificationCreator.buildSingleMessageNotificationWithLockScreenNotification(
|
||||
account,
|
||||
holder,
|
||||
notificationData
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.fsck.k9.Account
|
|||
import com.fsck.k9.K9
|
||||
import com.fsck.k9.notification.NotificationChannelManager.ChannelType
|
||||
|
||||
internal open class SingleMessageNotifications(
|
||||
internal open class SingleMessageNotificationCreator(
|
||||
private val notificationHelper: NotificationHelper,
|
||||
private val actionCreator: NotificationActionCreator,
|
||||
private val resourceProvider: NotificationResourceProvider,
|
|
@ -25,12 +25,12 @@ class NewMailNotificationsTest : K9RobolectricTest() {
|
|||
private val notificationManager = createNotificationManager()
|
||||
private val contentCreator = createNotificationContentCreator()
|
||||
private val messageSummaryNotifications = createMessageSummaryNotifications()
|
||||
private val singleMessageNotifications = createSingleMessageNotifications()
|
||||
private val singleMessageNotificationCreator = createSingleMessageNotificationCreator()
|
||||
private val newMailNotifications = TestNewMailNotifications(
|
||||
notificationHelper = createNotificationHelper(notificationManager),
|
||||
contentCreator = contentCreator,
|
||||
messageSummaryNotifications = messageSummaryNotifications,
|
||||
singleMessageNotifications = singleMessageNotifications
|
||||
singleMessageNotificationCreator = singleMessageNotificationCreator
|
||||
)
|
||||
|
||||
@Test
|
||||
|
@ -282,7 +282,7 @@ class NewMailNotificationsTest : K9RobolectricTest() {
|
|||
|
||||
private fun createNotification(): Notification = mock()
|
||||
|
||||
private fun createSingleMessageNotifications(): SingleMessageNotifications = mock()
|
||||
private fun createSingleMessageNotificationCreator(): SingleMessageNotificationCreator = mock()
|
||||
|
||||
private fun createMessageReference(number: Int): MessageReference {
|
||||
return MessageReference("account", 1, number.toString())
|
||||
|
@ -292,7 +292,7 @@ class NewMailNotificationsTest : K9RobolectricTest() {
|
|||
notificationHolder: NotificationHolder,
|
||||
notificationToReturn: Notification
|
||||
) {
|
||||
stubbing(singleMessageNotifications) {
|
||||
stubbing(singleMessageNotificationCreator) {
|
||||
on { buildSingleMessageNotification(account, notificationHolder) } doReturn notificationToReturn
|
||||
}
|
||||
}
|
||||
|
@ -323,9 +323,9 @@ class NewMailNotificationsTest : K9RobolectricTest() {
|
|||
notificationHelper: NotificationHelper,
|
||||
contentCreator: NotificationContentCreator,
|
||||
messageSummaryNotifications: MessageSummaryNotifications,
|
||||
singleMessageNotifications: SingleMessageNotifications
|
||||
singleMessageNotificationCreator: SingleMessageNotificationCreator
|
||||
) : NewMailNotifications(
|
||||
notificationHelper, contentCreator, messageSummaryNotifications, singleMessageNotifications
|
||||
notificationHelper, contentCreator, messageSummaryNotifications, singleMessageNotificationCreator
|
||||
) {
|
||||
val notificationData = mock<NotificationData>()
|
||||
|
||||
|
|
|
@ -25,13 +25,13 @@ import org.mockito.kotlin.whenever
|
|||
private const val ACCOUNT_NUMBER = 42
|
||||
private const val ACCOUNT_NAME = "accountName"
|
||||
|
||||
class SingleMessageNotificationsTest : RobolectricTest() {
|
||||
class SingleMessageNotificationCreatorTest : RobolectricTest() {
|
||||
private val resourceProvider: NotificationResourceProvider = TestNotificationResourceProvider()
|
||||
private val account = createAccount()
|
||||
private val notification = mock<Notification>()
|
||||
private val builder = createNotificationBuilder(notification)
|
||||
private val actionCreator = mock<NotificationActionCreator>()
|
||||
private val notifications = SingleMessageNotifications(
|
||||
private val notificationCreator = SingleMessageNotificationCreator(
|
||||
notificationHelper = createNotificationHelper(builder),
|
||||
actionCreator = actionCreator,
|
||||
resourceProvider = resourceProvider,
|
||||
|
@ -58,7 +58,7 @@ class SingleMessageNotificationsTest : RobolectricTest() {
|
|||
markAsReadPendingIntent
|
||||
)
|
||||
|
||||
val result = notifications.buildSingleMessageNotification(account, holder)
|
||||
val result = notificationCreator.buildSingleMessageNotification(account, holder)
|
||||
|
||||
assertThat(result).isEqualTo(notification)
|
||||
verifyExtendWasOnlyCalledOnce()
|
||||
|
@ -80,7 +80,7 @@ class SingleMessageNotificationsTest : RobolectricTest() {
|
|||
deletePendingIntent
|
||||
)
|
||||
|
||||
val result = notifications.buildSingleMessageNotification(account, holder)
|
||||
val result = notificationCreator.buildSingleMessageNotification(account, holder)
|
||||
|
||||
assertThat(result).isEqualTo(notification)
|
||||
verifyExtendWasOnlyCalledOnce()
|
||||
|
@ -100,7 +100,7 @@ class SingleMessageNotificationsTest : RobolectricTest() {
|
|||
archivePendingIntent
|
||||
)
|
||||
|
||||
val result = notifications.buildSingleMessageNotification(account, holder)
|
||||
val result = notificationCreator.buildSingleMessageNotification(account, holder)
|
||||
|
||||
assertThat(result).isEqualTo(notification)
|
||||
verifyExtendWasOnlyCalledOnce()
|
||||
|
@ -120,7 +120,7 @@ class SingleMessageNotificationsTest : RobolectricTest() {
|
|||
markAsSpamPendingIntent
|
||||
)
|
||||
|
||||
val result = notifications.buildSingleMessageNotification(account, holder)
|
||||
val result = notificationCreator.buildSingleMessageNotification(account, holder)
|
||||
|
||||
assertThat(result).isEqualTo(notification)
|
||||
verifyExtendWasOnlyCalledOnce()
|
|
@ -168,7 +168,7 @@ class SummaryNotificationsTest : RobolectricTest() {
|
|||
lockScreenNotificationCreator: LockScreenNotificationCreator
|
||||
): TestMessageSummaryNotifications {
|
||||
val notificationHelper = createFakeNotificationHelper(builder)
|
||||
val singleMessageNotifications = TestSingleMessageNotifications(
|
||||
val singleMessageNotificationCreator = TestSingleMessageNotificationCreator(
|
||||
notificationHelper = notificationHelper,
|
||||
actionCreator = mock(),
|
||||
resourceProvider = resourceProvider,
|
||||
|
@ -179,7 +179,7 @@ class SummaryNotificationsTest : RobolectricTest() {
|
|||
notificationHelper = notificationHelper,
|
||||
actionCreator = mock(),
|
||||
lockScreenNotificationCreator = lockScreenNotificationCreator,
|
||||
singleMessageNotifications = singleMessageNotifications,
|
||||
singleMessageNotificationCreator = singleMessageNotificationCreator,
|
||||
resourceProvider = resourceProvider
|
||||
)
|
||||
}
|
||||
|
@ -198,13 +198,13 @@ class SummaryNotificationsTest : RobolectricTest() {
|
|||
notificationHelper: NotificationHelper,
|
||||
actionCreator: NotificationActionCreator,
|
||||
lockScreenNotificationCreator: LockScreenNotificationCreator,
|
||||
singleMessageNotifications: SingleMessageNotifications,
|
||||
singleMessageNotificationCreator: SingleMessageNotificationCreator,
|
||||
resourceProvider: NotificationResourceProvider
|
||||
) : MessageSummaryNotifications(
|
||||
notificationHelper,
|
||||
actionCreator,
|
||||
lockScreenNotificationCreator,
|
||||
singleMessageNotifications,
|
||||
singleMessageNotificationCreator,
|
||||
resourceProvider
|
||||
) {
|
||||
val inboxStyle = mockBuilder<NotificationCompat.InboxStyle>()
|
||||
|
@ -214,12 +214,12 @@ class SummaryNotificationsTest : RobolectricTest() {
|
|||
}
|
||||
}
|
||||
|
||||
internal inner class TestSingleMessageNotifications(
|
||||
internal inner class TestSingleMessageNotificationCreator(
|
||||
notificationHelper: NotificationHelper,
|
||||
actionCreator: NotificationActionCreator,
|
||||
resourceProvider: NotificationResourceProvider,
|
||||
lockScreenNotificationCreator: LockScreenNotificationCreator
|
||||
) : SingleMessageNotifications(
|
||||
) : SingleMessageNotificationCreator(
|
||||
notificationHelper,
|
||||
actionCreator,
|
||||
resourceProvider,
|
||||
|
|
Loading…
Reference in a new issue