Merge branch 'develop' of https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui into feature/molecular_top_alert

This commit is contained in:
Pfeil, Scott Robert 2020-09-15 11:43:29 -04:00
commit a971f3daa9
3 changed files with 23 additions and 10 deletions

View File

@ -9,7 +9,7 @@
import UIKit
@objcMembers open class RadioButton: Control {
@objcMembers open class RadioButton: Control, MFButtonProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
@ -99,6 +99,9 @@ import UIKit
} else {
isSelected = !isSelected
}
if let actionModel = radioModel?.action, isSelected {
Button.performButtonAction(with: actionModel, button: self, delegateObject: delegateObject, additionalData: nil)
}
_ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate)
setNeedsDisplay()
}

View File

@ -26,6 +26,7 @@ open class RadioButtonModel: MoleculeModelProtocol, FormFieldProtocol {
public var baseValue: AnyHashable?
public var groupName: String = FormValidator.defaultGroupName
public var fieldKey: String?
public var action: ActionModelProtocol?
//--------------------------------------------------
// MARK: - Keys
@ -39,6 +40,7 @@ open class RadioButtonModel: MoleculeModelProtocol, FormFieldProtocol {
case fieldValue
case fieldKey
case groupName
case action
}
//--------------------------------------------------
@ -81,6 +83,7 @@ open class RadioButtonModel: MoleculeModelProtocol, FormFieldProtocol {
self.groupName = groupName
}
fieldValue = try typeContainer.decodeIfPresent(String.self, forKey: .fieldValue)
action = try typeContainer.decodeModelIfPresent(codingKey: .action)
}
public func encode(to encoder: Encoder) throws {
@ -92,5 +95,6 @@ open class RadioButtonModel: MoleculeModelProtocol, FormFieldProtocol {
try container.encodeIfPresent(fieldKey, forKey: .fieldKey)
try container.encodeIfPresent(groupName, forKey: .groupName)
try container.encodeIfPresent(fieldValue, forKey: .fieldValue)
try container.encodeModelIfPresent(action, forKey: .action)
}
}

View File

@ -128,7 +128,9 @@ extension WebView : WKUIDelegate {
if !dynamicHeight {
return
}
/* was using "document.readyState" to check the state, while evaluateJavaScript "document.readyState",only works when webview contains userscrpt.otherwise, it would return WKErrorDomain Code=4 "A JavaScript exception occurred".
/*
was using "document.readyState" to check the state,
while evaluateJavaScript "document.readyState",only works when webview contains userscrpt.otherwise, it would return WKErrorDomain Code=4 "A JavaScript exception occurred".
so webView.isLoading to check load finished state
*/
if !webView.isLoading {
@ -136,14 +138,18 @@ extension WebView : WKUIDelegate {
guard let self = self else {
return
}
if let height = result as? CGFloat {
self.webViewHeight?.constant = height
} else {
//if failed to get height from javascript, using scrollview.contensize's height
let scrollHeight = self.webView?.scrollView.contentSize.height
self.webViewHeight?.constant = scrollHeight ?? 44
}
self.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self)
MVMCoreDispatchUtility.performBlock(onMainThread: { [weak self] in
guard let self = self else {
return
}
if let height = result as? CGFloat {
self.webViewHeight?.constant = height
} else {
//if failed to get height from javascript, using scrollview.contensize's height
self.webViewHeight?.constant = webView.scrollView.contentSize.height
}
self.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self)
})
})
}
}