mirror of
https://github.com/readrops/Readrops.git
synced 2025-01-18 20:09:49 +01:00
Get feed id as room insert result
This commit is contained in:
parent
6cd29826c1
commit
adbbf2f2bd
@ -122,11 +122,9 @@ public class LocalFeedRepository extends ARepository implements QueryCallback {
|
||||
Feed dbFeed = database.feedDao().getFeedByUrl(rssFeed.getChannel().getFeedUrl());
|
||||
if (dbFeed == null) {
|
||||
dbFeed = Feed.feedFromRSS(rssFeed.getChannel());
|
||||
|
||||
dbFeed.setColor(getFaviconColor(dbFeed.getSiteUrl()));
|
||||
|
||||
database.feedDao().insert(dbFeed);
|
||||
dbFeed.setId(database.feedDao().getFeedIdByUrl(rssFeed.getChannel().getFeedUrl()));
|
||||
dbFeed.setId((int)(database.feedDao().insert(dbFeed)));
|
||||
}
|
||||
|
||||
List<Item> dbItems = Item.itemsFromRSS(rssFeed.getChannel().getItems(), dbFeed);
|
||||
@ -143,11 +141,9 @@ public class LocalFeedRepository extends ARepository implements QueryCallback {
|
||||
Feed dbFeed = database.feedDao().getFeedByUrl(feed.getLink());
|
||||
if (dbFeed == null) {
|
||||
dbFeed = Feed.feedFromATOM(feed);
|
||||
database.feedDao().insert(dbFeed);
|
||||
|
||||
dbFeed.setColor(getFaviconColor(dbFeed.getSiteUrl()));
|
||||
|
||||
dbFeed.setId(database.feedDao().getFeedIdByUrl(feed.getLink()));
|
||||
dbFeed.setId((int)(database.feedDao().insert(dbFeed)));
|
||||
}
|
||||
|
||||
List<Item> dbItems = Item.itemsFromATOM(feed.getEntries(), dbFeed);
|
||||
@ -165,11 +161,9 @@ public class LocalFeedRepository extends ARepository implements QueryCallback {
|
||||
Feed dbFeed = database.feedDao().getFeedByUrl(feed.getFeedUrl());
|
||||
if (dbFeed == null) {
|
||||
dbFeed = Feed.feedFromJSON(feed);
|
||||
database.feedDao().insert(dbFeed);
|
||||
|
||||
dbFeed.setColor(getFaviconColor(dbFeed.getSiteUrl()));
|
||||
|
||||
dbFeed.setId(database.feedDao().getFeedIdByUrl(feed.getFeedUrl()));
|
||||
dbFeed.setId((int)(database.feedDao().insert(dbFeed)));
|
||||
}
|
||||
|
||||
List<Item> dbItems = Item.itemsFromJSON(feed.getItems(), dbFeed);
|
||||
@ -205,6 +199,7 @@ public class LocalFeedRepository extends ARepository implements QueryCallback {
|
||||
|
||||
Response response = okHttpClient.newCall(request).execute();
|
||||
InputStream inputStream = response.body().byteStream();
|
||||
|
||||
return BitmapFactory.decodeStream(inputStream);
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ public interface FeedDao {
|
||||
List<Feed> getAllFeeds();
|
||||
|
||||
@Insert
|
||||
void insert(Feed feed);
|
||||
long insert(Feed feed);
|
||||
|
||||
@Query("Select count(*) from Feed")
|
||||
int getFeedCount();
|
||||
|
@ -27,7 +27,7 @@ public interface ItemDao {
|
||||
String guidExist(String guid);
|
||||
|
||||
@Insert
|
||||
void insert(Item item);
|
||||
long insert(Item item);
|
||||
|
||||
@Insert
|
||||
void insertAll(List<Item> items);
|
||||
|
Loading…
Reference in New Issue
Block a user