updated to use new tilelet onClickSubscriber
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
db0afbb15d
commit
210e759297
@ -21,12 +21,7 @@ open class Tilelet: VDS.Tilelet, VDSMoleculeViewProtocol{
|
||||
public var viewModel: TileletModel!
|
||||
public var delegateObject: MVMCoreUIDelegateObject?
|
||||
public var additionalData: [AnyHashable: Any]?
|
||||
|
||||
//even though we have a local set, others could be
|
||||
//subscribing to other events, we use this one specically
|
||||
//for the action so that we can ensure there is only 1 being used
|
||||
private var actionSubscriber: AnyCancellable?
|
||||
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializers
|
||||
//--------------------------------------------------
|
||||
@ -52,7 +47,7 @@ open class Tilelet: VDS.Tilelet, VDSMoleculeViewProtocol{
|
||||
//setup action
|
||||
if let action = viewModel.action {
|
||||
//add the subscriber
|
||||
actionSubscriber = publisher(for: .touchUpInside)
|
||||
onClickSubscriber = publisher(for: .touchUpInside)
|
||||
.sink {[weak self] control in
|
||||
guard let self else { return }
|
||||
MVMCoreUIActionHandler.performActionUnstructured(with: action,
|
||||
@ -60,10 +55,6 @@ open class Tilelet: VDS.Tilelet, VDSMoleculeViewProtocol{
|
||||
additionalData: self.additionalData,
|
||||
delegateObject: self.delegateObject)
|
||||
}
|
||||
}//if there is no action but there was a subscriber, kill it
|
||||
else if let actionSubscriber {
|
||||
actionSubscriber.cancel()
|
||||
self.actionSubscriber = nil
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user