merge
This commit is contained in:
commit
9381e41906
@ -259,6 +259,7 @@
|
||||
D29770FC21F7C77400B2F0D0 /* MVMCoreUITextFieldView.m in Sources */ = {isa = PBXBuildFile; fileRef = D29770FA21F7C77400B2F0D0 /* MVMCoreUITextFieldView.m */; };
|
||||
D29770FD21F7C77400B2F0D0 /* MVMCoreUITextFieldView.h in Headers */ = {isa = PBXBuildFile; fileRef = D29770FB21F7C77400B2F0D0 /* MVMCoreUITextFieldView.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D29B771022C281F400D6ACE0 /* ModuleMolecule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D29B770F22C281F400D6ACE0 /* ModuleMolecule.swift */; };
|
||||
D29C94D5242901C9003813BA /* MVMCoreUICommonViewsUtility+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D29C94D4242901C9003813BA /* MVMCoreUICommonViewsUtility+Extension.swift */; };
|
||||
D29DF0D121E404D4003B2FB9 /* MVMCoreUI.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF0CF21E404D4003B2FB9 /* MVMCoreUI.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D29DF0E621E4F3C7003B2FB9 /* MVMCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D29DF0E521E4F3C7003B2FB9 /* MVMCore.framework */; };
|
||||
D29DF11521E6805F003B2FB9 /* UIColor+MFConvenience.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF11121E6805F003B2FB9 /* UIColor+MFConvenience.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
@ -638,6 +639,7 @@
|
||||
D29770FA21F7C77400B2F0D0 /* MVMCoreUITextFieldView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUITextFieldView.m; sourceTree = "<group>"; };
|
||||
D29770FB21F7C77400B2F0D0 /* MVMCoreUITextFieldView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreUITextFieldView.h; sourceTree = "<group>"; };
|
||||
D29B770F22C281F400D6ACE0 /* ModuleMolecule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModuleMolecule.swift; sourceTree = "<group>"; };
|
||||
D29C94D4242901C9003813BA /* MVMCoreUICommonViewsUtility+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MVMCoreUICommonViewsUtility+Extension.swift"; sourceTree = "<group>"; };
|
||||
D29DF0CC21E404D4003B2FB9 /* MVMCoreUI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MVMCoreUI.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
D29DF0CF21E404D4003B2FB9 /* MVMCoreUI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUI.h; sourceTree = "<group>"; };
|
||||
D29DF0D021E404D4003B2FB9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
@ -1447,6 +1449,7 @@
|
||||
D29DF13B21E6870B003B2FB9 /* Sizing */,
|
||||
D29DF28221E7AB24003B2FB9 /* MVMCoreUICommonViewsUtility.h */,
|
||||
D29DF28121E7AB23003B2FB9 /* MVMCoreUICommonViewsUtility.m */,
|
||||
D29C94D4242901C9003813BA /* MVMCoreUICommonViewsUtility+Extension.swift */,
|
||||
D29DF14D21E693AD003B2FB9 /* MFFonts.h */,
|
||||
D29DF14C21E693AD003B2FB9 /* MFFonts.m */,
|
||||
9458C3152406C8FD00930963 /* UIFont+FontWrapping.h */,
|
||||
@ -2004,6 +2007,7 @@
|
||||
525019E52406852100EED91C /* ListFourColumnDataUsageDividerModel.swift in Sources */,
|
||||
0A7EF86723D8B0AE00B2AAD1 /* DateDropdownEntryFieldModel.swift in Sources */,
|
||||
94FB966323D797DA003D482B /* MFTextButton.m in Sources */,
|
||||
D29C94D5242901C9003813BA /* MVMCoreUICommonViewsUtility+Extension.swift in Sources */,
|
||||
D260105323CEA61600764D80 /* ToggleModel.swift in Sources */,
|
||||
014AA72523C501E2006F3E93 /* ContainerModel.swift in Sources */,
|
||||
0A7EF86523D8AFFF00B2AAD1 /* ItemDropdownEntryFieldModel.swift in Sources */,
|
||||
|
||||
@ -130,7 +130,7 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol {
|
||||
self?.enableField(model.enabled)
|
||||
}
|
||||
|
||||
FormValidator.setupValidation(molecule: model, delegate: delegateObject?.formHolderDelegate)
|
||||
FormValidator.setupValidation(molecule: model, delegate: delegateObject?.formHolderDelegate)
|
||||
}
|
||||
|
||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
|
||||
@ -342,7 +342,7 @@ import UIKit
|
||||
setAsSecureTextEntry(model.secureEntry)
|
||||
|
||||
for digitBox in digitBoxes {
|
||||
MVMCoreUICommonViewsUtility.addDismissToolbar(digitBox.digitField, delegate: delegateObject as? UITextFieldDelegate)
|
||||
digitBox.digitField.inputAccessoryView = MVMCoreUICommonViewsUtility.getToolbarWithDoneButton(delegate: delegateObject?.observingTextFieldDelegate ?? self)
|
||||
}
|
||||
|
||||
super.set(with: model, delegateObject, additionalData)
|
||||
|
||||
@ -19,7 +19,7 @@ import UIKit
|
||||
}
|
||||
|
||||
|
||||
@objcMembers open class TextEntryField: EntryField, UITextFieldDelegate {
|
||||
@objcMembers open class TextEntryField: EntryField, UITextFieldDelegate, ObservingTextFieldDelegate {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Outlets
|
||||
//--------------------------------------------------
|
||||
@ -315,7 +315,7 @@ import UIKit
|
||||
|
||||
uiTextFieldDelegate = delegateObject?.uiTextFieldDelegate
|
||||
observingTextFieldDelegate = delegateObject?.observingTextFieldDelegate
|
||||
//MVMCoreUICommonViewsUtility.addDismissToolbar(textField, delegate: uiTextFieldDelegate)
|
||||
textField.inputAccessoryView = MVMCoreUICommonViewsUtility.getToolbarWithDoneButton(delegate: observingTextFieldDelegate ?? self)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -8,14 +8,15 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public protocol NavigationItemModelProtocol: MoleculeModelProtocol {
|
||||
public protocol NavigationItemModelProtocol {
|
||||
var title: String? { get set }
|
||||
var titleView: MoleculeModelProtocol? { get set }
|
||||
var hidden: Bool { get set }
|
||||
var backgroundColor: Color? { get set }
|
||||
var transparent: Bool { get set }
|
||||
var tintColor: Color { get set }
|
||||
var systemBackButton: Bool? { get set }
|
||||
var line: LineModel? { get set }
|
||||
var systemBackButton: Bool { get set }
|
||||
var showLeftPanelButton: Bool? { get set }
|
||||
var showRightPanelButton: Bool? { get set }
|
||||
var additionalLeftItems: [NavigationItemButtonModel]? { get set }
|
||||
@ -49,7 +50,7 @@ public class NavigationItemButtonModel: Codable {
|
||||
}
|
||||
}
|
||||
|
||||
public class NavigationItemModel: NavigationItemModelProtocol {
|
||||
public class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtocol {
|
||||
public class var identifier: String {
|
||||
return "navigationItem"
|
||||
}
|
||||
@ -60,7 +61,8 @@ public class NavigationItemModel: NavigationItemModelProtocol {
|
||||
public var backgroundColor: Color?
|
||||
public var transparent: Bool
|
||||
public var tintColor: Color
|
||||
public var systemBackButton: Bool?
|
||||
public var line: LineModel?
|
||||
public var systemBackButton = false
|
||||
public var showLeftPanelButton: Bool?
|
||||
public var showRightPanelButton: Bool?
|
||||
public var additionalLeftItems: [NavigationItemButtonModel]?
|
||||
@ -71,6 +73,7 @@ public class NavigationItemModel: NavigationItemModelProtocol {
|
||||
transparent = false
|
||||
backgroundColor = Color(uiColor: .white)
|
||||
tintColor = Color(uiColor: .black)
|
||||
line = LineModel(type: .standard)
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
@ -80,6 +83,7 @@ public class NavigationItemModel: NavigationItemModelProtocol {
|
||||
case backgroundColor
|
||||
case transparent
|
||||
case tintColor
|
||||
case line
|
||||
case systemBackButton
|
||||
case showLeftPanelButton
|
||||
case showRightPanelButton
|
||||
@ -95,6 +99,7 @@ public class NavigationItemModel: NavigationItemModelProtocol {
|
||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) ?? Color(uiColor: .white)
|
||||
transparent = try typeContainer.decodeIfPresent(Bool.self, forKey: .transparent) ?? false
|
||||
tintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .tintColor) ?? Color(uiColor: .black)
|
||||
line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line)
|
||||
systemBackButton = try typeContainer.decodeIfPresent(Bool.self, forKey: .systemBackButton) ?? false
|
||||
showLeftPanelButton = try typeContainer.decodeIfPresent(Bool.self, forKey: .showLeftPanelButton)
|
||||
showRightPanelButton = try typeContainer.decodeIfPresent(Bool.self, forKey: .showRightPanelButton)
|
||||
@ -110,7 +115,8 @@ public class NavigationItemModel: NavigationItemModelProtocol {
|
||||
try container.encode(backgroundColor, forKey: .backgroundColor)
|
||||
try container.encode(transparent, forKey: .transparent)
|
||||
try container.encode(tintColor, forKey: .tintColor)
|
||||
try container.encodeIfPresent(systemBackButton, forKey: .systemBackButton)
|
||||
try container.encodeIfPresent(line, forKey: .line)
|
||||
try container.encode(systemBackButton, forKey: .systemBackButton)
|
||||
try container.encode(showLeftPanelButton, forKey: .showLeftPanelButton)
|
||||
try container.encode(showRightPanelButton, forKey: .showRightPanelButton)
|
||||
try container.encodeIfPresent(additionalLeftItems, forKey: .additionalLeftItems)
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public protocol MoleculeDelegateProtocol {
|
||||
public protocol MoleculeDelegateProtocol: AnyObject {
|
||||
|
||||
/// returns a module for the corresponding module name.
|
||||
func getModuleWithName(_ name: String?) -> [AnyHashable : Any]?
|
||||
|
||||
@ -153,7 +153,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
|
||||
|
||||
open override func getIndexPath(for molecule: ListItemModelProtocol & MoleculeModelProtocol) -> IndexPath? {
|
||||
guard let index = moleculesInfo?.firstIndex(where: { (moleculeInfo) -> Bool in
|
||||
//TODO: cehck for molecule protocola eqality
|
||||
//TODO: check for molecule protocola eqaulity
|
||||
let json = moleculeInfo.molecule.toJSON()
|
||||
return json == molecule.toJSON()
|
||||
}) else { return nil }
|
||||
@ -183,7 +183,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
|
||||
|
||||
open override func removeMolecules(_ molecules: [ListItemModelProtocol & MoleculeModelProtocol], animation: UITableView.RowAnimation) {
|
||||
var indexPaths: [IndexPath] = []
|
||||
//TODO: cehck for molecule protocola eqality
|
||||
//TODO: check for molecule protocola equality
|
||||
|
||||
for molecule in molecules {
|
||||
if let removeIndex = moleculesInfo?.firstIndex(where: { molecule.toJSON() == $0.molecule.toJSON() }) {
|
||||
|
||||
@ -17,7 +17,7 @@ import Foundation
|
||||
public var pageType: String
|
||||
public var screenHeading: String?
|
||||
public var isAtomicTabs: Bool?
|
||||
public var navigationItem: NavigationItemModelProtocol?
|
||||
public var navigationItem: (NavigationItemModelProtocol & MoleculeModelProtocol)?
|
||||
|
||||
public init(pageType: String) {
|
||||
self.pageType = pageType
|
||||
|
||||
@ -18,7 +18,7 @@ import Foundation
|
||||
return Self.identifier
|
||||
}
|
||||
public var screenHeading: String?
|
||||
public var navigationItem: NavigationItemModelProtocol?
|
||||
public var navigationItem: (NavigationItemModelProtocol & MoleculeModelProtocol)?
|
||||
public var formRules: [FormGroupRule]?
|
||||
|
||||
public init(pageType: String) {
|
||||
|
||||
@ -18,7 +18,7 @@ import Foundation
|
||||
public var pageType: String
|
||||
public var screenHeading: String?
|
||||
public var isAtomicTabs: Bool?
|
||||
public var navigationItem: NavigationItemModelProtocol?
|
||||
public var navigationItem: (NavigationItemModelProtocol & MoleculeModelProtocol)?
|
||||
|
||||
public var header: MoleculeModelProtocol?
|
||||
public var middle: MoleculeModelProtocol?
|
||||
|
||||
@ -31,7 +31,7 @@ open class ProgrammaticScrollViewController: ScrollingViewController {
|
||||
|
||||
let scrollView = UIScrollView()
|
||||
scrollView.backgroundColor = .clear
|
||||
scrollView.translatesAutoresizingMaskIntoConstraints = true
|
||||
scrollView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(scrollView)
|
||||
|
||||
// Sets the constraints for the scroll view
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
@objc open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMCoreViewManagerViewControllerProtocol, MoleculeDelegateProtocol, FormHolderProtocol, MVMCoreActionDelegateProtocol, UITextFieldDelegate, UITextViewDelegate {
|
||||
@objc open class ViewController: UIViewController, MVMCoreViewControllerProtocol, MVMCoreViewManagerViewControllerProtocol, MoleculeDelegateProtocol, FormHolderProtocol, MVMCoreActionDelegateProtocol, UITextFieldDelegate, UITextViewDelegate, ObservingTextFieldDelegate {
|
||||
@objc public var pageType: String?
|
||||
@objc public var loadObject: MVMCoreLoadObject?
|
||||
public var pageModel: MVMControllerModelProtocol?
|
||||
@ -91,6 +91,14 @@ import UIKit
|
||||
try parsePageJSON()
|
||||
MVMCoreDispatchUtility.performBlock(onMainThread: {
|
||||
self.handleNewDataAndUpdateUI()
|
||||
// If the screen is showing, can update the navigation controller.
|
||||
if let navigationController = self.manager?.navigationController,
|
||||
self.manager!.getCurrentViewController() == self {
|
||||
self.set(navigationController: navigationController)
|
||||
} else if let navigationController = self.navigationController,
|
||||
self == MVMCoreUIUtility.getCurrentVisibleController() {
|
||||
self.set(navigationController: navigationController)
|
||||
}
|
||||
})
|
||||
} catch {
|
||||
if let coreError = MVMCoreErrorObject.createErrorObject(for: error, location: "updateJSON for pageType: \(String(describing: pageType))") {
|
||||
@ -153,20 +161,15 @@ import UIKit
|
||||
|
||||
/// Processes any new data. Called after the page is loaded the first time and on response updates for this page,
|
||||
open func handleNewData() {
|
||||
// Convert legacy to navigation model.
|
||||
if pageModel?.navigationItem == nil {
|
||||
let navigationModel = NavigationItemModel()
|
||||
if navigationModel.title == nil {
|
||||
navigationModel.title = pageModel?.screenHeading
|
||||
}
|
||||
if navigationModel.showLeftPanelButton == nil {
|
||||
navigationModel.showLeftPanelButton = isMasterInitiallyAccessible()
|
||||
}
|
||||
if navigationModel.showRightPanelButton == nil {
|
||||
navigationModel.showRightPanelButton = isSupportInitiallyAccessible()
|
||||
}
|
||||
pageModel?.navigationItem = navigationModel
|
||||
// TODO: remove legacy. Temporary, convert legacy to navigation model.
|
||||
var navigationModel = pageModel?.navigationItem ?? NavigationItemModel()
|
||||
navigationModel.title = pageModel?.screenHeading
|
||||
navigationModel.showLeftPanelButton = isMasterInitiallyAccessible()
|
||||
navigationModel.showRightPanelButton = isSupportInitiallyAccessible()
|
||||
if /*(self as? MVMCoreUITabBarPageControlViewController) != nil ||*/ manager != nil || loadObject?.requestParameters?.tabWasPressed ?? false == true {
|
||||
navigationModel.line = LineModel(type: .none)
|
||||
}
|
||||
pageModel?.navigationItem = navigationModel
|
||||
if self.formValidator == nil {
|
||||
let rules = pageModel?.formRules
|
||||
self.formValidator = FormValidator(rules)
|
||||
@ -180,30 +183,12 @@ import UIKit
|
||||
MVMCoreUISession.sharedGlobal()?.splitViewController?.parent?.setNeedsStatusBarAppearanceUpdate()
|
||||
return
|
||||
}
|
||||
navigationItem.title = navigationItemModel.title
|
||||
navigationItem.accessibilityLabel = navigationItemModel.title
|
||||
|
||||
navigationController.setNavigationBarHidden(navigationItemModel.hidden, animated: true)
|
||||
UIColor.setBackgroundColor(navigationItemModel.backgroundColor?.uiColor ?? .white, for: navigationController.navigationBar, isTransparent: navigationItemModel.transparent)
|
||||
|
||||
let tint = navigationItemModel.tintColor.uiColor
|
||||
navigationController.navigationBar.tintColor = tint
|
||||
|
||||
// Have the navigation title match the tint color
|
||||
navigationController.navigationBar.titleTextAttributes?.updateValue(tint, forKey: .foregroundColor)
|
||||
|
||||
// Update icons if main navigation controller.
|
||||
if navigationController == MVMCoreUISplitViewController.main()?.navigationController,
|
||||
MVMCoreUISplitViewController.main()?.getCurrentVisibleController() == self {
|
||||
navigationController.topViewController == self {
|
||||
MVMCoreUISession.sharedGlobal()?.splitViewController?.setupPanels()
|
||||
MVMCoreUISplitViewController.main()?.setLeftPanelIsAccessible(navigationItemModel.showLeftPanelButton ?? false, for: self)
|
||||
MVMCoreUISplitViewController.main()?.setRightPanelIsAccessible(navigationItemModel.showRightPanelButton ?? false, for: self)
|
||||
showBottomProgressBar()
|
||||
MVMCoreUISession.sharedGlobal()?.splitViewController?.setNavigationIconColor(tint)
|
||||
|
||||
// Update separator.
|
||||
MVMCoreUISession.sharedGlobal()?.navigationController?.separatorView?.isHidden = /*self is MVMCoreUITabBarPageControlViewController ||*/ manager != nil || loadObject?.requestParameters?.tabWasPressed ?? false == true
|
||||
showBottomProgressBar()
|
||||
}
|
||||
NavigationController.set(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: self)
|
||||
}
|
||||
|
||||
// Eventually will be moved to server
|
||||
|
||||
@ -39,4 +39,34 @@ import UIKit
|
||||
MVMCoreUISession.sharedGlobal()?.setup(asStandardLoadViewDelegate: navigationController)
|
||||
return navigationController
|
||||
}
|
||||
|
||||
public static func set(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: (UIViewController & MVMCoreViewControllerProtocol)) {
|
||||
viewController.navigationItem.title = navigationItemModel.title
|
||||
viewController.navigationItem.accessibilityLabel = navigationItemModel.title
|
||||
viewController.navigationItem.hidesBackButton = !navigationItemModel.systemBackButton
|
||||
|
||||
navigationController.setNavigationBarHidden(navigationItemModel.hidden, animated: true)
|
||||
UIColor.setBackgroundColor(navigationItemModel.backgroundColor?.uiColor ?? .white, for: navigationController.navigationBar, isTransparent: navigationItemModel.transparent)
|
||||
|
||||
let tint = navigationItemModel.tintColor.uiColor
|
||||
navigationController.navigationBar.tintColor = tint
|
||||
|
||||
// Have the navigation title match the tint color
|
||||
navigationController.navigationBar.titleTextAttributes?.updateValue(tint, forKey: .foregroundColor)
|
||||
|
||||
// Update icons if main navigation controller.
|
||||
if navigationController == MVMCoreUISession.sharedGlobal()?.navigationController,
|
||||
navigationController.topViewController == viewController {
|
||||
// Update line.
|
||||
MVMCoreUISession.sharedGlobal()?.navigationController?.separatorView?.set(with: navigationItemModel.line ?? LineModel(type: .standard), viewController.delegateObject?() as? MVMCoreUIDelegateObject, nil)
|
||||
}
|
||||
|
||||
if navigationController == MVMCoreUISplitViewController.main()?.navigationController,
|
||||
navigationController.topViewController == viewController {
|
||||
// Update Panels
|
||||
MVMCoreUISplitViewController.main()?.setLeftPanelIsAccessible(navigationItemModel.showLeftPanelButton ?? false, for: viewController)
|
||||
MVMCoreUISplitViewController.main()?.setRightPanelIsAccessible(navigationItemModel.showRightPanelButton ?? false, for: viewController)
|
||||
MVMCoreUISession.sharedGlobal()?.splitViewController?.setNavigationIconColor(tint)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ import MVMCore
|
||||
static var defaultGroupName: String = "default"
|
||||
var extraValidationBlock: (() -> Bool)?
|
||||
var formRules: [FormGroupRule]?
|
||||
var delegate: FormHolderProtocol?
|
||||
weak var delegate: FormHolderProtocol?
|
||||
var fieldMolecules: [String: FormFieldProtocol] = [:]
|
||||
var formActionMolecules: [FormActionFieldProtocol] = []
|
||||
var radioButtonsModelByGroup: [String: RadioButtonSelectionHelper] = [:]
|
||||
|
||||
@ -11,5 +11,5 @@ import Foundation
|
||||
public protocol PageModelProtocol {
|
||||
var pageType: String { get set }
|
||||
var screenHeading: String? { get set }
|
||||
var navigationItem: NavigationItemModelProtocol? { get set }
|
||||
var navigationItem: (NavigationItemModelProtocol & MoleculeModelProtocol)? { get set }
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ open class MVMCoreUIDelegateObject: DelegateObject {
|
||||
public weak var buttonDelegate: ButtonDelegateProtocol?
|
||||
public weak var uiTextFieldDelegate: UITextFieldDelegate?
|
||||
public weak var observingTextFieldDelegate: ObservingTextFieldDelegate?
|
||||
public var moleculeDelegate: MoleculeDelegateProtocol?
|
||||
public weak var moleculeDelegate: MoleculeDelegateProtocol?
|
||||
|
||||
open override func setAll(withDelegate delegate: Any) {
|
||||
super.setAll(withDelegate: delegate)
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
//
|
||||
// MVMCoreUICommonViewsUtility+Extension.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 3/23/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public extension MVMCoreUICommonViewsUtility {
|
||||
static func getToolbarWithDoneButton(delegate: ObservingTextFieldDelegate) -> UIToolbar {
|
||||
let toolbar = self.makeEmptyToolbar()
|
||||
let space = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
|
||||
let button = UIBarButtonItem(barButtonSystemItem: .done, target: delegate, action: #selector(ObservingTextFieldDelegate.dismissFieldInput(sender:)))
|
||||
button.tintColor = .black
|
||||
toolbar.setItems([space, button], animated: false)
|
||||
return toolbar
|
||||
}
|
||||
}
|
||||
@ -31,6 +31,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
// Returns the margins for a view.
|
||||
+ (UIEdgeInsets)getMarginsForView:(nullable UIView *)view;
|
||||
|
||||
/// Gets the current visible view controller. Checks presented view controllers first, and then it checks on the NavigationController in the session object.
|
||||
+ (UIViewController *)getCurrentVisibleController;
|
||||
|
||||
#pragma mark - Setters
|
||||
|
||||
+ (void)setMarginsForView:(nullable UIView *)view leading:(CGFloat)leading top:(CGFloat)top trailing:(CGFloat)trailing bottom:(CGFloat)bottom;
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
#import "MVMCoreUIConstants.h"
|
||||
#import "MVMCoreUISession.h"
|
||||
#import "MVMCoreUISplitViewController.h"
|
||||
#import <MVMCoreUI/MVMCoreUI-Swift.h>
|
||||
@import MVMCore.MVMCoreNavigationHandler;
|
||||
@import MVMCore.MVMCoreGetterUtility;
|
||||
|
||||
@ -60,6 +61,26 @@
|
||||
return UIEdgeInsetsMake(view.directionalLayoutMargins.top, view.directionalLayoutMargins.leading, view.directionalLayoutMargins.bottom, view.directionalLayoutMargins.trailing);
|
||||
}
|
||||
|
||||
+ (UIViewController *)getCurrentVisibleController {
|
||||
UIViewController *baseViewController = [MVMCoreNavigationHandler sharedNavigationHandler].viewControllerToPresentOn ?: [UIApplication sharedApplication].keyWindow.rootViewController;
|
||||
UIViewController *viewController = nil;
|
||||
while (baseViewController.presentedViewController && !baseViewController.presentedViewController.isBeingDismissed) {
|
||||
viewController = baseViewController.presentedViewController;
|
||||
baseViewController = viewController;
|
||||
}
|
||||
if ([viewController isKindOfClass:[UINavigationController class]]) {
|
||||
viewController = ((UINavigationController *)viewController).topViewController;
|
||||
}
|
||||
// if it is not presented viewcontroller, existing BAU logic will be working
|
||||
if (!viewController) {
|
||||
viewController = [MVMCoreUISession sharedGlobal].navigationController.topViewController;
|
||||
if ([viewController conformsToProtocol:@protocol(MVMCoreViewManagerProtocol)]) {
|
||||
viewController = [viewController performSelector:@selector(getCurrentViewController)];
|
||||
}
|
||||
}
|
||||
return viewController;
|
||||
}
|
||||
|
||||
#pragma mark - Setters
|
||||
|
||||
+ (void)setMarginsForView:(nullable UIView *)view leading:(CGFloat)leading top:(CGFloat)top trailing:(CGFloat)trailing bottom:(CGFloat)bottom {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user