Shows app’s source icon on AppBannerView

Excluding contexts where it is redundant (e.g. source detail page).
This commit is contained in:
Riley Testut
2023-12-07 18:19:42 -06:00
committed by Magesh K
parent 20b424c97c
commit 5c808ec59e
5 changed files with 68 additions and 18 deletions

View File

@@ -226,11 +226,12 @@ private extension SourceDetailContentViewController
cell.contentView.backgroundColor = .altBackground
cell.bannerView.button.isIndicatingActivity = false
cell.bannerView.configure(for: storeApp)
cell.bannerView.configure(for: storeApp, showSourceIcon: false)
cell.bannerView.button.tintColor = storeApp.tintColor
cell.bannerView.button.addTarget(self, action: #selector(SourceDetailContentViewController.performAppAction(_:)), for: .primaryActionTriggered)
cell.bannerView.iconImageView.image = nil
cell.bannerView.iconImageView.isIndicatingActivity = true
}
dataSource.prefetchHandler = { (storeApp, indexPath, completion) -> Foundation.Operation? in
@@ -248,14 +249,15 @@ private extension SourceDetailContentViewController
}
}
}
dataSource.prefetchCompletionHandler = { (cell, image, indexPath, error) in
dataSource.prefetchCompletionHandler = { [weak dataSource] (cell, image, indexPath, error) in
let cell = cell as! AppBannerCollectionViewCell
cell.bannerView.iconImageView.image = image
cell.bannerView.iconImageView.isIndicatingActivity = false
if let error
if let error, let dataSource
{
print("[ALTLog] Error loading source icon:", error)
let app = dataSource.item(at: indexPath)
Logger.main.debug("Failed to fetch app icon from \(app.iconURL, privacy: .public). \(error.localizedDescription, privacy: .public)")
}
}