code review
This commit is contained in:
parent
ff3055a4c7
commit
8b3d561543
@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
@property (strong, nonatomic) NSMutableArray <MFTextField *>*textFields;
|
@property (strong, nonatomic) NSMutableArray <MFTextField *>*textFields;
|
||||||
@property (nonatomic, readwrite, assign) PrimaryButtonType primaryButtonType;
|
@property (nonatomic, readwrite, assign) PrimaryButtonType primaryButtonType;
|
||||||
@property (nonnull, strong, nonatomic) FormValidator* formValidator;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@ -682,7 +681,6 @@
|
|||||||
|
|
||||||
- (void)setEnabledByValidity {
|
- (void)setEnabledByValidity {
|
||||||
|
|
||||||
|
|
||||||
__block BOOL valid = YES;
|
__block BOOL valid = YES;
|
||||||
[self.textFields enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
[self.textFields enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||||
if (!((MFTextField *)obj).valid) {
|
if (!((MFTextField *)obj).valid) {
|
||||||
|
|||||||
@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *textContainerRightPin;
|
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *textContainerRightPin;
|
||||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *errorLableRightPin;
|
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *errorLableRightPin;
|
||||||
|
@property (nonatomic) BOOL isMolecule;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@ -48,6 +49,13 @@
|
|||||||
self.label.font = [MFStyler fontForTextFieldUnderLabel];
|
self.label.font = [MFStyler fontForTextFieldUnderLabel];
|
||||||
[MFStyler styleTextField:self.textField];
|
[MFStyler styleTextField:self.textField];
|
||||||
[self.dashLine updateView:size];
|
[self.dashLine updateView:size];
|
||||||
|
|
||||||
|
if (self.isMolecule) {
|
||||||
|
[self setVerticalPadding:[MFStyler defaultHorizontalPaddingForApplicationWidth]];
|
||||||
|
|
||||||
|
} else {
|
||||||
|
[self setVerticalPadding:0];
|
||||||
|
}
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,14 +117,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)setWithJSON:(NSDictionary *)json delegate:(nullable id<UITextFieldDelegate, MFTextFieldDelegate>)delegate additionalData:(NSDictionary *)additionalData {
|
- (void)setWithJSON:(NSDictionary *)json delegate:(nullable id<UITextFieldDelegate, MFTextFieldDelegate>)delegate additionalData:(NSDictionary *)additionalData {
|
||||||
[FormValidator setupValidationWithMolecule:self delegate: (id<FormValidationProtocol>)delegate];
|
|
||||||
|
|
||||||
|
self.isMolecule = YES;
|
||||||
|
[FormValidator setupValidationWithMolecule:self delegate:(id<FormValidationProtocol>)delegate];
|
||||||
[self setWithMap:json bothDelegates:delegate];
|
[self setWithMap:json bothDelegates:delegate];
|
||||||
|
|
||||||
FormValidator *formValidator = [FormValidator getFormValidatorForDelegate:(id<FormValidationProtocol>)delegate];
|
FormValidator *formValidator = [FormValidator getFormValidatorForDelegate:(id<FormValidationProtocol>)delegate];
|
||||||
self.mfTextFieldDelegate = formValidator;
|
self.mfTextFieldDelegate = formValidator;
|
||||||
self.uiTextFieldDelegate = formValidator;
|
self.uiTextFieldDelegate = formValidator;
|
||||||
[self setVerticalPadding:[MFStyler defaultHorizontalPaddingForApplicationWidth]];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setVerticalPadding:(CGFloat) padding {
|
- (void)setVerticalPadding:(CGFloat) padding {
|
||||||
@ -134,7 +142,6 @@
|
|||||||
MFTextField *textField = [self mfTextField];
|
MFTextField *textField = [self mfTextField];
|
||||||
textField.translatesAutoresizingMaskIntoConstraints = NO;
|
textField.translatesAutoresizingMaskIntoConstraints = NO;
|
||||||
[textField setWithJSON:map delegate:delegate additionalData:nil];
|
[textField setWithJSON:map delegate:delegate additionalData:nil];
|
||||||
[textField setVerticalPadding:0];
|
|
||||||
return textField;
|
return textField;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,7 +326,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)setWithMap:(nullable NSDictionary *)map bothDelegates:(nullable id<UITextFieldDelegate, MFTextFieldDelegate>)delegate {
|
- (void)setWithMap:(nullable NSDictionary *)map bothDelegates:(nullable id<UITextFieldDelegate, MFTextFieldDelegate>)delegate {
|
||||||
if (map.count > 0) {
|
if (map.count == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
[MVMCoreUICommonViewsUtility addDismissToolbar:self.textField delegate:delegate];
|
[MVMCoreUICommonViewsUtility addDismissToolbar:self.textField delegate:delegate];
|
||||||
[self setBothTextFieldDelegates:delegate];
|
[self setBothTextFieldDelegates:delegate];
|
||||||
|
|
||||||
@ -367,7 +377,6 @@
|
|||||||
[self setDefaultValidationBlock];
|
[self setDefaultValidationBlock];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setValidationBlock:(BOOL (^)(NSString * _Nullable))validationBlock {
|
- (void)setValidationBlock:(BOOL (^)(NSString * _Nullable))validationBlock {
|
||||||
_validationBlock = validationBlock;
|
_validationBlock = validationBlock;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user