From 939ee1ec7abba49a8425a57f88fb4e611218e3be Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Fri, 15 Sep 2023 15:44:42 +0530 Subject: [PATCH 1/6] Adding option to show a label to loading overlay --- .../BaseControllers/MFLoadingViewController.m | 33 +++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/BaseControllers/MFLoadingViewController.m b/MVMCoreUI/BaseControllers/MFLoadingViewController.m index 56ad6d3b..567790aa 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,40 @@ 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 commonLabelH3:YES]; + infoLabel.textAlignment = NSTextAlignmentCenter; + infoLabel.translatesAutoresizingMaskIntoConstraints = NO; + self.indicatorText = infoLabel; + + [loadingStack addArrangedSubview:activityIndicatorView]; + [loadingStack addArrangedSubview:infoLabel]; + + 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,6 +80,14 @@ [self.activityIndicator resumeSpinner]; } +- (void)startLoadingWith:(nullable NSString *) text{ + if([text length] != 0){ + self.indicatorText.text = text; + self.indicatorText.accessibilityLabel = text; + } + [self.activityIndicator resumeSpinner]; +} + - (void)stopLoading { [self.activityIndicator pauseSpinner]; } From 20a4a2c87be4cf897d2f95d62f2adc9c811d4aa1 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Tue, 17 Oct 2023 14:57:25 +0530 Subject: [PATCH 2/6] Moving progress indicator below the text in the loading overlay screen --- MVMCoreUI/BaseControllers/MFLoadingViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/BaseControllers/MFLoadingViewController.m b/MVMCoreUI/BaseControllers/MFLoadingViewController.m index 567790aa..e573fcd8 100644 --- a/MVMCoreUI/BaseControllers/MFLoadingViewController.m +++ b/MVMCoreUI/BaseControllers/MFLoadingViewController.m @@ -47,8 +47,8 @@ infoLabel.translatesAutoresizingMaskIntoConstraints = NO; self.indicatorText = infoLabel; - [loadingStack addArrangedSubview:activityIndicatorView]; [loadingStack addArrangedSubview:infoLabel]; + [loadingStack addArrangedSubview:activityIndicatorView]; loadingStack.translatesAutoresizingMaskIntoConstraints = NO; [view addSubview:loadingStack]; From 0a42ebb032ccad02ab34f1211e3225a6a0f756f3 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Tue, 17 Oct 2023 20:14:19 +0530 Subject: [PATCH 3/6] Setting empty string to the text in the loading overlay --- MVMCoreUI/BaseControllers/MFLoadingViewController.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/BaseControllers/MFLoadingViewController.m b/MVMCoreUI/BaseControllers/MFLoadingViewController.m index e573fcd8..a2edee05 100644 --- a/MVMCoreUI/BaseControllers/MFLoadingViewController.m +++ b/MVMCoreUI/BaseControllers/MFLoadingViewController.m @@ -81,9 +81,12 @@ } - (void)startLoadingWith:(nullable NSString *) text{ - if([text length] != 0){ + if(text != nil){ self.indicatorText.text = text; self.indicatorText.accessibilityLabel = text; + } else { + self.indicatorText.text = @""; + self.indicatorText.accessibilityLabel = @""; } [self.activityIndicator resumeSpinner]; } From fdaa932c3b89812e96f28491e4268895d42f9403 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Thu, 19 Oct 2023 16:58:07 +0530 Subject: [PATCH 4/6] Enabling the loading overlay info text to take attributed string. --- MVMCoreUI/BaseControllers/MFLoadingViewController.m | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/MVMCoreUI/BaseControllers/MFLoadingViewController.m b/MVMCoreUI/BaseControllers/MFLoadingViewController.m index a2edee05..fb7dd8f8 100644 --- a/MVMCoreUI/BaseControllers/MFLoadingViewController.m +++ b/MVMCoreUI/BaseControllers/MFLoadingViewController.m @@ -42,7 +42,7 @@ self.activityIndicator.accessibilityIdentifier = @"Loader"; [activityIndicatorView pinWidthAndHeight]; - Label *infoLabel = [Label commonLabelH3:YES]; + Label *infoLabel = [Label label]; infoLabel.textAlignment = NSTextAlignmentCenter; infoLabel.translatesAutoresizingMaskIntoConstraints = NO; self.indicatorText = infoLabel; @@ -80,12 +80,12 @@ [self.activityIndicator resumeSpinner]; } -- (void)startLoadingWith:(nullable NSString *) text{ +- (void)startLoadingWith:(nullable NSAttributedString *) text{ if(text != nil){ - self.indicatorText.text = text; - self.indicatorText.accessibilityLabel = text; + self.indicatorText.attributedText = text; + self.indicatorText.accessibilityLabel = text.string; } else { - self.indicatorText.text = @""; + self.indicatorText.attributedText = nil; self.indicatorText.accessibilityLabel = @""; } [self.activityIndicator resumeSpinner]; From 9be7fef53c2ae991c19bba1d8e97caf127e25182 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Tue, 31 Oct 2023 22:51:39 +0530 Subject: [PATCH 5/6] Showing/Hiding the text while starting/pausing the loading overlay --- MVMCoreUI/BaseControllers/MFLoadingViewController.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MVMCoreUI/BaseControllers/MFLoadingViewController.m b/MVMCoreUI/BaseControllers/MFLoadingViewController.m index fb7dd8f8..79565df2 100644 --- a/MVMCoreUI/BaseControllers/MFLoadingViewController.m +++ b/MVMCoreUI/BaseControllers/MFLoadingViewController.m @@ -45,6 +45,7 @@ Label *infoLabel = [Label label]; infoLabel.textAlignment = NSTextAlignmentCenter; infoLabel.translatesAutoresizingMaskIntoConstraints = NO; + infoLabel.hidden = true; self.indicatorText = infoLabel; [loadingStack addArrangedSubview:infoLabel]; @@ -84,15 +85,20 @@ 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 From 848defaf39804b5a7152776205f6fe18e85b5619 Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Wed, 1 Nov 2023 12:33:03 -0400 Subject: [PATCH 6/6] 32 -> 16 horizontal margin --- MVMCoreUI/Styles/MFStyler.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;