Merge branch 'develop' of https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui into feature/audio_player_behavior
This commit is contained in:
commit
bd26ff181e
@ -325,7 +325,6 @@
|
|||||||
D20C7009250BF99B0095B21C /* TopNotificationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20C7008250BF99B0095B21C /* TopNotificationModel.swift */; };
|
D20C7009250BF99B0095B21C /* TopNotificationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20C7008250BF99B0095B21C /* TopNotificationModel.swift */; };
|
||||||
D20C700B250BFDE40095B21C /* MVMCoreUITopAlertView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20C700A250BFDE40095B21C /* MVMCoreUITopAlertView+Extension.swift */; };
|
D20C700B250BFDE40095B21C /* MVMCoreUITopAlertView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20C700A250BFDE40095B21C /* MVMCoreUITopAlertView+Extension.swift */; };
|
||||||
D20F3B44252E00E4004B3F56 /* PageProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20F3B43252E00E4004B3F56 /* PageProtocol.swift */; };
|
D20F3B44252E00E4004B3F56 /* PageProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20F3B43252E00E4004B3F56 /* PageProtocol.swift */; };
|
||||||
D20F3B5E252F9B5E004B3F56 /* NavigationBarRefreshProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20F3B5D252F9B5D004B3F56 /* NavigationBarRefreshProtocol.swift */; };
|
|
||||||
D20FB165241A5D75004AFC3A /* NavigationItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20FB164241A5D75004AFC3A /* NavigationItemModel.swift */; };
|
D20FB165241A5D75004AFC3A /* NavigationItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20FB164241A5D75004AFC3A /* NavigationItemModel.swift */; };
|
||||||
D213347723843825008E41B3 /* Line.swift in Sources */ = {isa = PBXBuildFile; fileRef = D213347623843825008E41B3 /* Line.swift */; };
|
D213347723843825008E41B3 /* Line.swift in Sources */ = {isa = PBXBuildFile; fileRef = D213347623843825008E41B3 /* Line.swift */; };
|
||||||
D2169301251E51E7002A6324 /* SectionListTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2169300251E51E7002A6324 /* SectionListTemplate.swift */; };
|
D2169301251E51E7002A6324 /* SectionListTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2169300251E51E7002A6324 /* SectionListTemplate.swift */; };
|
||||||
@ -891,7 +890,6 @@
|
|||||||
D20C7008250BF99B0095B21C /* TopNotificationModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopNotificationModel.swift; sourceTree = "<group>"; };
|
D20C7008250BF99B0095B21C /* TopNotificationModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopNotificationModel.swift; sourceTree = "<group>"; };
|
||||||
D20C700A250BFDE40095B21C /* MVMCoreUITopAlertView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MVMCoreUITopAlertView+Extension.swift"; sourceTree = "<group>"; };
|
D20C700A250BFDE40095B21C /* MVMCoreUITopAlertView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MVMCoreUITopAlertView+Extension.swift"; sourceTree = "<group>"; };
|
||||||
D20F3B43252E00E4004B3F56 /* PageProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PageProtocol.swift; sourceTree = "<group>"; };
|
D20F3B43252E00E4004B3F56 /* PageProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PageProtocol.swift; sourceTree = "<group>"; };
|
||||||
D20F3B5D252F9B5D004B3F56 /* NavigationBarRefreshProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationBarRefreshProtocol.swift; sourceTree = "<group>"; };
|
|
||||||
D20FB164241A5D75004AFC3A /* NavigationItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationItemModel.swift; sourceTree = "<group>"; };
|
D20FB164241A5D75004AFC3A /* NavigationItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationItemModel.swift; sourceTree = "<group>"; };
|
||||||
D213347623843825008E41B3 /* Line.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Line.swift; sourceTree = "<group>"; };
|
D213347623843825008E41B3 /* Line.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Line.swift; sourceTree = "<group>"; };
|
||||||
D2169300251E51E7002A6324 /* SectionListTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SectionListTemplate.swift; sourceTree = "<group>"; };
|
D2169300251E51E7002A6324 /* SectionListTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SectionListTemplate.swift; sourceTree = "<group>"; };
|
||||||
@ -2325,7 +2323,6 @@
|
|||||||
D20F3B43252E00E4004B3F56 /* PageProtocol.swift */,
|
D20F3B43252E00E4004B3F56 /* PageProtocol.swift */,
|
||||||
012A88AC238C418100FE3DA1 /* TemplateProtocol.swift */,
|
012A88AC238C418100FE3DA1 /* TemplateProtocol.swift */,
|
||||||
D28BA7442481652D00B75CB8 /* TabBarProtocol.swift */,
|
D28BA7442481652D00B75CB8 /* TabBarProtocol.swift */,
|
||||||
D20F3B5D252F9B5D004B3F56 /* NavigationBarRefreshProtocol.swift */,
|
|
||||||
011B58EE23A2AA850085F53C /* ModelProtocols */,
|
011B58EE23A2AA850085F53C /* ModelProtocols */,
|
||||||
);
|
);
|
||||||
path = Protocols;
|
path = Protocols;
|
||||||
@ -2761,7 +2758,6 @@
|
|||||||
D22479942316AE5E003FCCF9 /* NSLayoutConstraintExtension.swift in Sources */,
|
D22479942316AE5E003FCCF9 /* NSLayoutConstraintExtension.swift in Sources */,
|
||||||
D2B18B94236214AD00A9AEDC /* NavigationController.swift in Sources */,
|
D2B18B94236214AD00A9AEDC /* NavigationController.swift in Sources */,
|
||||||
0A9D09222433796500D2E6C0 /* CarouselIndicator.swift in Sources */,
|
0A9D09222433796500D2E6C0 /* CarouselIndicator.swift in Sources */,
|
||||||
D20F3B5E252F9B5E004B3F56 /* NavigationBarRefreshProtocol.swift in Sources */,
|
|
||||||
D29E28DA23D21AFA00ACEA85 /* StringAndMoleculeModel.swift in Sources */,
|
D29E28DA23D21AFA00ACEA85 /* StringAndMoleculeModel.swift in Sources */,
|
||||||
D260105D23D0BCD400764D80 /* Stack.swift in Sources */,
|
D260105D23D0BCD400764D80 /* Stack.swift in Sources */,
|
||||||
0A7EF85D23D8A95600B2AAD1 /* TextEntryFieldModel.swift in Sources */,
|
0A7EF85D23D8A95600B2AAD1 /* TextEntryFieldModel.swift in Sources */,
|
||||||
|
|||||||
@ -24,7 +24,6 @@ import Foundation
|
|||||||
super.setupView()
|
super.setupView()
|
||||||
layer.borderColor = UIColor.mvmCoolGray6.cgColor
|
layer.borderColor = UIColor.mvmCoolGray6.cgColor
|
||||||
layer.borderWidth = 1
|
layer.borderWidth = 1
|
||||||
label.numberOfLines = 1
|
|
||||||
addSubview(label)
|
addSubview(label)
|
||||||
NSLayoutConstraint.constraintPinSubview(label, pinTop: true, topConstant: 13, pinBottom: true, bottomConstant: 13, pinLeft: true, leftConstant: 15, pinRight: true, rightConstant: 15)
|
NSLayoutConstraint.constraintPinSubview(label, pinTop: true, topConstant: 13, pinBottom: true, bottomConstant: 13, pinLeft: true, leftConstant: 15, pinRight: true, rightConstant: 15)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,12 @@ import Foundation
|
|||||||
case backgroundColor
|
case backgroundColor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func setDefaults() {
|
||||||
|
if label.numberOfLines == nil {
|
||||||
|
label.numberOfLines = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
label = try typeContainer.decode(LabelModel.self, forKey: .label)
|
label = try typeContainer.decode(LabelModel.self, forKey: .label)
|
||||||
|
|||||||
@ -315,6 +315,10 @@ public typealias ActionBlock = () -> ()
|
|||||||
if let color = labelModel.textColor {
|
if let color = labelModel.textColor {
|
||||||
textColor = color.uiColor
|
textColor = color.uiColor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let lines = labelModel.numberOfLines {
|
||||||
|
numberOfLines = lines
|
||||||
|
}
|
||||||
|
|
||||||
if let attributes = labelModel.attributes, let labelText = text {
|
if let attributes = labelModel.attributes, let labelText = text {
|
||||||
let attributedString = NSMutableAttributedString(string: labelText, attributes: [NSAttributedString.Key.font: font.updateSize(standardFontSize), NSAttributedString.Key.foregroundColor: textColor as UIColor])
|
let attributedString = NSMutableAttributedString(string: labelText, attributes: [NSAttributedString.Key.font: font.updateSize(standardFontSize), NSAttributedString.Key.foregroundColor: textColor as UIColor])
|
||||||
@ -790,6 +794,7 @@ extension Label {
|
|||||||
accessibilityCustomActions = []
|
accessibilityCustomActions = []
|
||||||
clauses = []
|
clauses = []
|
||||||
accessibilityTraits = .staticText
|
accessibilityTraits = .staticText
|
||||||
|
numberOfLines = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
public func needsToBeConstrained() -> Bool { true }
|
public func needsToBeConstrained() -> Bool { true }
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
public var html: String?
|
public var html: String?
|
||||||
public var hero: Int?
|
public var hero: Int?
|
||||||
public var makeWholeViewClickable: Bool?
|
public var makeWholeViewClickable: Bool?
|
||||||
|
public var numberOfLines: Int?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Keys
|
// MARK: - Keys
|
||||||
@ -44,12 +45,13 @@
|
|||||||
case html
|
case html
|
||||||
case hero
|
case hero
|
||||||
case makeWholeViewClickable
|
case makeWholeViewClickable
|
||||||
|
case numberOfLines
|
||||||
}
|
}
|
||||||
|
|
||||||
enum AttributeTypeKey: String, CodingKey {
|
enum AttributeTypeKey: String, CodingKey {
|
||||||
case type
|
case type
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -76,6 +78,7 @@
|
|||||||
html = try typeContainer.decodeIfPresent(String.self, forKey: .html)
|
html = try typeContainer.decodeIfPresent(String.self, forKey: .html)
|
||||||
hero = try typeContainer.decodeIfPresent(Int.self, forKey: .hero)
|
hero = try typeContainer.decodeIfPresent(Int.self, forKey: .hero)
|
||||||
makeWholeViewClickable = try typeContainer.decodeIfPresent(Bool.self, forKey: .makeWholeViewClickable)
|
makeWholeViewClickable = try typeContainer.decodeIfPresent(Bool.self, forKey: .makeWholeViewClickable)
|
||||||
|
numberOfLines = try typeContainer.decodeIfPresent(Int.self, forKey: .numberOfLines)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
@ -93,5 +96,6 @@
|
|||||||
try container.encodeIfPresent(html, forKey: .html)
|
try container.encodeIfPresent(html, forKey: .html)
|
||||||
try container.encodeIfPresent(hero, forKey: .hero)
|
try container.encodeIfPresent(hero, forKey: .hero)
|
||||||
try container.encodeIfPresent(makeWholeViewClickable, forKey: .makeWholeViewClickable)
|
try container.encodeIfPresent(makeWholeViewClickable, forKey: .makeWholeViewClickable)
|
||||||
|
try container.encodeIfPresent(numberOfLines, forKey: .numberOfLines)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,11 +48,8 @@ import Foundation
|
|||||||
open override func setupView() {
|
open override func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
setDefaults()
|
setDefaults()
|
||||||
body.numberOfLines = 1
|
|
||||||
body.lineBreakMode = .byTruncatingTail
|
body.lineBreakMode = .byTruncatingTail
|
||||||
body2.numberOfLines = 1
|
|
||||||
body2.lineBreakMode = .byTruncatingTail
|
body2.lineBreakMode = .byTruncatingTail
|
||||||
body3.numberOfLines = 1
|
|
||||||
body3.lineBreakMode = .byTruncatingTail
|
body3.lineBreakMode = .byTruncatingTail
|
||||||
|
|
||||||
verticalLine1.widthConstraint?.isActive = true
|
verticalLine1.widthConstraint?.isActive = true
|
||||||
|
|||||||
@ -49,6 +49,15 @@ public class HeadersH2PricingTwoRowsModel: HeaderModel, MoleculeModelProtocol {
|
|||||||
subBody?.attributes = [LabelAttributeStrikeThroughModel(0, subBody?.text.count ?? 0)]
|
subBody?.attributes = [LabelAttributeStrikeThroughModel(0, subBody?.text.count ?? 0)]
|
||||||
subBody2?.attributes = [LabelAttributeStrikeThroughModel(0, subBody2?.text.count ?? 0)]
|
subBody2?.attributes = [LabelAttributeStrikeThroughModel(0, subBody2?.text.count ?? 0)]
|
||||||
subBody3?.attributes = [LabelAttributeStrikeThroughModel(0, subBody3?.text.count ?? 0)]
|
subBody3?.attributes = [LabelAttributeStrikeThroughModel(0, subBody3?.text.count ?? 0)]
|
||||||
|
if body.numberOfLines == nil {
|
||||||
|
body.numberOfLines = 1
|
||||||
|
}
|
||||||
|
if body2.numberOfLines == nil {
|
||||||
|
body2.numberOfLines = 1
|
||||||
|
}
|
||||||
|
if body3.numberOfLines == nil {
|
||||||
|
body3.numberOfLines = 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -50,7 +50,6 @@
|
|||||||
leftImage.contentMode = .scaleAspectFit
|
leftImage.contentMode = .scaleAspectFit
|
||||||
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
rightLabel.numberOfLines = 1
|
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,10 @@ public class ListLeftVariableIconWithRightCaretAllTextLinksModel: ListItemModel,
|
|||||||
image.width = 30
|
image.width = 30
|
||||||
image.height = 30
|
image.height = 30
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if rightLabel.numberOfLines == nil {
|
||||||
|
rightLabel.numberOfLines = 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|||||||
@ -55,7 +55,6 @@
|
|||||||
leftImage.contentMode = .scaleAspectFit
|
leftImage.contentMode = .scaleAspectFit
|
||||||
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
rightLabel.numberOfLines = 1
|
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,6 +29,9 @@ public class ListLeftVariableIconWithRightCaretBodyTextModel: ListItemModel, Mol
|
|||||||
}
|
}
|
||||||
headlineBody.style = .item
|
headlineBody.style = .item
|
||||||
headlineBody.headline?.hero = 0
|
headlineBody.headline?.hero = 0
|
||||||
|
if rightLabel.numberOfLines == nil {
|
||||||
|
rightLabel.numberOfLines = 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|||||||
@ -71,7 +71,6 @@
|
|||||||
rightBar.widthAnchor.constraint(equalToConstant: 20).isActive = true
|
rightBar.widthAnchor.constraint(equalToConstant: 20).isActive = true
|
||||||
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
rightLabel.numberOfLines = 1
|
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
horizontalStack.restack()
|
horizontalStack.restack()
|
||||||
|
|||||||
@ -45,6 +45,10 @@ public class ListProgressBarThinModel: ListItemModel, MoleculeModelProtocol {
|
|||||||
rightBar.backgroundColor = Color(uiColor: .gray)
|
rightBar.backgroundColor = Color(uiColor: .gray)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if rightLabel.numberOfLines == nil {
|
||||||
|
rightLabel.numberOfLines = 1
|
||||||
|
}
|
||||||
|
|
||||||
leftHeadline.hero = 0
|
leftHeadline.hero = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,6 @@
|
|||||||
|
|
||||||
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
rightLabel.numberOfLines = 1
|
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
horizontalStack.restack()
|
horizontalStack.restack()
|
||||||
|
|||||||
@ -38,6 +38,9 @@ public class ListStoreLocatorModel: ListItemModel, MoleculeModelProtocol {
|
|||||||
override public func setDefaults() {
|
override public func setDefaults() {
|
||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
leftHeadline.hero = 0
|
leftHeadline.hero = 0
|
||||||
|
if rightLabel.numberOfLines == nil {
|
||||||
|
rightLabel.numberOfLines = 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -61,7 +61,6 @@
|
|||||||
|
|
||||||
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
rightLabel.numberOfLines = 1
|
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,17 @@ public class ListRightVariablePriceChangeAllTextAndLinksModel: ListItemModel, Mo
|
|||||||
public var rightLabel: LabelModel
|
public var rightLabel: LabelModel
|
||||||
public var arrow: ArrowModel
|
public var arrow: ArrowModel
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Methods
|
||||||
|
//-----------------------------------------------------
|
||||||
|
|
||||||
|
override public func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
|
if rightLabel.numberOfLines == nil {
|
||||||
|
rightLabel.numberOfLines = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -46,7 +46,6 @@
|
|||||||
|
|
||||||
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
rightLabel.numberOfLines = 1
|
|
||||||
|
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
|
|||||||
@ -37,6 +37,9 @@ public class ListRightVariablePriceChangeBodyTextModel: ListItemModel, MoleculeM
|
|||||||
if let headline = headlineBody.headline {
|
if let headline = headlineBody.headline {
|
||||||
headline.hero = 0
|
headline.hero = 0
|
||||||
}
|
}
|
||||||
|
if rightLabel.numberOfLines == nil {
|
||||||
|
rightLabel.numberOfLines = 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -38,7 +38,6 @@
|
|||||||
super.setupView()
|
super.setupView()
|
||||||
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
rightLabel.numberOfLines = 1
|
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,17 @@ public class ListRightVariableRightCaretAllTextAndLinksModel: ListItemModel, Mol
|
|||||||
public var rightLabel: LabelModel
|
public var rightLabel: LabelModel
|
||||||
public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel
|
public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Methods
|
||||||
|
//-----------------------------------------------------
|
||||||
|
|
||||||
|
override public func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
|
if rightLabel.numberOfLines == nil {
|
||||||
|
rightLabel.numberOfLines = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -39,9 +39,6 @@
|
|||||||
|
|
||||||
open override func setupView() {
|
open override func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
leftLabel.numberOfLines = 1
|
|
||||||
centerLabel.numberOfLines = 1
|
|
||||||
rightLabel.numberOfLines = 1
|
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,23 @@ public class ListThreeColumnBillChangesModel: ListItemModel, MoleculeModelProtoc
|
|||||||
public var centerLabel: LabelModel
|
public var centerLabel: LabelModel
|
||||||
public var rightLabel: LabelModel
|
public var rightLabel: LabelModel
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Methods
|
||||||
|
//-----------------------------------------------------
|
||||||
|
|
||||||
|
override public func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
|
if rightLabel.numberOfLines == nil {
|
||||||
|
rightLabel.numberOfLines = 1
|
||||||
|
}
|
||||||
|
if centerLabel.numberOfLines == nil {
|
||||||
|
centerLabel.numberOfLines = 1
|
||||||
|
}
|
||||||
|
if leftLabel.numberOfLines == nil {
|
||||||
|
leftLabel.numberOfLines = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -74,9 +74,6 @@
|
|||||||
view.addSubview(rightVerticalStack)
|
view.addSubview(rightVerticalStack)
|
||||||
NSLayoutConstraint.pinViews(leftView: leftVerticalStack, rightView: rightVerticalStack, alignTop: true)
|
NSLayoutConstraint.pinViews(leftView: leftVerticalStack, rightView: rightVerticalStack, alignTop: true)
|
||||||
|
|
||||||
leftHeadline.numberOfLines = 1
|
|
||||||
rightLabel.numberOfLines = 1
|
|
||||||
rightSubLabel.numberOfLines = 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
|||||||
@ -34,6 +34,18 @@ public class ListTwoColumnPriceDescriptionModel: ListItemModel, MoleculeModelPro
|
|||||||
if rightSubLabel.attributes == nil {
|
if rightSubLabel.attributes == nil {
|
||||||
rightSubLabel.attributes = [LabelAttributeStrikeThroughModel(0, rightSubLabel.text.count)]
|
rightSubLabel.attributes = [LabelAttributeStrikeThroughModel(0, rightSubLabel.text.count)]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if rightLabel.numberOfLines == nil {
|
||||||
|
rightLabel.numberOfLines = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if rightSubLabel.numberOfLines == nil {
|
||||||
|
rightSubLabel.numberOfLines = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if leftHeadline.numberOfLines == nil {
|
||||||
|
leftHeadline.numberOfLines = 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -64,6 +64,7 @@ open class DoughnutChart: View {
|
|||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
titleLabel.reset()
|
titleLabel.reset()
|
||||||
|
titleLabel.numberOfLines = 1
|
||||||
subTitleLabel.reset()
|
subTitleLabel.reset()
|
||||||
clearLayers()
|
clearLayers()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,6 +26,9 @@ open class CollapsableNotificationModel: NotificationModel {
|
|||||||
|
|
||||||
open override func setDefaults() {
|
open override func setDefaults() {
|
||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
|
if topLabel.numberOfLines == nil {
|
||||||
|
topLabel.numberOfLines = 1
|
||||||
|
}
|
||||||
if topLabel.textColor == nil {
|
if topLabel.textColor == nil {
|
||||||
topLabel.textColor = Color(uiColor: .white)
|
topLabel.textColor = Color(uiColor: .white)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import Foundation
|
|||||||
@objcMembers open class CollapsableNotificationTopView: View {
|
@objcMembers open class CollapsableNotificationTopView: View {
|
||||||
public let label: Label = {
|
public let label: Label = {
|
||||||
let label = Label(fontStyle: .BoldBodySmall)
|
let label = Label(fontStyle: .BoldBodySmall)
|
||||||
label.numberOfLines = 1
|
|
||||||
label.textAlignment = .center
|
label.textAlignment = .center
|
||||||
label.setContentHuggingPriority(.defaultHigh, for: .vertical)
|
label.setContentHuggingPriority(.defaultHigh, for: .vertical)
|
||||||
return label
|
return label
|
||||||
|
|||||||
@ -1,34 +0,0 @@
|
|||||||
//
|
|
||||||
// NavigationBarRefreshProtocol.swift
|
|
||||||
// MVMCoreUI
|
|
||||||
//
|
|
||||||
// Created by Scott Pfeil on 10/8/20.
|
|
||||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
/// A protocol to inform that we should refresh the navigation bar ui.
|
|
||||||
@objc public protocol NavigationBarRefreshProtocol {
|
|
||||||
@objc func refreshNavigationUI()
|
|
||||||
}
|
|
||||||
|
|
||||||
extension UIViewController: NavigationBarRefreshProtocol {
|
|
||||||
|
|
||||||
/// Convenience function to refresh the navigation bar ui. A separate function for others to use.
|
|
||||||
@objc public static func refreshNavigationUI(for viewController: UIViewController) {
|
|
||||||
guard let model = (viewController as? PageProtocol)?.pageModel?.navigationBar else { return }
|
|
||||||
if let navigationController = viewController.navigationController {
|
|
||||||
NavigationController.setNavigationItem(navigationController: navigationController, navigationItemModel: model, viewController: viewController)
|
|
||||||
MVMCoreUISplitViewController.setNavigationBarUI(for: viewController, navigationController: navigationController, navigationItemModel: model)
|
|
||||||
}
|
|
||||||
if let manager = ((viewController as? MVMCoreViewManagerViewControllerProtocol)?.manager as? NavigationBarRefreshProtocol) {
|
|
||||||
// Refresh the manager if possible.
|
|
||||||
manager.refreshNavigationUI()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public func refreshNavigationUI() {
|
|
||||||
UIViewController.refreshNavigationUI(for: self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -114,17 +114,6 @@ import UIKit
|
|||||||
try parsePageJSON()
|
try parsePageJSON()
|
||||||
MVMCoreDispatchUtility.performBlock(onMainThread: {
|
MVMCoreDispatchUtility.performBlock(onMainThread: {
|
||||||
self.handleNewDataAndUpdateUI()
|
self.handleNewDataAndUpdateUI()
|
||||||
|
|
||||||
if MVMCoreUIUtility.getCurrentVisibleController() == self {
|
|
||||||
// Update navigation bar if showing.
|
|
||||||
self.setNavigationBar()
|
|
||||||
self.manager?.refreshNavigationUI()
|
|
||||||
}
|
|
||||||
// Update splitview properties
|
|
||||||
if self == MVMCoreUISplitViewController.main()?.getCurrentDetailViewController() {
|
|
||||||
MVMCoreUISplitViewController.main()?.setBottomProgressBarProgress(self.bottomProgress() ?? 0)
|
|
||||||
self.updateTabBar()
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
} catch {
|
} catch {
|
||||||
if let coreError = MVMCoreErrorObject.createErrorObject(for: error, location: "updateJSON for pageType: \(String(describing: pageType))") {
|
if let coreError = MVMCoreErrorObject.createErrorObject(for: error, location: "updateJSON for pageType: \(String(describing: pageType))") {
|
||||||
@ -237,6 +226,11 @@ import UIKit
|
|||||||
|
|
||||||
/// Processes any new data. Called after the page is loaded the first time and on response updates for this page,
|
/// Processes any new data. Called after the page is loaded the first time and on response updates for this page,
|
||||||
open func handleNewData() {
|
open func handleNewData() {
|
||||||
|
if model?.navigationBar == nil {
|
||||||
|
let navigationItem = createDefaultLegacyNavigationModel()
|
||||||
|
model?.navigationBar = navigationItem
|
||||||
|
}
|
||||||
|
|
||||||
executeBehaviors { (behavior: PageMoleculeTransformationBehavior) in
|
executeBehaviors { (behavior: PageMoleculeTransformationBehavior) in
|
||||||
behavior.onPageNew(rootMolecules: getRootMolecules(), delegateObjectIVar)
|
behavior.onPageNew(rootMolecules: getRootMolecules(), delegateObjectIVar)
|
||||||
}
|
}
|
||||||
@ -250,8 +244,14 @@ import UIKit
|
|||||||
view.backgroundColor = backgroundColor.uiColor
|
view.backgroundColor = backgroundColor.uiColor
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets up the navigation item based on the data.
|
// Update splitview properties
|
||||||
setNavigationItem()
|
if self == MVMCoreUISplitViewController.main()?.getCurrentDetailViewController() {
|
||||||
|
MVMCoreUISplitViewController.main()?.setBottomProgressBarProgress(bottomProgress() ?? 0)
|
||||||
|
updateTabBar()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notify the manager of new data
|
||||||
|
manager?.newDataReceived?(in: self)
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -267,28 +267,6 @@ import UIKit
|
|||||||
return model?.navigationBar
|
return model?.navigationBar
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the navigation item for this view controller.
|
|
||||||
open func setNavigationItem() {
|
|
||||||
guard let navigationItemModel = getNavigationModel(),
|
|
||||||
let navigationController = navigationController
|
|
||||||
else { return }
|
|
||||||
|
|
||||||
// Utilize helper function to set the navigation item state.
|
|
||||||
NavigationController.setNavigationItem(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: self)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Sets the appearance of the navigation bar based on the model.
|
|
||||||
open func setNavigationBar() {
|
|
||||||
guard let navigationItemModel = getNavigationModel(),
|
|
||||||
let navigationController = navigationController else {
|
|
||||||
MVMCoreUISession.sharedGlobal()?.splitViewController?.parent?.setNeedsStatusBarAppearanceUpdate()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Utilize helper function to set the split view and navigation item state.
|
|
||||||
MVMCoreUISplitViewController.setNavigationBarUI(for: self, navigationController: navigationController, navigationItemModel: navigationItemModel)
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - TabBar
|
// MARK: - TabBar
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -378,9 +356,6 @@ import UIKit
|
|||||||
updateTabBar()
|
updateTabBar()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the navigation bar ui when view is appearing.
|
|
||||||
setNavigationBar()
|
|
||||||
|
|
||||||
// Track.
|
// Track.
|
||||||
MVMCoreUISession.sharedGlobal()?.currentPageType = pageType
|
MVMCoreUISession.sharedGlobal()?.currentPageType = pageType
|
||||||
MVMCoreUILoggingHandler.shared()?.defaultLogPageState(forController: self)
|
MVMCoreUILoggingHandler.shared()?.defaultLogPageState(forController: self)
|
||||||
@ -540,11 +515,6 @@ import UIKit
|
|||||||
// MARK: - MVMCoreUIDetailViewProtocol
|
// MARK: - MVMCoreUIDetailViewProtocol
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
// Reset the navigation state.
|
|
||||||
public func splitViewDidReset() {
|
|
||||||
setNavigationBar()
|
|
||||||
}
|
|
||||||
|
|
||||||
public func isLeftPanelAccessible() -> Bool {
|
public func isLeftPanelAccessible() -> Bool {
|
||||||
// TODO: Remove when hamburger menu is fully phased out.
|
// TODO: Remove when hamburger menu is fully phased out.
|
||||||
if loadObject?.pageJSON?.boolForKey(KeyHideMainMenu) ?? false {
|
if loadObject?.pageJSON?.boolForKey(KeyHideMainMenu) ?? false {
|
||||||
|
|||||||
@ -44,18 +44,6 @@ public class PageGetContactBehavior: PageVisibilityBehavior {
|
|||||||
// TODO: move to protocol function instead
|
// TODO: move to protocol function instead
|
||||||
guard let controller = self?.delegate?.moleculeDelegate as? ViewController else { return }
|
guard let controller = self?.delegate?.moleculeDelegate as? ViewController else { return }
|
||||||
controller.handleNewDataAndUpdateUI()
|
controller.handleNewDataAndUpdateUI()
|
||||||
|
|
||||||
if MVMCoreUIUtility.getCurrentVisibleController() == controller {
|
|
||||||
// Update navigation bar if showing.
|
|
||||||
controller.setNavigationBar()
|
|
||||||
controller.manager?.refreshNavigationUI()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update splitview properties
|
|
||||||
if controller == MVMCoreUISplitViewController.main()?.getCurrentDetailViewController() {
|
|
||||||
MVMCoreUISplitViewController.main()?.setBottomProgressBarProgress(controller.bottomProgress() ?? 0)
|
|
||||||
controller.updateTabBar()
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,8 +8,9 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
@objcMembers open class NavigationController: UINavigationController {
|
@objcMembers open class NavigationController: UINavigationController, MVMCoreViewManagerViewControllerProtocol {
|
||||||
public var separatorView: Line?
|
public var separatorView: Line?
|
||||||
|
public var manager: (UIViewController & MVMCoreViewManagerProtocol)?
|
||||||
|
|
||||||
/// Getter for the main navigation controller
|
/// Getter for the main navigation controller
|
||||||
public static func navigationController() -> Self? {
|
public static func navigationController() -> Self? {
|
||||||
@ -33,6 +34,7 @@ import UIKit
|
|||||||
MVMCoreUISession.sharedGlobal()?.navigationController = navigationController
|
MVMCoreUISession.sharedGlobal()?.navigationController = navigationController
|
||||||
MVMCoreNavigationHandler.shared()?.viewControllerToPresentOn = navigationController
|
MVMCoreNavigationHandler.shared()?.viewControllerToPresentOn = navigationController
|
||||||
MVMCoreNavigationHandler.shared()?.navigationController = navigationController
|
MVMCoreNavigationHandler.shared()?.navigationController = navigationController
|
||||||
|
MVMCoreNavigationHandler.shared()?.addDelegate(navigationController)
|
||||||
return navigationController
|
return navigationController
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,4 +105,83 @@ import UIKit
|
|||||||
viewController.navigationItem.titleView = molecule
|
viewController.navigationItem.titleView = molecule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Convenience function to return the navigation model of the lowest controller traversing managers if applicable.
|
||||||
|
public func getNavigationModel(from viewController: UIViewController) -> NavigationItemModelProtocol? {
|
||||||
|
guard let topViewController = topViewController,
|
||||||
|
viewController == MVMCoreUIUtility.getViewControllerTraversingManagers(topViewController),
|
||||||
|
let model = (viewController as? PageProtocol)?.pageModel?.navigationBar else { return nil }
|
||||||
|
return model
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension NavigationController: MVMCoreViewManagerProtocol {
|
||||||
|
public func getCurrentViewController() -> UIViewController? {
|
||||||
|
guard let topViewController = topViewController else { return nil }
|
||||||
|
return MVMCoreUIUtility.getViewControllerTraversingManagers(topViewController)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func containsPage(withPageType pageType: String?) -> Bool {
|
||||||
|
for controller in viewControllers {
|
||||||
|
if let manager = controller as? MVMCoreViewManagerProtocol,
|
||||||
|
manager.containsPage(withPageType: pageType) {
|
||||||
|
return true
|
||||||
|
} else if let controller = controller as? MVMCoreViewControllerProtocol,
|
||||||
|
controller.pageType == pageType {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
public func newDataReceived(in viewController: UIViewController) {
|
||||||
|
if let topViewController = topViewController,
|
||||||
|
let model = getNavigationModel(from: viewController) {
|
||||||
|
Self.setNavigationItem(navigationController: self, navigationItemModel: model, viewController: topViewController)
|
||||||
|
Self.setNavigationBarUI(navigationController: self, navigationItemModel: model, viewController: topViewController)
|
||||||
|
}
|
||||||
|
manager?.newDataReceived?(in: viewController)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func willDisplay(_ viewController: UIViewController) {
|
||||||
|
if let topViewController = topViewController,
|
||||||
|
let model = getNavigationModel(from: viewController) {
|
||||||
|
Self.setNavigationItem(navigationController: self, navigationItemModel: model, viewController: topViewController)
|
||||||
|
}
|
||||||
|
manager?.willDisplay?(viewController)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func displayedViewController(_ viewController: UIViewController) {
|
||||||
|
if let topViewController = topViewController,
|
||||||
|
let model = getNavigationModel(from: viewController) {
|
||||||
|
Self.setNavigationBarUI(navigationController: self, navigationItemModel: model, viewController: topViewController)
|
||||||
|
}
|
||||||
|
manager?.displayedViewController?(viewController)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension NavigationController: MVMCorePresentationDelegateProtocol {
|
||||||
|
public func navigationController(_ navigationController: UINavigationController, willDisplay viewController: UIViewController) {
|
||||||
|
guard self == navigationController else { return }
|
||||||
|
if let controller = viewController as? (UIViewController & MVMCoreViewManagerViewControllerProtocol) {
|
||||||
|
MVMCoreViewManagerViewControllerProtocolHelper.helpSetManager(self, viewController: controller)
|
||||||
|
}
|
||||||
|
guard let newViewController = MVMCoreUIUtility.getViewControllerTraversingManagers(viewController) else { return }
|
||||||
|
if let model = getNavigationModel(from: newViewController) {
|
||||||
|
Self.setNavigationItem(navigationController: self, navigationItemModel: model, viewController: viewController)
|
||||||
|
}
|
||||||
|
manager?.willDisplay?(newViewController)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func navigationController(_ navigationController: UINavigationController, displayedViewController viewController: UIViewController) {
|
||||||
|
guard self == navigationController,
|
||||||
|
let newViewController = MVMCoreUIUtility.getViewControllerTraversingManagers(viewController) else { return }
|
||||||
|
if let model = getNavigationModel(from: newViewController) {
|
||||||
|
Self.setNavigationBarUI(navigationController: self, navigationItemModel: model, viewController: viewController)
|
||||||
|
}
|
||||||
|
manager?.displayedViewController?(newViewController)
|
||||||
|
if let controller = viewController as? (UIViewController & MVMCoreViewManagerViewControllerProtocol) {
|
||||||
|
controller.viewControllerReady?(inManager: self)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,9 +48,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (UIStatusBarStyle)defaultStatusBarStyle;
|
- (UIStatusBarStyle)defaultStatusBarStyle;
|
||||||
- (nullable UIColor *)defaultStatusBarBackgroundColor;
|
- (nullable UIColor *)defaultStatusBarBackgroundColor;
|
||||||
|
|
||||||
/// Called when the split view did reset. If this function found, the splitview assumes it is handling the split view state and does not do anything. If you have navigation item buttons, override this function and handle the panels manually.
|
|
||||||
- (void)splitViewDidReset;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|||||||
@ -8,15 +8,15 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
// Navigation bar update functions
|
||||||
public extension MVMCoreUISplitViewController {
|
public extension MVMCoreUISplitViewController {
|
||||||
|
|
||||||
/// Convenience function. Sets the navigation and split view properties for the view controller. Panel access is determined if view controller is a detail view protocol.
|
/// Convenience function. Sets the navigation and split view properties for the view controller. Panel access is determined if view controller is a detail view protocol.
|
||||||
static func setNavigationBarUI(for viewController: UIViewController, navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol) {
|
static func setNavigationBarUI(for viewController: UIViewController, navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol) {
|
||||||
guard let splitView = MVMCoreUISplitViewController.main(),
|
guard let splitView = MVMCoreUISplitViewController.main(),
|
||||||
navigationController == splitView.navigationController,
|
navigationController == splitView.navigationController,
|
||||||
navigationController.topViewController == viewController else {
|
viewController == MVMCoreUISplitViewController.main()?.getCurrentDetailViewController() else {
|
||||||
/// Not the split view navigation controller, skip split functions.
|
/// Not the split view navigation controller, skip split functions.
|
||||||
NavigationController.setNavigationBarUI(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
splitView.set(for: viewController, navigationController: navigationController, navigationItemModel: navigationItemModel)
|
splitView.set(for: viewController, navigationController: navigationController, navigationItemModel: navigationItemModel)
|
||||||
@ -24,8 +24,6 @@ public extension MVMCoreUISplitViewController {
|
|||||||
|
|
||||||
/// Sets the navigation item for the view controller based on the model and splitview controller
|
/// Sets the navigation item for the view controller based on the model and splitview controller
|
||||||
private func set(for viewController: UIViewController, navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol) {
|
private func set(for viewController: UIViewController, navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol) {
|
||||||
NavigationController.setNavigationBarUI(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
|
||||||
|
|
||||||
setLeftPanelIsAccessible((viewController as? MVMCoreUIDetailViewProtocol)?.isLeftPanelAccessible?() ?? false, for: viewController, updateNavigationButtons: false)
|
setLeftPanelIsAccessible((viewController as? MVMCoreUIDetailViewProtocol)?.isLeftPanelAccessible?() ?? false, for: viewController, updateNavigationButtons: false)
|
||||||
setRightPanelIsAccessible((viewController as? MVMCoreUIDetailViewProtocol)?.isRightPanelAccessible?() ?? false, for: viewController, updateNavigationButtons: false)
|
setRightPanelIsAccessible((viewController as? MVMCoreUIDetailViewProtocol)?.isRightPanelAccessible?() ?? false, for: viewController, updateNavigationButtons: false)
|
||||||
|
|
||||||
@ -37,6 +35,8 @@ public extension MVMCoreUISplitViewController {
|
|||||||
|
|
||||||
/// Sets the left navigation items for the view controller based on model and splitview.
|
/// Sets the left navigation items for the view controller based on model and splitview.
|
||||||
func setLeftNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) {
|
func setLeftNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) {
|
||||||
|
guard let topViewController = navigationController.topViewController else { return }
|
||||||
|
|
||||||
var leftItems: [UIBarButtonItem] = []
|
var leftItems: [UIBarButtonItem] = []
|
||||||
let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject
|
let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject
|
||||||
|
|
||||||
@ -75,11 +75,13 @@ public extension MVMCoreUISplitViewController {
|
|||||||
leftItems.append(contentsOf: additionalLeftButtons)
|
leftItems.append(contentsOf: additionalLeftButtons)
|
||||||
}
|
}
|
||||||
|
|
||||||
viewController.navigationItem.setLeftBarButtonItems(leftItems.count > 0 ? leftItems : nil, animated: !DisableAnimations.boolValue)
|
topViewController.navigationItem.setLeftBarButtonItems(leftItems.count > 0 ? leftItems : nil, animated: !DisableAnimations.boolValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the right navigation items for the view controller based on model and splitview.
|
/// Sets the right navigation items for the view controller based on model and splitview.
|
||||||
func setRightNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) {
|
func setRightNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) {
|
||||||
|
guard let topViewController = navigationController.topViewController else { return }
|
||||||
|
|
||||||
let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject
|
let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject
|
||||||
var rightItems: [UIBarButtonItem] = []
|
var rightItems: [UIBarButtonItem] = []
|
||||||
|
|
||||||
@ -102,6 +104,38 @@ public extension MVMCoreUISplitViewController {
|
|||||||
rightItems.append(contentsOf: additionalRightButtons)
|
rightItems.append(contentsOf: additionalRightButtons)
|
||||||
}
|
}
|
||||||
|
|
||||||
viewController.navigationItem.setRightBarButtonItems(rightItems.count > 0 ? rightItems : nil, animated: !DisableAnimations.boolValue)
|
topViewController.navigationItem.setRightBarButtonItems(rightItems.count > 0 ? rightItems : nil, animated: !DisableAnimations.boolValue)
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc func navigationBarModelExists() -> Bool {
|
||||||
|
// Legacy Navigation
|
||||||
|
guard let currentViewController = getCurrentDetailViewController(),
|
||||||
|
let _ = navigationController?.getNavigationModel(from: currentViewController) else { return false }
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Convenience function to update the navigation bar if the controller is the current lowest controller.
|
||||||
|
@objc func updateNavigationBarFor(viewController: UIViewController) {
|
||||||
|
guard let navigationController = navigationController,
|
||||||
|
let model = navigationController.getNavigationModel(from: viewController) else { return }
|
||||||
|
set(for: viewController, navigationController: navigationController, navigationItemModel: model)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension MVMCoreUISplitViewController: MVMCoreViewManagerProtocol {
|
||||||
|
public func getCurrentViewController() -> UIViewController? {
|
||||||
|
navigationController?.getCurrentViewController()
|
||||||
|
}
|
||||||
|
|
||||||
|
public func containsPage(withPageType pageType: String?) -> Bool {
|
||||||
|
navigationController?.containsPage(withPageType: pageType) ?? false
|
||||||
|
}
|
||||||
|
|
||||||
|
public func displayedViewController(_ viewController: UIViewController) {
|
||||||
|
updateNavigationBarFor(viewController: viewController)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func newDataReceived(in viewController: UIViewController) {
|
||||||
|
updateNavigationBarFor(viewController: viewController)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -240,7 +240,7 @@ CGFloat const PanelAnimationDuration = 0.2;
|
|||||||
|
|
||||||
- (void)setLeftNavigationItemForViewController:(UIViewController * _Nonnull)viewController accessible:(BOOL)accessible extended:(BOOL)extended {
|
- (void)setLeftNavigationItemForViewController:(UIViewController * _Nonnull)viewController accessible:(BOOL)accessible extended:(BOOL)extended {
|
||||||
NSMutableArray *leftBarButtonItems = [NSMutableArray array];
|
NSMutableArray *leftBarButtonItems = [NSMutableArray array];
|
||||||
if (viewController.navigationController && [MVMCoreNavigationHandler.sharedNavigationHandler getViewControllersForNavigationController:viewController.navigationController].count > 1) {
|
if (self.navigationController && [MVMCoreNavigationHandler.sharedNavigationHandler getViewControllersForNavigationController:self.navigationController].count > 1) {
|
||||||
[leftBarButtonItems addObject:self.backButton];
|
[leftBarButtonItems addObject:self.backButton];
|
||||||
}
|
}
|
||||||
if ((accessible && !extended) && self.leftPanelButton) {
|
if ((accessible && !extended) && self.leftPanelButton) {
|
||||||
@ -250,7 +250,7 @@ CGFloat const PanelAnimationDuration = 0.2;
|
|||||||
if (extraButtons) {
|
if (extraButtons) {
|
||||||
[leftBarButtonItems addObjectsFromArray:extraButtons];
|
[leftBarButtonItems addObjectsFromArray:extraButtons];
|
||||||
}
|
}
|
||||||
[viewController.navigationItem setLeftBarButtonItems:(leftBarButtonItems.count > 0 ? leftBarButtonItems : nil) animated:!DisableAnimations];
|
[self.navigationController.topViewController.navigationItem setLeftBarButtonItems:(leftBarButtonItems.count > 0 ? leftBarButtonItems : nil) animated:!DisableAnimations];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setLeftPanelIsAccessible:(BOOL)leftPanelIsAccessible forViewController:(UIViewController *)viewController updateNavigationButtons:(BOOL)updateNavigationButtons {
|
- (void)setLeftPanelIsAccessible:(BOOL)leftPanelIsAccessible forViewController:(UIViewController *)viewController updateNavigationButtons:(BOOL)updateNavigationButtons {
|
||||||
@ -422,7 +422,7 @@ CGFloat const PanelAnimationDuration = 0.2;
|
|||||||
if (extraButtons) {
|
if (extraButtons) {
|
||||||
[navigationItems addObjectsFromArray:extraButtons];
|
[navigationItems addObjectsFromArray:extraButtons];
|
||||||
}
|
}
|
||||||
[viewController.navigationItem setRightBarButtonItems:(navigationItems.count > 0 ? navigationItems : nil) animated:!DisableAnimations];
|
[self.navigationController.topViewController.navigationItem setRightBarButtonItems:(navigationItems.count > 0 ? navigationItems : nil) animated:!DisableAnimations];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)shouldExtendRightPanel {
|
- (BOOL)shouldExtendRightPanel {
|
||||||
@ -857,6 +857,7 @@ CGFloat const PanelAnimationDuration = 0.2;
|
|||||||
|
|
||||||
// The main view.
|
// The main view.
|
||||||
NavigationController *navigationController = [NavigationController setupNavigationController];
|
NavigationController *navigationController = [NavigationController setupNavigationController];
|
||||||
|
navigationController.manager = self;
|
||||||
self.navigationController = navigationController;
|
self.navigationController = navigationController;
|
||||||
|
|
||||||
UIView *mainView = navigationController.view;
|
UIView *mainView = navigationController.view;
|
||||||
@ -988,9 +989,11 @@ CGFloat const PanelAnimationDuration = 0.2;
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)resetDrawers {
|
- (void)resetDrawers {
|
||||||
if ([self.navigationItemViewController respondsToSelector:@selector(splitViewDidReset)]) {
|
if (!self.navigationItemViewController) { return; }
|
||||||
[((UIViewController<MVMCoreUIDetailViewProtocol> *)self.navigationItemViewController) splitViewDidReset];
|
if ([self navigationBarModelExists]) {
|
||||||
|
[self updateNavigationBarForViewController:self.navigationItemViewController];
|
||||||
} else {
|
} else {
|
||||||
|
// Legacy
|
||||||
[self setLeftPanelIsAccessible:self.leftPanelIsAccessible forViewController:self.navigationItemViewController updateNavigationButtons:YES];
|
[self setLeftPanelIsAccessible:self.leftPanelIsAccessible forViewController:self.navigationItemViewController updateNavigationButtons:YES];
|
||||||
[self setRightPanelIsAccessible:self.rightPanelIsAccessible forViewController:self.navigationItemViewController updateNavigationButtons:YES];
|
[self setRightPanelIsAccessible:self.rightPanelIsAccessible forViewController:self.navigationItemViewController updateNavigationButtons:YES];
|
||||||
|
|
||||||
@ -1066,10 +1069,7 @@ CGFloat const PanelAnimationDuration = 0.2;
|
|||||||
}
|
}
|
||||||
// if it is not presented viewcontroller, existing BAU logic will be working
|
// if it is not presented viewcontroller, existing BAU logic will be working
|
||||||
if (!viewController) {
|
if (!viewController) {
|
||||||
viewController = self.navigationController.topViewController;
|
viewController = [MVMCoreUIUtility getViewControllerTraversingManagers:self.navigationController.topViewController];
|
||||||
if ([viewController conformsToProtocol:@protocol(MVMCoreViewManagerProtocol)]) {
|
|
||||||
viewController = [viewController performSelector:@selector(getCurrentViewController)];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return viewController;
|
return viewController;
|
||||||
}
|
}
|
||||||
@ -1077,10 +1077,7 @@ CGFloat const PanelAnimationDuration = 0.2;
|
|||||||
- (UIViewController *)getCurrentDetailViewController {
|
- (UIViewController *)getCurrentDetailViewController {
|
||||||
__block UIViewController *viewController = nil;
|
__block UIViewController *viewController = nil;
|
||||||
[MVMCoreDispatchUtility performSyncBlockOnMainThread:^{
|
[MVMCoreDispatchUtility performSyncBlockOnMainThread:^{
|
||||||
viewController = self.navigationController.topViewController;
|
viewController = [MVMCoreUIUtility getViewControllerTraversingManagers:self.navigationController.topViewController];
|
||||||
if ([viewController conformsToProtocol:@protocol(MVMCoreViewManagerProtocol)]) {
|
|
||||||
viewController = [viewController performSelector:@selector(getCurrentViewController)];
|
|
||||||
}
|
|
||||||
}];
|
}];
|
||||||
return viewController;
|
return viewController;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
+ (UIEdgeInsets)getMarginsForView:(nullable UIView *)view;
|
+ (UIEdgeInsets)getMarginsForView:(nullable UIView *)view;
|
||||||
|
|
||||||
/// Gets the current visible view controller. Checks presented view controllers first, and then it checks on the NavigationController in the session object.
|
/// Gets the current visible view controller. Checks presented view controllers first, and then it checks on the NavigationController in the session object.
|
||||||
+ (UIViewController *)getCurrentVisibleController;
|
+ (nullable UIViewController *)getCurrentVisibleController;
|
||||||
|
|
||||||
|
/// Gets the first non manager controller.
|
||||||
|
+ (nullable UIViewController *)getViewControllerTraversingManagers:(UIViewController *)viewController;
|
||||||
|
|
||||||
/// Checks if the view or any descendents of the view is currently focused for voice over.
|
/// Checks if the view or any descendents of the view is currently focused for voice over.
|
||||||
+ (BOOL)viewContainsAccessiblityFocus:(nonnull UIView *)view;
|
+ (BOOL)viewContainsAccessiblityFocus:(nonnull UIView *)view;
|
||||||
|
|||||||
@ -63,14 +63,19 @@
|
|||||||
}
|
}
|
||||||
// if it is not presented viewcontroller, existing BAU logic will be working
|
// if it is not presented viewcontroller, existing BAU logic will be working
|
||||||
if (!viewController) {
|
if (!viewController) {
|
||||||
viewController = [MVMCoreUISession sharedGlobal].navigationController.topViewController;
|
viewController = [self getViewControllerTraversingManagers:[MVMCoreUISession sharedGlobal].navigationController.topViewController];
|
||||||
if ([viewController conformsToProtocol:@protocol(MVMCoreViewManagerProtocol)]) {
|
|
||||||
viewController = [viewController performSelector:@selector(getCurrentViewController)];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return viewController;
|
return viewController;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (UIViewController *)getViewControllerTraversingManagers:(UIViewController *)viewController {
|
||||||
|
UIViewController *controller = viewController;
|
||||||
|
while ([controller conformsToProtocol:@protocol(MVMCoreViewManagerProtocol)]) {
|
||||||
|
controller = [controller performSelector:@selector(getCurrentViewController)];
|
||||||
|
}
|
||||||
|
return controller;
|
||||||
|
}
|
||||||
|
|
||||||
+ (BOOL)viewContainsAccessiblityFocus:(nonnull UIView *)view {
|
+ (BOOL)viewContainsAccessiblityFocus:(nonnull UIView *)view {
|
||||||
if (!UIAccessibilityIsVoiceOverRunning()) {
|
if (!UIAccessibilityIsVoiceOverRunning()) {
|
||||||
return NO;
|
return NO;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user