Edits history: Improve temporary UX a bit

This commit is contained in:
manuroe
2019-07-01 10:51:07 +02:00
parent fe1f719284
commit 69966e36c0
4 changed files with 39 additions and 17 deletions
@@ -19,7 +19,13 @@
import Foundation
final class EditHistoryViewModel: EditHistoryViewModelType {
// MARK: - Constants
private enum Pagination {
static let count: UInt = 2
}
// MARK: - Properties
// MARK: Private
@@ -74,7 +80,7 @@ final class EditHistoryViewModel: EditHistoryViewModelType {
}
self.update(viewState: .loading)
self.operation = self.aggregations.replaceEvents(forEvent: self.eventId, inRoom: self.roomId, from: self.nextBatch, limit: 10, success: { [weak self] (response) in
self.operation = self.aggregations.replaceEvents(forEvent: self.eventId, inRoom: self.roomId, from: self.nextBatch, limit: Pagination.count, success: { [weak self] (response) in
guard let sself = self else {
return
}
@@ -84,6 +90,10 @@ final class EditHistoryViewModel: EditHistoryViewModelType {
sself.process(editEvents: response.chunk)
if sself.nextBatch == nil {
sself.update(viewState: .allLoaded)
}
}, failure: { [weak self] error in
guard let sself = self else {
return