diff --git a/TalerWallet1/Views/Sheets/Payment/ChoicesView.swift b/TalerWallet1/Views/Sheets/Payment/ChoicesView.swift index dbeb0dca..680ee72c 100644 --- a/TalerWallet1/Views/Sheets/Payment/ChoicesView.swift +++ b/TalerWallet1/Views/Sheets/Payment/ChoicesView.swift @@ -175,6 +175,31 @@ struct ChoicesView: View, Sendable { } } // MARK: - +/// The merchant-supplied product image (a data URL), decoded once +struct ProductImageView: View { + let imageBase64: String + + @State private var image: Image? = nil + + var body: some View { + Group { + if let image { + image + .resizable() + .aspectRatio(contentMode: .fit) + .clipShape(RoundedRectangle(cornerRadius: 6)) + } else { + Color.clear // keeps the view (and its .task) alive until decoded + } + } + .frame(width: 44, height: 44) + .accessibilityHidden(true) + .task(id: imageBase64) { + image = Image(imageBase64: imageBase64) + } + } +} +// MARK: - struct ProductsView: View, Sendable { let stack: CallStack let scope: ScopeInfo? @@ -188,6 +213,9 @@ struct ProductsView: View, Sendable { Section { ForEach(products, id: \.self) { product in HStack { + if let imageBase64 = product.image { + ProductImageView(imageBase64: imageBase64) + } VStack(alignment: .leading) { if let name = product.productName { Text(name)