Fixed Feed syncing
This commit is contained in:
parent
922b868914
commit
ee9662e73d
|
@ -39,7 +39,7 @@ public class FeedManager {
|
||||||
public void refreshAllFeeds(Context context) {
|
public void refreshAllFeeds(Context context) {
|
||||||
Log.d(TAG, "Refreshing all feeds.");
|
Log.d(TAG, "Refreshing all feeds.");
|
||||||
for (Feed feed : feeds) {
|
for (Feed feed : feeds) {
|
||||||
requester.downloadFeed(context, feed);
|
requester.downloadFeed(context, new Feed(feed.getDownload_url(), new Date()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,17 +85,13 @@ public class FeedManager {
|
||||||
for (FeedItem item : newFeed.getItems()) {
|
for (FeedItem item : newFeed.getItems()) {
|
||||||
FeedItem oldItem = searchFeedItemByLink(savedFeed,
|
FeedItem oldItem = searchFeedItemByLink(savedFeed,
|
||||||
item.getLink());
|
item.getLink());
|
||||||
if (oldItem != null) {
|
if (oldItem == null) {
|
||||||
FeedItem newItem = searchFeedItemByLink(newFeed,
|
// item is new
|
||||||
item.getLink());
|
savedFeed.getItems().add(item);
|
||||||
if (newItem != null) {
|
|
||||||
newItem.setRead(oldItem.isRead());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newFeed.setId(savedFeed.getId());
|
savedFeed.setLastUpdate(newFeed.getLastUpdate());
|
||||||
savedFeed = newFeed;
|
setFeed(context, savedFeed);
|
||||||
setFeed(context, newFeed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue