Merge branch 'mbruce/bugfix' into 'develop'

Bug fixes

See merge request BPHV_MIPS/vds_ios!298
This commit is contained in:
Bruce, Matt R 2024-08-27 20:28:14 +00:00
commit 973c45adbd
5 changed files with 31 additions and 13 deletions

View File

@ -1593,7 +1593,7 @@
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 72;
CURRENT_PROJECT_VERSION = 73;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
@ -1631,7 +1631,7 @@
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 72;
CURRENT_PROJECT_VERSION = 73;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;

View File

@ -87,9 +87,6 @@ open class SelectorBase: Control, SelectorControlable, ParentViewProtocol {
open var selectorColorConfiguration = ControlColorConfiguration() { didSet { setNeedsUpdate() } }
/// The natural size for the receiving view, considering only properties of the view itself.
open override var intrinsicContentSize: CGSize { size }
//--------------------------------------------------
// MARK: - Private Properties
//--------------------------------------------------
@ -109,6 +106,16 @@ open class SelectorBase: Control, SelectorControlable, ParentViewProtocol {
super.setup()
isAccessibilityElement = true
accessibilityTraits = .button
let layoutGuide = UILayoutGuide()
addLayoutGuide(layoutGuide)
layoutGuide
.pinTop(0)
.pinLeading(0)
.pinTrailing(0, .defaultHigh)
.pinBottom(0, .defaultHigh)
.width(size.width)
.height(size.height)
}
open override func setDefaults() {

View File

@ -272,6 +272,7 @@ open class Carousel: View {
super.updateView()
updateScrollbar()
updateCarousel()
collectionView.collectionViewLayout.invalidateLayout()
collectionView.reloadData()
}
@ -516,10 +517,15 @@ extension Carousel: UICollectionViewDelegate, UICollectionViewDataSource, UIColl
public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: CarouselSlotCell.identifier, for: indexPath) as? CarouselSlotCell else { return UICollectionViewCell() }
cell.contentView.subviews.forEach { $0.removeFromSuperview() }
let component = views[indexPath.row]
cell.update(with: component, slotAlignment: slotAlignment, surface: surface)
cell.layoutIfNeeded()
//component.setNeedsLayout()
if hasDebugBorder {
cell.addDebugBorder()
} else {
cell.removeDebugBorder()
}
return cell
}

View File

@ -25,11 +25,6 @@ final class CarouselSlotCell: UICollectionViewCell {
super.init(coder: coder)
setUp()
}
//--------------------------------------------------
// MARK: - Private Properties
//--------------------------------------------------
private var surface: Surface = .light
//--------------------------------------------------
// MARK: - Private Methods
@ -42,7 +37,7 @@ final class CarouselSlotCell: UICollectionViewCell {
/// Updating UI based on data along with surface.
func update(with component: UIView, slotAlignment: Carousel.CarouselSlotAlignmentModel?, surface: Surface) {
self.surface = surface
contentView.subviews.forEach { $0.removeFromSuperview() }
contentView.addSubview(component)
if var surfacedView = component as? Surfaceable {
surfacedView.surface = surface

View File

@ -18,6 +18,8 @@ open class Pagination: View {
//--------------------------------------------------
// MARK: - Private Properties
//--------------------------------------------------
private let pageChangedSubject = PassthroughSubject<Pagination, Never>()
///Maximum component width
private let maxWidth: CGFloat = 288.0
///Collectionview width anchor
@ -52,6 +54,8 @@ open class Pagination: View {
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
public var pageChangedPublisher: AnyPublisher<Pagination, Never> { pageChangedSubject.eraseToAnyPublisher() }
///Previous button to select previous page
public let previousButton: PaginationButton = .init(type: .previous)
///Next button to select next page
@ -145,6 +149,11 @@ open class Pagination: View {
.sink { [weak self] value in
self?.collectionViewWidthAnchor?.constant = value //As cell width is dynamic i.e cell may contain 2 or 3 or 4 charcters. Make sure that all the visible cells are displayed.
}.store(in: &subscribers)
pageChangedPublisher.sink { [weak self] control in
guard let self else { return }
onPageDidSelect?(control.selectedPage)
}.store(in: &subscribers)
}
open override func setDefaults() {
@ -195,6 +204,7 @@ open class Pagination: View {
let isNextAction = sender == nextButton
_selectedPageIndex = if isNextAction { _selectedPageIndex + 1 } else { _selectedPageIndex - 1 }
updateSelection()
pageChangedSubject.send(self)
DispatchQueue.main.asyncAfter(deadline: .now() + 1) { [weak self] in
guard let self else { return }
UIAccessibility.post(notification: .announcement, argument: paginationDescription)
@ -249,7 +259,7 @@ extension Pagination: UICollectionViewDelegate, UICollectionViewDataSource, UICo
guard _selectedPageIndex != indexPath.row else { return }
_selectedPageIndex = indexPath.row
updateSelection()
onPageDidSelect?(selectedPage)
pageChangedSubject.send(self)
}
}