mirror of https://github.com/readrops/Readrops.git
Insert greader API writeToken after getting it
This commit is contained in:
parent
46d4d8a868
commit
ccf0a46a13
|
@ -28,4 +28,7 @@ public abstract class AccountDao implements BaseDao<Account> {
|
|||
|
||||
@Query("Select count(*) From Account")
|
||||
public abstract Integer getAccountCount();
|
||||
|
||||
@Query("Update Account set writeToken = :writeToken Where id = :accountId")
|
||||
public abstract void updateWriteToken(int accountId, String writeToken);
|
||||
}
|
||||
|
|
|
@ -121,10 +121,13 @@ public class FreshRSSRepository extends ARepository {
|
|||
|
||||
if (account.getWriteToken() == null) {
|
||||
return api.getWriteToken()
|
||||
.flatMapCompletable(writeToken -> api.
|
||||
markItemReadUnread(read, item.getRemoteId(), writeToken));
|
||||
.flatMapCompletable(writeToken -> {
|
||||
database.accountDao().updateWriteToken(account.getId(), writeToken);
|
||||
|
||||
return api.markItemReadUnread(read, item.getRemoteId(), writeToken).concatWith(super.setItemReadState(item, read));
|
||||
});
|
||||
} else {
|
||||
return api.markItemReadUnread(read, item.getRemoteId(), account.getWriteToken());
|
||||
return api.markItemReadUnread(read, item.getRemoteId(), account.getWriteToken()).concatWith(super.setItemReadState(item, read));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue