diff --git a/app/src/main/java/com/readrops/app/utils/SyncResultAnalyser.kt b/app/src/main/java/com/readrops/app/utils/SyncResultAnalyser.kt index 963a7da8..2d2dcef8 100644 --- a/app/src/main/java/com/readrops/app/utils/SyncResultAnalyser.kt +++ b/app/src/main/java/com/readrops/app/utils/SyncResultAnalyser.kt @@ -56,7 +56,8 @@ class SyncResultAnalyser(val context: Context, private val syncResults: Map { + fun oneAccountOneFeedOneItem(context: Context): Map { val account1 = Account().apply { id = 1 accountType = AccountType.FRESHRSS } - val item = Item().apply { - id = 1 - title = "oneAccountOneFeedOneItem" - feedId = 90 - } + val item = Database.getInstance(context).itemDao().select(5362) return mutableMapOf().apply { put(account1, SyncResult().apply { items = mutableListOf(item) }) diff --git a/readropsdb/src/main/java/com/readrops/readropsdb/dao/ItemDao.java b/readropsdb/src/main/java/com/readrops/readropsdb/dao/ItemDao.java index bcb5ff2b..276327bd 100644 --- a/readropsdb/src/main/java/com/readrops/readropsdb/dao/ItemDao.java +++ b/readropsdb/src/main/java/com/readrops/readropsdb/dao/ItemDao.java @@ -24,12 +24,18 @@ public interface ItemDao extends BaseDao { @RawQuery(observedEntities = {Item.class, Folder.class, Feed.class}) DataSource.Factory selectAll(SupportSQLiteQuery query); + @Query("Select * From Item Where id = :itemId") + Item select(int itemId); + @Query("Select case When :guid In (Select guid From Item Inner Join Feed on Item.feed_id = Feed.id and account_id = :accountId) Then 1 else 0 end") boolean itemExists(String guid, int accountId); @Query("Select case When :remoteId In (Select remoteId from Item) And :feedId In (Select feed_id From Item) Then 1 else 0 end") boolean remoteItemExists(String remoteId, int feedId); + @Query("Select * From Item Where remoteId = :remoteId And feed_id = :feedId") + Item selectByRemoteId(String remoteId, int feedId); + /** * Set an item read or unread *