Merge branch 'release/9_1_0' of https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui into bugfix/carousel_issues

* 'release/9_1_0' of https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui:
  error checks
  threading fix
  Revert "Merge branch 'bugfix/carousel_issues' into 'develop'"

# Conflicts:
#	MVMCoreUI/Atomic/Organisms/Carousel/Carousel.swift
This commit is contained in:
Tondapu, Alekhya 2021-07-23 13:10:08 +05:30
commit 64e11e8f7a
7 changed files with 21 additions and 19 deletions

View File

@ -88,14 +88,18 @@ import UIKit
} }
@objc public override func dismissFieldInput(_ sender: Any?) { @objc public override func dismissFieldInput(_ sender: Any?) {
performDropdownAction() if !textField.isFirstResponder {
performDropdownAction()
}
super.dismissFieldInput(sender) super.dismissFieldInput(sender)
} }
func performDropdownAction() { func performDropdownAction() {
if let baseDropdownEntryFieldModel = baseDropdownEntryFieldModel, let actionModel = baseDropdownEntryFieldModel.action { guard let baseDropdownEntryFieldModel = baseDropdownEntryFieldModel,
let additionalDataWithSource = additionalData.dictionaryAdding(key: KeySourceModel, value: baseDropdownEntryFieldModel) let actionModel = baseDropdownEntryFieldModel.action
MVMCoreActionHandler.shared()?.asyncHandleAction(with: actionModel, additionalData: additionalDataWithSource, delegateObject: delegateObject) else { return }
}
let additionalDataWithSource = additionalData.dictionaryAdding(key: KeySourceModel, value: baseDropdownEntryFieldModel)
MVMCoreActionHandler.shared()?.asyncHandleAction(with: actionModel, additionalData: additionalDataWithSource, delegateObject: delegateObject)
} }
} }

View File

@ -234,7 +234,6 @@ open class BarsIndicatorView: CarouselIndicator {
super.reset() super.reset()
barReferences.forEach { $0.removeFromSuperview() } barReferences.forEach { $0.removeFromSuperview() }
barReferences = [] barReferences = []
currentIndex = 0
} }
public override func updateUI(previousIndex: Int, newIndex: Int, totalCount: Int, isAnimated: Bool) { public override func updateUI(previousIndex: Int, newIndex: Int, totalCount: Int, isAnimated: Bool) {

View File

@ -248,10 +248,4 @@ open class CarouselIndicator: Control, CarouselPageControlProtocol {
bottomConstraint?.constant = constant bottomConstraint?.constant = constant
topConstraint?.constant = constant topConstraint?.constant = constant
} }
open override func reset() {
super.reset()
currentIndex = 0
previousIndex = 0
}
} }

View File

@ -41,7 +41,7 @@ open class Carousel: View {
open var numberOfPages = 0 open var numberOfPages = 0
/// The models for the molecules. /// The models for the molecules.
public var molecules: [MoleculeModelProtocol & CarouselItemModelProtocol & CollectionItemModelProtocol]? public var molecules: [MoleculeModelProtocol & CarouselItemModelProtocol]?
/// The horizontal alignment of the cell in the collection view. Only noticeable if the itemWidthPercent is less than 100%. /// The horizontal alignment of the cell in the collection view. Only noticeable if the itemWidthPercent is less than 100%.
public var itemAlignment = UICollectionView.ScrollPosition.left public var itemAlignment = UICollectionView.ScrollPosition.left
@ -177,7 +177,6 @@ open class Carousel: View {
if let selectedIndex = carouselModel.selectedIndex { if let selectedIndex = carouselModel.selectedIndex {
let adjustedIndex = loop ? selectedIndex + 2 : selectedIndex let adjustedIndex = loop ? selectedIndex + 2 : selectedIndex
collectionView.selectItem(at: IndexPath(row: adjustedIndex, section: 0), animated: false, scrollPosition: []) collectionView.selectItem(at: IndexPath(row: adjustedIndex, section: 0), animated: false, scrollPosition: [])
goTo(adjustedIndex, animated: false)
} }
} }

View File

@ -20,7 +20,7 @@ import UIKit
} }
public var backgroundColor: Color? public var backgroundColor: Color?
public var molecules: [MoleculeModelProtocol & CarouselItemModelProtocol & CollectionItemModelProtocol] public var molecules: [MoleculeModelProtocol & CarouselItemModelProtocol]
public var index: Int = 0 public var index: Int = 0
public var spacing: CGFloat? public var spacing: CGFloat?
public var border: Bool? public var border: Bool?
@ -41,7 +41,7 @@ import UIKit
public var selectable = false public var selectable = false
public var selectedIndex: Int? public var selectedIndex: Int?
public init(molecules: [MoleculeModelProtocol & CarouselItemModelProtocol & CollectionItemModelProtocol]) { public init(molecules: [MoleculeModelProtocol & CarouselItemModelProtocol]) {
self.molecules = molecules self.molecules = molecules
} }

View File

@ -1053,7 +1053,11 @@ CGFloat const PanelAnimationDuration = 0.2;
} }
+ (CGFloat)getApplicationViewWidth { + (CGFloat)getApplicationViewWidth {
return CGRectGetWidth([self getBounds:[MVMCoreUISession sharedGlobal].splitViewController.view.superview]); __block CGFloat width;
[MVMCoreDispatchUtility performSyncBlockOnMainThread:^{
width = CGRectGetWidth([self getBounds:[MVMCoreUISession sharedGlobal].splitViewController.view.superview]);
}];
return width;
} }
+ (CGFloat)getApplicationViewMaxSize { + (CGFloat)getApplicationViewMaxSize {

View File

@ -270,7 +270,9 @@ import UIKit
bottomBar?.frame = CGRect(x: 0, y: bounds.height - size, width: bounds.width, height: size) bottomBar?.frame = CGRect(x: 0, y: bounds.height - size, width: bounds.width, height: size)
if updateMoleculeLayout || heightChanged { if updateMoleculeLayout || heightChanged {
delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self) DispatchQueue.main.async { [self] in
delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self)
}
} }
setNeedsDisplay() setNeedsDisplay()