Enable set all items and all feed items read state features for local accounts only

This commit is contained in:
Shinokuni 2021-07-17 15:02:44 +02:00
parent 056d8db78f
commit 8f017753cc
1 changed files with 10 additions and 3 deletions

View File

@ -129,11 +129,19 @@ public abstract class ARepository {
} }
public Completable setAllItemsReadState(boolean read) { public Completable setAllItemsReadState(boolean read) {
if (account.isLocal()) { // TODO see if it's possible to implement for others accounts
return database.itemDao().setAllItemsReadState(read ? 1 : 0, account.getId()); return database.itemDao().setAllItemsReadState(read ? 1 : 0, account.getId());
} else {
return Completable.complete();
}
} }
public Completable setAllFeedItemsReadState(int feedId, boolean read) { public Completable setAllFeedItemsReadState(int feedId, boolean read) {
if (account.isLocal()) {
return database.itemDao().setAllFeedItemsReadState(feedId, read ? 1 : 0); return database.itemDao().setAllFeedItemsReadState(feedId, read ? 1 : 0);
} else {
return Completable.complete();
}
} }
public Completable setItemStarState(Item item) { public Completable setItemStarState(Item item) {
@ -147,7 +155,6 @@ public abstract class ARepository {
return database.itemStateChangesDao().upsertItemStarStateChange(item, account.getId(), false) return database.itemStateChangesDao().upsertItemStarStateChange(item, account.getId(), false)
.andThen(database.itemDao().setStarState(item.getId(), item.isStarred())); .andThen(database.itemDao().setStarState(item.getId(), item.isStarred()));
} }
} }
public Single<Integer> getFeedCount(int accountId) { public Single<Integer> getFeedCount(int accountId) {