Merge branch 'develop' into feature/standardlistitemwithimage

# Conflicts:
#	MVMCoreUI.xcodeproj/project.pbxproj
This commit is contained in:
Kevin G Christiano 2019-08-05 09:11:44 -04:00
commit eea2560e15
12 changed files with 116 additions and 60 deletions

View File

@ -169,6 +169,7 @@
D2A638FD22CA98280052ED1F /* HeadlineBody.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A638FC22CA98280052ED1F /* HeadlineBody.swift */; };
D2A6390122CBB1820052ED1F /* Carousel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A6390022CBB1820052ED1F /* Carousel.swift */; };
D2A6390522CBCE160052ED1F /* MoleculeCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A6390422CBCE160052ED1F /* MoleculeCollectionViewCell.swift */; };
D2B1E3E522F37D6A0065F95C /* ImageHeadlineBody.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2B1E3E422F37D6A0065F95C /* ImageHeadlineBody.swift */; };
D2C5001821F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.h in Headers */ = {isa = PBXBuildFile; fileRef = D2C5001621F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.h */; settings = {ATTRIBUTES = (Public, ); }; };
D2C5001921F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m in Sources */ = {isa = PBXBuildFile; fileRef = D2C5001721F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m */; };
D2D6CD4022E78C1A00D701B8 /* Scroller.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2D6CD3F22E78C1A00D701B8 /* Scroller.swift */; };
@ -351,6 +352,7 @@
D2A638FC22CA98280052ED1F /* HeadlineBody.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBody.swift; sourceTree = "<group>"; };
D2A6390022CBB1820052ED1F /* Carousel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Carousel.swift; sourceTree = "<group>"; };
D2A6390422CBCE160052ED1F /* MoleculeCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeCollectionViewCell.swift; sourceTree = "<group>"; };
D2B1E3E422F37D6A0065F95C /* ImageHeadlineBody.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageHeadlineBody.swift; sourceTree = "<group>"; };
D2C5001621F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIViewControllerMappingObject.h; sourceTree = "<group>"; };
D2C5001721F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUIViewControllerMappingObject.m; sourceTree = "<group>"; };
D2D6CD3F22E78C1A00D701B8 /* Scroller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Scroller.swift; sourceTree = "<group>"; };
@ -478,7 +480,6 @@
D29DF10E21E67A77003B2FB9 /* Molecules */ = {
isa = PBXGroup;
children = (
18423C7D22E07B260069C7B7 /* MultiLabelListItem.swift */,
01DF55DF21F8FAA800CC099B /* MFTextFieldListView.swift */,
D29770C721F7C4AE00B2F0D0 /* TopLabelsView.h */,
D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */,
@ -501,6 +502,7 @@
D260D7B022D65BDD007E7233 /* MVMCoreUIPageControl.m */,
D260D7B522D68509007E7233 /* MVMCoreUIPagingProtocol.h */,
D2D6CD3F22E78C1A00D701B8 /* Scroller.swift */,
D2B1E3E422F37D6A0065F95C /* ImageHeadlineBody.swift */,
);
path = Molecules;
sourceTree = "<group>";
@ -930,7 +932,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
18423C7E22E07B260069C7B7 /* MultiLabelListItem.swift in Sources */,
D29DF32121ED0CBA003B2FB9 /* LabelView.m in Sources */,
DBC4391822442197001AB423 /* CaretView.swift in Sources */,
D29770F221F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.m in Sources */,
@ -1002,6 +1003,7 @@
D29770C821F7C4AE00B2F0D0 /* TopLabelsView.m in Sources */,
D2E1FADF2268B8E700AEFD8C /* ThreeLayerTableViewController.swift in Sources */,
D20A9A5E2243D3E300ADE781 /* TwoButtonView.swift in Sources */,
D2B1E3E522F37D6A0065F95C /* ImageHeadlineBody.swift in Sources */,
D29DF2AA21E7B2F9003B2FB9 /* MVMCoreUIConstants.m in Sources */,
D2A5146122121FBF00345BFB /* MoleculeStackTemplate.swift in Sources */,
D29DF11821E6805F003B2FB9 /* NSLayoutConstraint+MFConvenience.m in Sources */,

View File

@ -215,6 +215,7 @@ import UIKit
// MARK: - MVMCoreUIMoleculeViewProtocol functions
open override func setAsMolecule() {
addSizeConstraintsForAspectRatio = true
pinEdges(.all)
}
public override static func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {

View File

@ -46,6 +46,10 @@
#pragma mark - MVMCoreUIMoleculeViewProtocol
- (void)setAsMolecule {
self.translatesAutoresizingMaskIntoConstraints = NO;
}
- (void)reset {
self.backgroundColor = [UIColor clearColor];
}

View File

@ -114,6 +114,11 @@
} else {
self.hidden = YES;
}
NSString *colorString = [json string:KeyBackgroundColor];
if (colorString) {
self.backgroundColor = [UIColor mfGetColorForHex:colorString];
}
}
#pragma mark - helper

View File

@ -347,9 +347,6 @@
}
}
- (void)setAsMolecule {
}
- (void)setWithJSON:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData {
[super setWithJSON:json delegateObject:delegateObject additionalData:additionalData];

View File

@ -255,6 +255,10 @@ extension Carousel: UICollectionViewDelegateFlowLayout {
let itemWidth = collectionView.bounds.width * itemWidthPercent
return CGSize(width: itemWidth, height: collectionView.bounds.height)
}
public func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
(cell as? MoleculeCollectionViewCell)?.setPeaking(false, animated: false)
}
}
extension Carousel: UICollectionViewDataSource {

View File

@ -11,6 +11,7 @@ import UIKit
open class HeadlineBody: ViewConstrainingView {
let headlineLabel = Label.commonLabelH2(true)
let messageLabel = Label.commonLabelB2(true)
var spaceBetweenLabelsConstant = PaddingTwo
var spaceBetweenLabels: NSLayoutConstraint?
var leftConstraintTitle: NSLayoutConstraint?
var rightConstraintTitle: NSLayoutConstraint?
@ -44,7 +45,7 @@ open class HeadlineBody: ViewConstrainingView {
topPin = headlineLabel.topAnchor.constraint(equalTo: topAnchor, constant: 0)
topPin?.isActive = true
spaceBetweenLabels = messageLabel.topAnchor.constraint(equalTo: headlineLabel.bottomAnchor, constant: PaddingTwo)
spaceBetweenLabels = messageLabel.topAnchor.constraint(equalTo: headlineLabel.bottomAnchor, constant: spaceBetweenLabelsConstant)
spaceBetweenLabels?.isActive = true
leftConstraintTitle = headlineLabel.leftAnchor.constraint(equalTo: leftAnchor)
@ -66,7 +67,7 @@ open class HeadlineBody: ViewConstrainingView {
// MARK: - Constraining
public func setSpacing() {
if headlineLabel.hasText && messageLabel.hasText {
spaceBetweenLabels?.constant = PaddingTwo
spaceBetweenLabels?.constant = spaceBetweenLabelsConstant
} else {
spaceBetweenLabels?.constant = 0
}
@ -96,6 +97,7 @@ open class HeadlineBody: ViewConstrainingView {
super.reset()
headlineLabel.styleH2(true)
messageLabel.styleB2(true)
spaceBetweenLabelsConstant = PaddingTwo
}
public override static func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {

View File

@ -0,0 +1,85 @@
//
// ImageHeadlineBody.swift
// MVMCoreUI
//
// Created by Scott Pfeil on 8/1/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import UIKit
@objcMembers open class ImageHeadlineBody: ViewConstrainingView {
let headlineBody = HeadlineBody(frame: .zero)
let imageView = MFLoadImageView()
var constraintBetweenImageLabelsConstant: CGFloat = 16
var constraintBetweenImageLabels: NSLayoutConstraint?
// MARK: - MFViewProtocol
open override func setupView() {
guard subviews.count == 0 else {
return
}
MVMCoreUIUtility.setMarginsFor(self, leading: 0, top: 0, trailing: 0, bottom: 0)
headlineBody.headlineLabel.styleB1(true)
headlineBody.spaceBetweenLabelsConstant = 0
addSubview(headlineBody)
addSubview(imageView)
NSLayoutConstraint.pinViewTop(toSuperview: headlineBody, useMargins: true, constant: 0).isActive = true
NSLayoutConstraint.pinViewRight(toSuperview: headlineBody, useMargins: true, constant: 0).isActive = true
layoutMarginsGuide.bottomAnchor.constraint(greaterThanOrEqualTo: headlineBody.bottomAnchor).isActive = true
var constraint = NSLayoutConstraint.pinViewBottom(toSuperview: headlineBody, useMargins: true, constant: 0)
constraint.priority = .defaultLow
constraint.isActive = true
imageView.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true
NSLayoutConstraint.pinViewLeft(toSuperview: imageView, useMargins: true, constant: 0).isActive = true
imageView.topAnchor.constraint(greaterThanOrEqualTo: layoutMarginsGuide.topAnchor).isActive = true
layoutMarginsGuide.bottomAnchor.constraint(greaterThanOrEqualTo: imageView.bottomAnchor).isActive = true
constraint = NSLayoutConstraint.pinViewBottom(toSuperview: imageView, useMargins: true, constant: 0)
constraint.priority = UILayoutPriority(rawValue: 200)
constraint.isActive = true
constraint = NSLayoutConstraint.pinViewTop(toSuperview: imageView, useMargins: true, constant: 0)
constraint.priority = UILayoutPriority(rawValue: 200)
constraint.isActive = true
constraintBetweenImageLabels = headlineBody.leadingAnchor.constraint(equalTo: imageView.trailingAnchor, constant: constraintBetweenImageLabelsConstant)
constraintBetweenImageLabels?.isActive = true
}
open override func updateView(_ size: CGFloat) {
super.updateView(size)
headlineBody.updateView(size)
imageView.updateView(size)
}
// MARK: - MVMCoreUIMoleculeViewProtocol
open override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
headlineBody.setWithJSON(json?.optionalDictionaryForKey("headlineBody"), delegateObject: delegateObject, additionalData: additionalData)
let imageJSON = json?.optionalDictionaryForKey("image")
imageView.setWithJSON(imageJSON, delegateObject: delegateObject, additionalData: additionalData)
constraintBetweenImageLabels?.constant = imageJSON != nil ? constraintBetweenImageLabelsConstant : 0
}
open override func setAsMolecule() {
super.setAsMolecule()
headlineBody.setAsMolecule()
imageView.setAsMolecule()
}
open override func reset() {
super.reset()
headlineBody.reset()
headlineBody.headlineLabel.styleB1(true)
headlineBody.spaceBetweenLabelsConstant = 0
imageView.reset()
}
public override static func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
return 95
}
}

View File

@ -297,7 +297,9 @@ static CGFloat const IndicatorRectangleHeight = 4;
if (selectedIndex != NSNotFound) {
self.currentPage = selectedIndex;
[self sendActionsForControlEvents:UIControlEventValueChanged];
self.pagingTouchBlock(self);
if (self.pagingTouchBlock) {
self.pagingTouchBlock(self);
}
}
}
}
@ -351,7 +353,9 @@ static CGFloat const IndicatorRectangleHeight = 4;
if ((index < self.numberOfPages && index >= 0) || self.alwaysSendingControlEvent) {
[self setCurrentPage:index animated:NO];
[self sendActionsForControlEvents:UIControlEventValueChanged];
self.pagingTouchBlock(self);
if (self.pagingTouchBlock) {
self.pagingTouchBlock(self);
}
}
}

View File

@ -98,7 +98,7 @@ import UIKit
}
// Add the caret if there is an action and it's not declared hidden.
if let _ = json?.optionalDictionaryForKey("actionMap"), json!.boolForKey("hideArrow") {
if let _ = json?.optionalDictionaryForKey("actionMap"), !json!.boolForKey("hideArrow") {
addCaretViewAccessory()
} else {
accessoryView = nil

View File

@ -1,48 +0,0 @@
//
// multiLabelListItem.swift
// MVMCoreUI
//
// Created by Kanamarlapudi, Vasavi on 15/7/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import UIKit
@objcMembers public class MultiLabelListItem: ViewConstrainingView {
var moleculestackview = MoleculeStackView(frame: .zero)
open override func needsToBeConstrained() -> Bool {
return true
}
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
let moleculestackjson = json?.optionalDictionaryForKey("moleculeStack")
moleculestackview.setWithJSON(moleculestackjson, delegateObject: delegateObject, additionalData: additionalData)
moleculestackview.useStackSpacingBeforeFirstItem = true
}
override open func setupView() {
super.setupView()
addSubview(moleculestackview)
moleculestackview.leftAnchor.constraint(equalTo: self.leftAnchor).isActive = true
moleculestackview.topAnchor.constraint(equalTo: self.topAnchor).isActive = true
let topleftwidthconstraint = NSLayoutConstraint(item: moleculestackview, attribute: .width, relatedBy: .equal, toItem: self, attribute: .width, multiplier: 0.5, constant: 0.0)
topleftwidthconstraint.priority = UILayoutPriority(100)
topleftwidthconstraint.isActive = true
moleculestackview.setContentHuggingPriority(UILayoutPriority(911), for: .horizontal)
moleculestackview.setContentHuggingPriority(UILayoutPriority(911), for: .vertical)
var bottomconstraint = bottomAnchor.constraint(equalTo: moleculestackview.bottomAnchor, constant: PaddingTwo)
bottomconstraint.priority = UILayoutPriority(249)
bottomconstraint.isActive = true
bottomAnchor.constraint(greaterThanOrEqualTo: moleculestackview.bottomAnchor, constant: PaddingTwo).isActive = true
bottomconstraint = bottomAnchor.constraint(equalTo: moleculestackview.bottomAnchor, constant: PaddingTwo)
bottomconstraint.priority = UILayoutPriority(249)
bottomconstraint.isActive = true
bottomAnchor.constraint(greaterThanOrEqualTo: moleculestackview.bottomAnchor, constant: PaddingTwo).isActive = true
}
}

View File

@ -50,12 +50,12 @@
@"listItemWithImage": ListItemWithImage.class,
@"image": MFLoadImageView.class,
@"moduleMolecule": ModuleMolecule.class,
@"multiLabelListItem": MultiLabelListItem.class,
@"headlineBody": HeadlineBody.class,
@"carousel": Carousel.class,
@"carouselItem": MoleculeCollectionViewCell.class,
@"barsPager": MVMCoreUIPageControl.class,
@"scroller": Scroller.class
@"scroller": Scroller.class,
@"imageHeadlineBody": ImageHeadlineBody.class
} mutableCopy];
});
return mapping;