mirror of
https://github.com/readrops/Readrops.git
synced 2025-02-02 11:46:52 +01:00
Fix feed being null when there is only one new item for sync result notification
This commit is contained in:
parent
05f8fc56a7
commit
1052b453a8
@ -5,6 +5,7 @@ import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import com.readrops.app.R
|
||||
import com.readrops.readropsdb.Database
|
||||
import com.readrops.readropsdb.entities.account.Account
|
||||
import com.readrops.readropslibrary.services.SyncResult
|
||||
|
||||
@ -39,7 +40,7 @@ class SyncResultAnalyser(val context: Context, private val syncResults: Map<Acco
|
||||
contentText = context.getString(R.string.new_items, syncResult.items.size.toString())
|
||||
largeIcon = BitmapFactory.decodeResource(context.resources, account.accountType.iconRes)
|
||||
} else if (feedsIdsForNewItems.size == 1) { // new items from only one feed from one account
|
||||
val feed = syncResult.feeds.find { it.id == feedsIdsForNewItems.first() }
|
||||
val feed = Database.getInstance(context).feedDao().getFeedById(feedsIdsForNewItems.first())
|
||||
title = feed?.name
|
||||
contentText = syncResult.items.first().title
|
||||
|
||||
|
@ -25,6 +25,9 @@ public abstract class FeedDao implements BaseDao<Feed> {
|
||||
@Query("Select * from Feed Order By name ASC")
|
||||
public abstract LiveData<List<Feed>> getAllFeeds();
|
||||
|
||||
@Query("Select * from Feed Where id = :feedId")
|
||||
public abstract Feed getFeedById(int feedId);
|
||||
|
||||
@Query("Select case When :feedUrl In (Select url from Feed Where account_id = :accountId) Then 1 else 0 end")
|
||||
public abstract boolean feedExists(String feedUrl, int accountId);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user