diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 201e8d9a..c32e376c 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -10,8 +10,9 @@ 0105618D224BBE7700E1557D /* FormValidator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0105618A224BBE7700E1557D /* FormValidator.swift */; }; 0105618E224BBE7700E1557D /* FormValidator+TextFields.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0105618B224BBE7700E1557D /* FormValidator+TextFields.swift */; }; 0105618F224BBE7700E1557D /* FormValidator+FormParams.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0105618C224BBE7700E1557D /* FormValidator+FormParams.swift */; }; - 01056191224BBE8000E1557D /* FormValidationProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01056190224BBE7F00E1557D /* FormValidationProtocol.swift */; }; - 013DAB042254FCE00092ABB7 /* CheckBoxWithLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 013DAB032254FCE00092ABB7 /* CheckBoxWithLabel.swift */; }; + 0198F79F225679880066C936 /* FormValidationProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0198F79E225679870066C936 /* FormValidationProtocol.swift */; }; + 0198F7A62256A80B0066C936 /* MFRadioButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 0198F7A02256A80A0066C936 /* MFRadioButton.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 0198F7A82256A80B0066C936 /* MFRadioButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 0198F7A22256A80A0066C936 /* MFRadioButton.m */; }; 01DF55E021F8FAA800CC099B /* MFTextFieldListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01DF55DF21F8FAA800CC099B /* MFTextFieldListView.swift */; }; 01DF567021FA5AB300CC099B /* TextFieldListFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01DF566F21FA5AB300CC099B /* TextFieldListFormViewController.swift */; }; 01E569D3223FFFA500327251 /* ThreeLayerViewController.swift in Headers */ = {isa = PBXBuildFile; fileRef = D2A5146A2214905000345BFB /* ThreeLayerViewController.swift */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -167,8 +168,9 @@ 0105618A224BBE7700E1557D /* FormValidator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormValidator.swift; sourceTree = ""; }; 0105618B224BBE7700E1557D /* FormValidator+TextFields.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "FormValidator+TextFields.swift"; sourceTree = ""; }; 0105618C224BBE7700E1557D /* FormValidator+FormParams.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "FormValidator+FormParams.swift"; sourceTree = ""; }; - 01056190224BBE7F00E1557D /* FormValidationProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormValidationProtocol.swift; sourceTree = ""; }; - 013DAB032254FCE00092ABB7 /* CheckBoxWithLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckBoxWithLabel.swift; sourceTree = ""; }; + 0198F79E225679870066C936 /* FormValidationProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormValidationProtocol.swift; sourceTree = ""; }; + 0198F7A02256A80A0066C936 /* MFRadioButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFRadioButton.h; sourceTree = ""; }; + 0198F7A22256A80A0066C936 /* MFRadioButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFRadioButton.m; sourceTree = ""; }; 01DF55DF21F8FAA800CC099B /* MFTextFieldListView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MFTextFieldListView.swift; sourceTree = ""; }; 01DF566F21FA5AB300CC099B /* TextFieldListFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldListFormViewController.swift; sourceTree = ""; }; D206997521FB8A0B00CAE0DE /* MVMCoreUINavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUINavigationController.h; sourceTree = ""; }; @@ -336,22 +338,15 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 01C74D86224298C3009C25A3 /* Protocols */ = { - isa = PBXGroup; - children = ( - 01056190224BBE7F00E1557D /* FormValidationProtocol.swift */, - ); - path = Protocols; - sourceTree = ""; - }; - 01C74D87224298E2009C25A3 /* Models */ = { + 01C74D87224298E2009C25A3 /* FormUIHelpers */ = { isa = PBXGroup; children = ( + 0198F79E225679870066C936 /* FormValidationProtocol.swift */, 0105618A224BBE7700E1557D /* FormValidator.swift */, 0105618C224BBE7700E1557D /* FormValidator+FormParams.swift */, 0105618B224BBE7700E1557D /* FormValidator+TextFields.swift */, ); - path = Models; + path = FormUIHelpers; sourceTree = ""; }; D22D1F582204D2590077CEC0 /* LegacyControllers */ = { @@ -387,8 +382,7 @@ D29DF0CE21E404D4003B2FB9 /* MVMCoreUI */ = { isa = PBXGroup; children = ( - 01C74D87224298E2009C25A3 /* Models */, - 01C74D86224298C3009C25A3 /* Protocols */, + 01C74D87224298E2009C25A3 /* FormUIHelpers */, D29DF31421ECECA7003B2FB9 /* SupportingFiles */, D29DF27021E79B2C003B2FB9 /* OtherHandlers */, D29DF13A21E68682003B2FB9 /* Utility */, @@ -597,7 +591,8 @@ D22D1F19220341F50077CEC0 /* MVMCoreUICheckBox.m */, D22D1F44220496A30077CEC0 /* MVMCoreUISwitch.h */, D22D1F45220496A30077CEC0 /* MVMCoreUISwitch.m */, - 013DAB032254FCE00092ABB7 /* CheckBoxWithLabel.swift */, + 0198F7A02256A80A0066C936 /* MFRadioButton.h */, + 0198F7A22256A80A0066C936 /* MFRadioButton.m */, ); path = Views; sourceTree = ""; @@ -726,6 +721,7 @@ D29DF29D21E7AE38003B2FB9 /* MFStyler.h in Headers */, D29DF2B021E7B3A4003B2FB9 /* MFTextView.h in Headers */, D29DF2A921E7B2F9003B2FB9 /* MVMCoreUIConstants.h in Headers */, + 0198F7A62256A80B0066C936 /* MFRadioButton.h in Headers */, D29DF25221E6A177003B2FB9 /* MFMdnTextField.h in Headers */, D22D1F1A220341F60077CEC0 /* MVMCoreUICheckBox.h in Headers */, D29DF29921E7ADB8003B2FB9 /* ProgrammaticScrollViewController.h in Headers */, @@ -920,8 +916,8 @@ D22D1F47220496A30077CEC0 /* MVMCoreUISwitch.m in Sources */, D29DF28C21E7AC2B003B2FB9 /* ViewConstrainingView.m in Sources */, D29DF17B21E69E1F003B2FB9 /* PrimaryButton.m in Sources */, - 01056191224BBE8000E1557D /* FormValidationProtocol.swift in Sources */, D29DF11D21E684A9003B2FB9 /* MVMCoreUISplitViewController.m in Sources */, + 0198F79F225679880066C936 /* FormValidationProtocol.swift in Sources */, D29DF29821E7ADB8003B2FB9 /* MFScrollingViewController.m in Sources */, D29770C821F7C4AE00B2F0D0 /* TopLabelsView.m in Sources */, D20A9A5E2243D3E300ADE781 /* TwoButtonView.swift in Sources */, @@ -932,6 +928,7 @@ D29770FC21F7C77400B2F0D0 /* MVMCoreUITextFieldView.m in Sources */, D29DF25121E6A177003B2FB9 /* MFDigitTextBox.m in Sources */, DBC4391B224421A0001AB423 /* CaretButton.swift in Sources */, + 0198F7A82256A80B0066C936 /* MFRadioButton.m in Sources */, D29DF13221E6851E003B2FB9 /* MVMCoreUITopAlertBaseView.m in Sources */, D2C5001E21F8EE67001DA659 /* LabelWithInternalButton.m in Sources */, D29DF29C21E7ADB9003B2FB9 /* MFProgrammaticTableViewController.m in Sources */, @@ -1113,7 +1110,7 @@ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -1142,7 +1139,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.vzw.MVMCoreUI; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; diff --git a/MVMCoreUI/Atoms/Buttons/CaretButton.swift b/MVMCoreUI/Atoms/Buttons/CaretButton.swift index af7d1d60..7d67afb1 100644 --- a/MVMCoreUI/Atoms/Buttons/CaretButton.swift +++ b/MVMCoreUI/Atoms/Buttons/CaretButton.swift @@ -109,23 +109,24 @@ open class CaretButton: MFCustomButton { @objc open override func setAsMolecule() { backgroundColor = .clear + setTitleColor(enabledColor, for: .normal) + setTitleColor(disabledColor, for: .disabled) } @objc override open func setWithJSON(_ json: [AnyHashable: Any]?, delegate: NSObject?, additionalData: [AnyHashable: Any]?) { - super.setWithJSON(json, delegate: delegate, additionalData: additionalData) + setWithActionMap(json, delegate: delegate as? (MVMCoreActionDelegateProtocol & NSObjectProtocol), additionalData: additionalData) - // Configure class properties with JSON values - guard let jsonDictionary = json else { return } + guard let dictionary = json else { return } - if let backgroundColorHex = jsonDictionary[KeyBackgroundColor] as? String { + if let backgroundColorHex = dictionary[KeyBackgroundColor] as? String { backgroundColor = UIColor.mfGet(forHex: backgroundColorHex) } - if let enableColorHex = jsonDictionary["enableColor"] as? String { - enabledColor = UIColor.mfGet(forHex: enableColorHex) + if let enabledColorHex = dictionary["enabledColor"] as? String { + enabledColor = UIColor.mfGet(forHex: enabledColorHex) } - if let disabledColorHex = jsonDictionary["disabledColor"] as? String { + if let disabledColorHex = dictionary["disabledColor"] as? String { disabledColor = UIColor.mfGet(forHex: disabledColorHex) } } diff --git a/MVMCoreUI/Atoms/Buttons/PrimaryButton.m b/MVMCoreUI/Atoms/Buttons/PrimaryButton.m index 6c3ed6a9..5a708f2c 100644 --- a/MVMCoreUI/Atoms/Buttons/PrimaryButton.m +++ b/MVMCoreUI/Atoms/Buttons/PrimaryButton.m @@ -13,8 +13,6 @@ #import "MFStyler.h" #import "UIColor+MFConvenience.h" #import - - @import MVMCore.MVMCoreDispatchUtility; @import MVMCore.MVMCoreGetterUtility; @import MVMCore.NSDictionary_MFConvenience; @@ -709,21 +707,6 @@ [self setEnabledByValidity]; } -- (void)addTextFieldsForValidation:(nonnull MFTextField *)textField { - if (self.textFields == nil) { - self.textFields = [NSMutableArray array]; - } - if (textField) { - [self.textFields addObject:textField]; - } - - for (MFTextField *field in self.textFields) { - field.mfTextFieldDelegate = self; - [field setDefaultValidationBlock]; - } - [self setEnabledByValidity]; -} - - (void)handleEnablingWithTextFields:(nullable NSArray *)textFields { if (self.textFields) { @@ -758,9 +741,8 @@ #pragma mark - FormValidationProtocol -- (void)enableField:(BOOL) enable { - - if (self.validationRequired == NO) { +- (void)enableField:(BOOL)enable { + if (!self.validationRequired) { self.enabled = YES; } else { self.enabled = enable; diff --git a/MVMCoreUI/Atoms/TextFields/MFTextField.h b/MVMCoreUI/Atoms/TextFields/MFTextField.h index cc5ccccb..81b4059f 100644 --- a/MVMCoreUI/Atoms/TextFields/MFTextField.h +++ b/MVMCoreUI/Atoms/TextFields/MFTextField.h @@ -127,6 +127,7 @@ - (void)setAccessibilityString:(nullable NSString *)accessibilityString; +// For Validator Protocol - (nullable NSString *)formFieldName; - (nullable id)formFieldValue; diff --git a/MVMCoreUI/Atoms/TextFields/MFTextField.m b/MVMCoreUI/Atoms/TextFields/MFTextField.m index 67b3f73a..565e086c 100644 --- a/MVMCoreUI/Atoms/TextFields/MFTextField.m +++ b/MVMCoreUI/Atoms/TextFields/MFTextField.m @@ -15,9 +15,7 @@ #import "MFLabel.h" #import "MVMCoreUIUtility.h" #import "MVMCoreUIConstants.h" - #import - @import MVMCore.MVMCoreDispatchUtility; @import MVMCore.NSDictionary_MFConvenience; @import MVMCore.MVMCoreJSONConstants; @@ -51,10 +49,9 @@ [self.dashLine updateView:size]; if (self.isMolecule) { - [self setVerticalPadding:[MFStyler defaultHorizontalPaddingForApplicationWidth]]; - + [self setHorizontalPadding:[MFStyler defaultHorizontalPaddingForSize:size]]; } else { - [self setVerticalPadding:0]; + [self setHorizontalPadding:0]; } }]; } @@ -116,27 +113,6 @@ return textField; } -- (void)setWithJSON:(NSDictionary *)json delegate:(nullable id)delegate additionalData:(NSDictionary *)additionalData { - - self.isMolecule = YES; - [FormValidator setupValidationWithMolecule:self delegate:(id)delegate]; - [self setWithMap:json bothDelegates:delegate]; - - FormValidator *formValidator = [FormValidator getFormValidatorForDelegate:(id)delegate]; - self.mfTextFieldDelegate = formValidator; - self.uiTextFieldDelegate = formValidator; -} - -- (void)setVerticalPadding:(CGFloat) padding { - self.textContainerLeftPin.constant = padding; - self.errorLableLeftPin.constant = padding; - self.formLabelLeftPin.constant = padding; - - self.textContainerRightPin.constant = padding; - self.errorLableRightPin.constant = padding; - self.formLabelRightPin.constant = padding; -} - + (nullable instancetype)mfTextFieldWithMap:(nullable NSDictionary *)map bothDelegates:(nullable id)delegate { MFTextField *textField = [self mfTextField]; textField.translatesAutoresizingMaskIntoConstraints = NO; @@ -392,6 +368,16 @@ }]; } +- (void)setHorizontalPadding:(CGFloat)padding { + self.textContainerLeftPin.constant = padding; + self.errorLableLeftPin.constant = padding; + self.formLabelLeftPin.constant = padding; + + self.textContainerRightPin.constant = padding; + self.errorLableRightPin.constant = padding; + self.formLabelRightPin.constant = padding; +} + - (void)dealloc { [self setBothTextFieldDelegates:nil]; } @@ -568,13 +554,27 @@ #pragma mark - MVMCoreUIMoleculeViewProtocol -- (BOOL) isValidField { +- (void)setAsMolecule { + self.isMolecule = YES; +} + +- (void)setWithJSON:(NSDictionary *)json delegate:(nullable id)delegate additionalData:(NSDictionary *)additionalData { + [FormValidator setupValidationWithMolecule:self delegate:(id)delegate]; + FormValidator *formValidator = [FormValidator getFormValidatorForDelegate:(id)delegate]; + [self setWithMap:json bothDelegates:formValidator]; +} + +#pragma mark - FormValidationProtocol + + +- (BOOL)isValidField { return self.valid; } - (nullable NSString *)formFieldName { return self.fieldKey; } + - (nullable id)formFieldValue { return self.text; } diff --git a/MVMCoreUI/Atoms/Views/CheckBoxWithLabel.swift b/MVMCoreUI/Atoms/Views/CheckBoxWithLabel.swift deleted file mode 100644 index 533ee060..00000000 --- a/MVMCoreUI/Atoms/Views/CheckBoxWithLabel.swift +++ /dev/null @@ -1,31 +0,0 @@ -// -// ChecckBoxWithLabel.swift -// MVMCoreUI -// -// Created by Suresh, Kamlesh on 4/3/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -import UIKit - -@objcMembers public class CheckBoxWithLabel: ViewConstrainingView { - let mvmCheckBox = MVMCoreUICheckBox(frame: .zero) - - public init() { - super.init(frame: .zero) - } - - public required init?(coder decoder: NSCoder) { - super.init(coder: decoder) - } - - public override func setupView() { - super.setupView() - addConstrainedView(mvmCheckBox) - } - - override open func setWithJSON(_ json: [AnyHashable: Any]?, delegate: NSObject?, additionalData: [AnyHashable: Any]?) { - super.setWithJSON(json, delegate: delegate, additionalData: additionalData) - mvmCheckBox.setWithJSON(json, delegate: delegate, additionalData: additionalData) - } -} diff --git a/MVMCoreUI/Atoms/Views/MFLabel.h b/MVMCoreUI/Atoms/Views/MFLabel.h index 193fe4fe..22308465 100644 --- a/MVMCoreUI/Atoms/Views/MFLabel.h +++ b/MVMCoreUI/Atoms/Views/MFLabel.h @@ -27,59 +27,37 @@ - (BOOL)hasText; #pragma mark - 2.0 - -+ (nonnull MFLabel *)commonLabelB2:(BOOL)scale; +//75Bd 40pt + (nonnull MFLabel *)commonLabelH1:(BOOL)scale; +//75Bd 25pt + (nonnull MFLabel *)commonLabelH2:(BOOL)scale; +//75Bd 18pt + (nonnull MFLabel *)commonLabelH3:(BOOL)scale; +//75Bd 32pt ++ (nonnull MFLabel *)commonLabelH32:(BOOL)scale; +//75Bd 13pt + (nonnull MFLabel *)commonLabelB1:(BOOL)scale; +//55Rg 13pt ++ (nonnull MFLabel *)commonLabelB2:(BOOL)scale; +//55Rg 11pt gray + (nonnull MFLabel *)commonLabelB3:(BOOL)scale; -+ (nonnull MFLabel *)commonLabelFeedMessage:(BOOL)scale; -+ (nonnull MFLabel *)commonLabelFeedSubMessage:(BOOL)scale; - -#pragma mark - 1.0 +//55Rg 20pt ++ (nonnull MFLabel *)commonLabelB20:(BOOL)scale; // Getters + (nonnull MFLabel *)label NS_SWIFT_NAME(commonLabel()); -+ (nonnull MFLabel *)commonLabelBodyWithSize:(CGFloat)size scale:(BOOL)scale; -+ (nonnull MFLabel *)commonLabelBodyBold:(BOOL)scale; -+ (nonnull MFLabel *)commonLabelBodyLighter:(BOOL)scale; -+ (nonnull MFLabel *)commonLabelBodyLarge:(BOOL)scale; -+ (nonnull MFLabel *)commonLabelHeadlineSmall:(BOOL)scale; -+ (nonnull MFLabel *)commonLabelHeadlineWithSize:(CGFloat)size scale:(BOOL)scale; -+ (nonnull MFLabel *)commonLabelHeadlineBlackWithSize:(CGFloat)size scale:(BOOL)scale; -+ (nonnull MFLabel *)commonLabelSubheadBold:(BOOL)scale; -+ (nonnull MFLabel *)commonLabelSubheadBoldLarge:(BOOL)scale; -+ (nonnull MFLabel *)commonLabelFeedHeadline:(BOOL)scale; -+ (nonnull MFLabel *)commonLabelFeedTitle:(BOOL)scale; -+ (nonnull MFLabel *)commonLabelPlanCardTitle:(BOOL)scale; -+ (nonnull MFLabel *)commonLabelTopAlert:(BOOL)scale; // Setters + (void)setLabel:(nullable UILabel *)label withHTML:(nullable NSString *)html; + (void)setUILabel:(nullable UILabel *)label withJSON:(nullable NSDictionary *)json delegate:(nullable NSObject *)delegate additionalData:(nullable NSDictionary *)additionalData; -- (void)styleB2:(BOOL)scale; -- (void)styleBodyWithSize:(CGFloat)size scale:(BOOL)scale; -- (void)styleBodyBold:(BOOL)scale; -- (void)styleBodyLighter:(BOOL)scale; -- (void)styleBodyLarge:(BOOL)scale; + - (void)styleH1:(BOOL)scale; - (void)styleH2:(BOOL)scale; -- (void)styleHeadlineLarge:(BOOL)scale; -- (void)styleHeadlineSmall:(BOOL)scale; -- (void)styleHeadlineWithSize:(CGFloat)size scale:(BOOL)scale; -- (void)styleHeadlineBlackWithSize:(CGFloat)size scale:(BOOL)scale; - (void)styleH3:(BOOL)scale; -- (void)styleSubheadBold:(BOOL)scale; -- (void)styleSubheadBoldLarge:(BOOL)scale; -- (void)styleB3:(BOOL)scale; -- (void)styleFeedHeadline:(BOOL)scale; -- (void)styleFeedTitle:(BOOL)scale; -- (void)stylePlanCardTitle:(BOOL)scale; +- (void)styleH32:(BOOL)scale; - (void)styleB1:(BOOL)scale; -- (void)styleTableRow:(BOOL)scale; - -// Without color -- (void)setFontH1:(BOOL)scale; +- (void)styleB2:(BOOL)scale; +- (void)styleB3:(BOOL)scale; +- (void)styleB20:(BOOL)scale; @end diff --git a/MVMCoreUI/Atoms/Views/MFLabel.m b/MVMCoreUI/Atoms/Views/MFLabel.m index eb9ed1c6..66b434e5 100644 --- a/MVMCoreUI/Atoms/Views/MFLabel.m +++ b/MVMCoreUI/Atoms/Views/MFLabel.m @@ -100,45 +100,11 @@ } } -#pragma mark - Getters - - (BOOL)hasText { return self.text.length > 0 || self.attributedText.length > 0; } -+ (nonnull MFLabel *)label { - return [[MFLabel alloc] initWithFrame:CGRectZero]; -} - -+ (nonnull MFLabel *)commonLabelB2:(BOOL)scale { - MFLabel *label = [MFLabel label]; - [label styleB2:scale]; - return label; -} - -+ (nonnull MFLabel *)commonLabelBodyWithSize:(CGFloat)size scale:(BOOL)scale { - MFLabel *label = [MFLabel label]; - [label styleBodyWithSize:size scale:scale]; - return label; -} - -+ (nonnull MFLabel *)commonLabelBodyBold:(BOOL)scale { - MFLabel *label = [MFLabel label]; - [label styleBodyBold:scale]; - return label; -} - -+ (nonnull MFLabel *)commonLabelBodyLighter:(BOOL)scale { - MFLabel *label = [MFLabel label]; - [label styleBodyLighter:scale]; - return label; -} - -+ (nonnull MFLabel *)commonLabelBodyLarge:(BOOL)scale { - MFLabel *label = [MFLabel label]; - [label styleBodyLarge:scale]; - return label; -} +#pragma mark - 2.0 + (nonnull MFLabel *)commonLabelH1:(BOOL)scale { MFLabel *label = [MFLabel label]; @@ -152,75 +118,14 @@ return label; } -+ (nonnull MFLabel *)commonLabelHeadlineSmall:(BOOL)scale { - MFLabel *label = [MFLabel label]; - [label styleHeadlineSmall:scale]; - return label; -} - -+ (nonnull MFLabel *)commonLabelHeadlineWithSize:(CGFloat)size scale:(BOOL)scale { - MFLabel *label = [MFLabel label]; - [label styleHeadlineWithSize:size scale:scale]; - return label; -} - -+ (nonnull MFLabel *)commonLabelHeadlineBlackWithSize:(CGFloat)size scale:(BOOL)scale { - MFLabel *label = [MFLabel label]; - [label styleHeadlineBlackWithSize:size scale:scale]; - return label; -} - + (nonnull MFLabel *)commonLabelH3:(BOOL)scale { MFLabel *label = [MFLabel label]; [label styleH3:scale]; return label; } - -+ (nonnull MFLabel *)commonLabelSubheadBold:(BOOL)scale { ++ (nonnull MFLabel *)commonLabelH32:(BOOL)scale { MFLabel *label = [MFLabel label]; - [label styleSubheadBold:scale]; - return label; -} - -+ (nonnull MFLabel *)commonLabelSubheadBoldLarge:(BOOL)scale { - MFLabel *label = [MFLabel label]; - [label styleSubheadBoldLarge:scale]; - return label; -} - -+ (nonnull MFLabel *)commonLabelB3:(BOOL)scale { - MFLabel *label = [MFLabel label]; - [label styleB3:scale]; - return label; -} - -+ (nonnull MFLabel *)commonLabelFeedMessage:(BOOL)scale { - MFLabel *label = [MFLabel label]; - [label styleFeedMessage:scale]; - return label; -} - -+ (nonnull MFLabel *)commonLabelFeedSubMessage:(BOOL)scale { - MFLabel *label = [MFLabel label]; - [label styleFeedSubMessage:scale]; - return label; -} - -+ (nonnull MFLabel *)commonLabelFeedHeadline:(BOOL)scale { - MFLabel *label = [MFLabel label]; - [label styleFeedHeadline:scale]; - return label; -} - -+ (nonnull MFLabel *)commonLabelFeedTitle:(BOOL)scale { - MFLabel *label = [MFLabel label]; - [label styleFeedTitle:scale]; - return label; -} - -+ (nonnull MFLabel *)commonLabelPlanCardTitle:(BOOL)scale { - MFLabel *label = [MFLabel label]; - [label stylePlanCardTitle:scale]; + [label styleH32:scale]; return label; } @@ -230,12 +135,28 @@ return label; } -+ (nonnull MFLabel *)commonLabelTopAlert:(BOOL)scale { ++ (nonnull MFLabel *)commonLabelB2:(BOOL)scale { MFLabel *label = [MFLabel label]; - [label styleTopAlert:scale]; + [label styleB2:scale]; return label; } ++ (nonnull MFLabel *)commonLabelB3:(BOOL)scale { + MFLabel *label = [MFLabel label]; + [label styleB3:scale]; + return label; +} + ++ (nonnull MFLabel *)commonLabelB20:(BOOL)scale { + MFLabel *label = [MFLabel label]; + [label styleB20:scale]; + return label; +} + ++ (nonnull MFLabel *)label { + return [[MFLabel alloc] initWithFrame:CGRectZero]; +} + #pragma mark - Setters + (void)setLabel:(nullable UILabel *)label withHTML:(nullable NSString *)html { @@ -316,31 +237,6 @@ self.originalAttributedString = self.attributedText; } -- (void)styleB2:(BOOL)scale { - [MFStyler styleLabelB2:self genericScaling:NO]; - [self setScale:scale]; -} - -- (void)styleBodyWithSize:(CGFloat)size scale:(BOOL)scale { - [MFStyler styleLabelB2:self size:size genericScaling:NO]; - [self setScale:scale]; -} - -- (void)styleBodyBold:(BOOL)scale { - [MFStyler styleLabelBodyBold:self genericScaling:NO]; - [self setScale:scale]; -} - -- (void)styleBodyLighter:(BOOL)scale { - [MFStyler styleLabelBodyLighter:self genericScaling:NO]; - [self setScale:scale]; -} - -- (void)styleBodyLarge:(BOOL)scale { - [MFStyler styleLabelBodyLarge:self genericScaling:NO]; - [self setScale:scale]; -} - - (void)styleH1:(BOOL)scale { [MFStyler styleLabelH1:self genericScaling:NO]; [self setScale:scale]; @@ -351,68 +247,13 @@ [self setScale:scale]; } -- (void)styleHeadlineLarge:(BOOL)scale { - [MFStyler styleLabelHeadlineLarge:self genericScaling:NO]; - [self setScale:scale]; -} -- (void)styleHeadlineSmall:(BOOL)scale { - [MFStyler styleLabelHeadlineSmall:self genericScaling:NO]; - [self setScale:scale]; -} - -- (void)styleHeadlineWithSize:(CGFloat)size scale:(BOOL)scale { - [MFStyler styleLabelH2:self size:size genericScaling:NO]; - [self setScale:scale]; -} - -- (void)styleHeadlineBlackWithSize:(CGFloat)size scale:(BOOL)scale { - [MFStyler styleLabelHeadlineBlack:self size:size genericScaling:NO]; - [self setScale:scale]; -} - - (void)styleH3:(BOOL)scale { [MFStyler styleLabelH3:self genericScaling:NO]; [self setScale:scale]; } -- (void)styleSubheadBold:(BOOL)scale { - [MFStyler styleLabelSubheadBold:self genericScaling:NO]; - [self setScale:scale]; -} - - -- (void)styleSubheadBoldLarge:(BOOL)scale { - [MFStyler styleLabelSubheadBoldLarge:self genericScaling:NO]; - [self setScale:scale]; -} - -- (void)styleB3:(BOOL)scale { - [MFStyler styleLabelB3:self genericScaling:NO]; - [self setScale:scale]; -} - -- (void)styleFeedMessage:(BOOL)scale { - [MFStyler styleLabelFeedMessage:self genericScaling:NO]; - [self setScale:scale]; -} - -- (void)styleFeedSubMessage:(BOOL)scale { - [MFStyler styleLabelFeedSubMessage:self genericScaling:NO]; - [self setScale:scale]; -} - -- (void)styleFeedHeadline:(BOOL)scale { - [MFStyler styleLabelHeadlineFeed:self genericScaling:NO]; - [self setScale:scale]; -} - -- (void)styleFeedTitle:(BOOL)scale { - [MFStyler styleFeedCardTitleLabel:self genericScaling:NO]; - [self setScale:scale]; -} - -- (void)stylePlanCardTitle:(BOOL)scale { - self.font = [MFStyler fontForPlanCardTitle:NO]; +- (void)styleH32:(BOOL)scale { + [MFStyler styleLabelH32:self genericScaling:NO]; [self setScale:scale]; } @@ -421,18 +262,18 @@ [self setScale:scale]; } -- (void)styleTableRow:(BOOL)scale { - [MFStyler styleLabelB1:self genericScaling:NO]; +- (void)styleB2:(BOOL)scale { + [MFStyler styleLabelB2:self genericScaling:NO]; [self setScale:scale]; } -- (void)styleTopAlert:(BOOL)scale { - self.font = [MFStyler fontB1:NO]; +- (void)styleB3:(BOOL)scale { + [MFStyler styleLabelB3:self genericScaling:NO]; [self setScale:scale]; } -- (void)setFontH1:(BOOL)scale { - self.font = [MFStyler fontH1:NO]; +- (void)styleB20:(BOOL)scale { + [MFStyler styleLabelB20:self genericScaling:NO]; [self setScale:scale]; } diff --git a/MVMCoreUI/Atoms/Views/MFRadioButton.h b/MVMCoreUI/Atoms/Views/MFRadioButton.h new file mode 100644 index 00000000..86837256 --- /dev/null +++ b/MVMCoreUI/Atoms/Views/MFRadioButton.h @@ -0,0 +1,89 @@ +// +// MFRadioButton.h +// MobileFirstFramework +// +// Created by Seshamani, Shreyas on 12/14/17. +// Copyright © 2017 Verizon Wireless. All rights reserved. +// + +#import +#import + + +typedef enum : NSUInteger { + ButtonSizeSmall,//24 + ButtonSizeSmall1,//30 + ButtonSizeSmall2,//36 + ButtonSizeMedium,//48 + ButtonSizeLarge,//60 + ButtonSizeExtraLarge,//96 +} ButtonSize; + +@interface MFRadioButton : UIView + + +// THESE ARE JUST DUMMY APIS. They will be deleted later!!!! + +typedef void (^PerformActionForRadioButton)(void); + +/* perform action for accessibility action*/ +@property (nullable, copy, nonatomic) PerformActionForRadioButton performActionForCheck; +typedef void (^CircleSelectedClosure)(_Nonnull id sender); + + +@property (nonatomic, strong, nullable) UIColor* fillColor; +@property (nonatomic, strong, nullable) UIColor* borderColor; +@property (nonatomic) CGFloat circleBorderWidth; +@property (nonatomic, copy, nullable) CircleSelectedClosure circleSelectedBlock; +@property (nonatomic, copy, nullable) CircleSelectedClosure handleSelectionBlock; +@property (nonatomic) CGFloat circleDiameter; +@property (nonatomic, nullable, strong, readonly) CAShapeLayer * myCircle; + +@property (nonatomic, strong, nullable) NSLayoutConstraint *heightConstraint; +@property (nonatomic, strong, nullable) NSLayoutConstraint *widthConstraint; +@property (nonatomic) BOOL respondsToTapGesture; +@property (nonatomic, getter = isSelected) BOOL selected; + +// Set line width manually +- (void)setCheckMarkLineWidth:(CGFloat)lineWidth; + +// Determine and set line width based on circle diameter +- (void)calculateAndSetCheckMarkLineWidth; + +- (void)setCheckMarkColor:(nullable UIColor *)color; + +-(void)animateCheckMark; + +-(void)drawCheckMarkWithoutAnimation; + +-(void)animateSelect:(nullable UIColor *)fillColor BorderColor:(nullable UIColor *)borderColor; + +- (void)addAccessibilityInformationIndex:(NSUInteger)index Total:(NSUInteger)totalCount; + +#pragma mark - Convenience + +/* Adds the border with the set border color and SelectableCircleBorderWidth */ +- (void)addBorder; + +/* Removes the border */ +- (void)removeBorder; + +/* Checks if the fill color is white*/ +- (BOOL)isFillColorWhite; + +/* Resize the circle for animations */ +-(void)resize:(ButtonSize)newSize; + +/* Deselect circle without calling blocks */ +- (void)cancelSelection; + +/* Disable the outer view */ +- (void)disableState; + +/* Enable outer view */ +- (void)enableState; + +#pragma mark - Animation +-(void)animateOutline:(nonnull UIColor *)strokeColor IsSelected:(BOOL)selected; + +@end diff --git a/MVMCoreUI/Atoms/Views/MFRadioButton.m b/MVMCoreUI/Atoms/Views/MFRadioButton.m new file mode 100644 index 00000000..d1a9ee03 --- /dev/null +++ b/MVMCoreUI/Atoms/Views/MFRadioButton.m @@ -0,0 +1,178 @@ +// +// MFRadioButton.m +// MobileFirstFramework +// +// Created by Seshamani, Shreyas on 12/14/17. +// Copyright © 2017 Verizon Wireless. All rights reserved. +// + +#import "MFRadioButton.h" +#import + +static CGFloat const DefaultOuterCircleSize = 31; +static CGFloat const DefaultInnerCircleSize = 19; + +@interface MFRadioButton () +@property (nullable, weak, nonatomic) UIView *outerCircleView; +@property (nullable, weak, nonatomic) UIView *innerCircleView; +@end + + +@implementation MFRadioButton + + + +- (instancetype)initWithFrame:(CGRect)frame { + + if (self = [super initWithFrame:frame]) { + [self setupView]; + } + return self; +} + +- (instancetype)initWithCoder:(NSCoder *)aDecoder { + + if (self = [super initWithCoder:aDecoder]) { + [self setupView]; + } + return self; +} + +- (instancetype)init { + + if (self = [super init]) { + [self setupView]; + } + return self; +} + +- (void)updateView:(CGFloat)size { + +} + +- (void)setupView { + + if (!self.outerCircleView && !self.innerCircleView) { + + UIView *outerCircleView = [[UIView alloc] init]; + [self addSubview:outerCircleView]; + outerCircleView.translatesAutoresizingMaskIntoConstraints = NO; + outerCircleView.layer.borderColor = [UIColor grayColor].CGColor; + outerCircleView.layer.borderWidth = 2.0; + + [outerCircleView.topAnchor constraintEqualToAnchor:self.topAnchor].active = YES; + [outerCircleView.leftAnchor constraintEqualToAnchor:self.leftAnchor].active = YES; + [outerCircleView.bottomAnchor constraintEqualToAnchor:self.bottomAnchor].active = YES; + [outerCircleView.rightAnchor constraintEqualToAnchor:self.rightAnchor].active = YES; + + [outerCircleView.widthAnchor constraintEqualToConstant:DefaultOuterCircleSize].active = YES; + [outerCircleView.heightAnchor constraintEqualToConstant:DefaultOuterCircleSize].active = YES; + + UIView *innerCircleView = [[UIView alloc] init]; + [outerCircleView addSubview:innerCircleView]; + innerCircleView.translatesAutoresizingMaskIntoConstraints = NO; + innerCircleView.backgroundColor = [UIColor blackColor]; + innerCircleView.hidden = YES; + + [innerCircleView.centerXAnchor constraintEqualToAnchor:outerCircleView.centerXAnchor].active = YES; + [innerCircleView.centerYAnchor constraintEqualToAnchor:outerCircleView.centerYAnchor].active = YES; + [innerCircleView.widthAnchor constraintEqualToConstant:DefaultInnerCircleSize].active = YES; + [innerCircleView.heightAnchor constraintEqualToConstant:DefaultInnerCircleSize].active = YES; + + outerCircleView.userInteractionEnabled = NO; + innerCircleView.userInteractionEnabled = NO; + + outerCircleView.layer.cornerRadius = DefaultOuterCircleSize/2; + innerCircleView.layer.cornerRadius = DefaultInnerCircleSize/2; + + self.outerCircleView = outerCircleView; + self.innerCircleView = innerCircleView; + + self.isAccessibilityElement = YES; + } +} + +//- (BOOL)isSelected { +// return self.selected; +//} + +- (void)setSelected:(BOOL)selected { + self.innerCircleView.hidden = !selected; + _selected = selected; +} + +/* Disable outer view */ +- (void)disableState { + self.outerCircleView.layer.borderColor = [UIColor mfLightSilver].CGColor; +} + +/* Enable the outer view */ +- (void)enableState { + self.outerCircleView.layer.borderColor = [UIColor grayColor].CGColor; +} + +#pragma mark - DUMMMIES + +// Set line width manually +- (void)setCheckMarkLineWidth:(CGFloat)lineWidth {} + +// Determine and set line width based on circle diameter +- (void)calculateAndSetCheckMarkLineWidth {} + +- (void)setCheckMarkColor:(nullable UIColor *)color {} + +-(void)animateCheckMark {} + +-(void)drawCheckMarkWithoutAnimation {} + +-(void)animateSelect:(nullable UIColor *)fillColor BorderColor:(nullable UIColor *)borderColor {} + +//- (void)addAccessibilityInformationIndex:(NSUInteger)index Total:(NSUInteger)totalCount {} + +/* Adds the border with the set border color and SelectableCircleBorderWidth */ +- (void)addBorder {} + +/* Removes the border */ +- (void)removeBorder {} + +/* Checks if the fill color is white*/ +- (BOOL)isFillColorWhite { return NO; } + +/* Resize the circle for animations */ +-(void)resize:(ButtonSize)newSize {} + +/* Deselect circle without calling blocks */ +- (void)cancelSelection {} + +#pragma mark - Animation +-(void)animateOutline:(nonnull UIColor *)strokeColor IsSelected:(BOOL)selected {} + +#pragma mark - Accessibility fucntion + +- (UIAccessibilityTraits)accessibilityTraits { + return ([super accessibilityTraits] | UIAccessibilityTraitButton); +} + +- (void)addAccessibilityInformationIndex:(NSUInteger)index Total:(NSUInteger)totalCount { + if(self.selected == YES){ + self.accessibilityTraits = (self.accessibilityTraits | UIAccessibilityTraitSelected); + } +} + +- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { + [super touchesEnded:touches withEvent:event]; + if (self.performActionForCheck) { + self.performActionForCheck(); + } +} + +//- (BOOL)accessibilityActivate { +// if (self.performActionForCheck) { +// self.performActionForCheck(); +// return YES; +// } else { +// return NO; +// } +//} + +@end diff --git a/MVMCoreUI/BaseControllers/MFLoadingViewController.m b/MVMCoreUI/BaseControllers/MFLoadingViewController.m index c44dd76f..aad2383e 100644 --- a/MVMCoreUI/BaseControllers/MFLoadingViewController.m +++ b/MVMCoreUI/BaseControllers/MFLoadingViewController.m @@ -33,6 +33,8 @@ activityIndicatorView.translatesAutoresizingMaskIntoConstraints = NO; [view addSubview:activityIndicatorView]; self.activityIndicator = activityIndicatorView; + self.activityIndicator.accessibilityIdentifier = @"Loader"; + [NSLayoutConstraint constraintPinView:activityIndicatorView heightConstraint:YES heightConstant:PaddingSix widthConstraint:YES widthConstant:PaddingSix]; // Sets the constraints for the activityIndicatorView diff --git a/MVMCoreUI/BaseControllers/MFViewController.m b/MVMCoreUI/BaseControllers/MFViewController.m index 28c3c625..c4ee3756 100644 --- a/MVMCoreUI/BaseControllers/MFViewController.m +++ b/MVMCoreUI/BaseControllers/MFViewController.m @@ -37,8 +37,6 @@ #import "MVMCoreUITabBarPageControlViewController.h" #import "MVMCoreUINavigationController.h" #import - - @import MVMAnimationFramework; @interface MFViewController() @@ -55,7 +53,7 @@ // title view for navigation bar, used for custom navigation titles @property (weak, nonatomic) UILabel *titleLabel; -@property (strong, nonatomic) FormValidator* formValidator; +@property (strong, nonatomic) FormValidator *formValidator; @end @@ -254,9 +252,7 @@ self.loadObject.pageJSON = page; } - [self updateUI]; -// [self newDataBuildScreen]; -// self.needToUpdateUI = YES; + [self updateUI]; [self.view setNeedsLayout]; [self.view layoutIfNeeded]; }]; @@ -413,9 +409,11 @@ [self initialLoad]; } - // Since we have new data, build stuff for the screen. + // Since we have new data, build stuff for the screen and update the ui once the screen is done laying out. [self updateUI]; + self.needToupdateUIOnScreenSizeChanges = YES; + if (UIAccessibilityIsVoiceOverRunning()) { self.disableAnimations = YES; } @@ -425,13 +423,10 @@ } } -- (void) updateUI { +- (void)updateUI { [self newDataBuildScreen]; [self.formValidator enableByValidation]; - - // Update the UI after the view is loaded. self.needToUpdateUI = YES; - self.needToupdateUIOnScreenSizeChanges = YES; } - (void)didReceiveMemoryWarning { diff --git a/MVMCoreUI/FormUIHelpers/FormValidationProtocol.swift b/MVMCoreUI/FormUIHelpers/FormValidationProtocol.swift new file mode 100644 index 00000000..afce4d28 --- /dev/null +++ b/MVMCoreUI/FormUIHelpers/FormValidationProtocol.swift @@ -0,0 +1,27 @@ +// +// FormValidationProtocol.swift +// MVMCoreUI +// +// Created by Suresh, Kamlesh on 3/26/19. +// Copyright © 2019 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objc public protocol FormValidationProtocol: NSObjectProtocol { + + // Getter method to get the FormValidator form the delegate (Mostly from the parent View Controller) + @objc optional func formValidatorModel() -> FormValidator? + + // Used to check the validity of the field, to enable/disable the primary button. + @objc optional func isValidField() -> Bool + + // Based on the isValidField(), the fields which needs to be enabled can call this method + @objc optional func enableField(_ enable: Bool) + + // The Field name key value pair for sending to server + @objc optional func formFieldName() -> String? + + // The Feild value key value paid for sending to server + @objc optional func formFieldValue() -> String? +} diff --git a/MVMCoreUI/FormUIHelpers/FormValidator+FormParams.swift b/MVMCoreUI/FormUIHelpers/FormValidator+FormParams.swift new file mode 100644 index 00000000..2f1e9f99 --- /dev/null +++ b/MVMCoreUI/FormUIHelpers/FormValidator+FormParams.swift @@ -0,0 +1,31 @@ +// +// MVMCoreUIFormValidator+FormParams.swift +// MVMCoreUI +// +// Created by Suresh, Kamlesh on 3/21/19. +// Copyright © 2019 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objc public extension FormValidator { + @objc public func addFormParams(requestParameters: MVMCoreRequestParameters) { + requestParameters.add(self.getFormParams()) + } + + @objc public func getFormParams() -> [String: Any] { + var extraParam: [String: Any] = [:] + MVMCoreDispatchUtility.performSyncBlock(onMainThread: { + for molecule in self.molecules { + if let formFieldName = molecule.formFieldName, + let formFieldValue = molecule.formFieldValue, + let fieldName = formFieldName(), + let fieldValue = formFieldValue() { + + extraParam[fieldName] = fieldValue + } + } + }) + return extraParam + } +} diff --git a/MVMCoreUI/FormUIHelpers/FormValidator+TextFields.swift b/MVMCoreUI/FormUIHelpers/FormValidator+TextFields.swift new file mode 100644 index 00000000..2532910d --- /dev/null +++ b/MVMCoreUI/FormUIHelpers/FormValidator+TextFields.swift @@ -0,0 +1,92 @@ +// +// MVMCoreUIFormValidator+TextFields.swift +// MVMCoreUI +// +// Created by Suresh, Kamlesh on 3/21/19. +// Copyright © 2019 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objc extension FormValidator: UITextFieldDelegate { + public func textFieldDidEndEditing(_ textField: UITextField) { + enableByValidation() + if let delegate = delegate as? UITextFieldDelegate { + delegate.textFieldDidEndEditing?(textField) + } + } + + public func textFieldShouldReturn(_ textField: UITextField) -> Bool { + textField.resignFirstResponder() + if let delegate = delegate as? UITextFieldDelegate { + return delegate.textFieldShouldReturn?(textField) ?? true + } + return true + } + + public func textFieldDidBeginEditing(_ textField: UITextField) { + if let delegate = delegate as? UITextFieldDelegate { + delegate.textFieldDidBeginEditing?(textField) + } + } + + public func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool { + if let delegate = delegate as? UITextFieldDelegate { + return delegate.textFieldShouldBeginEditing?(textField) ?? true + } + return true + } + + public func textFieldShouldEndEditing(_ textField: UITextField) -> Bool { + if let delegate = delegate as? UITextFieldDelegate { + return delegate.textFieldShouldEndEditing?(textField) ?? true + } + return true + } + + public func textFieldDidEndEditing(_ textField: UITextField, reason: UITextField.DidEndEditingReason) { + if let delegate = delegate as? UITextFieldDelegate { + delegate.textFieldDidEndEditing?(textField, reason: reason) + } + } + + public func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { + if let delegate = delegate as? UITextFieldDelegate { + return delegate.textField?(textField, shouldChangeCharactersIn: range, replacementString: string) ?? true + } + return true + } + + public func textFieldShouldClear(_ textField: UITextField) -> Bool { + if let delegate = delegate as? UITextFieldDelegate { + return delegate.textFieldShouldClear?(textField) ?? true + } + return true + } +} + +@objc extension FormValidator: MFTextFieldDelegate { + public func dismissFieldInput(_ sender: Any?) { + if let delegate = delegate as? MFTextFieldDelegate { + delegate.dismissFieldInput?(sender) + } + } + + public func entryIsValid(_ textfield: MFTextField?) { + MVMCoreDispatchUtility.performBlock(onMainThread: { + self.enableByValidation() + if let delegate = self.delegate as? MFTextFieldDelegate { + delegate.entryIsValid?(textfield) + } + }) + } + + public func entryIsInvalid(_ textfield: MFTextField?) { + MVMCoreDispatchUtility.performBlock(onMainThread: { + self.enableByValidation() + if let delegate = self.delegate as? MFTextFieldDelegate { + delegate.entryIsInvalid?(textfield) + } + }) + } +} diff --git a/MVMCoreUI/Models/FormValidator.swift b/MVMCoreUI/FormUIHelpers/FormValidator.swift similarity index 100% rename from MVMCoreUI/Models/FormValidator.swift rename to MVMCoreUI/FormUIHelpers/FormValidator.swift diff --git a/MVMCoreUI/MVMCoreUI.h b/MVMCoreUI/MVMCoreUI.h index 53ceeb3e..e9e7c92a 100644 --- a/MVMCoreUI/MVMCoreUI.h +++ b/MVMCoreUI/MVMCoreUI.h @@ -85,6 +85,7 @@ FOUNDATION_EXPORT const unsigned char MVMCoreUIVersionString[]; #import #import #import +#import #pragma mark Buttons #import diff --git a/MVMCoreUI/Models/FormValidator+FormParams.swift b/MVMCoreUI/Models/FormValidator+FormParams.swift deleted file mode 100644 index 2c6c1d2a..00000000 --- a/MVMCoreUI/Models/FormValidator+FormParams.swift +++ /dev/null @@ -1,32 +0,0 @@ -// -// MVMCoreUIFormValidator+FormParams.swift -// MVMCoreUI -// -// Created by Suresh, Kamlesh on 3/21/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -import Foundation - -@objc public extension FormValidator { - @objc public func addFormParams(requestParameters: MVMCoreRequestParameters) { - DispatchQueue.main.sync { - requestParameters.add(self.getFormParams()) - } - } - - @objc public func getFormParams() -> [String: Any] { - - var extraParam: [String: Any] = [:] - for molecule in self.molecules { - if let formFieldName = molecule.formFieldName, - let formFieldValue = molecule.formFieldValue, - let fieldName = formFieldName(), - let fieldValue = formFieldValue() { - - extraParam[fieldName] = fieldValue - } - } - return extraParam - } -} diff --git a/MVMCoreUI/Models/FormValidator+TextFields.swift b/MVMCoreUI/Models/FormValidator+TextFields.swift deleted file mode 100644 index d95a4cbb..00000000 --- a/MVMCoreUI/Models/FormValidator+TextFields.swift +++ /dev/null @@ -1,46 +0,0 @@ -// -// MVMCoreUIFormValidator+TextFields.swift -// MVMCoreUI -// -// Created by Suresh, Kamlesh on 3/21/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -import Foundation - -@objc extension FormValidator: UITextFieldDelegate, UITextViewDelegate, MFTextFieldDelegate{ - public func textFieldDidEndEditing(_ textField: UITextField) { - enableByValidation() - } - - public func dismissFieldInput(_ sender: Any?) { - if let delegate = delegate as? MFTextFieldDelegate, - let dismissFieldInput = delegate.dismissFieldInput { - dismissFieldInput(sender) - } - } - - public func textFieldShouldReturn(_ textField: UITextField) -> Bool { - textField.resignFirstResponder() - return true - } - - public func textFieldDidBeginEditing(_ textField: UITextField) { - if let delegate = delegate as? UITextFieldDelegate, - let textFieldDidBeginEditing = delegate.textFieldDidBeginEditing { - textFieldDidBeginEditing(textField) - } - } - - public func entryIsValid(_ textfield: MFTextField?) { - DispatchQueue.main.async { - self.enableByValidation() - } - } - - public func entryIsInvalid(_ textfield: MFTextField?) { - DispatchQueue.main.async { - self.enableByValidation() - } - } -} diff --git a/MVMCoreUI/Molecules/TopLabelsView.m b/MVMCoreUI/Molecules/TopLabelsView.m index 04c9b758..08bd4007 100644 --- a/MVMCoreUI/Molecules/TopLabelsView.m +++ b/MVMCoreUI/Molecules/TopLabelsView.m @@ -180,7 +180,7 @@ #pragma mark - Common styles - (void)setAsLargeHeadline { - [MFStyler styleLabelHeadlineLarge:self.headlineLabel]; + [MFStyler styleLabelH1:self.headlineLabel]; [self layoutIfNeeded]; if (self.tableView) { [self.tableView showHeader]; diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m b/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m index 4eb66001..48a99509 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m +++ b/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m @@ -33,7 +33,7 @@ @"caretView": CaretView.class, @"caretButton": CaretButton.class, @"textField" : MFTextField.class, - @"checkbox" : CheckBoxWithLabel.class + @"checkbox" : MVMCoreUICheckBox.class } mutableCopy]; }); return mapping; diff --git a/MVMCoreUI/Protocols/FormValidationProtocol.swift b/MVMCoreUI/Protocols/FormValidationProtocol.swift deleted file mode 100644 index 5336af24..00000000 --- a/MVMCoreUI/Protocols/FormValidationProtocol.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// FormValidationProtocol.swift -// MVMCoreUI -// -// Created by Suresh, Kamlesh on 3/26/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -import Foundation - -@objc public protocol FormValidationProtocol: NSObjectProtocol { - - @objc optional func formValidatorModel() -> FormValidator? - @objc optional func isValidField() -> Bool - @objc optional func enableField(_ enable: Bool) - - @objc optional func formFieldName() -> String? - @objc optional func formFieldValue() -> Any? -} diff --git a/MVMCoreUI/Styles/MFStyler.h b/MVMCoreUI/Styles/MFStyler.h index 2020d5c6..488a0648 100644 --- a/MVMCoreUI/Styles/MFStyler.h +++ b/MVMCoreUI/Styles/MFStyler.h @@ -104,6 +104,9 @@ B3 -> Legal //75Bd 18pt + (nullable UIFont *)fontH3:(BOOL)genericScaling; + (nullable UIFont *)fontH3; +//75Bd 32pt ++ (nullable UIFont *)fontH32:(BOOL)genericScaling; ++ (nullable UIFont *)fontH32; //75Bd 13pt + (nullable UIFont *)fontB1:(BOOL)genericScaling; @@ -114,10 +117,9 @@ B3 -> Legal //55Rg 11pt + (nullable UIFont *)fontB3:(BOOL)genericScaling; + (nullable UIFont *)fontB3; -//55Rg 14pt -+ (nullable UIFont *)fontB4:(BOOL)genericScaling; -+ (nullable UIFont *)fontB4; - +//55Rg 20pt ++ (nullable UIFont *)fontB20:(BOOL)genericScaling; ++ (nullable UIFont *)fontB20; #pragma mark - 1.0 fonts @@ -125,91 +127,48 @@ B3 -> Legal + (nullable UIFont *)fontForPlan; //75Bd 48pt + (nullable UIFont *)fontForBiggerHeadline; -//75Bd 26pt -+ (nullable UIFont *)fontForLoyaltySignUpHeadLine; -//75Bd 40pt -+ (nullable UIFont *)fontForFeedHeadline; -//55Rg 20pt -+ (nullable UIFont *)fontForFeedMessage; -//55Rg 11pt -+ (nullable UIFont *)fontForFeedSubMessage; //75Bd 15pt + (nullable UIFont *)fontForHeadlineSmall; -//75Bd 11pt -+ (nullable UIFont *)fontForHeadlineTiny; -//75Bd 16pt -+ (nullable UIFont *)fontForHeadlineSmall2; -//75Bd 32pt -+ (nullable UIFont *)fontForHeadlineLarge; -//75Bd 36pt -+ (nullable UIFont *)fontForHeadlineExtraLarge; -//75Bd 14pt -+ (nullable UIFont *)fontForSubheadBold; -//75Md 20pt -+ (nullable UIFont *)fontForSubheadBoldLarge; - //55Rg 14pt + (nullable UIFont *)fontforChatText; //55Rg 16pt + (nullable UIFont *)fontForAccountLandingGreeting; -//55Rg 20pt -+ (nullable UIFont *)fontForBodyLarge; -//Bold System 13 -+ (nullable UIFont *)fontForBodyBold; - //55Rg 10pt + (nullable UIFont *)fontForProgressBarBottomLabel; //55Rg 14pt + (nullable UIFont *)fontForPrimaryButton; -//55Rg 12pt +//75Bd 11pt + (nullable UIFont *)fontForSmallButton; -//45Lt 20pt +//55Rg 16pt + (nullable UIFont *)fontForTextField; //55Rg 12pt + (nullable UIFont *)fontForTextFieldUnderLabel; -//45Lt 24pt +//55Rg 24pt + (nullable UIFont *)fontForHeadlineAlternative; -//65Md 16pt +//75Bd 16pt + (nullable UIFont *)fontForFeedCardTitle; -//65Md 18pt -+ (nullable UIFont *)fontForSupportQuestionMark; -//65Md 11pt -+ (nullable UIFont *)fontForSupportDateStamp; -//65Md 10pt -+ (nullable UIFont *)fontForProgressBarTopLabel; -//75Bd 20pt -+ (nullable UIFont *)fontForPlanCardTitle; -//75Bd 18pt -+ (nullable UIFont *)fontForAccesseriesHeadline; //75Bd 60pt + (nullable UIFont *)fontForLargeLoyaltyHeaderTitle; //75Bd 42pt + (nullable UIFont *)fontForLoyaltyTitleSmall; //55Rg 20pt + (nullable UIFont *)fontForLoyaltyMessage; -//45Lt 24pt only for support +//75Bd 10pt only for support + (nullable UIFont *)fontForUnreadMessageOnSupport; // Returns the fonts for these styles allowing to apply a generic scale by device or not. -+ (nullable UIFont *)fontForHeadlineWithSize:(CGFloat)size genericScaling:(BOOL)genericScaling; -+ (nullable UIFont *)fontForFeedHeadline:(BOOL)genericScaling; -+ (nullable UIFont *)fontForFeedMessage:(BOOL)genericScaling; -+ (nullable UIFont *)fontForFeedSubMessage:(BOOL)genericScaling; ++ (nullable UIFont *)fontForBiggerHeadLine:(BOOL)genericScaling; ++ (nullable UIFont *)fontForPlan:(BOOL)genericScaling; + (nullable UIFont *)fontForHeadlineSmall:(BOOL)genericScaling; ++ (nullable UIFont *)fontForHeadlineSmall2; + (nullable UIFont *)fontForHeadlineSmall2:(BOOL)genericScaling; + (nullable UIFont *)fontForHeadlineSmall2ForWidth:(CGFloat)size; -+ (nullable UIFont *)fontForHeadlineLarge:(BOOL)genericScaling; -+ (nullable UIFont *)fontForHeadlineExtraLarge:(BOOL)genericScaling; + (nullable UIFont *)fontB1ForWidth:(CGFloat)size; -+ (nullable UIFont *)fontForSubheadBold:(BOOL)genericScaling; -+ (nullable UIFont *)fontForSubheadBoldLarge:(BOOL)genericScaling; + (nullable UIFont *)fontForBodyWithSize:(CGFloat)size genericScaling:(BOOL)genericScaling; + (nullable UIFont *)fontB2ForWidth:(CGFloat)size; + (nullable UIFont *)fontForBodyWithSize:(CGFloat)size forWidth:(CGFloat)width; + (nullable UIFont *)fontforChatText:(BOOL)genericScaling; + (nullable UIFont *)fontForAccountLandingGreeting:(BOOL)genericScaling; -+ (nullable UIFont *)fontForBodyLarge:(BOOL)genericScaling; -+ (nullable UIFont *)fontForBodyBold:(BOOL)genericScaling; + (nullable UIFont *)fontForPrimaryButton:(BOOL)genericScaling; + (nullable UIFont *)fontForPrimaryButtonForWidth:(CGFloat)size; @@ -221,11 +180,6 @@ B3 -> Legal + (nullable UIFont *)fontForHeadlineAlternativeForWidth:(CGFloat)size; + (nullable UIFont *)fontForFeedCardTitle:(BOOL)genericScaling; -+ (nullable UIFont *)fontForSupportQuestionMark:(BOOL)genericScaling; -+ (nullable UIFont *)fontForSupportDateStamp:(BOOL)genericScaling; -+ (nullable UIFont *)fontForProgressBarTopLabel:(BOOL)genericScaling; -+ (nullable UIFont *)fontForPlanCardTitle:(BOOL)genericScaling; -+ (nullable UIFont *)fontForAccesseriesHeadline:(BOOL)genericScaling; + (nullable UIFont *)fontForLargeLoyaltyHeaderTitle:(BOOL)genericScaling; + (nullable UIFont *)fontForLoyaltyTitleSmall:(BOOL)genericScaling; + (nullable UIFont *)fontForLoyaltyMessage:(BOOL)genericScaling; @@ -251,83 +205,52 @@ B3 -> Legal + (void)styleLabelH3:(nonnull UILabel *)label; + (void)styleLabelH3:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling; ++ (void)styleLabelH32:(nonnull UILabel *)label; ++ (void)styleLabelH32:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling; + + (void)styleLabelB1:(nonnull UILabel *)label; + (void)styleLabelB1:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling; ++ (void)styleLabelB2:(nonnull UILabel *)label; + (void)styleLabelB2:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling; + (void)styleLabelB2:(nonnull UILabel *)label size:(CGFloat)size genericScaling:(BOOL)genericScaling; + (void)styleLabelB3:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling; + (void)styleLabelB3:(nonnull UILabel *)label; -+ (void)styleLabelB4:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling; -+ (void)styleLabelB4:(nonnull UILabel *)label; ++ (void)styleLabelB20:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling; ++ (void)styleLabelB20:(nonnull UILabel *)label; + (void)styleLabelTextStyle2:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling; + (void)styleLabelTextStyle2:(nonnull UILabel *)label; #pragma mark - 1.0 styles -+ (void)styleLabelHeadlineLarge:(nonnull UILabel *)label; -+ (void)styleLabelHeadlineExtraLarge:(nonnull UILabel *)label; -+ (void)styleLabelHeadlineFeed:(nonnull UILabel *)label; -+ (void)styleLabelFeedMessage:(nonnull UILabel *)label; -+ (void)styleLabelFeedSubMessage:(nonnull UILabel *)label; -+ (void)styleLabelSubheadBold:(nonnull UILabel *)label; -+ (void)styleLabelB2:(nonnull UILabel *)label; -+ (void)styleLabelBodyLarge:(nonnull UILabel *)label; -+ (void)styleLabelBodyBold:(nonnull UILabel *)label; -+ (void)styleLabelBodyLighter:(nonnull UILabel *)label; - - + (void)styleFeedCardTitleLabel:(nonnull UILabel *)label; + (void)styleFeedCardTagLabel:(nonnull UILabel *)label; - + (void)styleStandardSeparatorView:(nonnull UIView *)view; + (void)styleLabelHeadlineSmall:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling; -+ (void)styleLabelHeadlineLarge:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling; -+ (void)styleLabelHeadlineExtraLarge:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling; -+ (void)styleLabelHeadlineFeed:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling; -+ (void)styleLabelFeedMessage:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling; -+ (void)styleLabelFeedSubMessage:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling; -+ (void)styleLabelH2:(nonnull UILabel *)label size:(CGFloat)size genericScaling:(BOOL)genericScaling; -+ (void)styleLabelHeadlineBlack:(nonnull UILabel *)label size:(CGFloat)size genericScaling:(BOOL)genericScaling; -+ (void)styleLabelSubheadBold:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling; -+ (void)styleLabelSubheadBoldLarge:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling; -+ (void)styleLabelBodyLarge:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling; -+ (void)styleLabelBodyBold:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling; -+ (void)styleLabelBodyLighter:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling; + (void)styleFeedCardTitleLabel:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling; + (void)styleFeedCardTagLabel:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling; //------------------------------------------------- -// Sets the text with strings attributed with these styles. - -+ (void)styleSetLabelTextWithH2:(nonnull UILabel *)label text:(nullable NSString *)text; -+ (void)styleSetLabelTextWithHeadlineLarge:(nonnull UILabel *)label text:(nullable NSString *)text; -+ (void)styleSetLabelTextWithHeadlineExtraLarge:(nonnull UILabel *)label text:(nullable NSString *)text; -+ (void)styleSetLabelTextWithH3:(nonnull UILabel *)label text:(nullable NSString *)text; -+ (void)styleSetLabelTextWithB2:(nonnull UILabel *)label text:(nullable NSString *)text; -+ (void)styleSetLabelTextWithBodyBold:(nonnull UILabel *)label text:(nullable NSString *)text; -+ (void)styleSetLabelTextWithB3:(nonnull UILabel *)label text:(nullable NSString *)text; #pragma mark - Attributed Strings + (nonnull NSAttributedString *)styleGetAttributedString:(nullable NSString *)string font:(nonnull UIFont *)font color:(nonnull UIColor *)color; -+ (nonnull NSAttributedString *)styleGetHeadlineAttributedString:(nullable NSString *)string; -+ (nonnull NSAttributedString *)styleGetHeadlineLargeAttributedString:(nullable NSString *)string; -+ (nonnull NSAttributedString *)styleGetHeadlineExtraLargeAttributedString:(nullable NSString *)string; -+ (nonnull NSAttributedString *)styleGetSubheadAttributedString:(nullable NSString *)string; -+ (nonnull NSAttributedString *)styleGetBodyAttributedString:(nullable NSString *)string; -+ (nonnull NSAttributedString *)styleGetBodyBoldAttributedString:(nullable NSString *)string; -+ (nonnull NSAttributedString *)styleGetDisabledBodyAttributedString:(nullable NSString *)string; -+ (nonnull NSAttributedString *)styleGetLegalAttributedString:(nullable NSString *)string; -+ (nonnull NSAttributedString *)styleGetSubtitleAttributedString:(nullable NSString *)string; -+ (nonnull NSAttributedString *)styleGetDisabledSubtitleAttributedString:(nullable NSString *)string; ++ (nonnull NSAttributedString *)styleGetH1AttributedString:(nullable NSString *)string; ++ (nonnull NSAttributedString *)styleGetH2AttributedString:(nullable NSString *)string; ++ (nonnull NSAttributedString *)styleGetH3AttributedString:(nullable NSString *)string; ++ (nonnull NSAttributedString *)styleGetB1AttributedString:(nullable NSString *)string; ++ (nonnull NSAttributedString *)styleGetB2AttributedString:(nullable NSString *)string; ++ (nonnull NSAttributedString *)styleGetB3AttributedString:(nullable NSString *)string; + ++ (nonnull NSAttributedString *)styleGetDisabledB2AttributedString:(nullable NSString *)string; ++ (nonnull NSAttributedString *)styleGetDisabledB1AttributedString:(nullable NSString *)string; + (nonnull NSAttributedString *)styleGetTopAlignedAttributeStringWithLeftString:(nullable NSString *)left centerString:(nonnull NSString *)center rightString:(nullable NSString *)right withCenterStringFontSize:(CGFloat)fontSize andColor:(nonnull UIColor *)color; + (nonnull NSAttributedString *)styleGetTopAlignedAttributeStringWithLeftStringRightTop:(nullable NSString *)left centerString:(nonnull NSString *)center rightString:(nullable NSString *)right withCenterStringFontSize:(CGFloat)fontSize andColor:(nonnull UIColor *)color; + (void)styleGetAlignCenteredAttrituedString:(nullable NSMutableAttributedString *)string; @@ -336,6 +259,7 @@ B3 -> Legal //------------------------------------------------- // Returns colors for Gradient Text presets + + (nonnull NSArray *)gradientSpecialTicketGold; + (nonnull NSArray *)gradientSpecialTicketGoldCGColor; diff --git a/MVMCoreUI/Styles/MFStyler.m b/MVMCoreUI/Styles/MFStyler.m index 4367b37e..36d04e51 100644 --- a/MVMCoreUI/Styles/MFStyler.m +++ b/MVMCoreUI/Styles/MFStyler.m @@ -126,15 +126,68 @@ CGFloat const LabelWithInternalButtonLineSpace = 2; return [self fontH3:YES]; } -#pragma mark - Fonts - -+ (nullable UIFont *)fontForHeadlineWithSize:(CGFloat)size genericScaling:(BOOL)genericScaling { ++ (nullable UIFont *)fontH32:(BOOL)genericScaling { + CGFloat size = 32; if (genericScaling) { size = [self sizeFontGenericForCurrentDevice:size]; } return [MFFonts mfFont75Bd:size]; } ++ (nullable UIFont *)fontH32 { + return [self fontH32:YES]; +} + ++ (nullable UIFont *)fontB1:(BOOL)genericScaling { + CGFloat size = 13; + if (genericScaling) { + size = [self sizeFontGenericForCurrentDevice:size]; + } + return [MFFonts mfFont75Bd:size]; +} + ++ (nullable UIFont *)fontB1 { + return [self fontB1:YES]; +} + ++ (nullable UIFont *)fontB2:(BOOL)genericScaling { + CGFloat size = 13; + if (genericScaling) { + size = [self sizeFontGenericForCurrentDevice:size]; + } + return [MFFonts mfFont55Rg:size]; +} + ++ (nullable UIFont *)fontB2 { + return [self fontB2:YES]; +} + ++ (nullable UIFont *)fontB3:(BOOL)genericScaling { + CGFloat size = 11; + if (genericScaling) { + size = [self sizeFontGenericForCurrentDevice:size]; + } + return [MFFonts mfFont55Rg:size]; +} + ++ (nullable UIFont *)fontB3 { + return [self fontB3:YES]; +} + ++ (nullable UIFont *)fontB20:(BOOL)genericScaling { + CGFloat size = 20; + if (genericScaling) { + size = [self sizeFontGenericForCurrentDevice:size]; + } + return [MFFonts mfFont55Rg:size]; +} + ++ (nullable UIFont *)fontB20 { + return [self fontB20:YES]; +} + +#pragma mark - 1.0 Fonts + + (nullable UIFont *)fontForPlan:(BOOL)genericScaling { CGFloat size = 100; if (genericScaling) { @@ -143,6 +196,10 @@ CGFloat const LabelWithInternalButtonLineSpace = 2; return [MFFonts mfFont75Bd:size]; } ++ (nullable UIFont *)fontForPlan { + return [self fontForPlan:YES]; +} + + (nullable UIFont *)fontForBiggerHeadLine:(BOOL)genericScaling { CGFloat size = 48; if (genericScaling) { @@ -151,36 +208,8 @@ CGFloat const LabelWithInternalButtonLineSpace = 2; return [MFFonts mfFont75Bd:size]; } -+ (nullable UIFont *)fontForLoyaltySignUpHeadLine:(BOOL)genericScaling { - CGFloat size = 26; - if (genericScaling) { - size = [self sizeFontGenericForCurrentDevice:size]; - } - return [MFFonts mfFont75Bd:size]; -} - -+ (nullable UIFont *)fontForFeedHeadline:(BOOL)genericScaling { - CGFloat size = 32; - if (genericScaling) { - size = [self sizeFontGenericForCurrentDevice:size]; - } - return [MFFonts mfFont75Bd:size]; -} - -+ (nullable UIFont *)fontForFeedMessage:(BOOL)genericScaling { - CGFloat size = 20; - if (genericScaling) { - size = [self sizeFontGenericForCurrentDevice:size]; - } - return [MFFonts mfFont55Rg:size]; -} - -+ (nullable UIFont *)fontForFeedSubMessage:(BOOL)genericScaling { - CGFloat size = 11; - if (genericScaling) { - size = [self sizeFontGenericForCurrentDevice:size]; - } - return [MFFonts mfFont55Rg:size]; ++ (nullable UIFont *)fontForBiggerHeadline { + return [self fontForBiggerHeadLine:YES]; } + (nullable UIFont *)fontForHeadlineSmall:(BOOL)genericScaling { @@ -205,61 +234,12 @@ CGFloat const LabelWithInternalButtonLineSpace = 2; return [MFFonts mfFont75Bd:pointSize]; } -+ (nullable UIFont *)fontForHeadlineLarge:(BOOL)genericScaling { - CGFloat size = 40; - if (genericScaling) { - size = [self sizeFontGenericForCurrentDevice:size]; - } - return [MFFonts mfFont75Bd:size]; -} - -+ (nullable UIFont *)fontForHeadlineExtraLarge:(BOOL)genericScaling { - CGFloat size = 36; - if (genericScaling) { - size = [self sizeFontGenericForCurrentDevice:size]; - } - return [MFFonts mfFont75Bd:size]; -} - -+ (nullable UIFont *)commonLabelB1:(BOOL)genericScaling { - CGFloat size = 13; - if (genericScaling) { - size = [self sizeFontGenericForCurrentDevice:size]; - } - return [MFFonts mfFont75Bd:size]; -} - + (nullable UIFont *)fontB1ForWidth:(CGFloat)size { CGFloat pointSize = 13; pointSize = [[MFStyler sizeObjectGenericForCurrentDevice:pointSize] getValueBasedOnSize:size]; return [MFFonts mfFont75Bd:pointSize]; } -+ (nullable UIFont *)fontForSubheadBold:(BOOL)genericScaling { - CGFloat size = 14; - if (genericScaling) { - size = [self sizeFontGenericForCurrentDevice:size]; - } - return [MFFonts mfFont75Bd:size]; -} - - -+ (nullable UIFont *)fontForSubheadBoldLarge:(BOOL)genericScaling { - CGFloat size = 20; - if (genericScaling) { - size = [self sizeFontGenericForCurrentDevice:size]; - } - return [MFFonts mfFont75Bd:size]; -} - -+ (nullable UIFont *)fontB2:(BOOL)genericScaling { - CGFloat size = 13; - if (genericScaling) { - size = [self sizeFontGenericForCurrentDevice:size]; - } - return [MFFonts mfFont55Rg:size]; -} - + (nullable UIFont *)fontForBodyWithSize:(CGFloat)size genericScaling:(BOOL)genericScaling { if (genericScaling) { size = [self sizeFontGenericForCurrentDevice:size]; @@ -294,30 +274,6 @@ CGFloat const LabelWithInternalButtonLineSpace = 2; return [MFFonts mfFont55Rg:size]; } -+ (nullable UIFont *)fontForBodyLarge:(BOOL)genericScaling { - CGFloat size = 20; - if (genericScaling) { - size = [self sizeFontGenericForCurrentDevice:size]; - } - return [MFFonts mfFont55Rg:size]; -} - -+ (nullable UIFont *)fontForBodyBold:(BOOL)genericScaling { - CGFloat size = 13; - if (genericScaling) { - size = [self sizeFontGenericForCurrentDevice:size]; - } - return [MFFonts mfFont75Bd:size]; -} - -+ (nullable UIFont *)fontB3:(BOOL)genericScaling { - CGFloat size = 11; - if (genericScaling) { - size = [self sizeFontGenericForCurrentDevice:size]; - } - return [MFFonts mfFont55Rg:size]; -} - + (nullable UIFont *)fontForProgressBarBottomLabel:(BOOL)genericScaling { CGFloat size = 10; if (genericScaling) { @@ -326,14 +282,6 @@ CGFloat const LabelWithInternalButtonLineSpace = 2; return [MFFonts mfFont55Rg:size]; } -+ (nullable UIFont *)fontB1:(BOOL)genericScaling { - CGFloat size = 13; - if (genericScaling) { - size = [self sizeFontGenericForCurrentDevice:size]; - } - return [MFFonts mfFont75Bd:size]; -} - + (nullable UIFont *)fontForPrimaryButton:(BOOL)genericScaling { CGFloat size = 14; if (genericScaling) { @@ -416,54 +364,6 @@ CGFloat const LabelWithInternalButtonLineSpace = 2; return [MFFonts mfFont75Bd:size]; } -+ (nullable UIFont *)fontB4:(BOOL)genericScaling { - CGFloat size = 14; - if (genericScaling) { - size = [self sizeFontGenericForCurrentDevice:size]; - } - return [MFFonts mfFont55Rg:size]; -} - -+ (nullable UIFont *)fontForSupportQuestionMark:(BOOL)genericScaling { - CGFloat size = 18; - if (genericScaling) { - size = [self sizeFontGenericForCurrentDevice:size]; - } - return [MFFonts mfFont75Bd:size]; -} - -+ (nullable UIFont *)fontForSupportDateStamp:(BOOL)genericScaling { - CGFloat size = 11; - if (genericScaling) { - size = [self sizeFontGenericForCurrentDevice:size]; - } - return [MFFonts mfFont75Bd:size]; -} - -+ (nullable UIFont *)fontForProgressBarTopLabel:(BOOL)genericScaling { - CGFloat size = 10; - if (genericScaling) { - size = [self sizeFontGenericForCurrentDevice:size]; - } - return [MFFonts mfFont75Bd:size]; -} - -+ (nullable UIFont *)fontForPlanCardTitle:(BOOL)genericScaling { - CGFloat size = 20; - if (genericScaling) { - size = [self sizeFontGenericForCurrentDevice:size]; - } - return [MFFonts mfFont75Bd:size]; -} - -+ (nullable UIFont *)fontForAccesseriesHeadline:(BOOL)genericScaling { - CGFloat size = 18.0; - if (genericScaling) { - size = [self sizeFontGenericForCurrentDevice:size]; - } - return [MFFonts mfFont75Bd:size]; -} - + (nullable UIFont *)fontForLargeLoyaltyHeaderTitle:(BOOL)genericScaling { CGFloat size = 60; if (genericScaling) { @@ -510,62 +410,14 @@ CGFloat const LabelWithInternalButtonLineSpace = 2; return [MFFonts mfFontOcratxt:size]; } -+ (nullable UIFont *)fontForPlan { - return [self fontForPlan:YES]; -} - -+ (nullable UIFont *)fontForBiggerHeadline { - return [self fontForBiggerHeadLine:YES]; -} - -+ (nullable UIFont *)fontForLoyaltySignUpHeadLine { - return [self fontForLoyaltySignUpHeadLine:YES]; -} - -+ (nullable UIFont *)fontForFeedHeadline { - return [self fontForFeedHeadline:YES]; -} - -+ (nullable UIFont *)fontForFeedMessage { - return [self fontForFeedMessage:YES]; -} - -+ (nullable UIFont *)fontForFeedSubMessage { - return [self fontForFeedSubMessage:YES]; -} - + (nullable UIFont *)fontForHeadlineSmall { return [self fontForHeadlineSmall:YES]; } -+ (nullable UIFont *)fontForHeadlineTiny { - return [MFFonts mfFont75Bd:11]; -} - + (nullable UIFont *)fontForHeadlineSmall2 { return [self fontForHeadlineSmall2:YES]; } -+ (nullable UIFont *)fontForHeadlineLarge { - return [self fontForHeadlineLarge:YES]; -} - -+ (nullable UIFont *)fontForHeadlineExtraLarge { - return [self fontForHeadlineExtraLarge:YES]; -} - -+ (nullable UIFont *)fontForSubheadBold { - return [self fontForSubheadBold:YES]; -} - -+ (nullable UIFont *)fontForSubheadBoldLarge { - return [self fontForSubheadBoldLarge:YES]; -} - -+ (nullable UIFont *)fontB2 { - return [self fontB2:YES]; -} - + (nullable UIFont *)fontforChatText { return [self fontforChatText:NO]; } @@ -574,26 +426,10 @@ CGFloat const LabelWithInternalButtonLineSpace = 2; return [self fontForAccountLandingGreeting:YES]; } -+ (nullable UIFont *)fontForBodyLarge { - return [self fontForBodyLarge:YES]; -} - -+ (nullable UIFont *)fontForBodyBold { - return [self fontForBodyBold:YES]; -} - -+ (nullable UIFont *)fontB3 { - return [self fontB3:YES]; -} - + (nullable UIFont *)fontForProgressBarBottomLabel { return [self fontForProgressBarBottomLabel:YES]; } -+ (nullable UIFont *)fontB1 { - return [self fontB1:YES]; -} - + (nullable UIFont *)fontForPrimaryButton { return [self fontForPrimaryButton:YES]; } @@ -618,30 +454,6 @@ CGFloat const LabelWithInternalButtonLineSpace = 2; return [self fontForFeedCardTitle:YES]; } -+ (nullable UIFont *)fontB4 { - return [self fontB4:YES]; -} - -+ (nullable UIFont *)fontForSupportQuestionMark { - return [self fontForSupportQuestionMark:YES]; -} - -+ (nullable UIFont *)fontForSupportDateStamp { - return [self fontForSupportDateStamp:YES]; -} - -+ (nullable UIFont *)fontForProgressBarTopLabel { - return [self fontForProgressBarTopLabel:YES]; -} - -+ (nullable UIFont *)fontForPlanCardTitle { - return [self fontForPlanCardTitle:YES]; -} - -+ (nullable UIFont *)fontForAccesseriesHeadline { - return [self fontForAccesseriesHeadline:YES]; -} - + (nullable UIFont *)fontForLargeLoyaltyHeaderTitle { return [self fontForLargeLoyaltyHeaderTitle:YES]; } @@ -686,29 +498,44 @@ CGFloat const LabelWithInternalButtonLineSpace = 2; [self styleLabelH2:label genericScaling:YES]; } -+ (void)styleLabelH3:(nonnull UILabel *)label { - label.font = [MFStyler fontH3]; - label.textColor = [UIColor blackColor]; -} - + (void)styleLabelH3:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling { label.font = [MFStyler fontH3:genericScaling]; label.textColor = [UIColor blackColor]; } ++ (void)styleLabelH3:(nonnull UILabel *)label { + [self styleLabelH3:label genericScaling:YES]; +} + ++ (void)styleLabelH32:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling { + label.font = [MFStyler fontH32:genericScaling]; + label.textColor = [UIColor blackColor]; +} + ++ (void)styleLabelH32:(nonnull UILabel *)label { + [self styleLabelH32:label genericScaling:YES]; +} + + (void)styleLabelB1:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling { label.font = [MFStyler fontB1:genericScaling]; label.textColor = [UIColor blackColor]; } ++ (void)styleLabelB1:(nonnull UILabel *)label { + [self styleLabelB1:label genericScaling:YES]; +} + + (void)styleLabelB2:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling { label.font = [MFStyler fontB2:genericScaling]; label.textColor = [UIColor blackColor]; } ++ (void)styleLabelB2:(nonnull UILabel *)label { + [self styleLabelB2:label genericScaling:YES]; +} + + (void)styleLabelB2:(nonnull UILabel *)label size:(CGFloat)size genericScaling:(BOOL)genericScaling { label.font = [MFStyler fontForBodyWithSize:size genericScaling:genericScaling]; - label.textColor = [UIColor blackColor]; } + (void)styleLabelB3:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling { @@ -717,18 +544,16 @@ CGFloat const LabelWithInternalButtonLineSpace = 2; } + (void)styleLabelB3:(nonnull UILabel *)label { - label.font = [MFStyler fontB3]; - label.textColor = [UIColor mfBattleshipGrey]; + [self styleLabelB3:label genericScaling:YES]; } -+ (void)styleLabelB4:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling { - label.font = [MFStyler fontB4:genericScaling]; ++ (void)styleLabelB20:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling { + label.font = [MFStyler fontB20:genericScaling]; label.textColor = [UIColor blackColor]; } -+ (void)styleLabelB4:(nonnull UILabel *)label { - label.font = [MFStyler fontB4]; - label.textColor = [UIColor blackColor]; ++ (void)styleLabelB20:(nonnull UILabel *)label { + [self styleLabelB20:label genericScaling:YES]; } + (void)styleLabelTextStyle2:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling { @@ -737,67 +562,12 @@ CGFloat const LabelWithInternalButtonLineSpace = 2; } + (void)styleLabelTextStyle2:(nonnull UILabel *)label { - label.font = [MFStyler fontB2]; - label.textColor = [UIColor mfBattleshipGrey]; + [self styleLabelTextStyle2:label genericScaling:YES]; } -+ (void)styleLabelFeedMessage:(nonnull UILabel *)label { - label.font = [MFStyler fontForFeedMessage]; - label.textColor = [UIColor blackColor]; -} - -+ (void)styleLabelFeedSubMessage:(nonnull UILabel *)label { - label.font = [MFStyler fontForFeedMessage]; - label.textColor = [UIColor blackColor]; -} #pragma mark - 1.0 Styles -+ (void)styleLabelHeadlineLarge:(nonnull UILabel *)label { - label.font = [MFStyler fontForHeadlineLarge]; - label.textColor = [UIColor blackColor]; -} - -+ (void)styleLabelHeadlineExtraLarge:(nonnull UILabel *)label { - label.font = [MFStyler fontForHeadlineExtraLarge]; - label.textColor = [UIColor mfRedColor]; -} - -+ (void)styleLabelHeadlineFeed:(nonnull UILabel *)label { - label.font = [MFStyler fontForFeedHeadline]; - label.textColor = [UIColor mfRedColor]; -} - -+ (void)styleLabelSubheadBold:(nonnull UILabel *)label { - label.font = [MFStyler fontForSubheadBold]; - label.textColor = [UIColor blackColor]; -} - -+ (void)styleLabelB2:(nonnull UILabel *)label { - label.font = [MFStyler fontB2]; - label.textColor = [UIColor blackColor]; -} - -+ (void)styleLabelBodyLarge:(nonnull UILabel *)label { - label.font = [MFStyler fontForBodyLarge]; - label.textColor = [UIColor blackColor]; -} - -+ (void)styleLabelBodyBold:(nonnull UILabel *)label { - label.font = [MFStyler fontForBodyBold]; - label.textColor = [UIColor mfCharcoalColor]; -} - -+ (void)styleLabelBodyLighter:(nonnull UILabel *)label { - label.font = [MFStyler fontB2]; - label.textColor = [UIColor mfGrayColor]; -} - -+ (void)styleLabelB1:(nonnull UILabel *)label { - label.font = [MFStyler fontB1]; - label.textColor = [UIColor blackColor]; -} - + (void)styleFeedCardTitleLabel:(nonnull UILabel *)label { label.font = [MFStyler fontForFeedCardTitle]; label.textColor = [UIColor blackColor]; @@ -808,78 +578,15 @@ CGFloat const LabelWithInternalButtonLineSpace = 2; label.textColor = [UIColor mfBrownishGrey]; } - + (void)styleStandardSeparatorView:(nonnull UIView *)view { [view setBackgroundColor:[UIColor mfBackgroundGray]]; } - + (void)styleLabelHeadlineSmall:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling { label.font = [MFStyler fontForHeadlineSmall:genericScaling]; label.textColor = [UIColor blackColor]; } -+ (void)styleLabelHeadlineLarge:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling { - label.font = [MFStyler fontForHeadlineLarge:genericScaling]; - label.textColor = [UIColor mfRedColor]; -} - -+ (void)styleLabelHeadlineExtraLarge:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling { - label.font = [MFStyler fontForHeadlineExtraLarge:genericScaling]; - label.textColor = [UIColor mfRedColor]; -} - -+ (void)styleLabelHeadlineFeed:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling { - label.font = [MFStyler fontForFeedHeadline:genericScaling]; - label.textColor = [UIColor blackColor]; -} - -+ (void)styleLabelFeedMessage:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling { - label.font = [MFStyler fontForFeedMessage:genericScaling]; - label.textColor = [UIColor blackColor]; -} - -+ (void)styleLabelFeedSubMessage:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling { - label.font = [MFStyler fontForFeedSubMessage:genericScaling]; - label.textColor = [UIColor blackColor]; -} -+ (void)styleLabelH2:(nonnull UILabel *)label size:(CGFloat)size genericScaling:(BOOL)genericScaling { - label.font = [MFStyler fontForHeadlineWithSize:size genericScaling:genericScaling]; - label.textColor = [UIColor mfRedColor]; -} - -+ (void)styleLabelHeadlineBlack:(nonnull UILabel *)label size:(CGFloat)size genericScaling:(BOOL)genericScaling { - label.font = [MFStyler fontForHeadlineWithSize:size genericScaling:genericScaling]; - label.textColor = [UIColor blackColor]; -} - - -+ (void)styleLabelSubheadBold:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling { - label.font = [MFStyler fontForSubheadBold:genericScaling]; - label.textColor = [UIColor blackColor]; -} - -+ (void)styleLabelSubheadBoldLarge:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling { - label.font = [MFStyler fontForSubheadBoldLarge:genericScaling]; - label.textColor = [UIColor blackColor]; -} - - -+ (void)styleLabelBodyLarge:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling { - label.font = [MFStyler fontForBodyLarge:genericScaling]; - label.textColor = [UIColor blackColor]; -} - -+ (void)styleLabelBodyBold:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling { - label.font = [MFStyler fontForBodyBold:genericScaling]; - label.textColor = [UIColor mfCharcoalColor]; -} - -+ (void)styleLabelBodyLighter:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling { - label.font = [MFStyler fontB2:genericScaling]; - label.textColor = [UIColor mfGrayColor]; -} - + (void)styleFeedCardTitleLabel:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling { label.font = [MFStyler fontForFeedCardTitle:genericScaling]; label.textColor = [UIColor blackColor]; @@ -890,42 +597,6 @@ CGFloat const LabelWithInternalButtonLineSpace = 2; label.textColor = [UIColor mfBrownishGrey]; } -#pragma mark - Set Text With Styles - -+ (void)styleSetLabelTextWithH2:(nonnull UILabel *)label text:(nullable NSString *)text { - [MFStyler styleLabelH2:label]; - label.text = text; -} - -+ (void)styleSetLabelTextWithHeadlineLarge:(nonnull UILabel *)label text:(nullable NSString *)text { - [MFStyler styleLabelHeadlineLarge:label]; - label.text = text; -} -+ (void)styleSetLabelTextWithHeadlineExtraLarge:(nonnull UILabel *)label text:(nullable NSString *)text { - [MFStyler styleLabelHeadlineExtraLarge:label]; - label.text = text; -} - -+ (void)styleSetLabelTextWithH3:(nonnull UILabel *)label text:(nullable NSString *)text { - [MFStyler styleLabelH3:label]; - label.text = text; -} - -+ (void)styleSetLabelTextWithB2:(nonnull UILabel *)label text:(nullable NSString *)text { - [MFStyler styleLabelB2:label]; - label.text = text; -} - -+ (void)styleSetLabelTextWithBodyBold:(UILabel *)label text:(NSString *)text { - [MFStyler styleLabelBodyBold:label]; - label.text = text; -} - -+ (void)styleSetLabelTextWithB3:(nonnull UILabel *)label text:(nullable NSString *)text { - [MFStyler styleLabelB3:label]; - label.text = text; -} - #pragma mark - Attributed Strings + (nonnull NSAttributedString *)styleGetAttributedString:(nullable NSString *)string font:(nonnull UIFont *)font color:(nonnull UIColor *)color { @@ -942,46 +613,38 @@ CGFloat const LabelWithInternalButtonLineSpace = 2; return attributedString; } -+ (nonnull NSAttributedString *)styleGetHeadlineAttributedString:(nullable NSString *)string { - return [MFStyler styleGetAttributedString:string font:[MFStyler fontH2] color:[UIColor mfRedColor]]; ++ (nonnull NSAttributedString *)styleGetH1AttributedString:(nullable NSString *)string { + return [MFStyler styleGetAttributedString:string font:[MFStyler fontH1] color:[UIColor blackColor]]; } -+ (nonnull NSAttributedString *)styleGetHeadlineLargeAttributedString:(nullable NSString *)string { - return [MFStyler styleGetAttributedString:string font:[MFStyler fontForHeadlineLarge] color:[UIColor mfRedColor]]; ++ (nonnull NSAttributedString *)styleGetH2AttributedString:(nullable NSString *)string { + return [MFStyler styleGetAttributedString:string font:[MFStyler fontH2] color:[UIColor blackColor]]; } -+ (nonnull NSAttributedString *)styleGetHeadlineExtraLargeAttributedString:(nullable NSString *)string { - return [MFStyler styleGetAttributedString:string font:[MFStyler fontForHeadlineExtraLarge] color:[UIColor mfRedColor]]; -} - -+ (nonnull NSAttributedString *)styleGetSubheadAttributedString:(nullable NSString *)string { ++ (nonnull NSAttributedString *)styleGetH3AttributedString:(nullable NSString *)string { return [MFStyler styleGetAttributedString:string font:[MFStyler fontH3] color:[UIColor blackColor]]; } -+ (nonnull NSAttributedString *)styleGetBodyAttributedString:(nullable NSString *)string { - return [MFStyler styleGetAttributedString:string font:[MFStyler fontB2] color:[UIColor blackColor]]; -} - -+ (nonnull NSAttributedString *)styleGetDisabledBodyAttributedString:(nullable NSString *)string { - return [MFStyler styleGetAttributedString:string font:[MFStyler fontB2] color:[UIColor mfLighterGrayColor]]; -} - -+ (nonnull NSAttributedString *)styleGetBodyBoldAttributedString:(nullable NSString *)string { - return [MFStyler styleGetAttributedString:string font:[MFStyler fontForBodyBold] color:[UIColor mfCharcoalColor]]; -} - -+ (nonnull NSAttributedString *)styleGetLegalAttributedString:(nullable NSString *)string { - return [MFStyler styleGetAttributedString:string font:[MFStyler fontB3] color:[UIColor mfGrayColor]]; -} - -+ (nonnull NSAttributedString *)styleGetSubtitleAttributedString:(nullable NSString *)string { ++ (nonnull NSAttributedString *)styleGetB1AttributedString:(nullable NSString *)string { return [MFStyler styleGetAttributedString:string font:[MFStyler fontB1] color:[UIColor blackColor]]; } -+ (nonnull NSAttributedString *)styleGetDisabledSubtitleAttributedString:(nullable NSString *)string { ++ (nonnull NSAttributedString *)styleGetB2AttributedString:(nullable NSString *)string { + return [MFStyler styleGetAttributedString:string font:[MFStyler fontB2] color:[UIColor blackColor]]; +} + ++ (nonnull NSAttributedString *)styleGetB3AttributedString:(nullable NSString *)string { + return [MFStyler styleGetAttributedString:string font:[MFStyler fontB3] color:[UIColor mfBattleshipGrey]]; +} + ++ (nonnull NSAttributedString *)styleGetDisabledB1AttributedString:(nullable NSString *)string { return [MFStyler styleGetAttributedString:string font:[MFStyler fontB1] color:[UIColor mfLighterGrayColor]]; } ++ (nonnull NSAttributedString *)styleGetDisabledB2AttributedString:(nullable NSString *)string { + return [MFStyler styleGetAttributedString:string font:[MFStyler fontB2] color:[UIColor mfLighterGrayColor]]; +} + + (nonnull NSAttributedString *)styleGetTopAlignedAttributeStringWithLeftString:(nullable NSString *)left centerString:(nonnull NSString *)center rightString:(nullable NSString *)right withCenterStringFontSize:(CGFloat)fontSize andColor:(nonnull UIColor *)color { if (left == nil){ left = @""; diff --git a/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.h b/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.h index 3d212499..cc1df5e6 100644 --- a/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.h +++ b/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.h @@ -20,25 +20,18 @@ #pragma mark - 2.0 labels ++ (nonnull UILabel *)commonLabelH1; + (nonnull UILabel *)commonLabelH2; + (nonnull UILabel *)commonLabelH3; ++ (nonnull UILabel *)commonLabelH32; + (nonnull UILabel *)commonLabelB1; + (nonnull UILabel *)commonLabelB2; + (nonnull UILabel *)commonLabelB3; -+ (nonnull UILabel *)commonLabelB4; #pragma mark - Labels // Creates and returns common labels + (nonnull UILabel *)label; -+ (nonnull UILabel *)commonLabelHeadlineLarge; -+ (nonnull UILabel *)commonLabelHeadlineExtraLarge; -+ (nonnull UILabel *)commonLabelHeadlineFeed; -+ (nonnull UILabel *)commonLabelSubheadBold; -+ (nonnull UILabel *)commonLabelBodyBold; -+ (nonnull UILabel *)commonLabelBodyLarge; -+ (nonnull UILabel *)commonLabelBodyLighter; -+ (nonnull UILabel *)commonLabelFeedTitle; #pragma mark - Text Field diff --git a/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.m b/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.m index a8a90a50..affbc470 100644 --- a/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.m +++ b/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.m @@ -53,21 +53,9 @@ static const CGFloat VertialShadowOffset = 6; return label; } -+ (nonnull UILabel *)commonLabelHeadlineLarge { ++ (nonnull UILabel *)commonLabelH1 { UILabel *label = [MVMCoreUICommonViewsUtility label]; - [MFStyler styleLabelHeadlineLarge:label]; - return label; -} - -+ (nonnull UILabel *)commonLabelHeadlineExtraLarge { - UILabel *label = [MVMCoreUICommonViewsUtility label]; - [MFStyler styleLabelHeadlineExtraLarge:label]; - return label; -} - -+ (nonnull UILabel *)commonLabelHeadlineFeed { - UILabel *label = [MVMCoreUICommonViewsUtility label]; - [MFStyler styleLabelHeadlineFeed:label]; + [MFStyler styleLabelH1:label]; return label; } @@ -83,39 +71,9 @@ static const CGFloat VertialShadowOffset = 6; return label; } -+ (nonnull UILabel *)commonLabelSubheadBold { ++ (nonnull UILabel *)commonLabelH32 { UILabel *label = [MVMCoreUICommonViewsUtility label]; - [MFStyler styleLabelSubheadBold:label]; - return label; -} - -+ (nonnull UILabel *)commonLabelBody { - UILabel *label = [MVMCoreUICommonViewsUtility label]; - [MFStyler styleLabelB2:label]; - return label; -} - -+ (nonnull UILabel *)commonLabelBodyBold { - UILabel *label = [MVMCoreUICommonViewsUtility label]; - [MFStyler styleLabelBodyBold:label]; - return label; -} - -+ (nonnull UILabel *)commonLabelBodyLarge { - UILabel *label = [MVMCoreUICommonViewsUtility label]; - [MFStyler styleLabelBodyLarge:label]; - return label; -} - -+ (nonnull UILabel *)commonLabelBodyLighter { - UILabel *label = [MVMCoreUICommonViewsUtility label]; - [MFStyler styleLabelBodyLighter:label]; - return label; -} - -+ (nonnull UILabel *)commonLabelFeedTitle { - UILabel *label = [MVMCoreUICommonViewsUtility label]; - [MFStyler styleFeedCardTitleLabel:label]; + [MFStyler styleLabelH32:label]; return label; } @@ -137,12 +95,6 @@ static const CGFloat VertialShadowOffset = 6; return label; } -+ (nonnull UILabel *)commonLabelB4 { - UILabel *label = [MVMCoreUICommonViewsUtility label]; - [MFStyler styleLabelB4:label]; - return label; -} - #pragma mark - Text Field + (nonnull UIPickerView *)addPickerToTextField:(nonnull UITextField *)textField delegate:(nullable id )delegate {