For multiple accounts sync result case, just return a title

This commit is contained in:
Shinokuni 2020-03-30 21:13:36 +02:00
parent dd4579fbd0
commit f885038c67
4 changed files with 5 additions and 5 deletions

View File

@ -143,8 +143,7 @@ class SyncResultAnalyserTest {
val notifContent = SyncResultAnalyser(context, syncResults, database).getSyncNotifContent()
assertEquals("Notifications", notifContent.title)
assertEquals(context.getString(R.string.new_items, 4), notifContent.content)
assertEquals(context.getString(R.string.new_items, 4), notifContent.title)
}
@Test

View File

@ -26,8 +26,7 @@ class SyncResultAnalyser(val context: Context, private val syncResults: Map<Acco
itemCount += syncResult.items.filter { isFeedNotificationEnabledForItem(feeds, it) }.size
}
notifContent.title = "Notifications"
notifContent.content = context.getString(R.string.new_items, itemCount.toString())
notifContent.title = context.getString(R.string.new_items, itemCount.toString())
} else { // new items from only one account
val syncResultMap = syncResults.filterValues { it.items.isNotEmpty() }

View File

@ -78,11 +78,13 @@ class SyncResultDebugData {
val account1 = Account().apply {
id = 1
accountType = AccountType.FRESHRSS
isNotificationsEnabled = true
}
val account2 = Account().apply {
id = 2
accountType = AccountType.LOCAL
isNotificationsEnabled = true
}
val item = Item().apply {

View File

@ -70,7 +70,7 @@ class SyncWorker(context: Context, parameters: WorkerParameters) : Worker(contex
private fun displaySyncResultNotif(syncResults: Map<Account, SyncResult>) {
val notifContent = SyncResultAnalyser(applicationContext, syncResults, database).getSyncNotifContent()
if (notifContent.title != null && notifContent.content != null) {
if (notifContent.title != null) {
val intent = Intent(applicationContext, MainActivity::class.java).apply {
if (notifContent.item != null) {
putExtra(ReadropsKeys.ITEM_ID, notifContent.item?.id)