Replace MessagingController.getSearchAccountStatsSynchronous()…
…with getUnreadMessageCount()
This commit is contained in:
parent
24a22beccc
commit
3114c6ef90
3 changed files with 4 additions and 15 deletions
|
@ -1758,8 +1758,8 @@ public class MessagingController {
|
|||
}
|
||||
}
|
||||
|
||||
public AccountStats getSearchAccountStatsSynchronous(SearchAccount searchAccount) {
|
||||
return accountStatsCollector.getSearchAccountStats(searchAccount);
|
||||
public int getUnreadMessageCount(SearchAccount searchAccount) {
|
||||
return accountStatsCollector.getSearchAccountStats(searchAccount).unreadMessageCount;
|
||||
}
|
||||
|
||||
public void getFolderUnreadMessageCount(final Account account, final String folderServerId,
|
||||
|
|
|
@ -28,10 +28,7 @@ class UnreadWidgetDataProvider(
|
|||
private fun loadSearchAccountData(configuration: UnreadWidgetConfiguration): UnreadWidgetData {
|
||||
val searchAccount = getSearchAccount(configuration.accountUuid)
|
||||
val title = searchAccount.description
|
||||
|
||||
val stats = messagingController.getSearchAccountStatsSynchronous(searchAccount)
|
||||
val unreadCount = stats.unreadMessageCount
|
||||
|
||||
val unreadCount = messagingController.getUnreadMessageCount(searchAccount)
|
||||
val clickIntent = MessageList.intentDisplaySearch(context, searchAccount.relatedSearch, false, true, true)
|
||||
|
||||
return UnreadWidgetData(configuration, title, unreadCount, clickIntent)
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.fsck.k9.widget.unread
|
|||
|
||||
import android.content.Context
|
||||
import com.fsck.k9.Account
|
||||
import com.fsck.k9.AccountStats
|
||||
import com.fsck.k9.Preferences
|
||||
import com.fsck.k9.AppRobolectricTest
|
||||
import com.fsck.k9.controller.MessagingController
|
||||
|
@ -84,7 +83,7 @@ class UnreadWidgetDataProviderTest : AppRobolectricTest() {
|
|||
}
|
||||
|
||||
fun createMessagingController(): MessagingController = mock {
|
||||
on { getSearchAccountStatsSynchronous(any()) } doReturn SEARCH_ACCOUNT_STATS
|
||||
on { getUnreadMessageCount(any<SearchAccount>()) } doReturn SEARCH_ACCOUNT_UNREAD_COUNT
|
||||
on { getUnreadMessageCount(account) } doReturn ACCOUNT_UNREAD_COUNT
|
||||
on { getFolderUnreadMessageCount(eq(account), eq(FOLDER_SERVER_ID)) } doReturn FOLDER_UNREAD_COUNT
|
||||
}
|
||||
|
@ -96,12 +95,5 @@ class UnreadWidgetDataProviderTest : AppRobolectricTest() {
|
|||
const val SEARCH_ACCOUNT_UNREAD_COUNT = 1
|
||||
const val ACCOUNT_UNREAD_COUNT = 2
|
||||
const val FOLDER_UNREAD_COUNT = 3
|
||||
|
||||
val SEARCH_ACCOUNT_STATS = AccountStats().apply {
|
||||
unreadMessageCount = SEARCH_ACCOUNT_UNREAD_COUNT
|
||||
}
|
||||
val ACCOUNT_STATS = AccountStats().apply {
|
||||
unreadMessageCount = ACCOUNT_UNREAD_COUNT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue