warning fix
This commit is contained in:
parent
5ebcba15fa
commit
8c19755ba8
@ -128,12 +128,12 @@
|
|||||||
|
|
||||||
#pragma mark - MVMCoreUIMoleculeViewProtocol
|
#pragma mark - MVMCoreUIMoleculeViewProtocol
|
||||||
|
|
||||||
- (void)setWithJSON:(NSDictionary *)json delegate:(NSObject *)delegate additionalData:(NSDictionary *)additionalData {
|
- (void)setWithJSON:(NSDictionary *)json delegateObject:(DelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData {
|
||||||
NSString *color = [json string:KeyTextColor];
|
NSString *color = [json string:KeyTextColor];
|
||||||
if (color) {
|
if (color) {
|
||||||
[self setTitleColor:[UIColor mfGetColorForHex:color] forState:UIControlStateNormal];
|
[self setTitleColor:[UIColor mfGetColorForHex:color] forState:UIControlStateNormal];
|
||||||
}
|
}
|
||||||
[self setWithActionMap:json actionDelegate:([delegate conformsToProtocol:@protocol(MVMCoreActionDelegateProtocol)] ? (NSObject <MVMCoreActionDelegateProtocol>*)delegate : nil) additionalData:additionalData buttonDelegate:([delegate conformsToProtocol:@protocol(ButtonDelegateProtocol)] ? (id <ButtonDelegateProtocol>)delegate : nil)];
|
[self setWithActionMap:json delegateObject:delegateObject additionalData:additionalData];
|
||||||
if ([self titleForState:UIControlStateNormal].length == 0) {
|
if ([self titleForState:UIControlStateNormal].length == 0) {
|
||||||
self.heightConstraint.constant = 0;
|
self.heightConstraint.constant = 0;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -648,9 +648,10 @@
|
|||||||
[self setAsStandardCustom];
|
[self setAsStandardCustom];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setWithJSON:(NSDictionary *)json delegate:(NSObject *)delegate additionalData:(nullable NSDictionary *)additionalData {
|
- (void)setWithJSON:(NSDictionary *)json delegateObject:(DelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData {
|
||||||
|
if ([delegateObject isKindOfClass:[MVMCoreUIDelegateObject class]]) {
|
||||||
[FormValidator setupValidationWithMolecule:self delegate:(id<FormValidationProtocol>)delegate];
|
[FormValidator setupValidationWithMolecule:self delegate:((MVMCoreUIDelegateObject *)delegateObject).formValidationProtocol];
|
||||||
|
}
|
||||||
|
|
||||||
self.primaryButtonType = PrimaryButtonTypeCustom;
|
self.primaryButtonType = PrimaryButtonTypeCustom;
|
||||||
NSString *color = [json string:@"fillColor"];
|
NSString *color = [json string:@"fillColor"];
|
||||||
@ -676,7 +677,7 @@
|
|||||||
self.validationRequired = [json boolForKey:@"validationRequired"];
|
self.validationRequired = [json boolForKey:@"validationRequired"];
|
||||||
|
|
||||||
[self setAsSmallButton:[json boolForKey:@"small"]];
|
[self setAsSmallButton:[json boolForKey:@"small"]];
|
||||||
[self setWithActionMap:json actionDelegate:([delegate conformsToProtocol:@protocol(MVMCoreActionDelegateProtocol)] ? (NSObject <MVMCoreActionDelegateProtocol>*)delegate : nil) additionalData:additionalData buttonDelegate:([delegate conformsToProtocol:@protocol(ButtonDelegateProtocol)] ? (id <ButtonDelegateProtocol>)delegate : nil)];
|
[self setWithActionMap:json delegateObject:delegateObject additionalData:additionalData];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Handling Validations
|
#pragma mark - Handling Validations
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#import <MVMCoreUI/MFView.h>
|
#import <MVMCoreUI/MFView.h>
|
||||||
@class MFSizeObject;
|
@class MFSizeObject;
|
||||||
|
@class DelegateObject;
|
||||||
|
|
||||||
@interface MFLabel : UILabel <MVMCoreViewProtocol, MVMCoreUIMoleculeViewProtocol>
|
@interface MFLabel : UILabel <MVMCoreViewProtocol, MVMCoreUIMoleculeViewProtocol>
|
||||||
|
|
||||||
@ -49,7 +50,7 @@
|
|||||||
|
|
||||||
// Setters
|
// Setters
|
||||||
+ (void)setLabel:(nullable UILabel *)label withHTML:(nullable NSString *)html;
|
+ (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)setUILabel:(nullable UILabel *)label withJSON:(nullable NSDictionary *)json delegateObject:(nullable DelegateObject *)delegateObject additionalData:(nullable NSDictionary *)additionalData;
|
||||||
|
|
||||||
- (void)styleH1:(BOOL)scale;
|
- (void)styleH1:(BOOL)scale;
|
||||||
- (void)styleH2:(BOOL)scale;
|
- (void)styleH2:(BOOL)scale;
|
||||||
|
|||||||
@ -138,7 +138,7 @@
|
|||||||
|
|
||||||
// Creates an initial load object if needed.
|
// Creates an initial load object if needed.
|
||||||
if (!self.loadObject) {
|
if (!self.loadObject) {
|
||||||
self.loadObject = [[MVMCoreLoadObject alloc] initWithDelegate:self];
|
self.loadObject = [[MVMCoreLoadObject alloc] initWithDelegateObject:[self delegateObject]];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Avoid the setter so we are only setting the bool and wait for view will appear to update the navigation bar.
|
// Avoid the setter so we are only setting the bool and wait for view will appear to update the navigation bar.
|
||||||
@ -343,7 +343,7 @@
|
|||||||
if (rightPanelLinkDict) {
|
if (rightPanelLinkDict) {
|
||||||
[[MVMCoreActionHandler sharedActionHandler] handleActionWithDictionary:rightPanelLinkDict
|
[[MVMCoreActionHandler sharedActionHandler] handleActionWithDictionary:rightPanelLinkDict
|
||||||
additionalData:nil
|
additionalData:nil
|
||||||
delegate:self];
|
delegateObject:[self delegateObject]];
|
||||||
return YES;
|
return YES;
|
||||||
} else {
|
} else {
|
||||||
return NO;
|
return NO;
|
||||||
@ -607,7 +607,7 @@
|
|||||||
[self.formValidator addFormParamsWithRequestParameters:requestParameters];
|
[self.formValidator addFormParamsWithRequestParameters:requestParameters];
|
||||||
requestParameters.parentPageType = [self.loadObject.pageJSON stringForKey:@"parentPageType"];
|
requestParameters.parentPageType = [self.loadObject.pageJSON stringForKey:@"parentPageType"];
|
||||||
|
|
||||||
[[MVMCoreLoadHandler sharedGlobal] loadRequest:requestParameters dataForPage:additionalData delegate:self];
|
[[MVMCoreLoadHandler sharedGlobal] loadRequest:requestParameters dataForPage:additionalData delegateObject:[self delegateObject]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)handleBackAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData {
|
- (void)handleBackAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData {
|
||||||
@ -662,7 +662,7 @@
|
|||||||
|
|
||||||
- (void)handleUnknownActionType:(nullable NSString *)actionType actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData {
|
- (void)handleUnknownActionType:(nullable NSString *)actionType actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData {
|
||||||
|
|
||||||
[MVMCoreActionHandler defaultHandleUnknownActionType:actionType actionInformation:actionInformation additionalData:additionalData delegate:self];
|
[MVMCoreActionHandler defaultHandleUnknownActionType:actionType actionInformation:actionInformation additionalData:additionalData delegateObject:[self delegateObject]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)handleActionError:(nonnull MVMCoreErrorObject *)error additionalData:(nullable NSDictionary *)additionalData {
|
- (void)handleActionError:(nonnull MVMCoreErrorObject *)error additionalData:(nullable NSDictionary *)additionalData {
|
||||||
@ -689,7 +689,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (nullable MVMCoreAlertObject *)alertObjectToShow:(nonnull MVMCoreLoadObject *)loadObject error:(nullable MVMCoreErrorObject *)errorObject {
|
- (nullable MVMCoreAlertObject *)alertObjectToShow:(nonnull MVMCoreLoadObject *)loadObject error:(nullable MVMCoreErrorObject *)errorObject {
|
||||||
return [MVMCoreAlertObject alertObjectForLoadObject:loadObject error:errorObject actionDelegate:self];
|
return [MVMCoreAlertObject alertObjectForLoadObject:loadObject error:errorObject delegateObject:[self delegateObject]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)handleFieldErrors:(nullable NSArray *)fieldErrors loadObject:(nonnull MVMCoreLoadObject *)loadObject {
|
- (void)handleFieldErrors:(nullable NSArray *)fieldErrors loadObject:(nonnull MVMCoreLoadObject *)loadObject {
|
||||||
|
|||||||
@ -394,7 +394,7 @@
|
|||||||
if (customAdditionalData) {
|
if (customAdditionalData) {
|
||||||
[additionalData addEntriesFromDictionary:customAdditionalData];
|
[additionalData addEntriesFromDictionary:customAdditionalData];
|
||||||
}
|
}
|
||||||
[[MVMCoreActionHandler sharedActionHandler] handleActionWithDictionary:actionMap additionalData:additionalData delegate:self];
|
[[MVMCoreActionHandler sharedActionHandler] handleActionWithDictionary:actionMap additionalData:additionalData delegateObject:[self delegateObject]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NO;
|
return NO;
|
||||||
|
|||||||
@ -9,11 +9,11 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
@objc public extension FormValidator {
|
@objc public extension FormValidator {
|
||||||
@objc public func addFormParams(requestParameters: MVMCoreRequestParameters) {
|
@objc func addFormParams(requestParameters: MVMCoreRequestParameters) {
|
||||||
requestParameters.add(self.getFormParams())
|
requestParameters.add(self.getFormParams())
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc public func getFormParams() -> [String: Any] {
|
@objc func getFormParams() -> [String: Any] {
|
||||||
var extraParam: [String: Any] = [:]
|
var extraParam: [String: Any] = [:]
|
||||||
MVMCoreDispatchUtility.performSyncBlock(onMainThread: {
|
MVMCoreDispatchUtility.performSyncBlock(onMainThread: {
|
||||||
for molecule in self.molecules {
|
for molecule in self.molecules {
|
||||||
|
|||||||
@ -117,7 +117,7 @@
|
|||||||
// Sets up the buttons/button.
|
// Sets up the buttons/button.
|
||||||
NSDictionary *primaryButtonDictionary = [self primaryButtonMap];
|
NSDictionary *primaryButtonDictionary = [self primaryButtonMap];
|
||||||
NSDictionary *secondaryButtonDictionary = [self secondaryButtonMap];
|
NSDictionary *secondaryButtonDictionary = [self secondaryButtonMap];
|
||||||
TwoButtonView *buttonView = [[TwoButtonView alloc] initWithPrimaryButtonMap:primaryButtonDictionary secondaryButtonMap:secondaryButtonDictionary actionDelegate:self additionalData:nil buttonDelegate:self];
|
TwoButtonView *buttonView = [[TwoButtonView alloc] initWithPrimaryButtonMap:primaryButtonDictionary secondaryButtonMap:secondaryButtonDictionary delegateObject:[self delegateObject] additionalData:nil];
|
||||||
self.secondaryButton = buttonView.secondaryButton;
|
self.secondaryButton = buttonView.secondaryButton;
|
||||||
self.primaryButton = buttonView.primaryButton;
|
self.primaryButton = buttonView.primaryButton;
|
||||||
|
|
||||||
|
|||||||
@ -127,7 +127,7 @@
|
|||||||
// Sets up the buttons/button.
|
// Sets up the buttons/button.
|
||||||
NSDictionary *primaryButtonDictionary = [self primaryButtonMap];
|
NSDictionary *primaryButtonDictionary = [self primaryButtonMap];
|
||||||
NSDictionary *secondaryButtonDictionary = [self secondaryButtonMap];
|
NSDictionary *secondaryButtonDictionary = [self secondaryButtonMap];
|
||||||
TwoButtonView *buttonView = [[TwoButtonView alloc] initWithPrimaryButtonMap:primaryButtonDictionary secondaryButtonMap:secondaryButtonDictionary actionDelegate:self additionalData:nil buttonDelegate:self];
|
TwoButtonView *buttonView = [[TwoButtonView alloc] initWithPrimaryButtonMap:primaryButtonDictionary secondaryButtonMap:secondaryButtonDictionary delegateObject:[self delegateObject] additionalData:nil];
|
||||||
self.secondaryButton = buttonView.secondaryButton;
|
self.secondaryButton = buttonView.secondaryButton;
|
||||||
self.primaryButton = buttonView.primaryButton;
|
self.primaryButton = buttonView.primaryButton;
|
||||||
bottomView = buttonView;
|
bottomView = buttonView;
|
||||||
|
|||||||
@ -150,6 +150,17 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Legacy
|
// MARK: - Legacy
|
||||||
|
public convenience init(primaryButtonMap: [AnyHashable: Any]?, secondaryButtonMap: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
|
self.init()
|
||||||
|
setup(primaryButtonMap: primaryButtonMap, secondaryButtonMap: secondaryButtonMap, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
}
|
||||||
|
|
||||||
|
public convenience init(buttonSmall small: Bool, buttonMap: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: AnyHashable]?) {
|
||||||
|
self.init()
|
||||||
|
setup(withButtonMap: buttonMap, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
primaryButton?.setAsSmall(small)
|
||||||
|
secondaryButton?.setAsSmall(small)
|
||||||
|
}
|
||||||
|
|
||||||
public convenience init(buttonSmall small: Bool, enabled: Bool) {
|
public convenience init(buttonSmall small: Bool, enabled: Bool) {
|
||||||
self.init()
|
self.init()
|
||||||
@ -159,6 +170,26 @@ import UIKit
|
|||||||
primaryButton?.isEnabled = enabled
|
primaryButton?.isEnabled = enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open func setup(primaryButtonMap: [AnyHashable: Any]?, secondaryButtonMap: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
|
setupUI(withPrimaryButtonMap: primaryButtonMap, secondaryButtonMap: secondaryButtonMap, legacy: true)
|
||||||
|
if primaryButtonMap != nil, secondaryButtonMap != nil {
|
||||||
|
primaryButton?.setWithActionMap(primaryButtonMap, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
secondaryButton?.setWithActionMap(secondaryButtonMap, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
} else if primaryButtonMap != nil {
|
||||||
|
primaryButton?.setWithActionMap(primaryButtonMap, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
primaryButton?.bordered = false
|
||||||
|
} else if secondaryButtonMap != nil {
|
||||||
|
primaryButton?.setWithActionMap(secondaryButtonMap, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
primaryButton?.bordered = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open func setup(withButtonMap buttonMap: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
|
let secondaryButtonMap = buttonMap?.optionalDictionaryForKey(KeySecondaryButton)
|
||||||
|
let primaryButtonMap = buttonMap?.optionalDictionaryForKey(KeyPrimaryButton)
|
||||||
|
setup(primaryButtonMap: primaryButtonMap, secondaryButtonMap: secondaryButtonMap, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
}
|
||||||
|
|
||||||
public func hidePrimaryLeftButton() {
|
public func hidePrimaryLeftButton() {
|
||||||
guard let secondaryButton = secondaryButton, !secondaryButton.isHidden else {
|
guard let secondaryButton = secondaryButton, !secondaryButton.isHidden else {
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user