diff --git a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift index 605f2e8a..82928c0f 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift @@ -34,11 +34,7 @@ public typealias ActionBlock = () -> () /// A specific text index to use as a unique marker. public var hero: Int? - - public var getRange: NSRange { - NSRange(location: 0, length: text?.count ?? 0) - } - + public var shouldMaskWhileRecording: Bool = false public var hasText: Bool { @@ -378,19 +374,24 @@ extension Label { // MARK: - Atomization extension Label { - + public func needsToBeConstrained() -> Bool { true } public func horizontalAlignment() -> UIStackView.Alignment { .leading } public func copyBackgroundColor() -> Bool { true } + } // MARK: - Multi-Link Functionality -extension Label { +extension VDS.Label { + + public var getRange: NSRange { + NSRange(location: 0, length: text?.count ?? 0) + } /// Underlines the tappable region and stores the tap logic for interation. - private func setTextLinkState(range: NSRange, actionBlock: @escaping ActionBlock) { + internal func setTextLinkState(range: NSRange, actionBlock: @escaping ActionBlock) { guard let text, text.isValid(range: range) else { return } var textLink = ActionLabelAttribute(location: range.location, length: range.length) @@ -417,8 +418,16 @@ extension Label { return { [weak self] in guard let self = self else { return } - if (delegateObject as? MVMCoreUIDelegateObject)?.buttonDelegate?.button?(self, shouldPerformActionWithMap: actionMap, additionalData: additionalData) ?? true { - MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject) + if let button = self as? MFButtonProtocol { + if (delegateObject as? MVMCoreUIDelegateObject)?.buttonDelegate?.button?(button, shouldPerformActionWithMap: actionMap, additionalData: additionalData) ?? true { + MVMCoreActionHandler.shared()?.handleAction(with: actionMap, + additionalData: additionalData, + delegateObject: delegateObject) + } + } else { + MVMCoreActionHandler.shared()?.handleAction(with: actionMap, + additionalData: additionalData, + delegateObject: delegateObject) } } }