Merge branch 'develop' of https://gitlab.verizon.com/BPHV_MIPS/vds_ios.git into mbruce/didSetUpdate

This commit is contained in:
Matt Bruce 2023-09-13 08:08:32 -05:00
commit bb2c3604ea
6 changed files with 75 additions and 62 deletions

View File

@ -1171,7 +1171,7 @@
BUILD_LIBRARY_FOR_DISTRIBUTION = YES; BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 41; CURRENT_PROJECT_VERSION = 42;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;
@ -1208,7 +1208,7 @@
BUILD_LIBRARY_FOR_DISTRIBUTION = YES; BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 41; CURRENT_PROJECT_VERSION = 42;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;

View File

@ -129,12 +129,18 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
/// Line break mode for the label, default is set to word wrapping. /// Line break mode for the label, default is set to word wrapping.
open override var lineBreakMode: NSLineBreakMode { didSet { if oldValue != lineBreakMode { setNeedsUpdate() } } } open override var lineBreakMode: NSLineBreakMode { didSet { if oldValue != lineBreakMode { setNeedsUpdate() } } }
private var _text: String?
/// Text that will be used in the label. /// Text that will be used in the label.
override open var text: String? { override open var text: String? {
didSet { get { _text }
useAttributedText = false set {
attributes = nil if _text != newValue {
setNeedsUpdate() _text = newValue
useAttributedText = false
attributes = nil
setNeedsUpdate()
}
} }
} }
@ -194,7 +200,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
open func updateView() { open func updateView() {
if !useAttributedText { if !useAttributedText {
if let text = text { if let text {
accessibilityCustomActions = [] accessibilityCustomActions = []
//create the primary string //create the primary string

View File

@ -68,6 +68,9 @@ extension Tabs {
///Size for tab ///Size for tab
open var size: Tabs.Size = .medium { didSet { if oldValue != size { setNeedsUpdate() } } } open var size: Tabs.Size = .medium { didSet { if oldValue != size { setNeedsUpdate() } } }
///Number of lines in the Label.
open var numberOfLines: Int = 0 { didSet { setNeedsUpdate() } }
///Text position left or center ///Text position left or center
open var textAlignment: TextAlignment = .left { didSet { if oldValue != textAlignment { setNeedsUpdate() } } } open var textAlignment: TextAlignment = .left { didSet { if oldValue != textAlignment { setNeedsUpdate() } } }
@ -162,15 +165,14 @@ extension Tabs {
labelBottomConstraint?.constant = -otherSpace labelBottomConstraint?.constant = -otherSpace
//label properties //label properties
label.textStyle = textStyle
label.text = text label.text = text
label.surface = surface label.surface = surface
label.textStyle = textStyle
label.textAlignment = textAlignment.value label.textAlignment = textAlignment.value
label.textColorConfiguration = textColorConfiguration.eraseToAnyColorable() label.textColorConfiguration = textColorConfiguration.eraseToAnyColorable()
setNeedsLayout() setNeedsLayout()
layoutIfNeeded() layoutIfNeeded()
}
}
/// Used to update any Accessibility properties. /// Used to update any Accessibility properties.
open override func updateAccessibility() { open override func updateAccessibility() {

View File

@ -269,7 +269,7 @@ open class Tabs: View {
private func updateTabs() { private func updateTabs() {
let numberOfLines = applyOverflow ? 1 : 0 let numberOfLines = applyOverflow ? 1 : 0
for (index, tabItem) in tabViews.enumerated() { for (index, tabItem) in tabViews.enumerated() {
tabItem.label.numberOfLines = numberOfLines tabItem.numberOfLines = numberOfLines
tabItem.size = size tabItem.size = size
tabItem.isSelected = selectedIndex == index tabItem.isSelected = selectedIndex == index
tabItem.index = index tabItem.index = index

View File

@ -29,7 +29,7 @@ open class TitleLockup: View {
public required init?(coder: NSCoder) { public required init?(coder: NSCoder) {
super.init(coder: coder) super.init(coder: coder)
} }
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
@ -43,12 +43,6 @@ open class TitleLockup: View {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Private Properties // MARK: - Private Properties
//-------------------------------------------------- //--------------------------------------------------
private var stackView = UIStackView().with {
$0.translatesAutoresizingMaskIntoConstraints = false
$0.axis = .vertical
$0.distribution = .fillProportionally
}
private var otherStandardStyle: OtherStandardStyle { private var otherStandardStyle: OtherStandardStyle {
if let subTitleModel, !subTitleModel.text.isEmpty { if let subTitleModel, !subTitleModel.text.isEmpty {
return subTitleModel.standardStyle return subTitleModel.standardStyle
@ -75,7 +69,7 @@ open class TitleLockup: View {
open var eyebrowLabel = Label().with { open var eyebrowLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
} }
/// Model used in rendering the eyebrow label. /// Model used in rendering the eyebrow label.
open var eyebrowModel: EyebrowModel? { didSet { if oldValue != eyebrowModel { setNeedsUpdate() } } } open var eyebrowModel: EyebrowModel? { didSet { if oldValue != eyebrowModel { setNeedsUpdate() } } }
@ -84,7 +78,7 @@ open class TitleLockup: View {
open var titleLabel = Label().with { open var titleLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
} }
/// Model used in rendering the title label. /// Model used in rendering the title label.
open var titleModel: TitleModel? { didSet { if oldValue != titleModel { setNeedsUpdate() } } } open var titleModel: TitleModel? { didSet { if oldValue != titleModel { setNeedsUpdate() } } }
@ -93,7 +87,7 @@ open class TitleLockup: View {
open var subTitleLabel = Label().with { open var subTitleLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
} }
/// Model used in rendering the subtitle label. /// Model used in rendering the subtitle label.
open var subTitleModel: SubTitleModel? { didSet { if oldValue != subTitleModel { setNeedsUpdate() } } } open var subTitleModel: SubTitleModel? { didSet { if oldValue != subTitleModel { setNeedsUpdate() } } }
@ -273,22 +267,8 @@ open class TitleLockup: View {
super.setup() super.setup()
titleLabel.textColorConfiguration = textColorPrimaryConfiguration titleLabel.textColorConfiguration = textColorPrimaryConfiguration
accessibilityElements = [eyebrowLabel, titleLabel, subTitleLabel] accessibilityElements = [eyebrowLabel, titleLabel, subTitleLabel]
addSubview(stackView)
stackView.spacing = 0.0
stackView.addArrangedSubview(eyebrowLabel)
stackView.addArrangedSubview(titleLabel)
stackView.addArrangedSubview(subTitleLabel)
//pin stackview to edges
stackView
.pinTop()
.pinLeading()
.pinTrailing()
.pinBottom(0, .defaultHigh)
} }
/// Resets to default settings. /// Resets to default settings.
@ -302,15 +282,18 @@ open class TitleLockup: View {
setNeedsUpdate() setNeedsUpdate()
} }
var labelViews = [UIView]()
/// Used to make changes to the View based off a change events or from local properties. /// Used to make changes to the View based off a change events or from local properties.
open override func updateView() { open override func updateView() {
super.updateView() super.updateView()
let allLabelsTextAlignment = textAlignment.value.value //remove all labels
var eyebrowTextIsEmpty = true eyebrowLabel.removeFromSuperview()
var titleTextIsEmpty = true titleLabel.removeFromSuperview()
var subTitleTextIsEmpty = true subTitleLabel.removeFromSuperview()
//set local vars
let allLabelsTextAlignment = textAlignment.value.value
var topSpacing: CGFloat = 0.0 var topSpacing: CGFloat = 0.0
var bottomSpacing: CGFloat = 0.0 var bottomSpacing: CGFloat = 0.0
@ -321,8 +304,12 @@ open class TitleLockup: View {
bottomSpacing = config.bottomSpacing bottomSpacing = config.bottomSpacing
} }
//set a previousView to keep track of the stack
//to deal with anchoring/spacing
var previousView: UIView?
//see if the eyebrow should exist
if let eyebrowModel, !eyebrowModel.text.isEmpty { if let eyebrowModel, !eyebrowModel.text.isEmpty {
eyebrowTextIsEmpty = false
eyebrowLabel.textAlignment = allLabelsTextAlignment eyebrowLabel.textAlignment = allLabelsTextAlignment
eyebrowLabel.text = eyebrowModel.text eyebrowLabel.text = eyebrowModel.text
eyebrowLabel.attributes = eyebrowModel.textAttributes eyebrowLabel.attributes = eyebrowModel.textAttributes
@ -345,20 +332,35 @@ open class TitleLockup: View {
eyebrowLabel.textColorConfiguration = textColorPrimaryConfiguration eyebrowLabel.textColorConfiguration = textColorPrimaryConfiguration
eyebrowLabel.textStyle = eyebrowModel.isBold ? otherStandardStyle.value.bold : otherStandardStyle.value.regular eyebrowLabel.textStyle = eyebrowModel.isBold ? otherStandardStyle.value.bold : otherStandardStyle.value.regular
} }
addSubview(eyebrowLabel)
eyebrowLabel
.pinTop()
.pinLeading()
.pinTrailing()
previousView = eyebrowLabel
} }
//see if the title should exist
if let titleModel, !titleModel.text.isEmpty { if let titleModel, !titleModel.text.isEmpty {
titleTextIsEmpty = false
titleLabel.textAlignment = allLabelsTextAlignment titleLabel.textAlignment = allLabelsTextAlignment
titleLabel.textStyle = titleModel.textStyle titleLabel.textStyle = titleModel.textStyle
titleLabel.text = titleModel.text titleLabel.text = titleModel.text
titleLabel.attributes = titleModel.textAttributes titleLabel.attributes = titleModel.textAttributes
titleLabel.numberOfLines = titleModel.numberOfLines titleLabel.numberOfLines = titleModel.numberOfLines
titleLabel.surface = surface titleLabel.surface = surface
addSubview(titleLabel)
titleLabel
.pinTop(previousView?.bottomAnchor ?? self.topAnchor, eyebrowLabel == previousView ? topSpacing : 0)
.pinLeading()
.pinTrailing()
previousView = titleLabel
} }
//see if the subtitle should exist
if let subTitleModel, !subTitleModel.text.isEmpty { if let subTitleModel, !subTitleModel.text.isEmpty {
subTitleTextIsEmpty = false
subTitleLabel.textAlignment = allLabelsTextAlignment subTitleLabel.textAlignment = allLabelsTextAlignment
subTitleLabel.textStyle = otherStandardStyle.value.regular subTitleLabel.textStyle = otherStandardStyle.value.regular
subTitleLabel.textColorConfiguration = subTitleModel.textColor == .secondary ? textColorSecondaryConfiguration : textColorPrimaryConfiguration subTitleLabel.textColorConfiguration = subTitleModel.textColor == .secondary ? textColorSecondaryConfiguration : textColorPrimaryConfiguration
@ -366,25 +368,23 @@ open class TitleLockup: View {
subTitleLabel.attributes = subTitleModel.textAttributes subTitleLabel.attributes = subTitleModel.textAttributes
subTitleLabel.numberOfLines = subTitleModel.numberOfLines subTitleLabel.numberOfLines = subTitleModel.numberOfLines
subTitleLabel.surface = surface subTitleLabel.surface = surface
addSubview(subTitleLabel)
subTitleLabel
.pinTop(previousView?.bottomAnchor ?? self.topAnchor, (eyebrowLabel == previousView || titleLabel == previousView) ? bottomSpacing : 0)
.pinLeading()
.pinTrailing()
previousView = subTitleLabel
} }
//if both first 2 rows not empty set spacing //pin the last view to the bottom of this view
if !eyebrowTextIsEmpty && !titleTextIsEmpty { previousView?.pinBottom()
stackView.spacing = topSpacing
} else {
stackView.spacing = 0.0
}
//if either first 2 rows not empty and subtile not empty, create space else collapse //debugging for borders
if (!eyebrowTextIsEmpty || !titleTextIsEmpty) && !subTitleTextIsEmpty { eyebrowLabel.debugBorder(show: hasDebugBorder, color: .green)
stackView.setCustomSpacing(bottomSpacing, after: titleLabel) titleLabel.debugBorder(show: hasDebugBorder, color: .green)
} else if (!eyebrowTextIsEmpty || !titleTextIsEmpty) && subTitleTextIsEmpty { subTitleLabel .debugBorder(show: hasDebugBorder, color: .green)
stackView.setCustomSpacing(0.0, after: titleLabel)
}
//hide/show
eyebrowLabel.isHidden = eyebrowTextIsEmpty
titleLabel.isHidden = titleTextIsEmpty
subTitleLabel.isHidden = subTitleTextIsEmpty
} }
} }

View File

@ -1,7 +1,12 @@
1.0.42
=======
- CXTDT-462698 - Tabs - Incorrect letter spacing on Large tabs
- CXTDT-427328 - Title Lockup text style combinations do not match spec
1.0.41 1.0.41
======= =======
- CXTDT-457899 - Tabs - Incorrect nonselected color on Dark surface - CXTDT-457899 - Tabs - Incorrect non-selected color on Dark surface
- ONEAPP-4652 - TextLinkCaret - Caret anouncement removed - ONEAPP-4652 - TextLinkCaret - Caret announcement removed
- Fixed ToggleView Disabled Shadow Color - Fixed ToggleView Disabled Shadow Color
- Fixed several component layout issues - Fixed several component layout issues
- Fixed bug in label for ActionLabelAttribute - Fixed bug in label for ActionLabelAttribute