forked from shadowfacts/Tusker
Prevent needlessly prefetching non-image attachments
This commit is contained in:
parent
1c708732f2
commit
794594805c
|
@ -189,7 +189,7 @@ extension ConversationTableViewController: UITableViewDataSourcePrefetching {
|
||||||
for indexPath in indexPaths {
|
for indexPath in indexPaths {
|
||||||
guard let status = mastodonController.persistentContainer.status(for: statuses[indexPath.row].id) else { continue }
|
guard let status = mastodonController.persistentContainer.status(for: statuses[indexPath.row].id) else { continue }
|
||||||
_ = ImageCache.avatars.get(status.account.avatar, completion: nil)
|
_ = ImageCache.avatars.get(status.account.avatar, completion: nil)
|
||||||
for attachment in status.attachments {
|
for attachment in status.attachments where attachment.kind == .image {
|
||||||
_ = ImageCache.attachments.get(attachment.url, completion: nil)
|
_ = ImageCache.attachments.get(attachment.url, completion: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ extension ConversationTableViewController: UITableViewDataSourcePrefetching {
|
||||||
for indexPath in indexPaths {
|
for indexPath in indexPaths {
|
||||||
guard let status = mastodonController.persistentContainer.status(for: statuses[indexPath.row].id) else { continue }
|
guard let status = mastodonController.persistentContainer.status(for: statuses[indexPath.row].id) else { continue }
|
||||||
ImageCache.avatars.cancelWithoutCallback(status.account.avatar)
|
ImageCache.avatars.cancelWithoutCallback(status.account.avatar)
|
||||||
for attachment in status.attachments {
|
for attachment in status.attachments where attachment.kind == .image {
|
||||||
ImageCache.attachments.cancelWithoutCallback(attachment.url)
|
ImageCache.attachments.cancelWithoutCallback(attachment.url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -295,7 +295,7 @@ extension ProfileStatusesViewController: UITableViewDataSourcePrefetching {
|
||||||
}
|
}
|
||||||
guard let status = mastodonController.persistentContainer.status(for: statusID) else { continue }
|
guard let status = mastodonController.persistentContainer.status(for: statusID) else { continue }
|
||||||
_ = ImageCache.avatars.get(status.account.avatar, completion: nil)
|
_ = ImageCache.avatars.get(status.account.avatar, completion: nil)
|
||||||
for attachment in status.attachments {
|
for attachment in status.attachments where attachment.kind == .image {
|
||||||
_ = ImageCache.attachments.get(attachment.url, completion: nil)
|
_ = ImageCache.attachments.get(attachment.url, completion: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -311,7 +311,7 @@ extension ProfileStatusesViewController: UITableViewDataSourcePrefetching {
|
||||||
}
|
}
|
||||||
guard let status = mastodonController.persistentContainer.status(for: statusID) else { continue }
|
guard let status = mastodonController.persistentContainer.status(for: statusID) else { continue }
|
||||||
ImageCache.avatars.cancelWithoutCallback(status.account.avatar)
|
ImageCache.avatars.cancelWithoutCallback(status.account.avatar)
|
||||||
for attachment in status.attachments {
|
for attachment in status.attachments where attachment.kind == .image {
|
||||||
ImageCache.avatars.cancelWithoutCallback(attachment.url)
|
ImageCache.avatars.cancelWithoutCallback(attachment.url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -261,7 +261,7 @@ extension TimelineTableViewController: UITableViewDataSourcePrefetching {
|
||||||
for indexPath in indexPaths {
|
for indexPath in indexPaths {
|
||||||
guard let status = mastodonController.persistentContainer.status(for: statusID(for: indexPath)) else { continue }
|
guard let status = mastodonController.persistentContainer.status(for: statusID(for: indexPath)) else { continue }
|
||||||
_ = ImageCache.avatars.get(status.account.avatar, completion: nil)
|
_ = ImageCache.avatars.get(status.account.avatar, completion: nil)
|
||||||
for attachment in status.attachments {
|
for attachment in status.attachments where attachment.kind == .image {
|
||||||
_ = ImageCache.attachments.get(attachment.url, completion: nil)
|
_ = ImageCache.attachments.get(attachment.url, completion: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ extension TimelineTableViewController: UITableViewDataSourcePrefetching {
|
||||||
guard indexPath.section < timelineSegments.count, indexPath.row < timelineSegments[indexPath.section].count,
|
guard indexPath.section < timelineSegments.count, indexPath.row < timelineSegments[indexPath.section].count,
|
||||||
let status = mastodonController.persistentContainer.status(for: statusID(for: indexPath)) else { continue }
|
let status = mastodonController.persistentContainer.status(for: statusID(for: indexPath)) else { continue }
|
||||||
ImageCache.avatars.cancelWithoutCallback(status.account.avatar)
|
ImageCache.avatars.cancelWithoutCallback(status.account.avatar)
|
||||||
for attachment in status.attachments {
|
for attachment in status.attachments where attachment.kind == .image {
|
||||||
ImageCache.attachments.cancelWithoutCallback(attachment.url)
|
ImageCache.attachments.cancelWithoutCallback(attachment.url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue