diff --git a/Tusker/Screens/Conversation/ConversationTableViewController.swift b/Tusker/Screens/Conversation/ConversationTableViewController.swift index 94a0452d91..61b05e10fd 100644 --- a/Tusker/Screens/Conversation/ConversationTableViewController.swift +++ b/Tusker/Screens/Conversation/ConversationTableViewController.swift @@ -189,7 +189,7 @@ extension ConversationTableViewController: UITableViewDataSourcePrefetching { for indexPath in indexPaths { guard let status = mastodonController.persistentContainer.status(for: statuses[indexPath.row].id) else { continue } _ = 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) } } @@ -199,7 +199,7 @@ extension ConversationTableViewController: UITableViewDataSourcePrefetching { for indexPath in indexPaths { guard let status = mastodonController.persistentContainer.status(for: statuses[indexPath.row].id) else { continue } 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) } } diff --git a/Tusker/Screens/Profile/ProfileStatusesViewController.swift b/Tusker/Screens/Profile/ProfileStatusesViewController.swift index ff93ca2718..24d48d4d40 100644 --- a/Tusker/Screens/Profile/ProfileStatusesViewController.swift +++ b/Tusker/Screens/Profile/ProfileStatusesViewController.swift @@ -295,7 +295,7 @@ extension ProfileStatusesViewController: UITableViewDataSourcePrefetching { } guard let status = mastodonController.persistentContainer.status(for: statusID) else { continue } _ = 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) } } @@ -311,7 +311,7 @@ extension ProfileStatusesViewController: UITableViewDataSourcePrefetching { } guard let status = mastodonController.persistentContainer.status(for: statusID) else { continue } 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) } } diff --git a/Tusker/Screens/Timeline/TimelineTableViewController.swift b/Tusker/Screens/Timeline/TimelineTableViewController.swift index 0a1fa3e73c..a7d3afecc4 100644 --- a/Tusker/Screens/Timeline/TimelineTableViewController.swift +++ b/Tusker/Screens/Timeline/TimelineTableViewController.swift @@ -261,7 +261,7 @@ extension TimelineTableViewController: UITableViewDataSourcePrefetching { for indexPath in indexPaths { guard let status = mastodonController.persistentContainer.status(for: statusID(for: indexPath)) else { continue } _ = 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) } } @@ -274,7 +274,7 @@ extension TimelineTableViewController: UITableViewDataSourcePrefetching { guard indexPath.section < timelineSegments.count, indexPath.row < timelineSegments[indexPath.section].count, let status = mastodonController.persistentContainer.status(for: statusID(for: indexPath)) else { continue } 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) } }