From 1e12517c555078320f257b2f16af4066083760f3 Mon Sep 17 00:00:00 2001 From: Sourabh Bhardwaj Date: Mon, 25 Sep 2023 19:38:01 +0530 Subject: [PATCH 1/7] Fixed headline body component's accessbility label issue --- .../List/OneColumn/ListOneColumnFullWidthTextBodyText.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift index 7a17dd1b..f9cfcc95 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift @@ -55,11 +55,11 @@ import Foundation isAccessibilityElement = true var message = "" - if let headlineLabel = headlineBody.headlineLabel.text { + if let headlineLabel = headlineBody.headlineLabel.accessibilityLabel ?? headlineBody.headlineLabel.text { message += headlineLabel + ", " } - if let messageLabel = headlineBody.messageLabel.text { + if let messageLabel = headlineBody.messageLabel.accessibilityLabel ?? headlineBody.messageLabel.text { message += messageLabel } From ab50921e88fbb95d0a0f1f57d71b0e7d4e444612 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 27 Sep 2023 15:34:49 -0500 Subject: [PATCH 2/7] added color extension for isDark Signed-off-by: Matt Bruce --- MVMCoreUI/Categories/UIColor+MFConvenience.h | 4 ++++ MVMCoreUI/Categories/UIColor+MFConvenience.m | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/MVMCoreUI/Categories/UIColor+MFConvenience.h b/MVMCoreUI/Categories/UIColor+MFConvenience.h index 97280ba1..2bb81cd8 100644 --- a/MVMCoreUI/Categories/UIColor+MFConvenience.h +++ b/MVMCoreUI/Categories/UIColor+MFConvenience.h @@ -187,4 +187,8 @@ + (nullable NSString *)hexStringForColor:(nonnull UIColor*)color; + (nonnull UIColor *)mfGetColorForHexWithTransparency:(nonnull NSString *)hexString; + +// Returns if the color is dark or not +- (BOOL)isDark; + @end diff --git a/MVMCoreUI/Categories/UIColor+MFConvenience.m b/MVMCoreUI/Categories/UIColor+MFConvenience.m index 8786df01..c185e7bb 100644 --- a/MVMCoreUI/Categories/UIColor+MFConvenience.m +++ b/MVMCoreUI/Categories/UIColor+MFConvenience.m @@ -403,4 +403,10 @@ } } +- (BOOL)isDark { + CGFloat greyScale = 0; + [self getWhite:&greyScale alpha:nil]; + return greyScale < 0.5; +} + @end From f98c6059b8b2a307c699429b759d55d62a0502cd Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 27 Sep 2023 15:53:53 -0500 Subject: [PATCH 3/7] rearranged Signed-off-by: Matt Bruce --- MVMCoreUI/Categories/UIColor+MFConvenience.h | 6 +++--- MVMCoreUI/Categories/UIColor+MFConvenience.m | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/MVMCoreUI/Categories/UIColor+MFConvenience.h b/MVMCoreUI/Categories/UIColor+MFConvenience.h index 2bb81cd8..10e9433d 100644 --- a/MVMCoreUI/Categories/UIColor+MFConvenience.h +++ b/MVMCoreUI/Categories/UIColor+MFConvenience.h @@ -183,12 +183,12 @@ // Returns a gradient lighter color; + (nonnull UIColor *)mfGradientColor:(nullable UIColor *)color; +// Returns if the color is dark or not +- (BOOL)isDark; + #pragma mark - Hex String + (nullable NSString *)hexStringForColor:(nonnull UIColor*)color; + (nonnull UIColor *)mfGetColorForHexWithTransparency:(nonnull NSString *)hexString; -// Returns if the color is dark or not -- (BOOL)isDark; - @end diff --git a/MVMCoreUI/Categories/UIColor+MFConvenience.m b/MVMCoreUI/Categories/UIColor+MFConvenience.m index c185e7bb..ac25ec22 100644 --- a/MVMCoreUI/Categories/UIColor+MFConvenience.m +++ b/MVMCoreUI/Categories/UIColor+MFConvenience.m @@ -389,6 +389,12 @@ return [UIColor whiteColor]; } +- (BOOL)isDark { + CGFloat greyScale = 0; + [self getWhite:&greyScale alpha:nil]; + return greyScale < 0.5; +} + #pragma mark - Hex String + (nullable NSString *)hexStringForColor:(nonnull UIColor*)color { @@ -403,10 +409,4 @@ } } -- (BOOL)isDark { - CGFloat greyScale = 0; - [self getWhite:&greyScale alpha:nil]; - return greyScale < 0.5; -} - @end From a19bd60f063d0a939ebb9c96dd80784bb0e8c6ea Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 27 Sep 2023 15:56:53 -0500 Subject: [PATCH 4/7] indented Signed-off-by: Matt Bruce --- MVMCoreUI/Categories/UIColor+MFConvenience.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Categories/UIColor+MFConvenience.m b/MVMCoreUI/Categories/UIColor+MFConvenience.m index ac25ec22..cd809509 100644 --- a/MVMCoreUI/Categories/UIColor+MFConvenience.m +++ b/MVMCoreUI/Categories/UIColor+MFConvenience.m @@ -390,9 +390,9 @@ } - (BOOL)isDark { - CGFloat greyScale = 0; - [self getWhite:&greyScale alpha:nil]; - return greyScale < 0.5; + CGFloat greyScale = 0; + [self getWhite:&greyScale alpha:nil]; + return greyScale < 0.5; } #pragma mark - Hex String From ab9d61fd156873c6fcc0225c88b9c9ffc57dca5b Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Thu, 28 Sep 2023 09:25:50 -0400 Subject: [PATCH 5/7] Link Fix --- MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift | 2 +- .../UINavigationController+Extension.swift | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift b/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift index 4f4a8b34..c6a14872 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift @@ -21,7 +21,7 @@ import VDSColorTokens else { return } // Set line to the same color as the text - if let color = titleLabel?.textColor?.cgColor { + if let color = titleColor(for: state)?.cgColor { context.setStrokeColor(color) } diff --git a/MVMCoreUI/Containers/NavigationController/UINavigationController+Extension.swift b/MVMCoreUI/Containers/NavigationController/UINavigationController+Extension.swift index 625f0a25..3372c1ab 100644 --- a/MVMCoreUI/Containers/NavigationController/UINavigationController+Extension.swift +++ b/MVMCoreUI/Containers/NavigationController/UINavigationController+Extension.swift @@ -12,6 +12,7 @@ import MVMCore public extension UINavigationController { /// Convenience function for setting the navigation item. + @MainActor func setNavigationItem(with model: NavigationItemModelProtocol, for viewController: UIViewController, coordinatingWith pageBehaviorController: PageBehaviorHandlerProtocol? = nil) { let behaviorHandler = pageBehaviorController ?? viewController as? PageBehaviorHandlerProtocol; @@ -33,6 +34,7 @@ public extension UINavigationController { } /// Convenience function for setting the navigation buttons. + @MainActor func setNavigationButtons(with model: NavigationItemModelProtocol, for viewController: UIViewController) { let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject var leftItems: [UIBarButtonItem] = [] @@ -60,6 +62,7 @@ public extension UINavigationController { } /// Convenience function for setting the navigation titleView. + @MainActor func setNavigationTitleView(with model: NavigationItemModelProtocol, for viewController: UIViewController, coordinatingWith pageBehaviorController: PageBehaviorHandlerProtocol? = nil) { guard let titleViewModel = model.titleView else { return } @@ -87,6 +90,7 @@ public extension UINavigationController { } /// Convenience function for setting the navigation bar ui + @MainActor func setNavigationBarUI(with model: NavigationItemModelProtocol) { let navigationBar = navigationBar let font = Styler.Font.BoldTitleSmall.getFont(false) From 308700c667f3c2534a51bffd2043620d2c2407e3 Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Wed, 4 Oct 2023 10:17:49 -0400 Subject: [PATCH 6/7] MVMCoreObject to swift --- .../xcshareddata/xcschemes/MVMCoreUI.xcscheme | 66 +++++++++++++++++++ MVMCoreUI/Alerts/AlertOperation.swift | 2 +- MVMCoreUI/OtherHandlers/CoreUIObject.swift | 16 ++--- MVMCoreUI/OtherHandlers/MVMCoreUISession.m | 3 +- 4 files changed, 76 insertions(+), 11 deletions(-) create mode 100644 MVMCoreUI.xcodeproj/xcshareddata/xcschemes/MVMCoreUI.xcscheme diff --git a/MVMCoreUI.xcodeproj/xcshareddata/xcschemes/MVMCoreUI.xcscheme b/MVMCoreUI.xcodeproj/xcshareddata/xcschemes/MVMCoreUI.xcscheme new file mode 100644 index 00000000..9e236f99 --- /dev/null +++ b/MVMCoreUI.xcodeproj/xcshareddata/xcschemes/MVMCoreUI.xcscheme @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MVMCoreUI/Alerts/AlertOperation.swift b/MVMCoreUI/Alerts/AlertOperation.swift index 088a6ff5..50b71e46 100644 --- a/MVMCoreUI/Alerts/AlertOperation.swift +++ b/MVMCoreUI/Alerts/AlertOperation.swift @@ -73,7 +73,7 @@ public class AlertOperation: MVMCoreOperation { if await !self.properties.getIsDisplayed() { self.markAsFinished() } else { - (CoreUIObject.sharedInstance()?.loggingDelegate as? MVMCoreUILoggingDelegateProtocol)?.logAlert(with: self.alertObject) + (MVMCoreObject.sharedInstance()?.loggingDelegate as? MVMCoreUILoggingDelegateProtocol)?.logAlert(with: self.alertObject) if self.isCancelled { await self.dismissAlertView() } diff --git a/MVMCoreUI/OtherHandlers/CoreUIObject.swift b/MVMCoreUI/OtherHandlers/CoreUIObject.swift index b96e9b93..5f16a8f3 100644 --- a/MVMCoreUI/OtherHandlers/CoreUIObject.swift +++ b/MVMCoreUI/OtherHandlers/CoreUIObject.swift @@ -9,19 +9,17 @@ import UIKit import MVMCore -@objcMembers open class CoreUIObject: MVMCoreObject { +@objcMembers +public class CoreUIObject: NSObject { + private static var singleton = CoreUIObject() + public static func sharedInstance() -> CoreUIObject? { singleton } + private override init() {} + public var alertHandler: AlertHandler? public var topNotificationHandler: NotificationHandler? - open override func defaultInitialSetup() { + public func defaultInitialSetup() { CoreUIModelMapping.registerObjects() - loadHandler = MVMCoreLoadHandler() - cache = MVMCoreCache() - session = MVMCoreUISession() - sessionHandler = MVMCoreSessionTimeHandler() - actionHandler = MVMCoreUIActionHandler() - viewControllerMapping = MVMCoreUIViewControllerMappingObject() - loggingDelegate = MVMCoreUILoggingHandler() alertHandler = AlertHandler() } } diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUISession.m b/MVMCoreUI/OtherHandlers/MVMCoreUISession.m index 42a3e769..3b1d5913 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUISession.m +++ b/MVMCoreUI/OtherHandlers/MVMCoreUISession.m @@ -9,7 +9,8 @@ #import "MVMCoreUISession.h" #import "MFLoadingViewController.h" #import "NSLayoutConstraint+MFConvenience.h" -@import MVMCore.MVMCoreObject; +@import MVMCore.MVMCoreLoadingOverlayDelegateProtocol; +@import MVMCore.Swift; @interface MVMCoreUISession () From e940c9bf087da7112718d4723728eed1378b23a8 Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Wed, 4 Oct 2023 17:20:54 -0400 Subject: [PATCH 7/7] add to default config --- MVMCoreUI/OtherHandlers/CoreUIObject.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MVMCoreUI/OtherHandlers/CoreUIObject.swift b/MVMCoreUI/OtherHandlers/CoreUIObject.swift index 5f16a8f3..d1fd18f9 100644 --- a/MVMCoreUI/OtherHandlers/CoreUIObject.swift +++ b/MVMCoreUI/OtherHandlers/CoreUIObject.swift @@ -19,7 +19,12 @@ public class CoreUIObject: NSObject { public var topNotificationHandler: NotificationHandler? public func defaultInitialSetup() { + MVMCoreObject.sharedInstance()?.defaultInitialSetup() CoreUIModelMapping.registerObjects() + MVMCoreObject.sharedInstance()?.session = MVMCoreUISession() + MVMCoreObject.sharedInstance()?.actionHandler = MVMCoreUIActionHandler() + MVMCoreObject.sharedInstance()?.viewControllerMapping = MVMCoreUIViewControllerMappingObject() + MVMCoreObject.sharedInstance()?.loggingDelegate = MVMCoreUILoggingHandler() alertHandler = AlertHandler() } }