From fa4b03ac1d0b2f67c68df8f74d827704f63f42cd Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Thu, 11 Apr 2019 11:20:46 -0400 Subject: [PATCH] code review --- MVMCoreUI.xcodeproj/project.pbxproj | 1 - MVMCoreUI/Atoms/TextFields/MFTextField.m | 2 +- MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.h | 1 - MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m | 8 ++++---- MVMCoreUI/Utility/MVMCoreUIConstants.h | 3 +++ MVMCoreUI/Utility/MVMCoreUIConstants.m | 3 +++ 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index c32e376c..eca11941 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -869,7 +869,6 @@ D29770F221F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.m in Sources */, DBC4391922442197001AB423 /* DashLine.swift in Sources */, D29DF29621E7ADB8003B2FB9 /* StackableViewController.m in Sources */, - 013DAB042254FCE00092ABB7 /* CheckBoxWithLabel.swift in Sources */, D22D1F1F220343560077CEC0 /* MVMCoreUICheckMarkView.m in Sources */, D282AAB4223FDDAE00C46919 /* MFLoadImageView.swift in Sources */, D29DF11721E6805F003B2FB9 /* UIColor+MFConvenience.m in Sources */, diff --git a/MVMCoreUI/Atoms/TextFields/MFTextField.m b/MVMCoreUI/Atoms/TextFields/MFTextField.m index 565e086c..ff1d3fd8 100644 --- a/MVMCoreUI/Atoms/TextFields/MFTextField.m +++ b/MVMCoreUI/Atoms/TextFields/MFTextField.m @@ -326,7 +326,7 @@ } // key used to send text value to server - string = [map string:@"fieldKey"]; + string = [map string:KeyFieldKey]; if (string.length > 0) { self.fieldKey = string; } diff --git a/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.h b/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.h index 32fb1e02..831c1994 100644 --- a/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.h +++ b/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.h @@ -59,7 +59,6 @@ - (void)setValueForAccessibilityText:(nullable NSString *)text; - (void)hideDescriptionLabelAndPinCheckboxToRight; -// Molecule Design - (void)setWithJSON:(nullable NSDictionary *)json delegate:(nullable NSObject *)delegate additionalData:(nullable NSDictionary *)additionalData; @end diff --git a/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m b/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m index f00d9101..fb81e0b5 100644 --- a/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m +++ b/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m @@ -54,15 +54,15 @@ static const CGFloat CheckBoxHeightWidth = 18.0; - (void)setWithJSON:(nullable NSDictionary *)json delegate:(nullable NSObject *)delegate additionalData:(nullable NSDictionary *)additionalData { [FormValidator setupValidationWithMolecule:self delegate:(id)delegate]; self.delegate = (id)delegate; - self.fieldKey = [json stringForKey:@"fieldKey"]; - self.isRequired = [json boolForKey:@"required"]; - + self.fieldKey = [json stringForKey:KeyFieldKey]; + self.isRequired = [json boolForKey:KeyRequired]; + NSString *checkedColorHex = [json string:@"checkedColor"]; NSString *unCheckedColorHex = [json string:@"unCheckedColor"]; UIColor *checkedColor = checkedColorHex ? [UIColor mfGetColorForHex:checkedColorHex]: [UIColor blackColor]; UIColor *unCheckedColor = unCheckedColorHex ? [UIColor mfGetColorForHex:unCheckedColorHex]: [UIColor clearColor]; - NSString *label = [json string:@"label"]; + NSString *label = [json string:KeyLabel]; [self setupWithCheckedColor:checkedColor unCheckColor:unCheckedColor text:label]; } diff --git a/MVMCoreUI/Utility/MVMCoreUIConstants.h b/MVMCoreUI/Utility/MVMCoreUIConstants.h index 93f77713..ba0eff4d 100644 --- a/MVMCoreUI/Utility/MVMCoreUIConstants.h +++ b/MVMCoreUI/Utility/MVMCoreUIConstants.h @@ -35,6 +35,9 @@ extern NSString * const KeyTextColor; extern NSString * const KeyIsHidden; extern NSString * const KeyIsOpaque; +extern NSString * const KeyFieldKey; +extern NSString * const KeyRequired; + #pragma mark - Values extern NSString * const StringY; diff --git a/MVMCoreUI/Utility/MVMCoreUIConstants.m b/MVMCoreUI/Utility/MVMCoreUIConstants.m index 684f013b..43763ae2 100644 --- a/MVMCoreUI/Utility/MVMCoreUIConstants.m +++ b/MVMCoreUI/Utility/MVMCoreUIConstants.m @@ -18,6 +18,8 @@ NSString * const KeyValue = @"value"; NSString * const KeyLabel = @"label"; NSString * const KeyDisable = @"disable"; NSString * const KeyFieldName = @"fieldName"; +NSString * const KeyFieldKey = @"fieldKey"; +NSString * const KeyRequired = @"required"; NSString * const KeyHideMainMenu = @"hideMainMenu"; NSString * const KeyProgressPercent = @"progressPercent"; @@ -34,6 +36,7 @@ NSString * const KeyTextColor = @"textColor"; NSString * const KeyIsHidden = @"isHidden"; NSString * const KeyIsOpaque = @"isOpaque"; + #pragma mark - Values NSString * const StringY = @"Y";