diff --git a/api/src/main/java/com/readrops/api/services/freshrss/FreshRSSDataSource.java b/api/src/main/java/com/readrops/api/services/freshrss/FreshRSSDataSource.java index 267e6bcb..16f4c602 100644 --- a/api/src/main/java/com/readrops/api/services/freshrss/FreshRSSDataSource.java +++ b/api/src/main/java/com/readrops/api/services/freshrss/FreshRSSDataSource.java @@ -12,7 +12,6 @@ import com.readrops.db.entities.Item; import java.io.StringReader; import java.util.Arrays; -import java.util.Collections; import java.util.List; import java.util.Properties; @@ -24,7 +23,6 @@ import okhttp3.RequestBody; public class FreshRSSDataSource { private static final int MAX_ITEMS = 5000; - private static final int MAX_UNREAD_ITEMS_IDS = 5000; private static final int MAX_STARRED_ITEMS = 1000; public static final String GOOGLE_READ = "user/-/state/com.google/read"; @@ -33,7 +31,7 @@ public class FreshRSSDataSource { private static final String FEED_PREFIX = "feed/"; - private FreshRSSService api; + private final FreshRSSService api; public FreshRSSDataSource(FreshRSSService api) { this.api = api; @@ -106,21 +104,29 @@ public class FreshRSSDataSource { if (syncType == SyncType.INITIAL_SYNC) { return getItems(Arrays.asList(GOOGLE_READ, GOOGLE_STARRED), MAX_ITEMS, null); } else { - return getItems(Collections.singletonList(GOOGLE_STARRED), MAX_ITEMS, syncData.getLastModified()); + return getItems(null, MAX_ITEMS, syncData.getLastModified()); } }) .flatMap(freshRSSItems -> { syncResult.setItems(freshRSSItems); - return getItemsIds(GOOGLE_READ, GOOGLE_READING_LIST, MAX_UNREAD_ITEMS_IDS); + return getItemsIds(GOOGLE_READ, GOOGLE_READING_LIST, MAX_ITEMS); }).flatMap(unreadItemsIds -> { syncResult.setUnreadIds(unreadItemsIds); - return getStarredItems(MAX_STARRED_ITEMS); - }).flatMap(starredItems -> { - syncResult.setStarredItems(starredItems); + return getItemsIds(null, GOOGLE_STARRED, MAX_STARRED_ITEMS); + }).flatMap(starredItemsIds -> { + syncResult.setStarredIds(starredItemsIds); - return Single.just(syncResult); + if (syncType == SyncType.INITIAL_SYNC) { + return getStarredItems(MAX_STARRED_ITEMS).flatMap(starredItems -> { + syncResult.setStarredItems(starredItems); + + return Single.just(syncResult); + }); + } else { + return Single.just(syncResult); + } })); }