Signed-off-by: Jarrod Courtney <jarrod.courtney@verizon.com>
This commit is contained in:
parent
f3e97ecfd4
commit
cb8fc9efa2
@ -7,6 +7,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
import VDSCoreTokens
|
||||||
|
|
||||||
@objcMembers open class ImageButton: Button {
|
@objcMembers open class ImageButton: Button {
|
||||||
|
|
||||||
@ -24,6 +25,7 @@ import Foundation
|
|||||||
super.set(with: model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
image.setOptional(with: castModel.image, delegateObject, additionalData)
|
image.setOptional(with: castModel.image, delegateObject, additionalData)
|
||||||
castModel.updateUI = { [weak self] in
|
castModel.updateUI = { [weak self] in
|
||||||
MVMCoreDispatchUtility.performBlock(onMainThread: {
|
MVMCoreDispatchUtility.performBlock(onMainThread: {
|
||||||
@ -42,10 +44,10 @@ import Foundation
|
|||||||
}
|
}
|
||||||
if castModel.enabled {
|
if castModel.enabled {
|
||||||
if let enabledTintColor = castModel.enabledTintColor {
|
if let enabledTintColor = castModel.enabledTintColor {
|
||||||
image.imageView.tintColor = enabledTintColor.uiColor
|
image.tintColor = enabledTintColor.uiColor
|
||||||
}
|
}
|
||||||
} else if let disabledTintColor = castModel.disabledTintColor {
|
} else if let disabledTintColor = castModel.disabledTintColor {
|
||||||
image.imageView.tintColor = disabledTintColor.uiColor
|
image.tintColor = disabledTintColor.uiColor
|
||||||
}
|
}
|
||||||
if let traits = model?.accessibilityTraits {
|
if let traits = model?.accessibilityTraits {
|
||||||
accessibilityTraits = traits
|
accessibilityTraits = traits
|
||||||
|
|||||||
@ -30,6 +30,7 @@
|
|||||||
public var clipsImage: Bool?
|
public var clipsImage: Bool?
|
||||||
public var allowServerParameters: Bool?
|
public var allowServerParameters: Bool?
|
||||||
public var shouldMaskRecordedView: Bool? = false
|
public var shouldMaskRecordedView: Bool? = false
|
||||||
|
public var tintColor: Color?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
@ -62,6 +63,7 @@
|
|||||||
case clipsImage
|
case clipsImage
|
||||||
case shouldMaskRecordedView
|
case shouldMaskRecordedView
|
||||||
case allowServerParameters
|
case allowServerParameters
|
||||||
|
case tintColor
|
||||||
}
|
}
|
||||||
|
|
||||||
public func isEqual(to model: any ModelComparisonProtocol) -> Bool {
|
public func isEqual(to model: any ModelComparisonProtocol) -> Bool {
|
||||||
|
|||||||
@ -36,6 +36,7 @@
|
|||||||
private var currentImageHeight: CGFloat?
|
private var currentImageHeight: CGFloat?
|
||||||
private var currentImageName: String?
|
private var currentImageName: String?
|
||||||
private var isFallbackImage: Bool = false
|
private var isFallbackImage: Bool = false
|
||||||
|
private var renderingMode: UIImage.RenderingMode = .automatic
|
||||||
|
|
||||||
private var containerHelper = ContainerHelper()
|
private var containerHelper = ContainerHelper()
|
||||||
|
|
||||||
@ -44,6 +45,12 @@
|
|||||||
set { imageView.accessibilityLabel = newValue }
|
set { imageView.accessibilityLabel = newValue }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override var tintColor: UIColor! {
|
||||||
|
didSet {
|
||||||
|
renderingMode = tintColor != nil ? .alwaysTemplate : .automatic
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Constraint Properties
|
// MARK: - Constraint Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -127,12 +134,13 @@
|
|||||||
|
|
||||||
open func defaultCompletionBlock() -> MVMCoreGetImageBlock {
|
open func defaultCompletionBlock() -> MVMCoreGetImageBlock {
|
||||||
return { image, gifData,_ in MVMCoreDispatchUtility.performBlock(onMainThread: { [weak self] in
|
return { image, gifData,_ in MVMCoreDispatchUtility.performBlock(onMainThread: { [weak self] in
|
||||||
|
guard let self else { return }
|
||||||
if let image = image {
|
if let image = image {
|
||||||
self?.imageView.image = image
|
imageView.image = image.withRenderingMode(renderingMode)
|
||||||
self?.layoutIfNeeded()
|
layoutIfNeeded()
|
||||||
} else if let gifData = gifData {
|
} else if let gifData = gifData {
|
||||||
self?.imageView.loadGifWithData(gifData)
|
imageView.loadGifWithData(gifData)
|
||||||
self?.layoutIfNeeded()
|
layoutIfNeeded()
|
||||||
}
|
}
|
||||||
})}
|
})}
|
||||||
}
|
}
|
||||||
@ -274,6 +282,10 @@
|
|||||||
imageView.isAccessibilityElement = true
|
imageView.isAccessibilityElement = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let color = imageModel.tintColor?.uiColor {
|
||||||
|
tintColor = color
|
||||||
|
}
|
||||||
|
|
||||||
let width = imageModel.width ?? imageWidth
|
let width = imageModel.width ?? imageWidth
|
||||||
let height = imageModel.height ?? imageHeight
|
let height = imageModel.height ?? imageHeight
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user