mirror of https://github.com/readrops/Readrops.git
For multiple accounts sync result case, just return a title
This commit is contained in:
parent
dd4579fbd0
commit
f885038c67
|
@ -143,8 +143,7 @@ class SyncResultAnalyserTest {
|
||||||
|
|
||||||
val notifContent = SyncResultAnalyser(context, syncResults, database).getSyncNotifContent()
|
val notifContent = SyncResultAnalyser(context, syncResults, database).getSyncNotifContent()
|
||||||
|
|
||||||
assertEquals("Notifications", notifContent.title)
|
assertEquals(context.getString(R.string.new_items, 4), notifContent.title)
|
||||||
assertEquals(context.getString(R.string.new_items, 4), notifContent.content)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -26,8 +26,7 @@ class SyncResultAnalyser(val context: Context, private val syncResults: Map<Acco
|
||||||
itemCount += syncResult.items.filter { isFeedNotificationEnabledForItem(feeds, it) }.size
|
itemCount += syncResult.items.filter { isFeedNotificationEnabledForItem(feeds, it) }.size
|
||||||
}
|
}
|
||||||
|
|
||||||
notifContent.title = "Notifications"
|
notifContent.title = context.getString(R.string.new_items, itemCount.toString())
|
||||||
notifContent.content = context.getString(R.string.new_items, itemCount.toString())
|
|
||||||
} else { // new items from only one account
|
} else { // new items from only one account
|
||||||
val syncResultMap = syncResults.filterValues { it.items.isNotEmpty() }
|
val syncResultMap = syncResults.filterValues { it.items.isNotEmpty() }
|
||||||
|
|
||||||
|
|
|
@ -78,11 +78,13 @@ class SyncResultDebugData {
|
||||||
val account1 = Account().apply {
|
val account1 = Account().apply {
|
||||||
id = 1
|
id = 1
|
||||||
accountType = AccountType.FRESHRSS
|
accountType = AccountType.FRESHRSS
|
||||||
|
isNotificationsEnabled = true
|
||||||
}
|
}
|
||||||
|
|
||||||
val account2 = Account().apply {
|
val account2 = Account().apply {
|
||||||
id = 2
|
id = 2
|
||||||
accountType = AccountType.LOCAL
|
accountType = AccountType.LOCAL
|
||||||
|
isNotificationsEnabled = true
|
||||||
}
|
}
|
||||||
|
|
||||||
val item = Item().apply {
|
val item = Item().apply {
|
||||||
|
|
|
@ -70,7 +70,7 @@ class SyncWorker(context: Context, parameters: WorkerParameters) : Worker(contex
|
||||||
private fun displaySyncResultNotif(syncResults: Map<Account, SyncResult>) {
|
private fun displaySyncResultNotif(syncResults: Map<Account, SyncResult>) {
|
||||||
val notifContent = SyncResultAnalyser(applicationContext, syncResults, database).getSyncNotifContent()
|
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 {
|
val intent = Intent(applicationContext, MainActivity::class.java).apply {
|
||||||
if (notifContent.item != null) {
|
if (notifContent.item != null) {
|
||||||
putExtra(ReadropsKeys.ITEM_ID, notifContent.item?.id)
|
putExtra(ReadropsKeys.ITEM_ID, notifContent.item?.id)
|
||||||
|
|
Loading…
Reference in New Issue