Merge branch 'develop' into feature/dynamicAccessibilityTraits

This commit is contained in:
Keerthy 2023-10-13 15:01:38 +05:30
commit a3d3b1e635
11 changed files with 100 additions and 16 deletions

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D29DF0CB21E404D4003B2FB9"
BuildableName = "MVMCoreUI.framework"
BlueprintName = "MVMCoreUI"
ReferencedContainer = "container:MVMCoreUI.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D29DF0CB21E404D4003B2FB9"
BuildableName = "MVMCoreUI.framework"
BlueprintName = "MVMCoreUI"
ReferencedContainer = "container:MVMCoreUI.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -73,7 +73,7 @@ public class AlertOperation: MVMCoreOperation {
if await !self.properties.getIsDisplayed() { if await !self.properties.getIsDisplayed() {
self.markAsFinished() self.markAsFinished()
} else { } else {
(CoreUIObject.sharedInstance()?.loggingDelegate as? MVMCoreUILoggingDelegateProtocol)?.logAlert(with: self.alertObject) (MVMCoreObject.sharedInstance()?.loggingDelegate as? MVMCoreUILoggingDelegateProtocol)?.logAlert(with: self.alertObject)
if self.isCancelled { if self.isCancelled {
await self.dismissAlertView() await self.dismissAlertView()
} }

View File

@ -21,7 +21,7 @@ import VDSColorTokens
else { return } else { return }
// Set line to the same color as the text // 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) context.setStrokeColor(color)
} }

View File

@ -55,11 +55,11 @@ import Foundation
isAccessibilityElement = true isAccessibilityElement = true
var message = "" var message = ""
if let headlineLabel = headlineBody.headlineLabel.text { if let headlineLabel = headlineBody.headlineLabel.accessibilityLabel ?? headlineBody.headlineLabel.text {
message += headlineLabel + ", " message += headlineLabel + ", "
} }
if let messageLabel = headlineBody.messageLabel.text { if let messageLabel = headlineBody.messageLabel.accessibilityLabel ?? headlineBody.messageLabel.text {
message += messageLabel message += messageLabel
} }

View File

@ -384,7 +384,7 @@ open class Carousel: View {
extension Carousel: UICollectionViewDelegateFlowLayout { extension Carousel: UICollectionViewDelegateFlowLayout {
open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let itemWidth = collectionView.bounds.width * itemWidthPercent let itemWidth = (collectionView.bounds.width - collectionView.contentInset.left - collectionView.contentInset.right) * itemWidthPercent
return CGSize(width: itemWidth, height: collectionView.bounds.height) return CGSize(width: itemWidth, height: collectionView.bounds.height)
} }

View File

@ -183,8 +183,12 @@
// Returns a gradient lighter color; // Returns a gradient lighter color;
+ (nonnull UIColor *)mfGradientColor:(nullable UIColor *)color; + (nonnull UIColor *)mfGradientColor:(nullable UIColor *)color;
// Returns if the color is dark or not
- (BOOL)isDark;
#pragma mark - Hex String #pragma mark - Hex String
+ (nullable NSString *)hexStringForColor:(nonnull UIColor*)color; + (nullable NSString *)hexStringForColor:(nonnull UIColor*)color;
+ (nonnull UIColor *)mfGetColorForHexWithTransparency:(nonnull NSString *)hexString; + (nonnull UIColor *)mfGetColorForHexWithTransparency:(nonnull NSString *)hexString;
@end @end

View File

@ -389,6 +389,12 @@
return [UIColor whiteColor]; return [UIColor whiteColor];
} }
- (BOOL)isDark {
CGFloat greyScale = 0;
[self getWhite:&greyScale alpha:nil];
return greyScale < 0.5;
}
#pragma mark - Hex String #pragma mark - Hex String
+ (nullable NSString *)hexStringForColor:(nonnull UIColor*)color { + (nullable NSString *)hexStringForColor:(nonnull UIColor*)color {

View File

@ -12,6 +12,7 @@ import MVMCore
public extension UINavigationController { public extension UINavigationController {
/// Convenience function for setting the navigation item. /// Convenience function for setting the navigation item.
@MainActor
func setNavigationItem(with model: NavigationItemModelProtocol, for viewController: UIViewController, coordinatingWith pageBehaviorController: PageBehaviorHandlerProtocol? = nil) { func setNavigationItem(with model: NavigationItemModelProtocol, for viewController: UIViewController, coordinatingWith pageBehaviorController: PageBehaviorHandlerProtocol? = nil) {
let behaviorHandler = pageBehaviorController ?? viewController as? PageBehaviorHandlerProtocol; let behaviorHandler = pageBehaviorController ?? viewController as? PageBehaviorHandlerProtocol;
@ -33,6 +34,7 @@ public extension UINavigationController {
} }
/// Convenience function for setting the navigation buttons. /// Convenience function for setting the navigation buttons.
@MainActor
func setNavigationButtons(with model: NavigationItemModelProtocol, for viewController: UIViewController) { func setNavigationButtons(with model: NavigationItemModelProtocol, for viewController: UIViewController) {
let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject
var leftItems: [UIBarButtonItem] = [] var leftItems: [UIBarButtonItem] = []
@ -60,6 +62,7 @@ public extension UINavigationController {
} }
/// Convenience function for setting the navigation titleView. /// Convenience function for setting the navigation titleView.
@MainActor
func setNavigationTitleView(with model: NavigationItemModelProtocol, for viewController: UIViewController, coordinatingWith pageBehaviorController: PageBehaviorHandlerProtocol? = nil) { func setNavigationTitleView(with model: NavigationItemModelProtocol, for viewController: UIViewController, coordinatingWith pageBehaviorController: PageBehaviorHandlerProtocol? = nil) {
guard let titleViewModel = model.titleView else { return } guard let titleViewModel = model.titleView else { return }
@ -87,6 +90,7 @@ public extension UINavigationController {
} }
/// Convenience function for setting the navigation bar ui /// Convenience function for setting the navigation bar ui
@MainActor
func setNavigationBarUI(with model: NavigationItemModelProtocol) { func setNavigationBarUI(with model: NavigationItemModelProtocol) {
let navigationBar = navigationBar let navigationBar = navigationBar
let font = Styler.Font.BoldTitleSmall.getFont(false) let font = Styler.Font.BoldTitleSmall.getFont(false)

View File

@ -273,7 +273,7 @@ open class SubNavManagerController: ViewController, MVMCoreViewManagerProtocol,
// Load controller from the cache // Load controller from the cache
needToTrackTabSelect = true needToTrackTabSelect = true
Task(priority: .userInitiated) { Task(priority: .userInitiated) {
await NavigationHandler.shared().replace(viewController: controller, navigationController: subNavigationController, tryToReplace: false, animated: true) await NavigationHandler.shared().replace(viewController: controller, navigationController:subNavigationController, delegateObject:delegateObject(), tryToReplace: false, animated: true)
} }
} else if let tabsModel = tabs.tabsModel, } else if let tabsModel = tabs.tabsModel,
let action = tabsModel.tabs[indexPath.row].action { let action = tabsModel.tabs[indexPath.row].action {

View File

@ -9,19 +9,22 @@
import UIKit import UIKit
import MVMCore 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 alertHandler: AlertHandler?
public var topNotificationHandler: NotificationHandler? public var topNotificationHandler: NotificationHandler?
open override func defaultInitialSetup() { public func defaultInitialSetup() {
MVMCoreObject.sharedInstance()?.defaultInitialSetup()
CoreUIModelMapping.registerObjects() CoreUIModelMapping.registerObjects()
loadHandler = MVMCoreLoadHandler() MVMCoreObject.sharedInstance()?.session = MVMCoreUISession()
cache = MVMCoreCache() MVMCoreObject.sharedInstance()?.actionHandler = MVMCoreUIActionHandler()
session = MVMCoreUISession() MVMCoreObject.sharedInstance()?.viewControllerMapping = MVMCoreUIViewControllerMappingObject()
sessionHandler = MVMCoreSessionTimeHandler() MVMCoreObject.sharedInstance()?.loggingDelegate = MVMCoreUILoggingHandler()
actionHandler = MVMCoreUIActionHandler()
viewControllerMapping = MVMCoreUIViewControllerMappingObject()
loggingDelegate = MVMCoreUILoggingHandler()
alertHandler = AlertHandler() alertHandler = AlertHandler()
} }
} }

View File

@ -9,7 +9,8 @@
#import "MVMCoreUISession.h" #import "MVMCoreUISession.h"
#import "MFLoadingViewController.h" #import "MFLoadingViewController.h"
#import "NSLayoutConstraint+MFConvenience.h" #import "NSLayoutConstraint+MFConvenience.h"
@import MVMCore.MVMCoreObject; @import MVMCore.MVMCoreLoadingOverlayDelegateProtocol;
@import MVMCore.Swift;
@interface MVMCoreUISession () <MVMCoreLoadingOverlayDelegateProtocol> @interface MVMCoreUISession () <MVMCoreLoadingOverlayDelegateProtocol>