Merge pull request #3274 from vladyslav-iosdev/#3267

WebImageView should probably have at most 1 of its subview visible at any time? #3267
pull/3273/head
Hwee-Boon Yar 3 years ago committed by GitHub
commit 19b95f8dc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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