Fix missing chats in app
Signed-off-by: Adolfo Santiago <epoch@nixnetmail.com>
This commit is contained in:
parent
9bc7e522a6
commit
237241baa1
2 changed files with 13 additions and 13 deletions
|
@ -631,7 +631,7 @@ interface MastodonApi {
|
|||
@Path("message_id") messageId: String
|
||||
): Single<ChatMessage>
|
||||
|
||||
@GET("api/v1/pleroma/chats")
|
||||
@GET("api/v2/pleroma/chats")
|
||||
fun getChats(
|
||||
@Query("max_id") maxId: String?,
|
||||
@Query("min_id") minId: String?,
|
||||
|
|
|
@ -59,24 +59,24 @@ class ChatRepositoryImpl(
|
|||
getChatMessagesFromNetwork(chatId, maxId, sinceId, sincedIdMinusOne, limit, accountId, requestMode)
|
||||
}*/
|
||||
|
||||
return getChatMessagesFromNetwork(chatId, maxId, sinceId, sincedIdMinusOne, limit, accountId, requestMode)
|
||||
return getChatMessagesFromNetwork(chatId, maxId, null, null, limit, accountId, requestMode)
|
||||
}
|
||||
|
||||
private fun getChatsFromNetwork(maxId: String?, sinceId: String?,
|
||||
sinceIdMinusOne: String?, limit: Int,
|
||||
accountId: Long, requestMode: TimelineRequestMode
|
||||
): Single<out List<ChatStatus>> {
|
||||
return mastodonApi.getChats(maxId, null, sinceIdMinusOne, 0, limit + 1)
|
||||
.map { chats ->
|
||||
this.saveChatsToDb(accountId, chats, maxId, sinceId)
|
||||
}
|
||||
.flatMap { chats ->
|
||||
this.addFromDbIfNeeded(accountId, chats, maxId, sinceId, limit, requestMode)
|
||||
}
|
||||
.onErrorResumeNext { error ->
|
||||
if (error is IOException && requestMode != NETWORK) {
|
||||
this.getChatsFromDb(accountId, maxId, sinceId, limit)
|
||||
} else {
|
||||
return mastodonApi.getChats(null, null, sinceIdMinusOne, 0, limit + 1)
|
||||
.map { chats ->
|
||||
this.saveChatsToDb(accountId, chats, maxId, sinceId)
|
||||
}
|
||||
.flatMap { chats ->
|
||||
this.addFromDbIfNeeded(accountId, chats, maxId, sinceId, limit, requestMode)
|
||||
}
|
||||
.onErrorResumeNext { error ->
|
||||
if (error is IOException && requestMode != NETWORK) {
|
||||
this.getChatsFromDb(accountId, maxId, sinceId, limit)
|
||||
} else {
|
||||
Single.error(error)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue