undo legacy changes
This commit is contained in:
parent
f378e66731
commit
b0ae313d42
@ -30,6 +30,11 @@ import UIKit
|
||||
primaryButton?.isEnabled = enabled
|
||||
}
|
||||
|
||||
public init(withJSON json: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?) {
|
||||
super.init(frame: .zero)
|
||||
setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
|
||||
// MARK: - MVMCoreViewProtocol
|
||||
open override func updateView(_ size: CGFloat) {
|
||||
super.updateView(size)
|
||||
@ -44,6 +49,11 @@ import UIKit
|
||||
alignCenterHorizontal()
|
||||
}
|
||||
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
open func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
primaryButton?.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
|
||||
// MARK: - Constraining
|
||||
open override func copyBackgroundColor() -> Bool {
|
||||
return true
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
#import <MVMCoreUI/MFCustomButton.h>
|
||||
#import <MVMCoreUI/MFTextField.h>
|
||||
#import <MVMCoreUI/MFView.h>
|
||||
@class MVMCoreUIDelegateObject;
|
||||
|
||||
typedef enum : NSUInteger {
|
||||
PrimaryButtonTypeRed,
|
||||
@ -117,6 +118,9 @@ static CGFloat const PrimaryButtonSmallHeight = 30.0;
|
||||
- (void)resetButtonType:(PrimaryButtonType)type small:(BOOL)isSmall bordered:(BOOL)bordered;
|
||||
- (void)resetButtonType:(PrimaryButtonType)type tiny:(BOOL)isTiny bordered:(BOOL)bordered;
|
||||
|
||||
// Convenience setter for common keys
|
||||
- (void)setWithJSON:(nullable NSDictionary *)json delegateObject:(nullable MVMCoreUIDelegateObject *)delegateObject additionalData:(nullable NSDictionary *)additionalData;
|
||||
|
||||
#pragma mark - Handling Validations
|
||||
|
||||
// Sets the enabled property depending on the validity checks
|
||||
|
||||
@ -655,6 +655,47 @@
|
||||
return button;
|
||||
}
|
||||
|
||||
- (void)setWithJSON:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData {
|
||||
self.primaryButtonType = PrimaryButtonTypeCustom;
|
||||
NSString *style = [json string:@"style"];
|
||||
if ([style isEqualToString:@"primary"]) {
|
||||
[self setAsStandardCustom];
|
||||
} else if ([style isEqualToString:@"secondary"]) {
|
||||
[self setAsSecondaryCustom];
|
||||
}
|
||||
|
||||
NSString *color = [json string:@"fillColor"];
|
||||
if (color) {
|
||||
self.fillColor = [UIColor mfGetColorForHex:color];
|
||||
}
|
||||
if ((color = [json string:KeyTextColor])) {
|
||||
self.textColor = [UIColor mfGetColorForHex:color];
|
||||
}
|
||||
if ((color = [json string:@"borderColor"])) {
|
||||
self.borderColor = [UIColor mfGetColorForHex:color];
|
||||
}
|
||||
_bordered = self.borderColor != nil;
|
||||
if ((color = [json string:@"disabledFillColor"])) {
|
||||
self.disabledFillColor = [UIColor mfGetColorForHex:color];
|
||||
}
|
||||
if ((color = [json string:@"disabledTextColor"])) {
|
||||
self.disabledTextColor = [UIColor mfGetColorForHex:color];
|
||||
}
|
||||
if ((color = [json string:@"disabledBorderColor"])) {
|
||||
self.disabledBorderColor = [UIColor mfGetColorForHex:color];
|
||||
}
|
||||
|
||||
NSString *size = [json string:@"size"];
|
||||
if ([size isEqualToString:@"small"]) {
|
||||
[self setAsSmallButton:YES];
|
||||
} else if ([size isEqualToString:@"tiny"]) {
|
||||
[self setAsTiny:YES];
|
||||
} else {
|
||||
[self setAsSmallButton:NO];
|
||||
}
|
||||
[self setWithActionMap:json delegateObject:delegateObject additionalData:additionalData];
|
||||
}
|
||||
|
||||
#pragma mark - Constraining Protocol
|
||||
|
||||
- (UIStackViewAlignment)horizontalAlignment {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user