diff --git a/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/BarsIndicatorView.swift b/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/BarsIndicatorView.swift index 2eefd716..4cff7bdb 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/BarsIndicatorView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/BarsIndicatorView.swift @@ -213,7 +213,9 @@ open class BarsIndicatorView: CarouselIndicator { let accessibleIndex = MVMCoreUIUtility.getOrdinalString(forIndex: NSNumber(value: index + 1)) else { return } - view.accessibilityLabel = String(format: accessibleValueFormat, accessibleIndex, numberOfPages) + let accessibilityValue = String(format: accessibleValueFormat, accessibleIndex, numberOfPages) + view.accessibilityLabel = accessibilityValue + view.accessibilityIdentifier = accessibilityValue } public override func assessTouchOf(_ touchPoint_X: CGFloat) { diff --git a/MVMCoreUI/Atomic/Organisms/Carousel/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel/Carousel.swift index 6b360120..cb618524 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel/Carousel.swift @@ -372,7 +372,9 @@ open class Carousel: View { self.carouselAccessibilityElement = carouselAccessibilityElement } - if let currentCell = collectionView.cellForItem(at: IndexPath(row: currentIndex, section: 0)) { + if let currentCell = collectionView.cellForItem(at: IndexPath(row: currentIndex, section: 0)), let pagingView = self.pagingView { + _accessibilityElements = [currentCell, carouselAccessibilityElement, pagingView] + } else if let currentCell = collectionView.cellForItem(at: IndexPath(row: currentIndex, section: 0)) { _accessibilityElements = [currentCell, carouselAccessibilityElement] } else { _accessibilityElements = [carouselAccessibilityElement] diff --git a/MVMCoreUI/BaseControllers/MFLoadingViewController.m b/MVMCoreUI/BaseControllers/MFLoadingViewController.m index 56ad6d3b..79565df2 100644 --- a/MVMCoreUI/BaseControllers/MFLoadingViewController.m +++ b/MVMCoreUI/BaseControllers/MFLoadingViewController.m @@ -12,11 +12,13 @@ #import "UIColor+MFConvenience.h" #import "MFStyler.h" #import "MVMCoreUICommonViewsUtility.h" +#import @interface MFLoadingViewController () @property (nullable, weak, nonatomic) MFLoadingSpinner *activityIndicator; @property (nullable, weak, nonatomic) UIView *transparentBackgroundView; +@property (nullable, weak, nonatomic) Label *indicatorText; @end @@ -27,23 +29,41 @@ view.backgroundColor = [UIColor clearColor]; self.view = view; + UIStackView *loadingStack = [[UIStackView alloc] initWithFrame:CGRectZero]; + loadingStack.axis = UILayoutConstraintAxisVertical; + loadingStack.alignment = UIStackViewAlignmentCenter; + loadingStack.spacing = 20; + // Sets up the loading view. MFLoadingSpinner *activityIndicatorView = [[MFLoadingSpinner alloc] initWithFrame:CGRectMake(0, 0, 36, 36)]; activityIndicatorView.backgroundColor = [UIColor clearColor]; activityIndicatorView.translatesAutoresizingMaskIntoConstraints = NO; - [view addSubview:activityIndicatorView]; self.activityIndicator = activityIndicatorView; self.activityIndicator.accessibilityIdentifier = @"Loader"; [activityIndicatorView pinWidthAndHeight]; + Label *infoLabel = [Label label]; + infoLabel.textAlignment = NSTextAlignmentCenter; + infoLabel.translatesAutoresizingMaskIntoConstraints = NO; + infoLabel.hidden = true; + self.indicatorText = infoLabel; + + [loadingStack addArrangedSubview:infoLabel]; + [loadingStack addArrangedSubview:activityIndicatorView]; + + loadingStack.translatesAutoresizingMaskIntoConstraints = NO; + [view addSubview:loadingStack]; // Sets the constraints for the activityIndicatorView - [NSLayoutConstraint constraintPinSubview:activityIndicatorView pinCenterX:YES pinCenterY:YES]; + + [NSLayoutConstraint constraintWithItem:infoLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil attribute:NSLayoutAttributeHeight multiplier:1.0 constant:1.0]; + [NSLayoutConstraint constraintPinSubview:loadingStack pinCenterX:YES pinCenterY:YES]; + [NSLayoutConstraint constraintPinSubview:loadingStack pinTop:NO topConstant:0 pinBottom:NO bottomConstant:0 pinLeft:YES leftConstant:0 pinRight:YES rightConstant:0]; // Sets up the transparent background view. UIView *transparentBackground = [MVMCoreUICommonViewsUtility commonView]; transparentBackground.backgroundColor = [UIColor mfBackgroundGray]; transparentBackground.alpha = 0.9; - [view insertSubview:transparentBackground belowSubview:activityIndicatorView]; + [view insertSubview:transparentBackground belowSubview:loadingStack]; self.transparentBackgroundView = transparentBackground; // Sets the constraints of the transparent background view to be the same as the activity indicator view. @@ -61,8 +81,24 @@ [self.activityIndicator resumeSpinner]; } +- (void)startLoadingWith:(nullable NSAttributedString *) text{ + if(text != nil){ + self.indicatorText.attributedText = text; + self.indicatorText.accessibilityLabel = text.string; + self.indicatorText.hidden = false; + } else { + self.indicatorText.attributedText = nil; + self.indicatorText.accessibilityLabel = @""; + self.indicatorText.hidden = true; + } + [self.activityIndicator resumeSpinner]; +} + - (void)stopLoading { [self.activityIndicator pauseSpinner]; + self.indicatorText.hidden = true; + self.indicatorText.attributedText = nil; + self.indicatorText.accessibilityLabel = @""; } @end diff --git a/MVMCoreUI/Styles/MFStyler.m b/MVMCoreUI/Styles/MFStyler.m index e65fddc5..c77e447d 100644 --- a/MVMCoreUI/Styles/MFStyler.m +++ b/MVMCoreUI/Styles/MFStyler.m @@ -17,7 +17,7 @@ #import CGFloat const PaddingDefault = 24; -CGFloat const PaddingDefaultHorizontalSpacing = 32; +CGFloat const PaddingDefaultHorizontalSpacing = 16; CGFloat const PaddingDefaultVerticalSpacing = 32; CGFloat const PaddingDefaultVerticalSpacing3 = 24; CGFloat const PaddingBetweenFields = 24;