Commit fbafca1b authored by Christophe Henry's avatar Christophe Henry

Fix unread section displaying too many articles by excluding read articles

parent a5f43c30
......@@ -94,14 +94,12 @@ class Api {
fun getUnreadItems(
olderTimestamp: Long,
excludStreamId: String? = null,
continuation: String? = null
): Promise<ContentItemsHandler, Exception> {
if(!isLogged()) return Promise.ofFail(ApiNotInitializedException())
val params = mutableListOf<Pair<String, String>>()
val params = mutableListOf("xt" to "user/-/state/com.google/read")
if(!continuation.isNullOrBlank()) params.add("c" to continuation)
if(!excludStreamId.isNullOrBlank()) params.add("xt" to excludStreamId)
if(olderTimestamp > 0) params.add("ot" to "$olderTimestamp")
return Fuel
......@@ -110,7 +108,7 @@ class Api {
.promise<ContentItemsHandler>()
.bind {it1 ->
if(it1.continuation.isNotBlank() && it1.continuation != continuation) {
getUnreadItems(olderTimestamp, excludStreamId, it1.continuation)
getUnreadItems(olderTimestamp, it1.continuation)
.then {it2 -> it2.copy(items = it1.items + it2.items)}
} else Promise.ofSuccess(it1)
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment