From ff5c8c0c6a446ad05a331af016a0a409445b7ad6 Mon Sep 17 00:00:00 2001 From: "Nandi, Dhamodaram" Date: Mon, 15 Feb 2021 05:21:45 -0500 Subject: [PATCH 01/17] Fix for CXTDT-155147 --- .../ListRightVariableRightCaretAlltextAndLinks.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift index 3b6a5b76..d7954f96 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift @@ -22,7 +22,7 @@ public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { // Fill for left vertical alignment because bottom constraint was breaking with leading. CXTDT-145456 - stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .fill)), (view: rightLabel, model: StackItemModel(horizontalAlignment:.fill, verticalAlignment: .leading))], axis: .horizontal) + stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .top)), (view: rightLabel, model: StackItemModel(horizontalAlignment: .trailing, verticalAlignment: .top))], axis: .horizontal) super.init(style: style, reuseIdentifier: reuseIdentifier) } @@ -37,6 +37,7 @@ open override func setupView() { super.setupView() rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal) + rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal) addMolecule(stack) stack.restack() } From 069db3c913188f44092933e7883894038bea2cf7 Mon Sep 17 00:00:00 2001 From: "Nandi, Dhamodaram" Date: Mon, 15 Feb 2021 05:31:14 -0500 Subject: [PATCH 02/17] discarded vertical alignment changes --- .../ListRightVariableRightCaretAlltextAndLinks.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift index d7954f96..943a11da 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift @@ -22,7 +22,7 @@ public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { // Fill for left vertical alignment because bottom constraint was breaking with leading. CXTDT-145456 - stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .top)), (view: rightLabel, model: StackItemModel(horizontalAlignment: .trailing, verticalAlignment: .top))], axis: .horizontal) + stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .fill)), (view: rightLabel, model: StackItemModel(horizontalAlignment: .trailing, verticalAlignment: .top))], axis: .horizontal) super.init(style: style, reuseIdentifier: reuseIdentifier) } From e91faf857fc98521cfb110d3a1cbb0c1c2e8d798 Mon Sep 17 00:00:00 2001 From: "Nandi, Dhamodaram" Date: Mon, 15 Feb 2021 09:43:43 -0500 Subject: [PATCH 03/17] updated --- .../ListRightVariableRightCaretAlltextAndLinks.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift index 943a11da..12f11b9e 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift @@ -22,7 +22,7 @@ public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { // Fill for left vertical alignment because bottom constraint was breaking with leading. CXTDT-145456 - stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .fill)), (view: rightLabel, model: StackItemModel(horizontalAlignment: .trailing, verticalAlignment: .top))], axis: .horizontal) + stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .fill)), (view: rightLabel, model: StackItemModel(horizontalAlignment: .trailing, verticalAlignment: .leading))], axis: .horizontal) super.init(style: style, reuseIdentifier: reuseIdentifier) } From a1b7e81dfc7805bfb5a68e1996799c8a11860606 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Tue, 16 Feb 2021 07:24:36 +0530 Subject: [PATCH 04/17] Added number of lines for rightlabel. --- .../ListRightVariableRightCaretAlltextAndLinks.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift index 12f11b9e..3a342b6a 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift @@ -38,6 +38,7 @@ super.setupView() rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal) rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal) + rightLabel.numberOfLines = 1 addMolecule(stack) stack.restack() } From 6b3bcbea6af60eaea6952f9b6a4b33f85be8bc8a Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 16 Feb 2021 17:27:35 -0500 Subject: [PATCH 05/17] asd --- .../MultiItemDropdownEntryFieldModel.swift | 12 +++ .../FormFields/TextFields/EntryField.swift | 76 ++++++++++++++----- 2 files changed, 71 insertions(+), 17 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/MultiItemDropdownEntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/MultiItemDropdownEntryFieldModel.swift index fbdde6f3..1dea0b0d 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/MultiItemDropdownEntryFieldModel.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/MultiItemDropdownEntryFieldModel.swift @@ -39,6 +39,18 @@ import Foundation return delimiters[index] } + /* + public func delimiter(for index: Int) -> String { + + guard index != components.count - 1 else { return "" } + guard let delimiters = delimiters, + index < delimiters.count + else { return " " } + + return delimiters[index] + } + */ + /// A string of the picker row concatenated by whitespace or delimiters if provided. public var selectedRowText: String { diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/EntryField.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/EntryField.swift index 3996c7fc..b9b60847 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/EntryField.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/EntryField.swift @@ -52,6 +52,8 @@ import UIKit /// Validate on each entry in the textField. Default: true public var validateEachCharacter: Bool = true +// private var observation: NSKeyValueObservation? = nil + //-------------------------------------------------- // MARK: - Computed Properties //-------------------------------------------------- @@ -60,10 +62,10 @@ import UIKit public var isEnabled: Bool { get { entryFieldContainer.isEnabled } set (enabled) { - self.titleLabel.textColor = enabled ? .mvmBlack : .mvmCoolGray3 - self.feedbackLabel.textColor = enabled ? .mvmBlack : .mvmCoolGray3 - self.entryFieldContainer.isEnabled = enabled - self.entryFieldModel?.enabled = enabled + titleLabel.textColor = enabled ? .mvmBlack : .mvmCoolGray3 + feedbackLabel.textColor = enabled ? .mvmBlack : .mvmCoolGray3 + entryFieldContainer.isEnabled = enabled + entryFieldModel?.enabled = enabled } } @@ -71,10 +73,10 @@ import UIKit public var showError: Bool { get { entryFieldContainer.showError } set (error) { - self.feedback = error ? errorMessage : entryFieldModel?.feedback - self.feedbackLabel.textColor = error ? entryFieldModel?.errorTextColor?.uiColor ?? .mvmBlack : .mvmBlack - self.entryFieldContainer.showError = error - self.entryFieldModel?.showError = error + feedback = error ? errorMessage : entryFieldModel?.feedback + feedbackLabel.textColor = error ? entryFieldModel?.errorTextColor?.uiColor ?? .mvmBlack : .mvmBlack + entryFieldContainer.showError = error + entryFieldModel?.showError = error } } @@ -86,8 +88,8 @@ import UIKit public var isLocked: Bool { get { entryFieldContainer.isLocked } set (locked) { - self.entryFieldContainer.isLocked = locked - self.entryFieldModel?.locked = locked + entryFieldContainer.isLocked = locked + entryFieldModel?.locked = locked } } @@ -95,17 +97,17 @@ import UIKit public var isSelected: Bool { get { entryFieldContainer.isSelected } set (selected) { - self.entryFieldContainer.isSelected = selected - self.entryFieldModel?.selected = selected + entryFieldContainer.isSelected = selected + entryFieldModel?.selected = selected } } /// Sets the text of titleLabel public var title: String? { get { titleLabel.text } - set (newText) { - titleLabel.text = newText - setAccessibilityString(newText) + set { + titleLabel.text = newValue + setAccessibilityString(newValue) } } @@ -118,8 +120,8 @@ import UIKit /// Sets feedback text in the textField. public var feedback: String? { get { feedbackLabel.text } - set (newFeedback) { - feedbackLabel.text = newFeedback + set { + feedbackLabel.text = newValue feedbackLabel.accessibilityElementsHidden = feedbackLabel.text?.isEmpty ?? true entryFieldContainer.refreshUI(updateMoleculeLayout: true) } @@ -217,6 +219,46 @@ import UIKit layoutMarginsGuide.bottomAnchor.constraint(equalTo: feedbackLabel.bottomAnchor).isActive = true } + /* + isAccessibilityElement = false + setContentCompressionResistancePriority(.required, for: .vertical) + accessibilityElements = [titleLabel, feedbackLabel] + backgroundColor = .mvmWhite + +// observation = observe(\.feedbackLabel.text, options: [.new]) { [weak self] _, _ in +// self?.entryFieldContainer.refreshUI(updateMoleculeLayout: true) +// } + + addSubview(titleLabel) + addSubview(entryFieldContainer) + addSubview(feedbackLabel) + + + titleLabelLeading = titleLabel.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor) + titleLabelTrailing = layoutMarginsGuide.trailingAnchor.constraint(equalTo: titleLabel.trailingAnchor) + titleContainerDistance = entryFieldContainer.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: Padding.One) + entryFieldContainerLeading = entryFieldContainer.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor) + feedbackContainerDistance = feedbackLabel.topAnchor.constraint(equalTo: entryFieldContainer.bottomAnchor, constant: Padding.Two) + entryFieldContainerTrailing = layoutMarginsGuide.trailingAnchor.constraint(equalTo: entryFieldContainer.trailingAnchor) + feedbackLabelLeading = feedbackLabel.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor) + feedbackLabelTrailing = layoutMarginsGuide.trailingAnchor.constraint(equalTo: feedbackLabel.trailingAnchor) + + NSLayoutConstraint.activate([ + titleLabel.topAnchor.constraint(equalTo: layoutMarginsGuide.topAnchor), + titleLabelLeading!, + titleLabelLeading!, + titleContainerDistance!, + entryFieldContainerLeading!, + entryFieldContainerTrailing!, + feedbackContainerDistance!, + feedbackLabelLeading!, + feedbackLabelTrailing!, + layoutMarginsGuide.bottomAnchor.constraint(equalTo: feedbackLabel.bottomAnchor) + ]) + + entryFieldContainer.setContentCompressionResistancePriority(.required, for: .vertical) + setupFieldContainerContent(entryFieldContainer) + */ @objc open override func layoutSubviews() { super.layoutSubviews() From d0326a9b3031744dd355442d7f23f9e9230a89bd Mon Sep 17 00:00:00 2001 From: "Khan, Arshad" Date: Wed, 17 Feb 2021 17:57:19 +0530 Subject: [PATCH 06/17] infinite loop crash fix in setting up bottom progress bar --- .../SplitViewController/MVMCoreUISplitViewController.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m index 7377701b..86cc08eb 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m @@ -824,14 +824,14 @@ CGFloat const PanelAnimationDuration = 0.2; [MVMCoreDispatchUtility performBlockOnMainThread:^{ if (self.bottomProgressBarHeightConstraint.constant != PaddingOne) { self.bottomProgressBarHeightConstraint.constant = PaddingOne; - [self.bottomProgressBar.superview layoutIfNeeded]; + [self.bottomProgressBar updateConstraintsIfNeeded]; } if (progress > 0.05) { self.bottomProgressBar.progress = progress; } else { self.bottomProgressBarHeightConstraint.constant = 0; - [self.bottomProgressBar.superview layoutIfNeeded]; + [self.bottomProgressBar updateConstraintsIfNeeded]; } }]; } From 84adccd18745ee3b031b43ed67f0898097fefacd Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Wed, 17 Feb 2021 10:09:06 -0500 Subject: [PATCH 07/17] updates --- .../MultiItemDropdownEntryField.swift | 12 ++--- .../MultiItemDropdownEntryFieldModel.swift | 46 +++++++++++-------- .../FormFields/TextFields/EntryField.swift | 43 ----------------- 3 files changed, 34 insertions(+), 67 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/MultiItemDropdownEntryField.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/MultiItemDropdownEntryField.swift index 2c509bb3..8bed3996 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/MultiItemDropdownEntryField.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/MultiItemDropdownEntryField.swift @@ -71,6 +71,10 @@ open class MultiItemDropdownEntryField: BaseItemPickerEntryField { } } + func pickerHasComponent(_ index: Int) -> Bool { + !pickerComponents.isEmpty && !pickerComponents[index].isEmpty + } + //-------------------------------------------------- // MARK: - TextField Observation //-------------------------------------------------- @@ -122,18 +126,14 @@ open class MultiItemDropdownEntryField: BaseItemPickerEntryField { @objc public func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { - guard !pickerComponents.isEmpty, - !pickerComponents[component].isEmpty - else { return nil } + guard pickerHasComponent(component) else { return nil } return pickerComponents[component][row] } @objc public func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { - guard !pickerComponents.isEmpty, - !pickerComponents[component].isEmpty - else { return } + guard pickerHasComponent(component) else { return } let oldText = text ?? "" dropdownModel?.selectedIndexes[component] = row diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/MultiItemDropdownEntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/MultiItemDropdownEntryFieldModel.swift index 1dea0b0d..bc7899d7 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/MultiItemDropdownEntryFieldModel.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/MultiItemDropdownEntryFieldModel.swift @@ -18,7 +18,7 @@ import Foundation public var components: [[String]] = [[]] public var selectedIndexes: [Int: Int] = [:] - public var delimiters: [String]? + public var delimiters: [Int: String] = [:] //-------------------------------------------------- // MARK: - Validation @@ -31,26 +31,19 @@ import Foundation return selectedRowText } + //-------------------------------------------------- + // MARK: - Methods + //-------------------------------------------------- + + /// - parameter index: The index of the delimiter. + /// - returns: The delimiter for a given idenx. Defaults to whitespace for valid index if no delimiters is provided. If invalid index, emoty string. public func delimiter(for index: Int) -> String { - - guard let delimiters = delimiters else { return " " } + guard index != components.count - 1 else { return "" } - return delimiters[index] + return delimiters[index] ?? " " } - /* - public func delimiter(for index: Int) -> String { - - guard index != components.count - 1 else { return "" } - guard let delimiters = delimiters, - index < delimiters.count - else { return " " } - - return delimiters[index] - } - */ - /// A string of the picker row concatenated by whitespace or delimiters if provided. public var selectedRowText: String { @@ -76,6 +69,18 @@ import Foundation return indexArray } + public var delimiterArray: [String] { + + var array: [String] = [] + + for i in 0.. Date: Wed, 17 Feb 2021 17:13:57 -0500 Subject: [PATCH 08/17] moved by request --- .../TextFields/TextEntryField.swift | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextEntryField.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextEntryField.swift index 91d64e90..6ff196c7 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextEntryField.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextEntryField.swift @@ -97,23 +97,7 @@ import UIKit get { textField.text } set { textEntryFieldModel?.text = newValue - - guard let regex = textEntryFieldModel?.displayFormat, - let mask = textEntryFieldModel?.displayMask, - let newText = newValue - else { - textField.text = newValue - return - } - - let range = NSRange(newText.startIndex..., in: newText) - - if let regex = try? NSRegularExpression(pattern: regex) { - let maskedText = regex.stringByReplacingMatches(in: newText, - range: range, - withTemplate: mask) - textField.text = maskedText - } + textField.text = newValue } } @@ -279,9 +263,28 @@ import UIKit self.isValid = isValid } + regexTextFieldOutputIfAvailable() + shouldShowError(!isValid) } + func regexTextFieldOutputIfAvailable() { + + if let regex = textEntryFieldModel?.displayFormat, + let mask = textEntryFieldModel?.displayMask, + let finalText = text { + + let range = NSRange(finalText.startIndex..., in: finalText) + + if let regex = try? NSRegularExpression(pattern: regex) { + let maskedText = regex.stringByReplacingMatches(in: finalText, + range: range, + withTemplate: mask) + textField.text = maskedText + } + } + } + @objc public func dismissFieldInput(_ sender: Any?) { resignFirstResponder() } From d9af965aa893e8c51694023f7f97921a891faa89 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 18 Feb 2021 09:20:23 -0500 Subject: [PATCH 09/17] default --- .../Item Dropdown/MultiItemDropdownEntryFieldModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/MultiItemDropdownEntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/MultiItemDropdownEntryFieldModel.swift index bc7899d7..248a86e1 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/MultiItemDropdownEntryFieldModel.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/MultiItemDropdownEntryFieldModel.swift @@ -41,7 +41,7 @@ import Foundation guard index != components.count - 1 else { return "" } - return delimiters[index] ?? " " + return delimiters[index, default: " "] } /// A string of the picker row concatenated by whitespace or delimiters if provided. From cd721967556ff68885ff8640976159464dfffb0d Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 18 Feb 2021 10:15:25 -0500 Subject: [PATCH 10/17] spelling fix --- .../Item Dropdown/MultiItemDropdownEntryFieldModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/MultiItemDropdownEntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/MultiItemDropdownEntryFieldModel.swift index 248a86e1..8799f6aa 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/MultiItemDropdownEntryFieldModel.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/MultiItemDropdownEntryFieldModel.swift @@ -36,7 +36,7 @@ import Foundation //-------------------------------------------------- /// - parameter index: The index of the delimiter. - /// - returns: The delimiter for a given idenx. Defaults to whitespace for valid index if no delimiters is provided. If invalid index, emoty string. + /// - returns: The delimiter for a given index. Defaults to whitespace for valid index if no delimiters is provided. If invalid index, empty string. public func delimiter(for index: Int) -> String { guard index != components.count - 1 else { return "" } From 76031200fa024ab3440967a35a39b455d869bf7a Mon Sep 17 00:00:00 2001 From: "Khan, Arshad" Date: Thu, 18 Feb 2021 23:45:26 +0530 Subject: [PATCH 11/17] reverting code which was added for infinite loop crash only in ipads and force crash --- .../SplitViewController/MVMCoreUISplitViewController.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m index 86cc08eb..7377701b 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m @@ -824,14 +824,14 @@ CGFloat const PanelAnimationDuration = 0.2; [MVMCoreDispatchUtility performBlockOnMainThread:^{ if (self.bottomProgressBarHeightConstraint.constant != PaddingOne) { self.bottomProgressBarHeightConstraint.constant = PaddingOne; - [self.bottomProgressBar updateConstraintsIfNeeded]; + [self.bottomProgressBar.superview layoutIfNeeded]; } if (progress > 0.05) { self.bottomProgressBar.progress = progress; } else { self.bottomProgressBarHeightConstraint.constant = 0; - [self.bottomProgressBar updateConstraintsIfNeeded]; + [self.bottomProgressBar.superview layoutIfNeeded]; } }]; } From 028341aa41f4f99e0bfce6a2e89b9099dca9fe07 Mon Sep 17 00:00:00 2001 From: Krishna Kishore Bandaru Date: Tue, 23 Feb 2021 17:16:54 +0530 Subject: [PATCH 12/17] changed access specifier public to open for Button model and static property to class property --- MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift index 52ade755..641d995c 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift @@ -11,12 +11,14 @@ import UIKit public typealias FacadeElements = (fill: UIColor?, text: UIColor?, border: UIColor?) -public class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWatcherFieldProtocol, EnableableModelProtocol { +open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWatcherFieldProtocol, EnableableModelProtocol { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- - - public static var identifier: String = "button" + //Making static property as class property so that subclasses can override getter function of the property + open class var identifier: String { + "button" + } public var backgroundColor: Color? public var accessibilityIdentifier: String? public var title: String @@ -247,7 +249,7 @@ public class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupW } } - public func encode(to encoder: Encoder) throws { + open func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(moleculeName, forKey: .moleculeName) try container.encode(title, forKey: .title) From 8a861077dd824a3af4a6c162ceefa56ac4f8d991 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 23 Feb 2021 14:56:23 -0500 Subject: [PATCH 13/17] styler additon. label width value --- .../Atomic/Atoms/Views/Label/Label.swift | 4 +++- MVMCoreUI/Styles/Styler.swift | 24 ++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift index 7e902d435..8838966c 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift @@ -594,7 +594,6 @@ public typealias ActionBlock = () -> () attributedText = attributedString } - @objc public func updateView(_ size: CGFloat) { scaleSize = size as NSNumber @@ -624,6 +623,9 @@ public typealias ActionBlock = () -> () } else if !MVMCoreGetterUtility.fequal(a: Float(standardFontSize), b: 0.0), let sizeObject = sizeObject ?? MFStyler.sizeObjectGeneric(forCurrentDevice: standardFontSize) { font = font.updateSize(sizeObject.getValueBased(onSize: size)) } + + // Provide the label additional size information to help calculate its intrinsic content. + preferredMaxLayoutWidth = Styler.maxAvailableLayoutWidth(size: size) } @objc public func setFont(_ font: UIFont, scale: Bool) { diff --git a/MVMCoreUI/Styles/Styler.swift b/MVMCoreUI/Styles/Styler.swift index c0dd6792..b2614f04 100644 --- a/MVMCoreUI/Styles/Styler.swift +++ b/MVMCoreUI/Styles/Styler.swift @@ -209,7 +209,29 @@ open class Styler { } open class func sizeFontGeneric(forCurrentDevice size: CGFloat) -> CGFloat { - return sizeObjectGeneric(forCurrentDevice: size)?.getValueBasedOnApplicationWidth() ?? size + sizeObjectGeneric(forCurrentDevice: size)?.getValueBasedOnApplicationWidth() ?? size + } + + open class func defaultHorizontalPadding(for size: CGFloat) -> CGFloat { + sizeObject(withScalingStandardSize: CGFloat(Padding.Component.horizontalPaddingForApplicationWidth)).getValueBased(onSize: size) + } + + open class func defaultVerticalPadding(for size: CGFloat) -> CGFloat { + sizeObject(withScalingStandardSize: CGFloat(Padding.Component.verticalPaddingForApplicationWidth)).getValueBased(onSize: size) + } + + open class func sizeObject(withScalingStandardSize standardSize: CGFloat) -> MFSizeObject { + let object = MFSizeObject() + object.standardSize = standardSize + object.scaleStandardSize = true + return object + } + + /// Provide additional size information to help calculate its intrinsic height. + /// - Returns: The available spacing that can be used for intrinsic content width. + open class func maxAvailableLayoutWidth(size: CGFloat) -> CGFloat { + // The 2 is the product of both sides of padding. + size - (defaultHorizontalPadding(for: size) * 2) } //-------------------------------------------------- From cd94f99f6076eb3ae816e4a78e55dfe35f3df458 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 23 Feb 2021 15:33:03 -0500 Subject: [PATCH 14/17] error check. --- MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift index 8838966c..3d57d0aa 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift @@ -836,7 +836,10 @@ extension Label { fileprivate func setActionAttributes(range: NSRange) { - guard let attributedText = attributedText else { return } + guard let attributedText = attributedText, + range.length > 0, + range.length <= attributedText.length + else { return } let mutableAttributedString = NSMutableAttributedString(attributedString: attributedText) addActionAttributes(range: range, string: mutableAttributedString) From f20895627f6c8649a309b8df1595fc1c65149d7a Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 23 Feb 2021 15:34:28 -0500 Subject: [PATCH 15/17] undo --- MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift index 8838966c..7e902d435 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift @@ -594,6 +594,7 @@ public typealias ActionBlock = () -> () attributedText = attributedString } + @objc public func updateView(_ size: CGFloat) { scaleSize = size as NSNumber @@ -623,9 +624,6 @@ public typealias ActionBlock = () -> () } else if !MVMCoreGetterUtility.fequal(a: Float(standardFontSize), b: 0.0), let sizeObject = sizeObject ?? MFStyler.sizeObjectGeneric(forCurrentDevice: standardFontSize) { font = font.updateSize(sizeObject.getValueBased(onSize: size)) } - - // Provide the label additional size information to help calculate its intrinsic content. - preferredMaxLayoutWidth = Styler.maxAvailableLayoutWidth(size: size) } @objc public func setFont(_ font: UIFont, scale: Bool) { From 55217c21c3e29321f91982ccdfeed3ea0c3ee072 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Wed, 24 Feb 2021 10:14:05 -0500 Subject: [PATCH 16/17] undo --- MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift index 91521b9b..511fb4dc 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift @@ -624,6 +624,9 @@ public typealias ActionBlock = () -> () } else if !MVMCoreGetterUtility.fequal(a: Float(standardFontSize), b: 0.0), let sizeObject = sizeObject ?? MFStyler.sizeObjectGeneric(forCurrentDevice: standardFontSize) { font = font.updateSize(sizeObject.getValueBased(onSize: size)) } + + // Provide the label additional size information to help calculate its intrinsic content. + preferredMaxLayoutWidth = Styler.maxAvailableLayoutWidth(size: size) } @objc public func setFont(_ font: UIFont, scale: Bool) { @@ -834,10 +837,7 @@ extension Label { fileprivate func setActionAttributes(range: NSRange) { - guard let attributedText = attributedText, - range.length > 0, - range.length <= attributedText.length - else { return } + guard let attributedText = attributedText else { return } let mutableAttributedString = NSMutableAttributedString(attributedString: attributedText) addActionAttributes(range: range, string: mutableAttributedString) From 10a91bd1ed38e052f8e59e52d0386f391e161c1d Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Wed, 24 Feb 2021 11:19:31 -0500 Subject: [PATCH 17/17] revised --- MVMCoreUI/Styles/Padding.swift | 10 ++++------ MVMCoreUI/Styles/Styler.swift | 17 +---------------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/MVMCoreUI/Styles/Padding.swift b/MVMCoreUI/Styles/Padding.swift index 0dd9ff6e..480896a0 100644 --- a/MVMCoreUI/Styles/Padding.swift +++ b/MVMCoreUI/Styles/Padding.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - /// Padding is a multiple based on the number 4. public struct Padding { @@ -30,19 +28,19 @@ public struct Padding { public static let VerticalMarginSpacing: CGFloat = 24 public static var horizontalPaddingForApplicationWidth: CGFloat { - return MFSizeObject(scalingStandardSize: HorizontalMarginSpacing)?.getValueBasedOnApplicationWidth() ?? HorizontalMarginSpacing + MFSizeObject(scalingStandardSize: HorizontalMarginSpacing)?.getValueBasedOnApplicationWidth() ?? HorizontalMarginSpacing } public static var verticalPaddingForApplicationWidth: CGFloat { - return MFSizeObject(scalingStandardSize: VerticalMarginSpacing)?.getValueBasedOnApplicationWidth() ?? VerticalMarginSpacing + MFSizeObject(scalingStandardSize: VerticalMarginSpacing)?.getValueBasedOnApplicationWidth() ?? VerticalMarginSpacing } public static func horizontalPaddingForSize(_ size: CGFloat) -> CGFloat { - return MFSizeObject(scalingStandardSize: HorizontalMarginSpacing)?.getValueBased(onSize: size) ?? HorizontalMarginSpacing + MFSizeObject(scalingStandardSize: HorizontalMarginSpacing)?.getValueBased(onSize: size) ?? HorizontalMarginSpacing } public static func verticalPaddingForSize(_ size: CGFloat) -> CGFloat { - return MFSizeObject(scalingStandardSize: VerticalMarginSpacing)?.getValueBased(onSize: size) ?? VerticalMarginSpacing + MFSizeObject(scalingStandardSize: VerticalMarginSpacing)?.getValueBased(onSize: size) ?? VerticalMarginSpacing } } } diff --git a/MVMCoreUI/Styles/Styler.swift b/MVMCoreUI/Styles/Styler.swift index b2614f04..77402295 100644 --- a/MVMCoreUI/Styles/Styler.swift +++ b/MVMCoreUI/Styles/Styler.swift @@ -212,26 +212,11 @@ open class Styler { sizeObjectGeneric(forCurrentDevice: size)?.getValueBasedOnApplicationWidth() ?? size } - open class func defaultHorizontalPadding(for size: CGFloat) -> CGFloat { - sizeObject(withScalingStandardSize: CGFloat(Padding.Component.horizontalPaddingForApplicationWidth)).getValueBased(onSize: size) - } - - open class func defaultVerticalPadding(for size: CGFloat) -> CGFloat { - sizeObject(withScalingStandardSize: CGFloat(Padding.Component.verticalPaddingForApplicationWidth)).getValueBased(onSize: size) - } - - open class func sizeObject(withScalingStandardSize standardSize: CGFloat) -> MFSizeObject { - let object = MFSizeObject() - object.standardSize = standardSize - object.scaleStandardSize = true - return object - } - /// Provide additional size information to help calculate its intrinsic height. /// - Returns: The available spacing that can be used for intrinsic content width. open class func maxAvailableLayoutWidth(size: CGFloat) -> CGFloat { // The 2 is the product of both sides of padding. - size - (defaultHorizontalPadding(for: size) * 2) + size - (Padding.Component.horizontalPaddingForSize(size) * 2) } //--------------------------------------------------