mirror of https://github.com/readrops/Readrops.git
Fix new unread items request
This commit is contained in:
parent
f6c322c4f2
commit
0a0abd4a4d
|
@ -20,8 +20,6 @@ import com.readrops.readropslibrary.services.freshrss.json.FreshRSSFeed;
|
|||
import com.readrops.readropslibrary.services.freshrss.json.FreshRSSFolder;
|
||||
import com.readrops.readropslibrary.services.freshrss.json.FreshRSSItem;
|
||||
|
||||
import org.joda.time.LocalDateTime;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -63,12 +61,11 @@ public class FreshRSSRepository extends ARepository {
|
|||
FreshRSSAPI api = new FreshRSSAPI(new FreshRSSCredentials(account.getToken(), account.getUrl()));
|
||||
|
||||
FreshRSSSyncData syncData = new FreshRSSSyncData();
|
||||
long lastModified = LocalDateTime.now().toDateTime().getMillis();
|
||||
SyncType syncType;
|
||||
|
||||
if (account.getLastModified() != 0) {
|
||||
syncType = SyncType.CLASSIC_SYNC;
|
||||
syncData.setLastModified(lastModified / 1000L);
|
||||
syncData.setLastModified(account.getLastModified());
|
||||
} else
|
||||
syncType = SyncType.INITIAL_SYNC;
|
||||
|
||||
|
@ -78,8 +75,8 @@ public class FreshRSSRepository extends ARepository {
|
|||
insertFeeds(syncResult.getFeeds(), account);
|
||||
insertItems(syncResult.getItems(), account, syncType == SyncType.INITIAL_SYNC);
|
||||
|
||||
account.setLastModified(lastModified);
|
||||
database.accountDao().updateLastModified(account.getId(), lastModified);
|
||||
account.setLastModified(syncResult.getLastUpdated());
|
||||
database.accountDao().updateLastModified(account.getId(), syncResult.getLastUpdated());
|
||||
|
||||
return Observable.empty();
|
||||
});
|
||||
|
|
|
@ -40,7 +40,8 @@ public final class ItemMatcher {
|
|||
newItem.setTitle(item.getTitle());
|
||||
newItem.setAuthor(item.getAuthor());
|
||||
|
||||
newItem.setPubDate(new LocalDateTime(item.getPublished() * 1000L));
|
||||
newItem.setPubDate(new LocalDateTime(item.getPublished() * 1000L,
|
||||
DateTimeZone.getDefault()));
|
||||
newItem.setContent(item.getSummary().getContent());
|
||||
|
||||
newItem.setLink(item.getAlternate().get(0).getHref());
|
||||
|
|
|
@ -72,6 +72,7 @@ public class FreshRSSAPI extends API<FreshRSSService> {
|
|||
})
|
||||
.flatMap(freshRSSItems -> {
|
||||
syncResult.setItems(freshRSSItems.getItems());
|
||||
syncResult.setLastUpdated(freshRSSItems.getUpdated());
|
||||
|
||||
return Single.just(syncResult);
|
||||
});
|
||||
|
|
|
@ -15,6 +15,8 @@ public class FreshRSSSyncResult {
|
|||
|
||||
private List<FreshRSSItem> items;
|
||||
|
||||
private long lastUpdated;
|
||||
|
||||
public FreshRSSSyncResult() {
|
||||
feeds = new ArrayList<>();
|
||||
items = new ArrayList<>();
|
||||
|
@ -36,6 +38,14 @@ public class FreshRSSSyncResult {
|
|||
this.items = items;
|
||||
}
|
||||
|
||||
public long getLastUpdated() {
|
||||
return lastUpdated;
|
||||
}
|
||||
|
||||
public void setLastUpdated(long lastUpdated) {
|
||||
this.lastUpdated = lastUpdated;
|
||||
}
|
||||
|
||||
public List<FreshRSSFolder> getFolders() {
|
||||
return folders;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue