merge
This commit is contained in:
commit
b07278d6dc
@ -189,6 +189,8 @@
|
||||
94F6516D2437954100631BF9 /* Tabs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94F6516C2437954100631BF9 /* Tabs.swift */; };
|
||||
AA0A257824766C8A00862F64 /* ListLeftVariableIconWithRightCaretBodyTextModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA0A257724766C8A00862F64 /* ListLeftVariableIconWithRightCaretBodyTextModel.swift */; };
|
||||
AA0A257A24766CA200862F64 /* ListLeftVariableIconWithRightCaretBodyText.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA0A257924766CA200862F64 /* ListLeftVariableIconWithRightCaretBodyText.swift */; };
|
||||
AA104AC724472DB0004D2810 /* HeadersH1Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA104AC624472DB0004D2810 /* HeadersH1Button.swift */; };
|
||||
AA104AC924472DC7004D2810 /* HeadersH1ButtonModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA104AC824472DC7004D2810 /* HeadersH1ButtonModel.swift */; };
|
||||
AA104ADA244734DB004D2810 /* HeadersH1LandingPageHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA104AD9244734DB004D2810 /* HeadersH1LandingPageHeader.swift */; };
|
||||
AA104ADC244734EA004D2810 /* HeadersH1LandingPageHeaderModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA104ADB244734EA004D2810 /* HeadersH1LandingPageHeaderModel.swift */; };
|
||||
AA104B1A24474A66004D2810 /* HeadersH2Buttons.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA104B1924474A66004D2810 /* HeadersH2Buttons.swift */; };
|
||||
@ -205,6 +207,8 @@
|
||||
AA56A211243C5EFC00303286 /* ListTwoColumnSubsectionDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA56A210243C5EFC00303286 /* ListTwoColumnSubsectionDivider.swift */; };
|
||||
AA617AB02453010A00910B8F /* ListDeviceComplexLinkSmall.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA617AAF2453010A00910B8F /* ListDeviceComplexLinkSmall.swift */; };
|
||||
AA617AB22453012400910B8F /* ListDeviceComplexLinkSmallModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA617AB12453012400910B8F /* ListDeviceComplexLinkSmallModel.swift */; };
|
||||
AA633B3124989EC000731E80 /* HeadersH2PricingTwoRowsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA633B3024989EC000731E80 /* HeadersH2PricingTwoRowsModel.swift */; };
|
||||
AA633B3324989ED500731E80 /* HeadersH2PricingTwoRows.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA633B3224989ED500731E80 /* HeadersH2PricingTwoRows.swift */; };
|
||||
AA69AAF62445BF5700AF3D3B /* ListLeftVariableCheckboxBodyText.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA69AAF52445BF5700AF3D3B /* ListLeftVariableCheckboxBodyText.swift */; };
|
||||
AA69AAF82445BF6800AF3D3B /* ListLeftVariableCheckboxBodyTextModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA69AAF72445BF6800AF3D3B /* ListLeftVariableCheckboxBodyTextModel.swift */; };
|
||||
AA7F32AB246C0F7900C965BA /* ListLeftVariableRadioButtonAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA7F32AA246C0F7900C965BA /* ListLeftVariableRadioButtonAllTextAndLinksModel.swift */; };
|
||||
@ -325,6 +329,7 @@
|
||||
D27CD40E2322EEAF00C1DC07 /* TabsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D27CD40D2322EEAF00C1DC07 /* TabsTableViewCell.swift */; };
|
||||
D27CD4102339057800C1DC07 /* EyebrowHeadlineBodyLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = D27CD40F2339057800C1DC07 /* EyebrowHeadlineBodyLink.swift */; };
|
||||
D282AABA224131D100C46919 /* MFTransparentGIFView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D282AAB9224131D100C46919 /* MFTransparentGIFView.swift */; };
|
||||
D2874024249BA6F300BE950A /* MVMCoreUISplitViewController+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2874023249BA6F300BE950A /* MVMCoreUISplitViewController+Extension.swift */; };
|
||||
D28764AA2458980300CB882D /* ThreeLayerFillMiddleTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28764A92458980300CB882D /* ThreeLayerFillMiddleTemplate.swift */; };
|
||||
D28764AC245898A400CB882D /* ThreeLayerFillMiddleTemplateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28764AB245898A400CB882D /* ThreeLayerFillMiddleTemplateModel.swift */; };
|
||||
D28764F9245A327200CB882D /* TwoLinkView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28764F8245A327200CB882D /* TwoLinkView.swift */; };
|
||||
@ -638,6 +643,8 @@
|
||||
94F6516C2437954100631BF9 /* Tabs.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Tabs.swift; sourceTree = "<group>"; };
|
||||
AA0A257724766C8A00862F64 /* ListLeftVariableIconWithRightCaretBodyTextModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaretBodyTextModel.swift; sourceTree = "<group>"; };
|
||||
AA0A257924766CA200862F64 /* ListLeftVariableIconWithRightCaretBodyText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaretBodyText.swift; sourceTree = "<group>"; };
|
||||
AA104AC624472DB0004D2810 /* HeadersH1Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH1Button.swift; sourceTree = "<group>"; };
|
||||
AA104AC824472DC7004D2810 /* HeadersH1ButtonModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH1ButtonModel.swift; sourceTree = "<group>"; };
|
||||
AA104AD9244734DB004D2810 /* HeadersH1LandingPageHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH1LandingPageHeader.swift; sourceTree = "<group>"; };
|
||||
AA104ADB244734EA004D2810 /* HeadersH1LandingPageHeaderModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH1LandingPageHeaderModel.swift; sourceTree = "<group>"; };
|
||||
AA104B1924474A66004D2810 /* HeadersH2Buttons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2Buttons.swift; sourceTree = "<group>"; };
|
||||
@ -654,6 +661,8 @@
|
||||
AA56A210243C5EFC00303286 /* ListTwoColumnSubsectionDivider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnSubsectionDivider.swift; sourceTree = "<group>"; };
|
||||
AA617AAF2453010A00910B8F /* ListDeviceComplexLinkSmall.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexLinkSmall.swift; sourceTree = "<group>"; };
|
||||
AA617AB12453012400910B8F /* ListDeviceComplexLinkSmallModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexLinkSmallModel.swift; sourceTree = "<group>"; };
|
||||
AA633B3024989EC000731E80 /* HeadersH2PricingTwoRowsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2PricingTwoRowsModel.swift; sourceTree = "<group>"; };
|
||||
AA633B3224989ED500731E80 /* HeadersH2PricingTwoRows.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2PricingTwoRows.swift; sourceTree = "<group>"; };
|
||||
AA69AAF52445BF5700AF3D3B /* ListLeftVariableCheckboxBodyText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxBodyText.swift; sourceTree = "<group>"; };
|
||||
AA69AAF72445BF6800AF3D3B /* ListLeftVariableCheckboxBodyTextModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxBodyTextModel.swift; sourceTree = "<group>"; };
|
||||
AA7F32AA246C0F7900C965BA /* ListLeftVariableRadioButtonAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableRadioButtonAllTextAndLinksModel.swift; sourceTree = "<group>"; };
|
||||
@ -773,6 +782,7 @@
|
||||
D27CD40D2322EEAF00C1DC07 /* TabsTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabsTableViewCell.swift; sourceTree = "<group>"; };
|
||||
D27CD40F2339057800C1DC07 /* EyebrowHeadlineBodyLink.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EyebrowHeadlineBodyLink.swift; sourceTree = "<group>"; };
|
||||
D282AAB9224131D100C46919 /* MFTransparentGIFView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MFTransparentGIFView.swift; sourceTree = "<group>"; };
|
||||
D2874023249BA6F300BE950A /* MVMCoreUISplitViewController+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MVMCoreUISplitViewController+Extension.swift"; sourceTree = "<group>"; };
|
||||
D28764A92458980300CB882D /* ThreeLayerFillMiddleTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreeLayerFillMiddleTemplate.swift; sourceTree = "<group>"; };
|
||||
D28764AB245898A400CB882D /* ThreeLayerFillMiddleTemplateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreeLayerFillMiddleTemplateModel.swift; sourceTree = "<group>"; };
|
||||
D28764F8245A327200CB882D /* TwoLinkView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TwoLinkView.swift; sourceTree = "<group>"; };
|
||||
@ -1040,14 +1050,8 @@
|
||||
5206F150241144A900658DC5 /* Headers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AAA74A182410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift */,
|
||||
AAA74A162410C04600080241 /* HeadersH2NoButtonsBodyText.swift */,
|
||||
AA26850D244840C300CE34CC /* HeadersH2TinyButtonModel.swift */,
|
||||
AA26850B244840AE00CE34CC /* HeadersH2TinyButton.swift */,
|
||||
AA104B1B24474A76004D2810 /* HeadersH2ButtonsModel.swift */,
|
||||
AA104B1924474A66004D2810 /* HeadersH2Buttons.swift */,
|
||||
AA104ADB244734EA004D2810 /* HeadersH1LandingPageHeaderModel.swift */,
|
||||
AA104AD9244734DB004D2810 /* HeadersH1LandingPageHeader.swift */,
|
||||
D287955224A2504C0056BF75 /* H1 */,
|
||||
D287955324A250550056BF75 /* H2 */,
|
||||
);
|
||||
path = Headers;
|
||||
sourceTree = "<group>";
|
||||
@ -1493,6 +1497,32 @@
|
||||
path = Selectors;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D287955224A2504C0056BF75 /* H1 */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA104AC824472DC7004D2810 /* HeadersH1ButtonModel.swift */,
|
||||
AA104AC624472DB0004D2810 /* HeadersH1Button.swift */,
|
||||
AA104ADB244734EA004D2810 /* HeadersH1LandingPageHeaderModel.swift */,
|
||||
AA104AD9244734DB004D2810 /* HeadersH1LandingPageHeader.swift */,
|
||||
);
|
||||
path = H1;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D287955324A250550056BF75 /* H2 */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AAA74A182410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift */,
|
||||
AAA74A162410C04600080241 /* HeadersH2NoButtonsBodyText.swift */,
|
||||
AA26850D244840C300CE34CC /* HeadersH2TinyButtonModel.swift */,
|
||||
AA26850B244840AE00CE34CC /* HeadersH2TinyButton.swift */,
|
||||
AA104B1B24474A76004D2810 /* HeadersH2ButtonsModel.swift */,
|
||||
AA104B1924474A66004D2810 /* HeadersH2Buttons.swift */,
|
||||
AA633B3024989EC000731E80 /* HeadersH2PricingTwoRowsModel.swift */,
|
||||
AA633B3224989ED500731E80 /* HeadersH2PricingTwoRows.swift */,
|
||||
);
|
||||
path = H2;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D29DF0C221E404D4003B2FB9 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -1819,6 +1849,7 @@
|
||||
D29DF15321E69760003B2FB9 /* MVMCoreUIPanelButtonProtocol.h */,
|
||||
D29DF11A21E684A9003B2FB9 /* MVMCoreUISplitViewController.h */,
|
||||
D29DF11B21E684A9003B2FB9 /* MVMCoreUISplitViewController.m */,
|
||||
D2874023249BA6F300BE950A /* MVMCoreUISplitViewController+Extension.swift */,
|
||||
);
|
||||
path = SplitViewController;
|
||||
sourceTree = "<group>";
|
||||
@ -2231,6 +2262,7 @@
|
||||
0ABD136D237CAD1E0081388D /* DateDropdownEntryField.swift in Sources */,
|
||||
D264FA8E243BCD9A00D98315 /* CollectionTemplate.swift in Sources */,
|
||||
0A7EF85B23D8A52800B2AAD1 /* EntryFieldModel.swift in Sources */,
|
||||
AA633B3124989EC000731E80 /* HeadersH2PricingTwoRowsModel.swift in Sources */,
|
||||
8DEFA95C243DAC20000D27E5 /* ListThreeColumnDataUsageDividerModel.swift in Sources */,
|
||||
D2092357244FA1EF0044AD09 /* ThreeLayerModelBase.swift in Sources */,
|
||||
0A1B4A96233BB18F005B3FB4 /* CheckboxLabel.swift in Sources */,
|
||||
@ -2268,6 +2300,7 @@
|
||||
942C378E2412F5B60066E45E /* ModalMoleculeStackTemplate.swift in Sources */,
|
||||
8D8067D32444473A00203BE8 /* ListRightVariablePriceChangeAllTextAndLinks.swift in Sources */,
|
||||
8D4687E4242E2DF300802879 /* ListFourColumnDataUsageListItem.swift in Sources */,
|
||||
D2874024249BA6F300BE950A /* MVMCoreUISplitViewController+Extension.swift in Sources */,
|
||||
01F2A03223A4498200D954D8 /* CaretLinkModel.swift in Sources */,
|
||||
0A7BAFA1232BE61800FB8E22 /* Checkbox.swift in Sources */,
|
||||
011B58F023A2AA980085F53C /* ListItemModelProtocol.swift in Sources */,
|
||||
@ -2329,6 +2362,7 @@
|
||||
AA7F32AB246C0F7900C965BA /* ListLeftVariableRadioButtonAllTextAndLinksModel.swift in Sources */,
|
||||
8D084AD02410BF4800951227 /* ListOneColumnFullWidthTextBodyTextModel.swift in Sources */,
|
||||
D253BB9E2458751F002DE544 /* BGImageMoleculeModel.swift in Sources */,
|
||||
AA104AC924472DC7004D2810 /* HeadersH1ButtonModel.swift in Sources */,
|
||||
0ABD1371237DB0450081388D /* ItemDropdownEntryField.swift in Sources */,
|
||||
8D24041123E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift in Sources */,
|
||||
BB2FB3BD247E7EF200DF73CD /* Tags.swift in Sources */,
|
||||
@ -2398,6 +2432,7 @@
|
||||
BB54C5202434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift in Sources */,
|
||||
948DB67E2326DCD90011F916 /* MultiProgress.swift in Sources */,
|
||||
013F801923FB4A8E00AD8013 /* UIContentMode+Extension.swift in Sources */,
|
||||
AA104AC724472DB0004D2810 /* HeadersH1Button.swift in Sources */,
|
||||
525239C22407BD1000454969 /* ListTwoColumnPriceDetails.swift in Sources */,
|
||||
AA997252247530B100FC7472 /* ListLeftVariableIconAllTextLinks.swift in Sources */,
|
||||
D2A5146122121FBF00345BFB /* MoleculeStackTemplate.swift in Sources */,
|
||||
@ -2449,6 +2484,7 @@
|
||||
0A25209824645B76000FA9F6 /* TextViewEntryFieldModel.swift in Sources */,
|
||||
525019DD2406430800EED91C /* ListProgressBarDataModel.swift in Sources */,
|
||||
C6FA7D5223C77A4A00A3614A /* UnOrderedList.swift in Sources */,
|
||||
AA633B3324989ED500731E80 /* HeadersH2PricingTwoRows.swift in Sources */,
|
||||
01509D8F2327EC6F00EF99AA /* MoleculeTableViewCell.swift in Sources */,
|
||||
0A6682A22434DB4F00AD3CA1 /* ListLeftVariableRadioButtonBodyText.swift in Sources */,
|
||||
EA5124FD243601600051A3A4 /* BGImageHeadlineBodyButton.swift in Sources */,
|
||||
|
||||
@ -204,10 +204,12 @@ import Foundation
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnDataUsageDivider.self, viewModelClass: ListThreeColumnDataUsageDividerModel.self)
|
||||
|
||||
// Designed Headers
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: HeadersH1Button.self, viewModelClass: HeadersH1ButtonModel.self)
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: HeadersH1LandingPageHeader.self, viewModelClass: HeadersH1LandingPageHeaderModel.self)
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2NoButtonsBodyText.self, viewModelClass: HeadersH2NoButtonsBodyTextModel.self)
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2TinyButton.self, viewModelClass: HeadersH2TinyButtonModel.self)
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2Buttons.self, viewModelClass: HeadersH2ButtonsModel.self)
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: HeadersH1LandingPageHeader.self, viewModelClass: HeadersH1LandingPageHeaderModel.self)
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2PricingTwoRows.self, viewModelClass: HeadersH2PricingTwoRowsModel.self)
|
||||
|
||||
// Device Items
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: ListDeviceComplexButtonMedium.self, viewModelClass: ListDeviceComplexButtonMediumModel.self)
|
||||
|
||||
@ -0,0 +1,59 @@
|
||||
//
|
||||
// HeadersH1Button.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Lekshmi S on 04/03/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
@objcMembers open class HeadersH1Button: HeaderView {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Outlets
|
||||
//--------------------------------------------------
|
||||
public let headlineBody = HeadlineBody(frame: .zero)
|
||||
public let buttons = TwoButtonView(frame: .zero)
|
||||
public let stack: Stack<StackModel>
|
||||
|
||||
//-------------------------------------------------------
|
||||
// MARK: - Initializers
|
||||
//-------------------------------------------------------
|
||||
public override init(frame: CGRect) {
|
||||
stack = Stack<StackModel>.createStack(with: [headlineBody, buttons], spacing: Padding.Eighteen)
|
||||
super.init(frame: frame)
|
||||
}
|
||||
|
||||
public required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
//-------------------------------------------------------
|
||||
// MARK: - View Lifecycle
|
||||
//-------------------------------------------------------
|
||||
open override func setupView() {
|
||||
super.setupView()
|
||||
headlineBody.styleLandingPageHeader()
|
||||
addMolecule(stack)
|
||||
stack.restack()
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
// MARK: - Molecule
|
||||
//------------------------------------------------------
|
||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||
super.set(with: model, delegateObject, additionalData)
|
||||
guard let model = model as? HeadersH1ButtonModel else { return }
|
||||
headlineBody.set(with: model.headlineBody, delegateObject, additionalData)
|
||||
buttons.set(with: model.buttons, delegateObject, additionalData)
|
||||
}
|
||||
|
||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return 121
|
||||
}
|
||||
|
||||
open override func reset() {
|
||||
super.reset()
|
||||
headlineBody.styleLandingPageHeader()
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
//
|
||||
// HeadersH1ButtonModel.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Lekshmi S on 04/03/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public class HeadersH1ButtonModel: HeaderModel, MoleculeModelProtocol {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Properties
|
||||
//--------------------------------------------------
|
||||
public static var identifier: String = "headerH1Btn"
|
||||
public var headlineBody: HeadlineBodyModel
|
||||
public var buttons: TwoButtonViewModel
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializer
|
||||
//--------------------------------------------------
|
||||
public init(headlineBody: HeadlineBodyModel, buttons: TwoButtonViewModel) {
|
||||
self.headlineBody = headlineBody
|
||||
self.buttons = buttons
|
||||
super.init()
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Keys
|
||||
//--------------------------------------------------
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case moleculeName
|
||||
case headlineBody
|
||||
case buttons
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Codec
|
||||
//--------------------------------------------------
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
headlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .headlineBody)
|
||||
buttons = try typeContainer.decode(TwoButtonViewModel.self, forKey: .buttons)
|
||||
try super.init(from: decoder)
|
||||
}
|
||||
|
||||
public override func encode(to encoder: Encoder) throws {
|
||||
try super.encode(to: encoder)
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
try container.encode(headlineBody, forKey: .headlineBody)
|
||||
try container.encode(buttons, forKey: .buttons)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,121 @@
|
||||
//
|
||||
// HeadersH2PricingTwoRows.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Lekshmi S on 16/06/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
@objcMembers open class HeadersH2PricingTwoRows: HeaderView {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Outlets
|
||||
//--------------------------------------------------
|
||||
public let headline = Label(fontStyle: .RegularTitleLarge)
|
||||
public let body = Label(fontStyle: .RegularMicro)
|
||||
public let subBody = Label(fontStyle: .RegularMicro)
|
||||
public let body2 = Label(fontStyle: .RegularMicro)
|
||||
public let subBody2 = Label(fontStyle: .RegularMicro)
|
||||
public let body3 = Label(fontStyle: .RegularMicro)
|
||||
public let subBody3 = Label(fontStyle: .RegularMicro)
|
||||
public let verticalLine1 = Line()
|
||||
public let verticalLine2 = Line()
|
||||
public let verticalStack1: Stack<StackModel>
|
||||
public let verticalStack2: Stack<StackModel>
|
||||
public let verticalStack3: Stack<StackModel>
|
||||
public let horizontalStack: Stack<StackModel>
|
||||
public let stack: Stack<StackModel>
|
||||
|
||||
//-------------------------------------------------------
|
||||
// MARK: - Initializers
|
||||
//-------------------------------------------------------
|
||||
public override init(frame: CGRect) {
|
||||
verticalStack1 = Stack<StackModel>.createStack(with: [body, subBody], spacing: 0)
|
||||
verticalStack2 = Stack<StackModel>.createStack(with: [body2, subBody2], spacing: 0)
|
||||
verticalStack3 = Stack<StackModel>.createStack(with: [body3, subBody3], spacing: 0)
|
||||
horizontalStack = Stack<StackModel>.createStack(with: [(view: verticalStack1, model: StackItemModel(percent: 29, verticalAlignment: .top)), (view: verticalLine1, model: StackItemModel(verticalAlignment: .top)),
|
||||
(view: verticalStack2, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .top)),
|
||||
(view: verticalLine2, model: StackItemModel(verticalAlignment: .top)),
|
||||
(view: verticalStack3, model: StackItemModel(percent: 32, verticalAlignment: .top))],
|
||||
axis: .horizontal)
|
||||
stack = Stack<StackModel>.createStack(with: [headline, horizontalStack], spacing: 8)
|
||||
super.init(frame: frame)
|
||||
}
|
||||
|
||||
public required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
//-------------------------------------------------------
|
||||
// MARK: - Lifecycle
|
||||
//-------------------------------------------------------
|
||||
open override func setupView() {
|
||||
super.setupView()
|
||||
setDefaults()
|
||||
body.numberOfLines = 1
|
||||
body.lineBreakMode = .byTruncatingTail
|
||||
body2.numberOfLines = 1
|
||||
body2.lineBreakMode = .byTruncatingTail
|
||||
body3.numberOfLines = 1
|
||||
body3.lineBreakMode = .byTruncatingTail
|
||||
|
||||
verticalLine1.widthConstraint?.isActive = true
|
||||
verticalLine1.backgroundColor = .mvmBlack
|
||||
verticalLine2.widthConstraint?.isActive = true
|
||||
verticalLine2.backgroundColor = .mvmBlack
|
||||
|
||||
addMolecule(stack)
|
||||
stack.restack()
|
||||
verticalStack1.restack()
|
||||
verticalStack2.restack()
|
||||
verticalStack3.restack()
|
||||
horizontalStack.restack()
|
||||
setLineHeight()
|
||||
}
|
||||
|
||||
open func setDefaults() {
|
||||
headline.setFontStyle(.BoldTitleLarge)
|
||||
body.setFontStyle(.RegularMicro)
|
||||
subBody.setFontStyle(.RegularMicro)
|
||||
body2.setFontStyle(.RegularMicro)
|
||||
subBody2.setFontStyle(.RegularMicro)
|
||||
body3.setFontStyle(.RegularMicro)
|
||||
subBody3.setFontStyle(.RegularMicro)
|
||||
subBody.textColor = .mvmCoolGray6
|
||||
subBody2.textColor = .mvmCoolGray6
|
||||
subBody3.textColor = .mvmCoolGray6
|
||||
}
|
||||
|
||||
open func setLineHeight() {
|
||||
verticalLine1.heightConstraint?.isActive = false
|
||||
verticalLine1.heightConstraint = verticalLine1.heightAnchor.constraint(equalTo: body2.heightAnchor, multiplier: 1)
|
||||
verticalLine1.heightConstraint?.isActive = true
|
||||
|
||||
verticalLine2.heightConstraint?.isActive = false
|
||||
verticalLine2.heightConstraint = verticalLine2.heightAnchor.constraint(equalTo: body3.heightAnchor, multiplier: 1)
|
||||
verticalLine2.heightConstraint?.isActive = true
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
// MARK: - Molecule
|
||||
//------------------------------------------------------
|
||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.set(with: model, delegateObject, additionalData)
|
||||
guard let model = model as? HeadersH2PricingTwoRowsModel else { return }
|
||||
headline.set(with: model.headline, delegateObject, additionalData)
|
||||
verticalStack1.updateContainedMolecules(with: [model.body, model.subBody], delegateObject, additionalData)
|
||||
verticalStack2.updateContainedMolecules(with: [model.body2, model.subBody2], delegateObject, additionalData)
|
||||
verticalStack3.updateContainedMolecules(with: [model.body3, model.subBody3], delegateObject, additionalData)
|
||||
setLineHeight()
|
||||
}
|
||||
|
||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return 121
|
||||
}
|
||||
|
||||
open override func reset() {
|
||||
super.reset()
|
||||
setDefaults()
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,89 @@
|
||||
//
|
||||
// HeadersH2PricingTwoRowsModel.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Lekshmi S on 16/06/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public class HeadersH2PricingTwoRowsModel: HeaderModel, MoleculeModelProtocol {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Properties
|
||||
//--------------------------------------------------
|
||||
public static var identifier: String = "headerH2TwoRows"
|
||||
public var headline: LabelModel
|
||||
public var body: LabelModel
|
||||
public var subBody: LabelModel?
|
||||
public var body2: LabelModel
|
||||
public var subBody2: LabelModel?
|
||||
public var body3: LabelModel
|
||||
public var subBody3: LabelModel?
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializer
|
||||
//--------------------------------------------------
|
||||
public init(headline: LabelModel, body: LabelModel, subBody: LabelModel? = nil, body2: LabelModel, subBody2: LabelModel? = nil, body3: LabelModel, subBody3: LabelModel? = nil) {
|
||||
self.headline = headline
|
||||
self.body = body
|
||||
self.subBody = subBody
|
||||
self.body2 = body2
|
||||
self.subBody2 = subBody2
|
||||
self.body3 = body3
|
||||
self.subBody3 = subBody3
|
||||
super.init()
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Methods
|
||||
//--------------------------------------------------
|
||||
public override func setDefaults() {
|
||||
super.setDefaults()
|
||||
subBody?.attributes = [LabelAttributeStrikeThroughModel(0, subBody?.text.count ?? 0)]
|
||||
subBody2?.attributes = [LabelAttributeStrikeThroughModel(0, subBody2?.text.count ?? 0)]
|
||||
subBody3?.attributes = [LabelAttributeStrikeThroughModel(0, subBody3?.text.count ?? 0)]
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Keys
|
||||
//--------------------------------------------------
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case moleculeName
|
||||
case headline
|
||||
case body
|
||||
case subBody
|
||||
case body2
|
||||
case subBody2
|
||||
case body3
|
||||
case subBody3
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Codec
|
||||
//--------------------------------------------------
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
headline = try typeContainer.decode(LabelModel.self, forKey: .headline)
|
||||
body = try typeContainer.decode(LabelModel.self, forKey: .body)
|
||||
subBody = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .subBody)
|
||||
body2 = try typeContainer.decode(LabelModel.self, forKey: .body2)
|
||||
subBody2 = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .subBody2)
|
||||
body3 = try typeContainer.decode(LabelModel.self, forKey: .body3)
|
||||
subBody3 = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .subBody3)
|
||||
try super.init(from: decoder)
|
||||
}
|
||||
|
||||
public override func encode(to encoder: Encoder) throws {
|
||||
try super.encode(to: encoder)
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
try container.encode(headline, forKey: .headline)
|
||||
try container.encode(body, forKey: .body)
|
||||
try container.encodeIfPresent(subBody, forKey: .subBody)
|
||||
try container.encode(body2, forKey: .body2)
|
||||
try container.encodeIfPresent(subBody2, forKey: .subBody2)
|
||||
try container.encode(body3, forKey: .body3)
|
||||
try container.encodeIfPresent(subBody3, forKey: .subBody3)
|
||||
}
|
||||
}
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
@objc open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMCoreViewManagerViewControllerProtocol, MoleculeDelegateProtocol, FormHolderProtocol, MVMCoreActionDelegateProtocol, MVMCoreLoadDelegateProtocol, UITextFieldDelegate, UITextViewDelegate, ObservingTextFieldDelegate {
|
||||
@objc open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMCoreViewManagerViewControllerProtocol, MoleculeDelegateProtocol, FormHolderProtocol, MVMCoreActionDelegateProtocol, MVMCoreLoadDelegateProtocol, UITextFieldDelegate, UITextViewDelegate, ObservingTextFieldDelegate, MVMCoreUIDetailViewProtocol {
|
||||
@objc public var pageType: String?
|
||||
@objc public var loadObject: MVMCoreLoadObject?
|
||||
public var pageModel: MVMControllerModelProtocol?
|
||||
@ -196,18 +196,8 @@ import UIKit
|
||||
// We additionally want our left items
|
||||
navigationItem.leftItemsSupplementBackButton = true
|
||||
|
||||
NavigationController.set(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
||||
|
||||
// Special logic when using the split view controller. Legacy Update Panels. Change how this is done.
|
||||
guard navigationController == MVMCoreUISplitViewController.main()?.navigationController,
|
||||
navigationController.topViewController == viewController else { return }
|
||||
|
||||
MVMCoreUISession.sharedGlobal()?.splitViewController?.setupPanels()
|
||||
showBottomProgressBar()
|
||||
|
||||
MVMCoreUISplitViewController.main()?.setLeftPanelIsAccessible(isMasterInitiallyAccessible(), for: viewController)
|
||||
MVMCoreUISplitViewController.main()?.setRightPanelIsAccessible(isSupportInitiallyAccessible(), for: viewController)
|
||||
MVMCoreUISession.sharedGlobal()?.splitViewController?.setNavigationIconColor(navigationItemModel.tintColor.uiColor)
|
||||
// Utilize helper function to set the split view and navigation item state.
|
||||
MVMCoreUISplitViewController.setSplitViewController(for: viewController, navigationController: navigationController, navigationItemModel: navigationItemModel, leftPanelAccessible: isMasterInitiallyAccessible(), rightPanelAccessible: isSupportInitiallyAccessible(), progress: bottomProgress() ?? 0)
|
||||
}
|
||||
|
||||
// Eventually will be moved to server
|
||||
@ -249,12 +239,10 @@ import UIKit
|
||||
}
|
||||
|
||||
// Eventually will be moved to Model
|
||||
open func showBottomProgressBar() {
|
||||
if MVMCoreUISplitViewController.main()?.getCurrentVisibleController() == self,
|
||||
let progressString = loadObject?.pageJSON?.optionalStringForKey(KeyProgressPercent),
|
||||
let progress = Float(progressString) {
|
||||
MVMCoreUISplitViewController.main()?.setBottomProgressBarProgress(progress / Float(100))
|
||||
}
|
||||
open func bottomProgress() -> Float? {
|
||||
guard let progressString = loadObject?.pageJSON?.optionalStringForKey(KeyProgressPercent),
|
||||
let progress = Float(progressString) else { return nil }
|
||||
return (progress / Float(100))
|
||||
}
|
||||
|
||||
// MARK: - TabBar
|
||||
@ -318,24 +306,23 @@ import UIKit
|
||||
super.viewDidLayoutSubviews()
|
||||
}
|
||||
|
||||
open override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
open func pageShown() {
|
||||
// Update the navigation bar ui when view is appearing.
|
||||
setNavigationController()
|
||||
|
||||
// Update the navigation bar ui when view is appearing. Can remove check in the future, see viewControllerReady
|
||||
if manager == nil {
|
||||
setNavigationController()
|
||||
}
|
||||
// Update tab if needed.
|
||||
updateTabBar()
|
||||
|
||||
// Track.
|
||||
MVMCoreUISession.sharedGlobal()?.currentPageType = pageType
|
||||
MVMCoreUILoggingHandler.shared()?.defaultLogPageState(forController: self)
|
||||
}
|
||||
|
||||
open override func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
|
||||
// Update tab if needed.
|
||||
updateTabBar()
|
||||
|
||||
if manager == nil {
|
||||
MVMCoreUISession.sharedGlobal()?.currentPageType = pageType
|
||||
MVMCoreUILoggingHandler.shared()?.defaultLogPageState(forController: self)
|
||||
pageShown()
|
||||
}
|
||||
|
||||
executeBehaviors { (behavior: PageVisibilityBehavior) in
|
||||
@ -372,13 +359,7 @@ import UIKit
|
||||
|
||||
// MARK: - MVMCoreViewManagerViewControllerProtocol
|
||||
open func viewControllerReady(inManager manager: UIViewController & MVMCoreViewManagerProtocol) {
|
||||
// TODO: This check and set aren't technically needed anymore. The one in viewwillappear should be enough. However, there is a timing issue with the manager where the screen lays out before the menu shows, so the screen grows off the screen. Can fix in the future.
|
||||
if let _ = self.view {
|
||||
setNavigationController()
|
||||
}
|
||||
// Janky way to track current page.
|
||||
MVMCoreUISession.sharedGlobal()?.currentPageType = pageType
|
||||
MVMCoreUILoggingHandler.shared()?.defaultLogPageState(forController: self)
|
||||
pageShown()
|
||||
}
|
||||
|
||||
// MARK: - MVMCoreLoadDelegateProtocol
|
||||
@ -440,6 +421,13 @@ import UIKit
|
||||
open func addMolecules(_ molecules: [ListItemModelProtocol & MoleculeModelProtocol], indexPath: IndexPath, animation: UITableView.RowAnimation) {}
|
||||
open func removeMolecules(_ molecules: [ListItemModelProtocol & MoleculeModelProtocol], animation: UITableView.RowAnimation) {}
|
||||
|
||||
// MARK: - MVMCoreUIDetailViewProtocol
|
||||
|
||||
// Reset the navigation state.
|
||||
public func splitViewDidReset() {
|
||||
setNavigationController()
|
||||
}
|
||||
|
||||
// MARK: - UITextFieldDelegate (Check if this is still needed)
|
||||
// To Remove TextFields Bug: Keyboard is not dismissing after reaching textfield max length limit
|
||||
open func textFieldShouldReturn(_ textField: UITextField) -> Bool {
|
||||
|
||||
@ -67,8 +67,8 @@ import UIKit
|
||||
viewController.navigationItem.rightBarButtonItems = rightItems.count > 0 ? rightItems : nil
|
||||
}
|
||||
|
||||
/// Convenience function for setting navigation bar with model.
|
||||
public static func set(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) {
|
||||
/// Convenience function for setting the navigation bar ui, except for the buttons.
|
||||
public static func setNavigationUI(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) {
|
||||
viewController.navigationItem.title = navigationItemModel.title
|
||||
viewController.navigationItem.accessibilityLabel = navigationItemModel.title
|
||||
viewController.navigationItem.hidesBackButton = (navigationItemModel.backButton != nil)
|
||||
@ -86,8 +86,11 @@ import UIKit
|
||||
if let navigationController = navigationController as? NavigationController {
|
||||
navigationController.separatorView?.isHidden = navigationItemModel.line?.type ?? .standard == .none
|
||||
}
|
||||
}
|
||||
|
||||
// Sets up the navigation buttons.
|
||||
/// Convenience function for setting navigation bar with model.
|
||||
public static func set(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) {
|
||||
setNavigationUI(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
||||
setNavigationButtons(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
||||
}
|
||||
|
||||
|
||||
@ -42,6 +42,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (UIStatusBarStyle)defaultStatusBarStyle;
|
||||
- (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
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@ -0,0 +1,124 @@
|
||||
//
|
||||
// MVMCoreUISplitViewController+Extension.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 6/18/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public extension MVMCoreUISplitViewController {
|
||||
|
||||
/// Convenience function. Sets the navigation and split view properties for the view controller. Optional parameters use current value if not set.
|
||||
static func setSplitViewController(for viewController: UIViewController, navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, leftPanelAccessible: Bool? = nil, rightPanelAccessible: Bool? = nil, progress: Float? = nil) {
|
||||
guard let splitView = MVMCoreUISplitViewController.main(),
|
||||
navigationController == splitView.navigationController,
|
||||
navigationController.topViewController == viewController else {
|
||||
NavigationController.set(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
||||
return
|
||||
}
|
||||
splitView.set(for: viewController, navigationController: navigationController, navigationItemModel: navigationItemModel, leftPanelAccessible: leftPanelAccessible, rightPanelAccessible: rightPanelAccessible, progress: progress)
|
||||
}
|
||||
|
||||
/// Sets the navigation item for the view controller based on the model and splitview controller
|
||||
func set(for viewController: UIViewController, navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, leftPanelAccessible: Bool? = nil, rightPanelAccessible: Bool? = nil, progress: Float? = nil) {
|
||||
|
||||
// Setup the panels.
|
||||
setupPanels()
|
||||
|
||||
NavigationController.setNavigationUI(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
||||
|
||||
setLeftPanelIsAccessible(leftPanelAccessible ?? leftPanelIsAccessible, for: viewController, updateNavigationButtons: false)
|
||||
setRightPanelIsAccessible(rightPanelAccessible ?? rightPanelIsAccessible, for: viewController, updateNavigationButtons: false)
|
||||
|
||||
setLeftNavigationButtons(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
||||
setRightNavigationButtons(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
||||
|
||||
setNavigationIconColor(navigationItemModel.tintColor.uiColor)
|
||||
|
||||
if let progress = progress {
|
||||
setBottomProgressBarProgress(progress)
|
||||
}
|
||||
}
|
||||
|
||||
/// Sets the left navigation items for the view controller based on model and splitview.
|
||||
func setLeftNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) {
|
||||
var leftItems: [UIBarButtonItem] = []
|
||||
let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject
|
||||
|
||||
// Add back button first.
|
||||
if let backButtonModel = navigationItemModel?.backButton {
|
||||
if navigationController.viewControllers.count > 1 || navigationItemModel!.alwaysShowBackButton {
|
||||
leftItems.append(backButtonModel.createNavigationItemButton(delegateObject: delegate, additionalData: nil))
|
||||
}
|
||||
} else if let backButton = backButton,
|
||||
navigationController.viewControllers.count > 1 {
|
||||
leftItems.append(backButton)
|
||||
}
|
||||
|
||||
// Add the panel button after the back button.
|
||||
if let panelButton = leftPanelButton,
|
||||
leftPanelIsAccessible,
|
||||
!leftPanelStaysExtended() {
|
||||
leftItems.append(panelButton)
|
||||
}
|
||||
|
||||
// Add other model buttons
|
||||
if let leftItemModels = navigationItemModel?.additionalLeftButtons {
|
||||
for item in leftItemModels {
|
||||
leftItems.append(item.createNavigationItemButton(delegateObject: delegate, additionalData: nil))
|
||||
}
|
||||
}
|
||||
|
||||
// Add any buttons added by the splitview.
|
||||
if let additionalLeftButtons = additionalLeftButtons(for: viewController) {
|
||||
leftItems.append(contentsOf: additionalLeftButtons)
|
||||
}
|
||||
|
||||
viewController.navigationItem.setLeftBarButtonItems(leftItems.count > 0 ? leftItems : nil, animated: !DisableAnimations.boolValue)
|
||||
}
|
||||
|
||||
/// Sets the right navigation items for the view controller based on model and splitview.
|
||||
func setRightNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) {
|
||||
let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject
|
||||
var rightItems: [UIBarButtonItem] = []
|
||||
|
||||
// Add the panel button first.
|
||||
if let panelButton = rightPanelButton,
|
||||
rightPanelIsAccessible,
|
||||
!rightPanelStaysExtended() {
|
||||
rightItems.append(panelButton)
|
||||
}
|
||||
|
||||
// Add other model buttons
|
||||
if let rightItemModels = navigationItemModel?.additionalRightButtons {
|
||||
for item in rightItemModels {
|
||||
rightItems.append(item.createNavigationItemButton(delegateObject: delegate, additionalData: nil))
|
||||
}
|
||||
}
|
||||
|
||||
// Add any buttons added by the splitview.
|
||||
if let additionalRightButtons = additionalRightButtons(for: viewController) {
|
||||
rightItems.append(contentsOf: additionalRightButtons)
|
||||
}
|
||||
|
||||
viewController.navigationItem.setRightBarButtonItems(rightItems.count > 0 ? rightItems : nil, animated: !DisableAnimations.boolValue)
|
||||
}
|
||||
|
||||
// MARK: - Legacy Functions
|
||||
/// Convenience setter for legacy files. Sets the navigation item for the view controller based on the json and splitview controller
|
||||
@objc static func setSplitViewController(for viewController: UIViewController, navigationController: UINavigationController, navigationJSON: [String: Any], leftPanelAccessible: Bool, rightPanelAccessible: Bool, progress: NSNumber?) throws {
|
||||
guard let navigationItemModel = try MoleculeObjectMapping.shared()?.getMoleculeModelForJSON(navigationJSON) as? (MoleculeModelProtocol & NavigationItemModelProtocol) else {
|
||||
throw ModelRegistry.Error.decoderOther(message: "Model not a bar model")
|
||||
}
|
||||
guard let splitView = MVMCoreUISplitViewController.main(),
|
||||
navigationController == splitView.navigationController,
|
||||
navigationController.topViewController == viewController else {
|
||||
NavigationController.set(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
|
||||
return
|
||||
}
|
||||
let progress = progress?.floatValue
|
||||
splitView.set(for: viewController, navigationController: navigationController, navigationItemModel: navigationItemModel, leftPanelAccessible: leftPanelAccessible, rightPanelAccessible: rightPanelAccessible, progress: progress)
|
||||
}
|
||||
}
|
||||
@ -67,10 +67,10 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) {
|
||||
#pragma mark - Panel Functions
|
||||
|
||||
// Sets if the left panel accessible for the view controller. Will show or hide the button.
|
||||
- (void)setLeftPanelIsAccessible:(BOOL)leftPanelIsAccessible forViewController:(nonnull UIViewController *)viewController;
|
||||
- (void)setLeftPanelIsAccessible:(BOOL)leftPanelIsAccessible forViewController:(nonnull UIViewController *)viewController updateNavigationButtons:(BOOL)updateNavigationButtons;
|
||||
|
||||
// Sets if the right panel accessible for the view controller. Will show or hide the button.
|
||||
- (void)setRightPanelIsAccessible:(BOOL)rightPanelIsAccessible forViewController:(nonnull UIViewController *)viewController;
|
||||
- (void)setRightPanelIsAccessible:(BOOL)rightPanelIsAccessible forViewController:(nonnull UIViewController *)viewController updateNavigationButtons:(BOOL)updateNavigationButtons;
|
||||
|
||||
- (void)hideLeftPanelIfNeededAnimated:(BOOL)animated;
|
||||
- (void)showLeftPanelAnimated:(BOOL)animated;
|
||||
@ -94,6 +94,12 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) {
|
||||
/// Updates the panels that are used.
|
||||
- (void)setupPanels;
|
||||
|
||||
/// Returns if the left panel is staying extended (usually do to screen size threshold)
|
||||
- (BOOL)leftPanelStaysExtended;
|
||||
|
||||
/// Returns if the right panel is staying extended (usually do to screen size threshold)
|
||||
- (BOOL)rightPanelStaysExtended;
|
||||
|
||||
#pragma mark - Bottom Progress Bar
|
||||
|
||||
- (void)setBottomProgressBarProgress:(float)progress;
|
||||
|
||||
@ -110,11 +110,11 @@ CGFloat const PanelAnimationDuration = 0.2;
|
||||
}
|
||||
|
||||
- (nullable NSArray <UIBarButtonItem *>*)additionalLeftButtonsForViewController:(nonnull UIViewController *)viewController {
|
||||
return viewController.navigationItem.leftBarButtonItems;
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (nullable NSArray <UIBarButtonItem *>*)additionalRightButtonsForViewController:(nonnull UIViewController *)viewController {
|
||||
return viewController.navigationItem.rightBarButtonItems;
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (CGFloat)leftPanelExtendedWidth {
|
||||
@ -234,19 +234,27 @@ CGFloat const PanelAnimationDuration = 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)leftPanelStaysExtended {
|
||||
MFNumberOfDrawers numberOfDrawers = [self numberOfDrawersShouldShow:self.transitionWidth];
|
||||
return [self shouldExtendLeftPanel:numberOfDrawers] && (numberOfDrawers != MFOneDrawer || self.explictlyShowingPanel != self.rightPanel);
|
||||
}
|
||||
|
||||
- (void)setLeftNavigationItemForViewController:(UIViewController * _Nonnull)viewController accessible:(BOOL)accessible extended:(BOOL)extended {
|
||||
NSMutableArray *leftBarButtonItems = [NSMutableArray array];
|
||||
NSArray *extraButtons = [self additionalLeftButtonsForViewController:viewController];
|
||||
if ((accessible && !extended) && self.leftPanelButton && ![extraButtons containsObject:self.leftPanelButton]) {
|
||||
if ([viewController.navigationController.viewControllers count] > 1) {
|
||||
[leftBarButtonItems addObject:self.backButton];
|
||||
}
|
||||
if ((accessible && !extended) && self.leftPanelButton) {
|
||||
[leftBarButtonItems addObject:self.leftPanelButton];
|
||||
}
|
||||
NSArray *extraButtons = [self additionalLeftButtonsForViewController:viewController];
|
||||
if (extraButtons) {
|
||||
[leftBarButtonItems addObjectsFromArray:extraButtons];
|
||||
}
|
||||
[viewController.navigationItem setLeftBarButtonItems:(leftBarButtonItems.count > 0 ? leftBarButtonItems : nil) animated:!DisableAnimations];
|
||||
}
|
||||
|
||||
- (void)setLeftPanelIsAccessible:(BOOL)leftPanelIsAccessible forViewController:(UIViewController *)viewController {
|
||||
- (void)setLeftPanelIsAccessible:(BOOL)leftPanelIsAccessible forViewController:(UIViewController *)viewController updateNavigationButtons:(BOOL)updateNavigationButtons {
|
||||
if ([self.leftPanel respondsToSelector:@selector(panelAvailable)]) {
|
||||
self.leftPanelIsAccessible = leftPanelIsAccessible && [self.leftPanel panelAvailable];
|
||||
} else {
|
||||
@ -262,8 +270,7 @@ CGFloat const PanelAnimationDuration = 0.2;
|
||||
} else {
|
||||
|
||||
// Determine if we should show the panel (extended based on width or from explicit action).
|
||||
MFNumberOfDrawers numberOfDrawers = [self numberOfDrawersShouldShow:self.transitionWidth];
|
||||
extended = [self shouldExtendLeftPanel:numberOfDrawers] && (numberOfDrawers != MFOneDrawer || self.explictlyShowingPanel != self.rightPanel);
|
||||
extended = [self leftPanelStaysExtended];
|
||||
if (extended || self.explictlyShowingPanel == self.leftPanel) {
|
||||
[self showLeftPanelAnimated:NO explict:NO];
|
||||
}
|
||||
@ -272,7 +279,9 @@ CGFloat const PanelAnimationDuration = 0.2;
|
||||
[self.leftPanel resetIconToDefault];
|
||||
}
|
||||
}
|
||||
[self setLeftNavigationItemForViewController:viewController accessible:self.leftPanelIsAccessible extended:extended];
|
||||
if (updateNavigationButtons) {
|
||||
[self setLeftNavigationItemForViewController:viewController accessible:self.leftPanelIsAccessible extended:extended];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
@ -407,10 +416,10 @@ CGFloat const PanelAnimationDuration = 0.2;
|
||||
|
||||
- (void)setRightNavigationItemForViewController:(UIViewController * _Nonnull)viewController accessible:(BOOL)accessible extended:(BOOL)extended {
|
||||
NSMutableArray *navigationItems = [[NSMutableArray alloc] init];
|
||||
NSArray *extraButtons = [self additionalRightButtonsForViewController:viewController];
|
||||
if ((accessible && !extended) && self.rightPanelButton && ![extraButtons containsObject:self.rightPanelButton]) {
|
||||
if ((accessible && !extended) && self.rightPanelButton) {
|
||||
[navigationItems addObject:self.rightPanelButton];
|
||||
}
|
||||
NSArray *extraButtons = [self additionalRightButtonsForViewController:viewController];
|
||||
if (extraButtons) {
|
||||
[navigationItems addObjectsFromArray:extraButtons];
|
||||
}
|
||||
@ -440,7 +449,12 @@ CGFloat const PanelAnimationDuration = 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setRightPanelIsAccessible:(BOOL)rightPanelIsAccessible forViewController:(UIViewController *)viewController {
|
||||
- (BOOL)rightPanelStaysExtended {
|
||||
MFNumberOfDrawers numberOfDrawers = [self numberOfDrawersShouldShow:self.transitionWidth];
|
||||
return [self shouldExtendRightPanel:numberOfDrawers] && (numberOfDrawers != MFOneDrawer || self.explictlyShowingPanel != self.leftPanel);
|
||||
}
|
||||
|
||||
- (void)setRightPanelIsAccessible:(BOOL)rightPanelIsAccessible forViewController:(UIViewController *)viewController updateNavigationButtons:(BOOL)updateNavigationButtons {
|
||||
|
||||
if ([self.rightPanel respondsToSelector:@selector(panelAvailable)]) {
|
||||
self.rightPanelIsAccessible = rightPanelIsAccessible && [self.rightPanel panelAvailable];
|
||||
@ -458,8 +472,7 @@ CGFloat const PanelAnimationDuration = 0.2;
|
||||
} else {
|
||||
|
||||
// Determine if we should show the right panel (extended based on width or from explicit action).
|
||||
MFNumberOfDrawers numberOfDrawers = [self numberOfDrawersShouldShow:self.transitionWidth];
|
||||
extended = [self shouldExtendRightPanel:numberOfDrawers] && (numberOfDrawers != MFOneDrawer || self.explictlyShowingPanel != self.leftPanel);
|
||||
extended = [self rightPanelStaysExtended];
|
||||
if (extended || self.explictlyShowingPanel == self.rightPanel) {
|
||||
[self showRightPanelAnimated:NO explict:NO];
|
||||
}
|
||||
@ -468,7 +481,10 @@ CGFloat const PanelAnimationDuration = 0.2;
|
||||
[self.rightPanel resetIconToDefault];
|
||||
}
|
||||
}
|
||||
[self setRightNavigationItemForViewController:viewController accessible:rightPanelIsAccessible extended:extended];
|
||||
|
||||
if (updateNavigationButtons) {
|
||||
[self setRightNavigationItemForViewController:viewController accessible:rightPanelIsAccessible extended:extended];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
@ -974,11 +990,15 @@ CGFloat const PanelAnimationDuration = 0.2;
|
||||
}
|
||||
|
||||
- (void)resetDrawers {
|
||||
[self setLeftPanelIsAccessible:self.leftPanelIsAccessible forViewController:self.navigationItemViewController];
|
||||
[self setRightPanelIsAccessible:self.rightPanelIsAccessible forViewController:self.navigationItemViewController];
|
||||
|
||||
[self.view setNeedsLayout];
|
||||
[self.view layoutIfNeeded];
|
||||
if ([self.navigationItemViewController respondsToSelector:@selector(splitViewDidReset)]) {
|
||||
[((UIViewController<MVMCoreUIDetailViewProtocol> *)self.navigationItemViewController) splitViewDidReset];
|
||||
} else {
|
||||
[self setLeftPanelIsAccessible:self.leftPanelIsAccessible forViewController:self.navigationItemViewController updateNavigationButtons:YES];
|
||||
[self setRightPanelIsAccessible:self.rightPanelIsAccessible forViewController:self.navigationItemViewController updateNavigationButtons:YES];
|
||||
|
||||
[self.view setNeedsLayout];
|
||||
[self.view layoutIfNeeded];
|
||||
}
|
||||
}
|
||||
|
||||
- (UIStatusBarStyle)preferredStatusBarStyle {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user