Skip to content
This repository has been archived by the owner on Mar 11, 2022. It is now read-only.

Commit

Permalink
Tweak pagination/room switching behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
neilalexander committed Sep 12, 2018
1 parent bc1f80b commit 9dda375
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
24 changes: 13 additions & 11 deletions Seaglass/Controller/Main View/MainViewRoomController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -378,20 +378,22 @@ class MainViewRoomController: NSViewController, MatrixRoomDelegate, NSTableViewD
})
}

if let room = MatrixServices.inst.session.room(withRoomId: cacheEntry.roomId) {
if cache.filteredContent.count < 50 {
if cache.filteredContent.count >= 50 {
roomDidPaginate()
} else {
if let room = MatrixServices.inst.session.room(withRoomId: cacheEntry.roomId) {
room.liveTimeline.resetPagination()
}
let group = DispatchGroup()
while cache.filteredContent.count == 0 {
group.enter()
room.liveTimeline.paginate(25, direction: .backwards, onlyFromStore: false) { _ in
if cache.filteredContent.count >= 50 {
roomDidPaginate()
let group = DispatchGroup()
while cache.filteredContent.count < 50 {
group.enter()
room.liveTimeline.paginate(25, direction: .backwards, onlyFromStore: false) { _ in
if cache.filteredContent.count >= 50 {
roomDidPaginate()
}
group.leave()
}
group.leave()
group.wait()
}
group.wait()
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Seaglass/Subclass/Image Views/InlineImageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class InlineImageView: ContextImageView, QLPreviewItem, QLPreviewPanelDelegate,
guard let mxcURL = forMxcUrl else { return }

if mxcURL.hasPrefix("mxc://") {
guard let url = MatrixServices.inst.client.url(ofContentThumbnail: forMxcUrl, toFitViewSize: CGSize(width: 96, height: 96), with: MXThumbnailingMethodScale) else { return }
guard let url = MatrixServices.inst.client.url(ofContentThumbnail: forMxcUrl, toFitViewSize: CGSize(width: 256, height: 256), with: MXThumbnailingMethodScale) else { return }
guard let realurl = MatrixServices.inst.client.url(ofContent: forMxcUrl) else { return }

if url.hasPrefix("http://") || url.hasPrefix("https://") {
Expand Down

0 comments on commit 9dda375

Please sign in to comment.