refmoved shouldUpdateView bools

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-07-14 09:10:22 -05:00
parent abc7f409e7
commit 76c3205921
16 changed files with 23 additions and 42 deletions

View File

@ -77,7 +77,6 @@ open class Badge: View {
open override func reset() {
super.reset()
shouldUpdateView = false
label.reset()
label.lineBreakMode = .byTruncatingTail
label.textPosition = .left
@ -86,7 +85,6 @@ open class Badge: View {
text = ""
maxWidth = nil
numberOfLines = 1
shouldUpdateView = true
setNeedsUpdate()
}

View File

@ -280,13 +280,11 @@ open class BadgeIndicator: View {
open override func reset() {
super.reset()
shouldUpdateView = false
label.reset()
label.lineBreakMode = .byTruncatingTail
label.textPosition = .center
fillColor = .red
number = nil
shouldUpdateView = true
setNeedsUpdate()
}

View File

@ -132,11 +132,9 @@ open class Button: ButtonBase, Useable {
open override func reset() {
super.reset()
shouldUpdateView = false
use = .primary
width = nil
size = .large
shouldUpdateView = true
setNeedsUpdate()
}

View File

@ -28,7 +28,9 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
//--------------------------------------------------
// MARK: - Combine Properties
//--------------------------------------------------
public var subject = PassthroughSubject<Void, Never>()
public var delayedSubject = PassthroughSubject<Void, Never>()
public var immediateSubject = PassthroughSubject<Void, Never>()
public var updateStrategy: HandlerableUpdateStrategy = .immediate
public var subscribers = Set<AnyCancellable>()
public var onClickSubscriber: AnyCancellable? {
willSet {
@ -45,9 +47,7 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
open var shouldUpdateView: Bool = true
//--------------------------------------------------
open var availableSizes: [ButtonSize] { [] }
open var text: String? { didSet { setNeedsUpdate() } }
@ -139,18 +139,23 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
}
open func reset() {
shouldUpdateView = false
surface = .light
disabled = false
text = nil
accessibilityCustomActions = []
shouldUpdateView = true
setNeedsUpdate()
}
//--------------------------------------------------
// MARK: - Overrides
//--------------------------------------------------
open override func didMoveToWindow() {
super.didMoveToWindow()
if window != nil {
updateStrategy = .delayed
}
}
override open var intrinsicContentSize: CGSize {
let intrinsicContentSize = super.intrinsicContentSize
let adjustedWidth = intrinsicContentSize.width + titleEdgeInsets.left + titleEdgeInsets.right

View File

@ -89,13 +89,11 @@ open class TextLink: ButtonBase {
open override func reset() {
super.reset()
shouldUpdateView = false
text = nil
size = .large
accessibilityCustomActions = []
isAccessibilityElement = true
accessibilityTraits = .link
shouldUpdateView = true
setNeedsUpdate()
}

View File

@ -255,7 +255,6 @@ open class ButtonIcon: Control {
open override func reset() {
super.reset()
shouldUpdateView = false
kind = .ghost
surfaceType = .colorFill
size = .large
@ -263,7 +262,6 @@ open class ButtonIcon: Control {
hideBorder = true
iconOffset = .init(x: 0, y: 0)
iconName = nil
shouldUpdateView = true
setNeedsUpdate()
}

View File

@ -16,16 +16,16 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
//--------------------------------------------------
// MARK: - Combine Properties
//--------------------------------------------------
public var subject = PassthroughSubject<Void, Never>()
public var delayedSubject = PassthroughSubject<Void, Never>()
public var immediateSubject = PassthroughSubject<Void, Never>()
public var subscribers = Set<AnyCancellable>()
public var updateStrategy: HandlerableUpdateStrategy = .immediate
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
private var initialSetupPerformed = false
open var shouldUpdateView: Bool = true
open var useAttributedText: Bool = false
open var surface: Surface = .light { didSet { setNeedsUpdate() }}
@ -93,7 +93,6 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
open func setup() {}
open func reset() {
shouldUpdateView = false
surface = .light
disabled = false
attributes = nil
@ -103,13 +102,19 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
attributedText = nil
numberOfLines = 0
backgroundColor = .clear
shouldUpdateView = true
setNeedsUpdate()
}
//--------------------------------------------------
// MARK: - Overrides
//--------------------------------------------------
//--------------------------------------------------
open override func didMoveToWindow() {
super.didMoveToWindow()
if window != nil {
updateStrategy = .delayed
}
}
open func updateView() {
if !useAttributedText {
if let text = text {

View File

@ -230,9 +230,7 @@ open class Notification: View {
open override func reset() {
super.reset()
shouldUpdateView = false
titleLabel.reset()
titleLabel.text = ""
titleLabel.textStyle = UIDevice.isIPad ? .boldBodyLarge : .boldBodySmall
@ -258,7 +256,6 @@ open class Notification: View {
hideCloseButton = false
fullBleed = false
shouldUpdateView = true
setNeedsUpdate()
}

View File

@ -202,7 +202,6 @@ open class RadioBoxItem: Control, Changeable {
open override func reset() {
super.reset()
shouldUpdateView = false
textLabel.reset()
subTextLabel.reset()
subTextRightLabel.reset()
@ -226,7 +225,6 @@ open class RadioBoxItem: Control, Changeable {
isSelected = false
shouldUpdateView = true
setNeedsUpdate()
}

View File

@ -91,7 +91,6 @@ open class RadioSwatch: Control {
open override func reset() {
super.reset()
shouldUpdateView = false
fillImage = nil
text = ""
primaryColor = nil
@ -99,7 +98,6 @@ open class RadioSwatch: Control {
strikethrough = false
inputId = nil
value = nil
shouldUpdateView = true
setNeedsUpdate()
setNeedsDisplay()
}

View File

@ -191,7 +191,6 @@ open class TileContainer: Control {
open override func reset() {
super.reset()
shouldUpdateView = false
color = .white
padding = .padding4X
aspectRatio = .ratio1x1
@ -200,7 +199,6 @@ open class TileContainer: Control {
height = nil
showBorder = false
showDropShadows = false
shouldUpdateView = true
setNeedsUpdate()
}

View File

@ -241,7 +241,6 @@ open class Tilelet: TileContainer {
}
open override func reset() {
shouldUpdateView = false
aspectRatio = .none
color = .black
//models
@ -250,7 +249,6 @@ open class Tilelet: TileContainer {
subTitleModel = nil
descriptiveIconModel = nil
directionalIconModel = nil
shouldUpdateView = true
setNeedsUpdate()
}

View File

@ -198,12 +198,10 @@ open class TitleLockup: View {
open override func reset() {
super.reset()
shouldUpdateView = false
textPosition = .left
eyebrowModel = nil
titleModel = nil
subTitleModel = nil
shouldUpdateView = true
setNeedsUpdate()
}

View File

@ -278,7 +278,6 @@ open class Toggle: Control, Changeable {
open override func reset() {
super.reset()
shouldUpdateView = false
label.reset()
isOn = false
isAnimated = true
@ -292,7 +291,6 @@ open class Toggle: Control, Changeable {
value = nil
toggleView.backgroundColor = toggleColorConfiguration.getColor(self)
knobView.backgroundColor = knobColorConfiguration.getColor(self)
shouldUpdateView = true
setNeedsUpdate()
}

View File

@ -141,14 +141,12 @@ open class Tooltip: Control, TooltipLaunchable {
open override func reset() {
super.reset()
shouldUpdateView = false
size = .medium
title = ""
content = ""
fillColor = .primary
closeButtonText = "Close"
imageView.image = nil
shouldUpdateView = true
setNeedsUpdate()
}

View File

@ -79,7 +79,6 @@ open class TrailingTooltipLabel: View, TooltipLaunchable {
open override func reset() {
super.reset()
shouldUpdateView = false
labelText = nil
labelAttributes = nil
labelTextStyle = .defaultStyle
@ -87,7 +86,6 @@ open class TrailingTooltipLabel: View, TooltipLaunchable {
tooltipCloseButtonText = "Close"
tooltipTitle = ""
tooltipContent = ""
shouldUpdateView = true
setNeedsUpdate()
}
}