corrections made.
This commit is contained in:
parent
845036b4ec
commit
efec81871c
@ -365,7 +365,7 @@ extension Label {
|
|||||||
|
|
||||||
public func createActionBlockFrom(actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) -> ActionBlock {
|
public func createActionBlockFrom(actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) -> ActionBlock {
|
||||||
return { [weak self] in
|
return { [weak self] in
|
||||||
if (delegateObject as? MVMCoreUIDelegateObject)?.buttonDelegate?.button?(self!, shouldPerformActionWithMap: actionMap, additionalData: additionalData) ?? true {
|
if let wSelf = self, (delegateObject as? MVMCoreUIDelegateObject)?.buttonDelegate?.button?(wSelf, shouldPerformActionWithMap: actionMap, additionalData: additionalData) ?? true {
|
||||||
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject)
|
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,8 @@ public typealias ButtonObjectDelegate = NSObjectProtocol & ButtonDelegateProtoco
|
|||||||
public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProtocol & MVMCoreLoadDelegateProtocol & MVMCorePresentationDelegateProtocol & NSObjectProtocol
|
public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProtocol & MVMCoreLoadDelegateProtocol & MVMCorePresentationDelegateProtocol & NSObjectProtocol
|
||||||
|
|
||||||
|
|
||||||
@objcMembers open class LabelWithInternalButton: UIControl, MVMCoreViewProtocol, MFButtonProtocol {
|
@available(*, deprecated, message: "This class is deprecated, please use the Label class.")
|
||||||
|
@objcMembers open class LabelWithInternalButton: UIControl, MVMCoreViewProtocol, MFButtonProtocol, MVMCoreUIMoleculeViewProtocol {
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
@ -177,7 +178,6 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
|
|||||||
|
|
||||||
if self.label == nil {
|
if self.label == nil {
|
||||||
let label = Label(frame: .zero)
|
let label = Label(frame: .zero)
|
||||||
label.isUserInteractionEnabled = true
|
|
||||||
label.setContentCompressionResistancePriority(.required, for: .vertical)
|
label.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||||
addSubview(label)
|
addSubview(label)
|
||||||
NSLayoutConstraint.constraintPinSubview(label, pinTop: true, pinBottom: true, pinLeft: true, pinRight: true)
|
NSLayoutConstraint.constraintPinSubview(label, pinTop: true, pinBottom: true, pinLeft: true, pinRight: true)
|
||||||
@ -458,14 +458,9 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
|
|||||||
@available(*, deprecated)
|
@available(*, deprecated)
|
||||||
private func setActionMap(_ actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?, buttonDelegate: ButtonObjectDelegate?) {
|
private func setActionMap(_ actionMap: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, actionDelegate delegate: ActionObjectDelegate?, buttonDelegate: ButtonObjectDelegate?) {
|
||||||
|
|
||||||
actionBlock = { [weak self, weak buttonDelegate] in
|
actionBlock = { [weak self, weak delegate, weak buttonDelegate] in
|
||||||
var performAction = true
|
|
||||||
|
if let wSelf = self, buttonDelegate?.button?(wSelf, shouldPerformActionWithMap: actionMap, additionalData: additionalData) ?? true {
|
||||||
if let wSelf = self, let wButtonDelegate = buttonDelegate, wButtonDelegate.responds(to: #selector(ButtonObjectDelegate.button(_:shouldPerformActionWithMap:additionalData:))) {
|
|
||||||
performAction = wButtonDelegate.button?(wSelf, shouldPerformActionWithMap: actionMap, additionalData: additionalData) ?? false
|
|
||||||
}
|
|
||||||
|
|
||||||
if performAction {
|
|
||||||
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegate: delegate as? CoreObjectActionLoadPresentDelegate)
|
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegate: delegate as? CoreObjectActionLoadPresentDelegate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -582,10 +577,10 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
|
|||||||
}
|
}
|
||||||
setLabelAttributes()
|
setLabelAttributes()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Atomization
|
//------------------------------------------------------
|
||||||
extension LabelWithInternalButton: MVMCoreUIMoleculeViewProtocol {
|
// MARK: - Atomization
|
||||||
|
//------------------------------------------------------
|
||||||
|
|
||||||
// Default values for view.
|
// Default values for view.
|
||||||
@objc open func setAsMolecule() {
|
@objc open func setAsMolecule() {
|
||||||
|
|||||||
@ -178,9 +178,9 @@ import Foundation
|
|||||||
|
|
||||||
guard let dictionary = actionMap else { return }
|
guard let dictionary = actionMap else { return }
|
||||||
|
|
||||||
title?.setWithJSON(dictionary.optionalDictionaryForKey("title"), delegateObject: delegateObject, additionalData: additionalData)
|
title?.setWithJSON(dictionary.optionalDictionaryForKey("title"), delegateObject: delegateObject as! MVMCoreUIDelegateObject, additionalData: additionalData)
|
||||||
message?.setWithJSON(dictionary.optionalDictionaryForKey("message"), delegateObject: delegateObject, additionalData: additionalData)
|
message?.setWithJSON(dictionary.optionalDictionaryForKey("message"), delegateObject: delegateObject as! MVMCoreUIDelegateObject, additionalData: additionalData)
|
||||||
detail?.setWithJSON(dictionary.optionalDictionaryForKey("detail"), delegateObject: delegateObject, additionalData: additionalData)
|
detail?.setWithJSON(dictionary.optionalDictionaryForKey("detail"), delegateObject: delegateObject as! MVMCoreUIDelegateObject, additionalData: additionalData)
|
||||||
|
|
||||||
if let backgroundColorHex = dictionary[KeyBackgroundColor] as? String {
|
if let backgroundColorHex = dictionary[KeyBackgroundColor] as? String {
|
||||||
backgroundColor = UIColor.mfGet(forHex: backgroundColorHex)
|
backgroundColor = UIColor.mfGet(forHex: backgroundColorHex)
|
||||||
@ -197,7 +197,7 @@ import Foundation
|
|||||||
}
|
}
|
||||||
|
|
||||||
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) {
|
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
super.setWithJSON(json, delegateObject: delegateObject as! MVMCoreUIDelegateObject, additionalData: additionalData)
|
||||||
setWithJSON(actionMap: json, delegateObject: delegateObject, additionalData: additionalData)
|
setWithJSON(actionMap: json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user