update based on Scott's comment
This commit is contained in:
parent
4abfeef11a
commit
0edc7a8f00
@ -60,8 +60,9 @@ import WebKit
|
||||
|
||||
super.set(with: model, delegateObject, additionalData)
|
||||
self.delegateObject = delegateObject
|
||||
|
||||
var webViewHeightConstant: CGFloat = 44
|
||||
if let height = webviewModel?.height {
|
||||
webViewHeightConstant = height
|
||||
webViewHeight?.constant = height
|
||||
dynamicHeight = false
|
||||
}
|
||||
@ -71,7 +72,7 @@ import WebKit
|
||||
} else {
|
||||
webView?.stopLoading()
|
||||
webView?.load(URLRequest(url: url))
|
||||
webViewHeight?.constant = 44
|
||||
webViewHeight?.constant = webViewHeightConstant
|
||||
overLayer.isHidden = false
|
||||
loadingSpinner.resumeSpinner()
|
||||
}
|
||||
@ -80,7 +81,7 @@ import WebKit
|
||||
//dont load the new html since they are the same html string as preivous
|
||||
} else {
|
||||
webView?.stopLoading()
|
||||
webViewHeight?.constant = 44
|
||||
webViewHeight?.constant = webViewHeightConstant
|
||||
webView?.loadHTMLString(htmlString, baseURL: nil)
|
||||
overLayer.isHidden = false
|
||||
loadingSpinner.resumeSpinner()
|
||||
@ -106,7 +107,6 @@ import WebKit
|
||||
loadingSpinner.widthAnchor.constraint(equalToConstant: 44.0).isActive = true
|
||||
loadingSpinner.centerXAnchor.constraint(equalTo: centerXAnchor).isActive = true
|
||||
loadingSpinner.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true
|
||||
loadingSpinner.resumeSpinner()
|
||||
}
|
||||
|
||||
func setupOverLayer() {
|
||||
|
||||
@ -16,7 +16,6 @@ import Foundation
|
||||
public var htmlString: String?
|
||||
public var height: CGFloat?
|
||||
public var borderColor: Color?
|
||||
public var buttonMap: [String: ButtonModel]?
|
||||
|
||||
private enum CodingKeys: String, CodingKey{
|
||||
case moleculeName
|
||||
@ -24,7 +23,6 @@ import Foundation
|
||||
case url
|
||||
case htmlString
|
||||
case height
|
||||
case buttonMap
|
||||
case borderColor
|
||||
}
|
||||
|
||||
@ -33,8 +31,10 @@ import Foundation
|
||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||
url = try typeContainer.decodeIfPresent(URL.self, forKey: .url)
|
||||
htmlString = try typeContainer.decodeIfPresent(String.self, forKey: .htmlString)
|
||||
if url == nil, htmlString == nil {
|
||||
throw ModelRegistry.Error.decoderErrorModelNotMapped
|
||||
}
|
||||
height = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .height)
|
||||
buttonMap = try typeContainer.decodeIfPresent([String: ButtonModel].self, forKey: .buttonMap)
|
||||
borderColor = try typeContainer.decodeIfPresent(Color.self, forKey: .borderColor)
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user