[WIP] Modern cache

This commit is contained in:
Ali
2022-12-17 00:17:31 +04:00
parent 792e0091bc
commit 614c74b0b0
189 changed files with 1464 additions and 848 deletions

View File

@@ -14,13 +14,15 @@ class BotCheckoutHeaderItem: ListViewItem, ItemListItem {
let account: Account
let theme: PresentationTheme
let invoice: TelegramMediaInvoice
let source: BotPaymentInvoiceSource
let botName: String
let sectionId: ItemListSectionId
init(account: Account, theme: PresentationTheme, invoice: TelegramMediaInvoice, botName: String, sectionId: ItemListSectionId) {
init(account: Account, theme: PresentationTheme, invoice: TelegramMediaInvoice, source: BotPaymentInvoiceSource, botName: String, sectionId: ItemListSectionId) {
self.account = account
self.theme = theme
self.invoice = invoice
self.source = source
self.botName = botName
self.sectionId = sectionId
}
@@ -173,7 +175,15 @@ class BotCheckoutHeaderItemNode: ListViewItemNode {
maxTextWidth = max(1.0, maxTextWidth - imageSize.width - imageTextSpacing)
if imageUpdated {
updatedImageSignal = chatWebFileImage(account: item.account, file: photo)
updatedFetchSignal = fetchedMediaResource(mediaBox: item.account.postbox.mediaBox, reference: .standalone(resource: photo.resource))
var userLocation: MediaResourceUserLocation = .other
switch item.source {
case let .message(messageId):
userLocation = .peer(messageId.peerId)
default:
break
}
updatedFetchSignal = fetchedMediaResource(mediaBox: item.account.postbox.mediaBox, userLocation: userLocation, userContentType: .image, reference: .standalone(resource: photo.resource))
}
}