From e69f262a4d2e73d2f68eb63a0f67c9feefed6e5b Mon Sep 17 00:00:00 2001 From: "Chintakrinda, Arun Kumar (Arun)" Date: Wed, 22 Apr 2020 19:24:02 +0530 Subject: [PATCH 1/2] Image border added as part of 3.0 requirement --- .../Utility/MVMCoreUICommonViewsUtility.h | 4 +++ .../Utility/MVMCoreUICommonViewsUtility.m | 29 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.h b/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.h index cc1df5e6..5cb733bb 100644 --- a/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.h +++ b/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.h @@ -79,6 +79,10 @@ // Creates, pins, and returns a safe area view for the passed in view. + (nullable UIView *)getAndSetupSafeAreaViewOnView:(nonnull UIView *)view; +#pragma mark border + ++ (nullable UIImage *)addBorderToImage:(nullable UIImage *)image; + #pragma mark - shadows + (void)drawBottomCurvedShadowsOnRect:(CGRect)rect toView:(nullable UIView *)view; diff --git a/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.m b/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.m index 5c796417..e2dd9552 100644 --- a/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.m +++ b/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.m @@ -253,6 +253,35 @@ static const CGFloat VertialShadowOffset = 6; return safeAreaView; } +#pragma mark border + ++ (nullable UIImage *)addBorderToImage:(nullable UIImage *)image { + if (!image) { + return nil; + } + CGSize size = [image size]; + UIGraphicsBeginImageContext(size); + + CGContextRef context = UIGraphicsGetCurrentContext(); + CGContextSetRGBStrokeColor(context, 0.0, 0.0, 0.0, 1.0); + CGContextSetLineWidth(context, 1.0); + CGContextMoveToPoint(context, 0, 0); + CGContextAddLineToPoint(context, size.width, 0); + CGContextAddLineToPoint(context, size.width, size.height); + CGContextAddLineToPoint(context, 0, size.height); + CGContextAddLineToPoint(context, 0, 0); + CGContextStrokePath(context); + + //Comensating for the border so that none of the image is missed + CGRect newImageRect = CGRectMake(1, 1, size.width - 2, size.height - 2); + [image drawInRect: newImageRect]; + + UIImage *imageWithBorder = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + return imageWithBorder; + +} + #pragma mark - shadows + (void)drawBottomCurvedShadowsOnRect:(CGRect)rect toView:(nullable UIView *)view { From f7d21e9a234192c0b9020c76cddecb4d40ef406a Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Fri, 1 May 2020 11:26:35 -0400 Subject: [PATCH 2/2] bug fix when checking array --- MVMCoreUI/BaseControllers/ViewController.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/BaseControllers/ViewController.swift b/MVMCoreUI/BaseControllers/ViewController.swift index 5fee7724..75cb897c 100644 --- a/MVMCoreUI/BaseControllers/ViewController.swift +++ b/MVMCoreUI/BaseControllers/ViewController.swift @@ -128,7 +128,8 @@ import UIKit } open class func verifyRequiredModulesLoaded(for loadObject: MVMCoreLoadObject?, error: AutoreleasingUnsafeMutablePointer) -> Bool { - guard let pageType = loadObject?.pageType, var modulesRequired = MVMCoreUIViewControllerMappingObject.shared()?.modulesRequired(forPageType: pageType) else { return true } + guard let pageType = loadObject?.pageType, var modulesRequired = MVMCoreUIViewControllerMappingObject.shared()?.modulesRequired(forPageType: pageType), + !modulesRequired.isEmpty else { return true } guard let loadedModules = loadObject?.modulesJSON else { return false }