Merge branch 'develop' into feature/Headers_H2_Buttons
This commit is contained in:
commit
1a3a140aaa
@ -24,13 +24,7 @@ public class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupW
|
|||||||
public var style: Styler.Button.Style? {
|
public var style: Styler.Button.Style? {
|
||||||
didSet {
|
didSet {
|
||||||
guard let style = style else { return }
|
guard let style = style else { return }
|
||||||
switch style {
|
setFacade(by: style)
|
||||||
case .primary:
|
|
||||||
setPrimaryFacade()
|
|
||||||
|
|
||||||
case .secondary:
|
|
||||||
setSecondaryFacade()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public var size: Styler.Button.Size? = .standard
|
public var size: Styler.Button.Size? = .standard
|
||||||
@ -160,6 +154,17 @@ public class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupW
|
|||||||
disabledBorderColor_inverted = Color(uiColor: .mvmCoolGray6)
|
disabledBorderColor_inverted = Color(uiColor: .mvmCoolGray6)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func setFacade(by style: Styler.Button.Style) {
|
||||||
|
|
||||||
|
switch style {
|
||||||
|
case .primary:
|
||||||
|
setPrimaryFacade()
|
||||||
|
|
||||||
|
case .secondary:
|
||||||
|
setSecondaryFacade()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Keys
|
// MARK: - Keys
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -195,6 +200,7 @@ public class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupW
|
|||||||
|
|
||||||
if let style = try typeContainer.decodeIfPresent(Styler.Button.Style.self, forKey: .style) {
|
if let style = try typeContainer.decodeIfPresent(Styler.Button.Style.self, forKey: .style) {
|
||||||
self.style = style
|
self.style = style
|
||||||
|
setFacade(by: style)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let size = try typeContainer.decodeIfPresent(Styler.Button.Size.self, forKey: .size) {
|
if let size = try typeContainer.decodeIfPresent(Styler.Button.Size.self, forKey: .size) {
|
||||||
|
|||||||
@ -26,6 +26,22 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol {
|
|||||||
didSet { style() }
|
didSet { style() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open var buttonSize: Styler.Button.Size = .standard {
|
||||||
|
didSet {
|
||||||
|
buttonModel?.size = buttonSize
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initializers
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
@objc public convenience init(asPrimaryButton isPrimary: Bool, makeTiny istiny: Bool) {
|
||||||
|
self.init()
|
||||||
|
buttonSize = istiny ? .tiny : .standard
|
||||||
|
isPrimary ? stylePrimary() : styleSecondary()
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Computed Properties
|
// MARK: - Computed Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -116,7 +132,7 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func getHeight() -> CGFloat {
|
private func getHeight() -> CGFloat {
|
||||||
PillButton.getHeight(for: buttonModel?.size, size: size)
|
PillButton.getHeight(for: buttonSize, size: size)
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func getHeight(for buttonSize: Styler.Button.Size?, size: CGFloat) -> CGFloat {
|
public static func getHeight(for buttonSize: Styler.Button.Size?, size: CGFloat) -> CGFloat {
|
||||||
@ -138,7 +154,7 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol {
|
|||||||
|
|
||||||
private func getMinimumWidth() -> CGFloat {
|
private func getMinimumWidth() -> CGFloat {
|
||||||
|
|
||||||
switch buttonModel?.size {
|
switch buttonSize {
|
||||||
case .tiny:
|
case .tiny:
|
||||||
return MFSizeObject(standardSize: 49,
|
return MFSizeObject(standardSize: 49,
|
||||||
standardiPadPortraitSize: 90,
|
standardiPadPortraitSize: 90,
|
||||||
@ -165,7 +181,9 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol {
|
|||||||
|
|
||||||
guard let model = model as? ButtonModel else { return }
|
guard let model = model as? ButtonModel else { return }
|
||||||
setTitle(model.title, for: .normal)
|
setTitle(model.title, for: .normal)
|
||||||
|
if let size = model.size {
|
||||||
|
buttonSize = size
|
||||||
|
}
|
||||||
model.updateUI = { [weak self] in
|
model.updateUI = { [weak self] in
|
||||||
MVMCoreDispatchUtility.performBlock(onMainThread: {
|
MVMCoreDispatchUtility.performBlock(onMainThread: {
|
||||||
self?.enableField(model.enabled)
|
self?.enableField(model.enabled)
|
||||||
@ -185,7 +203,7 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol {
|
|||||||
|
|
||||||
invalidateIntrinsicContentSize()
|
invalidateIntrinsicContentSize()
|
||||||
|
|
||||||
switch buttonModel?.size {
|
switch buttonSize {
|
||||||
case .tiny:
|
case .tiny:
|
||||||
titleLabel?.font = MFFonts.mfFont75Bd(11 * (intrinsicContentSize.height / Styler.Button.Size.tiny.getHeight()))
|
titleLabel?.font = MFFonts.mfFont75Bd(11 * (intrinsicContentSize.height / Styler.Button.Size.tiny.getHeight()))
|
||||||
|
|
||||||
|
|||||||
@ -134,6 +134,7 @@ open class BarsIndicatorView: CarouselIndicator {
|
|||||||
public override func assessTouchOf(_ touchPoint_X: CGFloat) {
|
public override func assessTouchOf(_ touchPoint_X: CGFloat) {
|
||||||
|
|
||||||
currentIndex = barReferences.firstIndex { $0.0.frame.maxX >= touchPoint_X && $0.0.frame.minX <= touchPoint_X } ?? 0
|
currentIndex = barReferences.firstIndex { $0.0.frame.maxX >= touchPoint_X && $0.0.frame.minX <= touchPoint_X } ?? 0
|
||||||
|
performAction()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
|
|||||||
@ -48,13 +48,10 @@ open class CarouselIndicator: Control, CarouselPageControlProtocol {
|
|||||||
previousIndex = currentIndex
|
previousIndex = currentIndex
|
||||||
carouselIndicatorModel?.currentIndex = newIndex
|
carouselIndicatorModel?.currentIndex = newIndex
|
||||||
|
|
||||||
if previousIndex != newIndex {
|
updateUI(previousIndex: previousIndex,
|
||||||
updateUI(previousIndex: previousIndex,
|
newIndex: newIndex,
|
||||||
newIndex: newIndex,
|
totalCount: numberOfPages,
|
||||||
totalCount: numberOfPages,
|
isAnimated: carouselIndicatorModel?.animated ?? true)
|
||||||
isAnimated: carouselIndicatorModel?.animated ?? true)
|
|
||||||
performAction()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,11 +138,13 @@ open class CarouselIndicator: Control, CarouselPageControlProtocol {
|
|||||||
|
|
||||||
func incrementCurrentIndex() {
|
func incrementCurrentIndex() {
|
||||||
currentIndex = (currentIndex + 1) % numberOfPages
|
currentIndex = (currentIndex + 1) % numberOfPages
|
||||||
|
performAction()
|
||||||
}
|
}
|
||||||
|
|
||||||
func decrementCurrentIndex() {
|
func decrementCurrentIndex() {
|
||||||
let newIndex = currentIndex - 1
|
let newIndex = currentIndex - 1
|
||||||
currentIndex = newIndex < 0 ? numberOfPages - 1 : newIndex
|
currentIndex = newIndex < 0 ? numberOfPages - 1 : newIndex
|
||||||
|
performAction()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Increments the currentIndex value.
|
/// Increments the currentIndex value.
|
||||||
|
|||||||
@ -26,10 +26,8 @@ open class Carousel: View {
|
|||||||
|
|
||||||
/// The index of the page, does not include dummy cells.
|
/// The index of the page, does not include dummy cells.
|
||||||
public var pageIndex: Int {
|
public var pageIndex: Int {
|
||||||
get {
|
get { return loop ? currentIndex - 2 : currentIndex }
|
||||||
return loop ? currentIndex - 2 : currentIndex
|
set (newIndex) {
|
||||||
}
|
|
||||||
set(newIndex) {
|
|
||||||
currentIndex = loop ? newIndex + 2 : newIndex
|
currentIndex = loop ? newIndex + 2 : newIndex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,6 +88,7 @@ open class Carousel: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
// MARK: - MVMCoreViewProtocol
|
// MARK: - MVMCoreViewProtocol
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
@ -194,7 +193,7 @@ open class Carousel: View {
|
|||||||
pagingView = MoleculeObjectMapping.shared()?.createMolecule(molecule, delegateObject: delegateObject) as? (UIView & CarouselPageControlProtocol)
|
pagingView = MoleculeObjectMapping.shared()?.createMolecule(molecule, delegateObject: delegateObject) as? (UIView & CarouselPageControlProtocol)
|
||||||
}
|
}
|
||||||
|
|
||||||
addPaging(view: pagingView , position: (CGFloat(molecule?.position ?? 20)))
|
addPaging(view: pagingView, position: (CGFloat(molecule?.position ?? 20)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Registers the cells with the collection view
|
/// Registers the cells with the collection view
|
||||||
@ -213,9 +212,7 @@ open class Carousel: View {
|
|||||||
|
|
||||||
/// Returns the (identifier, class) of the molecule for the given map.
|
/// Returns the (identifier, class) of the molecule for the given map.
|
||||||
func getMoleculeInfo(with molecule: MoleculeModelProtocol, delegateObject: MVMCoreUIDelegateObject?) -> (identifier: String, class: AnyClass, molecule: MoleculeModelProtocol)? {
|
func getMoleculeInfo(with molecule: MoleculeModelProtocol, delegateObject: MVMCoreUIDelegateObject?) -> (identifier: String, class: AnyClass, molecule: MoleculeModelProtocol)? {
|
||||||
guard let className = MoleculeObjectMapping.shared()?.getMoleculeClass(molecule) else {
|
guard let className = MoleculeObjectMapping.shared()?.getMoleculeClass(molecule) else { return nil }
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return (className.nameForReuse(with: molecule, delegateObject) ?? molecule.moleculeName, className, molecule)
|
return (className.nameForReuse(with: molecule, delegateObject) ?? molecule.moleculeName, className, molecule)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -45,8 +45,8 @@ extension MoleculeViewProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Do nothing, optionals.
|
// Do nothing, optionals.
|
||||||
public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {}
|
public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { }
|
||||||
public func reset() {}
|
public func reset() { }
|
||||||
|
|
||||||
public static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@ -188,14 +188,13 @@
|
|||||||
self.labelRightConstraint.active = NO;
|
self.labelRightConstraint.active = NO;
|
||||||
|
|
||||||
// Sets up to use a button action. Always uses the top view controller
|
// Sets up to use a button action. Always uses the top view controller
|
||||||
PillButton *button = [[PillButton alloc] init];
|
PillButton *button = [[PillButton alloc] initAsPrimaryButton:false makeTiny:true];
|
||||||
[button styleSecondary];
|
[button styleSecondary];
|
||||||
[button setContentCompressionResistancePriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
|
[button setContentCompressionResistancePriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
|
||||||
[button setContentHuggingPriority:800 forAxis:UILayoutConstraintAxisHorizontal];
|
[button setContentHuggingPriority:800 forAxis:UILayoutConstraintAxisHorizontal];
|
||||||
|
|
||||||
button.translatesAutoresizingMaskIntoConstraints = NO;
|
button.translatesAutoresizingMaskIntoConstraints = NO;
|
||||||
[self addSubview:button];
|
[self addSubview:button];
|
||||||
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|->=space-[button]->=space-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:@{@"space":@(PaddingFive)} views:NSDictionaryOfVariableBindings(button)]];
|
|
||||||
[NSLayoutConstraint constraintWithItem:button attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0].active = YES;
|
[NSLayoutConstraint constraintWithItem:button attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0].active = YES;
|
||||||
[NSLayoutConstraint constraintWithItem:button attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.centerView attribute:NSLayoutAttributeRight multiplier:1 constant:PaddingThree].active = YES;
|
[NSLayoutConstraint constraintWithItem:button attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.centerView attribute:NSLayoutAttributeRight multiplier:1 constant:PaddingThree].active = YES;
|
||||||
[NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:button attribute:NSLayoutAttributeRight multiplier:1 constant:(self.closeButton ? PaddingTen : PaddingFive)].active = YES;
|
[NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:button attribute:NSLayoutAttributeRight multiplier:1 constant:(self.closeButton ? PaddingTen : PaddingFive)].active = YES;
|
||||||
|
|||||||
@ -160,6 +160,7 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed.";
|
|||||||
UIColor *statusBarColor = nil;
|
UIColor *statusBarColor = nil;
|
||||||
UIStatusBarStyle statusBarStyle = UIStatusBarStyleDefault;
|
UIStatusBarStyle statusBarStyle = UIStatusBarStyleDefault;
|
||||||
MVMCoreUITopAlertBaseView *view = [self topAlertViewForTopAlertObject:topAlertObject animationDelegate:animationDelegate statusBarColor:&statusBarColor statusBarStyle:&statusBarStyle];
|
MVMCoreUITopAlertBaseView *view = [self topAlertViewForTopAlertObject:topAlertObject animationDelegate:animationDelegate statusBarColor:&statusBarColor statusBarStyle:&statusBarStyle];
|
||||||
|
[view updateView:CGRectGetWidth(self.bounds)];
|
||||||
if (!statusBarColor) {
|
if (!statusBarColor) {
|
||||||
statusBarColor = [UIColor whiteColor];
|
statusBarColor = [UIColor whiteColor];
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user