Display 1 subview for `WebImageView` for each image loading source type?

pull/3274/head
Vladyslav Shepitko 3 years ago
parent d6a9fc2167
commit 28d50d5313
  1. 10
      AlphaWallet/Tokens/Views/OpenSea/WebImageView.swift

@ -23,6 +23,8 @@ class WebImageView: UIView {
var url: URL? {
didSet {
imageView.image = nil
setIsLoadingImageFromURL(true)
if let url = url?.rewrittenIfIpfs {
if url.pathExtension == "svg" {
switch type {
@ -44,10 +46,16 @@ class WebImageView: UIView {
var image: UIImage? {
didSet {
imageView.image = image
setIsLoadingImageFromURL(false)
webView.loadHTMLString("", baseURL: nil)
}
}
private func setIsLoadingImageFromURL(_ value: Bool) {
imageView.isHidden = value
webView.isHidden = !imageView.isHidden
}
init(type: ImageType) {
self.type = type
url = nil
@ -101,4 +109,4 @@ class WebImageView: UIView {
</html>
"""
}
}
}

Loading…
Cancel
Save