Warning and analyze fixes

This commit is contained in:
Pfeil, Scott Robert 2020-03-24 09:54:18 -04:00
parent d1e02ad570
commit 7fdff34eeb
16 changed files with 35 additions and 62 deletions

View File

@ -100,7 +100,7 @@ CGFloat const PanelAnimationDuration = 0.2;
- (MFNumberOfDrawers)numberOfDrawersShouldShow:(NSNumber *)forWidth {
CGFloat width;
if (forWidth) {
if (forWidth != nil) {
width = [forWidth floatValue];
} else {
width = [MVMCoreUISplitViewController getApplicationViewWidth];
@ -814,7 +814,6 @@ CGFloat const PanelAnimationDuration = 0.2;
// The main view.
NavigationController *navigationController = [NavigationController setupNavigationController];
self.navigationController = navigationController;
self.automaticallyAdjustsScrollViewInsets = NO;
UIView *mainView = navigationController.view;
mainView.translatesAutoresizingMaskIntoConstraints = NO;

View File

@ -181,7 +181,7 @@
__block NSInteger currentIndex = NSNotFound;
if (!self.loadObject.pageDataFromCache) {
NSNumber *currentIndexNumber = [self.loadObject.pageJSON optionalNumberForKey:@"currentTabIndex"];
if (currentIndexNumber) {
if (currentIndexNumber != nil) {
currentIndex = [currentIndexNumber integerValue];
}
}

View File

@ -96,9 +96,6 @@
// This view controller should subclass this function and check the load to make sure it has all the needed data. Fills the error object if there are any errors. Returns if we should finish the load or not.
- (BOOL)shouldFinishProcessingLoad:(nonnull MVMCoreLoadObject *)loadObject error:(MVMCoreErrorObject *_Nonnull *_Nonnull)error;
/// Called in newDataBuildScreen. Can override to parse the json into a model object.
- (void)parsePageJSON:(NSError * _Nullable * _Nullable)error;
// Sets the screen to use the screen heading.
// it is required in device flow, where we are showing greeting name as screen heading,
// device details screen heading needs to be updated/refreshed again, if user has changed device nick name

View File

@ -88,25 +88,10 @@
self.pageType = loadObject.pageType;
self.loadObject = loadObject;
NSError *parseError = nil;
[self parsePageJSON:&parseError];
if (parseError) {
if (error) {
MVMCoreErrorObject *errorObject = [MVMCoreErrorObject createErrorObjectForNSError:parseError location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]];
errorObject.messageToDisplay = [MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorUnableToProcess];
*error = errorObject;
}
return false;
}
// Verifies all modules needed are loaded.
return [MFViewController verifyRequiredModulesLoadedForLoadObject:loadObject error:error];
}
- (void)parsePageJSON:(NSError * _Nullable * _Nullable)error {
}
// Sets the screen to use the screen heading.
// it is required in device flow, where we are showing greeting name as screen heading,
// device details screen heading needs to be updated/refreshed again, if user has changed device nick name
@ -255,8 +240,6 @@
- (BOOL)newPageLoaded:(nonnull NSDictionary *)page {
self.loadObject.pageJSON = page;
NSError *parseError = nil;
[self parsePageJSON:&parseError];
return YES;
}

View File

@ -35,8 +35,8 @@
@property (strong, nonatomic) UIView *topAccessoryView;
// Adds the button view to the screen. Out of the scroll or in.
- (void)addViewOutsideOfScrollView:(UIView *)bottomView;
- (void)addViewToContentView:(UIView *)bottomView;
- (void)addViewOutsideOfScrollView:(nonnull UIView *)bottomView;
- (void)addViewToContentView:(nonnull UIView *)bottomView;
@end
@ -133,8 +133,7 @@
self.topConstraintForTopView.active = YES;
// Checks if we are using a different object than the bottom buttons.
UIView *bottomView = [self useCustomViewInsteadOfButtons];
self.customBottemView = (bottomView != nil);
if (!self.customBottemView) {
if (bottomView == nil) {
// Sets up the buttons/button.
NSDictionary *primaryButtonDictionary = [self primaryButtonMap];
@ -144,8 +143,10 @@
self.primaryButton = buttonView.primaryButton;
bottomView = buttonView;
self.bottomView = bottomView;
self.customBottemView = NO;
} else {
self.bottomView = bottomView;
self.customBottemView = YES;
}
[self updateTopLabelsBottomButtonsPadding];
@ -220,7 +221,7 @@
// Needs the height constraint
heightConstraint.active = YES;
if (!spaceAbove && !spaceBelow) {
if (spaceAbove == nil && spaceBelow == nil) {
// No set space above or below, make the spacers the same height with a default minimum.
UIView *topSpacer = [MVMCoreUICommonViewsUtility commonView];
@ -237,7 +238,7 @@
minimumHeightSpacer.active = YES;
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[topBetweenEdgeView]-0-[topSpacer]-0-[viewBetween]-0-[bottomSpacer]-0-[bottomBetweenEdgeView]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(topBetweenEdgeView,topSpacer,viewBetween,bottomSpacer,bottomBetweenEdgeView)]];
} else if (spaceAbove) {
} else if (spaceAbove != nil) {
// Space above is set, space below is free.
UIView *bottomSpacer = [MVMCoreUICommonViewsUtility commonView];
@ -249,7 +250,7 @@
NSDictionary *verticalMetrics = @{@"top":spaceAbove};
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[topBetweenEdgeView]-top-[viewBetween]-0-[bottomSpacer]-0-[bottomBetweenEdgeView]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:verticalMetrics views:NSDictionaryOfVariableBindings(topBetweenEdgeView,viewBetween,bottomSpacer,bottomBetweenEdgeView)]];
} else if (spaceBelow) {
} else if (spaceBelow != nil) {
// Space below is set, space above is free.
UIView *topSpacer = [MVMCoreUICommonViewsUtility commonView];

View File

@ -49,7 +49,7 @@ CGFloat const CaretViewWidth = 6.6f;
- (void)addCaretImageView {
[self.rightView removeFromSuperview];
UIEdgeInsets edgeInsets = self.contentEdgeInsets;
CGFloat rightInset = self.rightViewWidth?self.rightViewWidth.floatValue:CaretViewWidth;
CGFloat rightInset = self.rightViewWidth != nil ? self.rightViewWidth.floatValue : CaretViewWidth;
UIEdgeInsets newInsets = UIEdgeInsetsMake(edgeInsets.top, edgeInsets.left, edgeInsets.bottom, 4 + rightInset);
self.contentEdgeInsets = newInsets;
UIView *caretViewIs = self.rightView;
@ -60,11 +60,11 @@ CGFloat const CaretViewWidth = 6.6f;
self.rightView.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:self.rightView];
CGFloat width = self.rightViewWidth?self.rightViewWidth.floatValue:CaretViewWidth;
CGFloat width = self.rightViewWidth != nil ? self.rightViewWidth.floatValue : CaretViewWidth;
NSLayoutConstraint *caretViewWidthConstraint = [NSLayoutConstraint constraintWithItem:caretViewIs attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:width];
caretViewWidthConstraint.active = YES;
CGFloat height = self.rightViewHeight?self.rightViewHeight.floatValue:CaretViewHeight;
CGFloat height = self.rightViewHeight != nil ? self.rightViewHeight.floatValue : CaretViewHeight;
NSLayoutConstraint *caretViewHeightConstraint = [NSLayoutConstraint constraintWithItem:caretViewIs attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:height];
caretViewHeightConstraint.active = YES;

View File

@ -65,7 +65,7 @@
CGContextClearRect(context, rect);
CGFloat lineWidth;
if (self.lineWidth) {
if (self.lineWidth != nil) {
lineWidth = self.lineWidth.floatValue;
} else {
lineWidth = self.frame.size.width/2.6;

View File

@ -43,10 +43,10 @@ typedef void (^CircleSelectedClosure)(_Nonnull id sender);
@property (nonatomic, strong, nullable) NSLayoutConstraint *widthConstraint;
@property (nonatomic) BOOL respondsToTapGesture;
@property (nonatomic, getter = isSelected) BOOL selected;
@property (strong, nonatomic) NSLayoutConstraint *innerHeightConstarint;
@property (strong, nonatomic) NSLayoutConstraint *innerWidthConstarint;
@property (strong, nonatomic) NSLayoutConstraint *outerHeightConstarint;
@property (strong, nonatomic) NSLayoutConstraint *outerWidthConstarint;
@property (strong, nonatomic, nullable) NSLayoutConstraint *innerHeightConstarint;
@property (strong, nonatomic, nullable) NSLayoutConstraint *innerWidthConstarint;
@property (strong, nonatomic, nullable) NSLayoutConstraint *outerHeightConstarint;
@property (strong, nonatomic, nullable) NSLayoutConstraint *outerWidthConstarint;
// Set line width manually
- (void)setCheckMarkLineWidth:(CGFloat)lineWidth;

View File

@ -131,8 +131,4 @@
- (void)setAccessibilityString:(nullable NSString *)accessibilityString;
// For Validator Protocol
- (nullable NSString *)formFieldName;
- (nullable id)formFieldValue;
@end

View File

@ -61,21 +61,21 @@ const CGFloat SwitchShakeIntensity = 2;
}
- (instancetype)initWithCoder:(NSCoder *)coder {
if ([super initWithCoder:coder]) {
if (self = [super initWithCoder:coder]) {
[self setupView];
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame {
if ([super initWithFrame:frame]) {
if (self = [super initWithFrame:frame]) {
[self setupView];
}
return self;
}
- (instancetype)init {
if ([super init]) {
if (self = [super init]) {
[self setupView];
}
return self;

View File

@ -41,7 +41,4 @@ typedef enum : NSUInteger {
- (void)setAsLight;
- (void)setAsMedium;
/// Returns if the separator should be visible based on the type.
- (BOOL)shouldBeVisible;
@end

View File

@ -79,7 +79,7 @@
}
- (nullable instancetype)initWithTopAlertObject:(nonnull MVMCoreTopAlertObject *)topAlertObject animationDelegate:(nullable id <MVMCoreTopAlertAnimationDelegateProtocol>)animationDelegate viewToLayout:(nonnull UIView *)viewTolayout {
if ([self init]) {
if (self = [self init]) {
self.animationDelegate = animationDelegate;
self.viewToLayout = viewTolayout;
@ -119,7 +119,7 @@
}
- (nullable instancetype)initWithTopMessage:(nullable NSString *)topMessage message:(nullable NSString *)message contentColor:(nonnull UIColor *)contentColor buttonTitle:(nullable NSString *)buttonTitle animationDelegate:(nullable id <MVMCoreTopAlertAnimationDelegateProtocol>)animationDelegate viewToLayout:(nonnull UIView *)viewTolayout {
if ([self init]) {
if (self = [self init]) {
self.animationDelegate = animationDelegate;
self.viewToLayout = viewTolayout;
[self setupViewWithTopMessage:topMessage message:message subMessage:nil contentColor:contentColor buttonTitle:buttonTitle];
@ -128,7 +128,7 @@
}
- (nullable instancetype)initWithTopMessage:(nullable NSString *)topMessage message:(nullable NSString *)message subMessage:(nullable NSString *)subMessage contentColor:(nonnull UIColor *)contentColor buttonTitle:(nullable NSString *)buttonTitle animationDelegate:(nullable id <MVMCoreTopAlertAnimationDelegateProtocol>)animationDelegate viewToLayout:(nonnull UIView *)viewTolayout {
if ([self init]) {
if (self = [self init]) {
self.animationDelegate = animationDelegate;
self.viewToLayout = viewTolayout;
[self setupViewWithTopMessage:topMessage message:message subMessage:subMessage contentColor:contentColor buttonTitle:buttonTitle];
@ -137,7 +137,7 @@
}
- (nullable instancetype)initWithTopMessage:(nullable NSString *)topMessage message:(nullable NSString *)message subMessage:(nullable NSString *)subMessage contentColor:(nonnull UIColor *)contentColor actionMap:(nullable NSDictionary *)actionMap additionalData:(nullable NSDictionary *)additionalData animationDelegate:(nullable id <MVMCoreTopAlertAnimationDelegateProtocol>)animationDelegate viewToLayout:(nonnull UIView *)viewTolayout {
if ([self init]) {
if (self = [self init]) {
self.animationDelegate = animationDelegate;
self.viewToLayout = viewTolayout;
[self setupViewWithTopMessage:topMessage message:message subMessage:subMessage contentColor:contentColor actionMap:actionMap additionalData:additionalData];

View File

@ -59,7 +59,7 @@
}
- (nullable instancetype)initWithTopAlertObject:(nonnull MVMCoreTopAlertObject *)topAlertObject animationDelegate:(nullable id <MVMCoreTopAlertAnimationDelegateProtocol>)animationDelegate {
if ([self init]) {
if (self = [self init]) {
UIColor *contentColor = topAlertObject.textColor ?: [[MVMCoreUITopAlertView sharedGlobal] getContentColorForType:topAlertObject.type];
self.backgroundColor = topAlertObject.backgroundColor ?: [[MVMCoreUITopAlertView sharedGlobal] getBackgroundColorForType:topAlertObject.type];
[self setupViewWithLabelAndImage:topAlertObject.imageNameOrURL topImage:topAlertObject.aboveTextImageString];
@ -72,7 +72,7 @@
- (nullable instancetype)initWithColor:(nonnull UIColor *)color contentColor:(nullable UIColor *)contentColor message:(nullable NSString *)message subMessage:(nullable NSString *)subMessage actionMap:(nullable NSDictionary *)actionMap additionalData:(nullable NSDictionary *)additionalData closeButton:(BOOL)closeButton animationDelegate:(nullable id <MVMCoreTopAlertAnimationDelegateProtocol>)animationDelegate {
// Handles all scenarios.
if ([self init]) {
if (self = [self init]) {
self.backgroundColor = color;
[self setupViewWithLabelAndImage:nil topImage:nil];
[self setupCloseButton:closeButton animationDelegate:animationDelegate];
@ -86,7 +86,7 @@
- (nullable instancetype)initWithColor:(nonnull UIColor *)color contentColor:(nullable UIColor *)contentColor imageURL:(nullable NSString *)imageURL message:(nullable NSString *)message subMessage:(nullable NSString *)subMessage actionMap:(nullable NSDictionary *)actionMap additionalData:(nullable NSDictionary *)additionalData closeButton:(BOOL)closeButton animationDelegate:(nullable id <MVMCoreTopAlertAnimationDelegateProtocol>)animationDelegate {
// Handles all scenarios.
if ([self init]) {
if (self = [self init]) {
self.backgroundColor = color;
[self setupViewWithLabelAndImage:imageURL topImage:nil];
[self setupCloseButton:closeButton animationDelegate:animationDelegate];
@ -98,7 +98,7 @@
- (nullable instancetype)initWithColor:(nonnull UIColor *)color contentColor:(nullable UIColor *)contentColor imageURL:(nullable NSString *)imageURL message:(nullable NSString *)message subMessage:(nullable NSString *)subMessage closeButton:(BOOL)closeButton animationDelegate:(nullable id <MVMCoreTopAlertAnimationDelegateProtocol>)animationDelegate {
// No main button.
if ([self init]) {
if (self = [self init]) {
self.backgroundColor = color;
[self setupViewWithLabelAndImage:imageURL topImage:nil];
[self setupCloseButton:closeButton animationDelegate:animationDelegate];
@ -286,7 +286,7 @@
- (nullable instancetype)initWithColor:(nonnull UIColor *)color contentColor:(nonnull UIColor *)contentColor message:(nullable NSString *)message subMessage:(nullable NSString *)subMessage actionMap:(nullable NSDictionary *)actionMap additionalData:(nullable NSDictionary *)additionalData {
// No icon or close button.
if ([self init]) {
if (self = [self init]) {
self.backgroundColor = color;
[self setupViewWithLabelAndImage:nil topImage:nil];
[self setupWithMessage:message subMessage:subMessage color:contentColor actionMap:actionMap additionalData:additionalData];
@ -297,7 +297,7 @@
- (nullable instancetype)initWithColor:(nonnull UIColor *)color contentColor:(nonnull UIColor *)contentColor message:(nullable NSString *)message subMessage:(nullable NSString *)subMessage closeButton:(BOOL)closeButton animationDelegate:(nullable id <MVMCoreTopAlertAnimationDelegateProtocol>)animationDelegate {
// No main button.
if ([self init]) {
if (self = [self init]) {
self.backgroundColor = color;
[self setupViewWithLabelAndImage:nil topImage:nil];
[self setupWithMessage:message subMessage:subMessage color:contentColor buttonTitle:nil userActionHandler:NULL];
@ -309,7 +309,7 @@
- (nullable instancetype)initWithColor:(nonnull UIColor *)color contentColor:(nonnull UIColor *)contentColor message:(nullable NSString *)message subMessage:(nullable NSString *)subMessage buttonTitle:(nullable NSString *)buttonTitle userActionHandler:(nullable void (^)(id _Nonnull sender))userActionHandler {
// No icon or close button. Custom button action.
if ([self init]) {
if (self = [self init]) {
self.backgroundColor = color;
[self setupViewWithLabelAndImage:nil topImage:nil];
[self setupWithMessage:message subMessage:subMessage color:contentColor buttonTitle:buttonTitle userActionHandler:userActionHandler];

View File

@ -86,7 +86,7 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed.";
- (void)pinATopViewController:(UIViewController *)viewController {
self.statusBarHeightConstraint.active = NO;
id topGuide = viewController.topLayoutGuide;
id topGuide = viewController.view.safeAreaLayoutGuide.topAnchor;
self.statusBarBottomConstraint = [NSLayoutConstraint constraintWithItem:self.statusBarView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:topGuide attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
self.statusBarBottomConstraint.active = YES;
}

View File

@ -150,7 +150,7 @@
}
+ (CGFloat)getHeightOfView:(nonnull UIView *)view forWidth:(nullable NSNumber *)width {
CGFloat floatWidth = (width ? width.floatValue : [MVMCoreUIUtility getWidth]);
CGFloat floatWidth = (width != nil ? width.floatValue : [MVMCoreUIUtility getWidth]);
return [view systemLayoutSizeFittingSize:CGSizeMake(floatWidth, UILayoutFittingCompressedSize.height) withHorizontalFittingPriority:1000 verticalFittingPriority:250].height;
}

View File

@ -30,7 +30,7 @@ CGFloat const MFSizeiPadProLandscapeThreshold = 1300;
+ (CGFloat)getScaledValue:(CGFloat)value forSize:(CGFloat)size fromBase:(nullable NSNumber *)base {
CGFloat baseFloat = 375.0;
if (base) {
if (base != nil) {
baseFloat = [base floatValue];
}
return value * (size/baseFloat);