From 9278ad75ea8d1511e71a1b074d9bd81bfb0db250 Mon Sep 17 00:00:00 2001 From: panxi Date: Mon, 15 Apr 2019 14:50:45 -0400 Subject: [PATCH 01/12] add override status bar function --- .../MVMCoreUIDetailViewProtocol.h | 3 +++ .../MVMCoreUISplitViewController.h | 3 +++ .../MVMCoreUISplitViewController.m | 20 ++++++++++++++++++- MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h | 3 +++ MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m | 10 +++++++++- 5 files changed, 37 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUIDetailViewProtocol.h b/MVMCoreUI/Containers/SplitViewController/MVMCoreUIDetailViewProtocol.h index 0c5a865d..5eeafc9f 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUIDetailViewProtocol.h +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUIDetailViewProtocol.h @@ -30,6 +30,9 @@ NS_ASSUME_NONNULL_BEGIN // View Controller can override this method and do custom action instead of opening the left panel - (BOOL)isOverridingLeftButton; +//return desired status bar style based on different View Controller +- (UIStatusBarStyle)panelPreferredStatusBarStyle; + @end NS_ASSUME_NONNULL_END diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h index 2ef7fa25..88b61188 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h @@ -105,6 +105,9 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) { + (CGFloat)getApplicationViewWidth; + (CGFloat)getApplicationViewMaxSize; +// return subviewcontrollers' prefer status bar style +- (UIStatusBarStyle)getDefaultStatusBarStyle; + #pragma mark - Main Subclassables // Can subclass to set threshold for when the drawers are permanently extended. Default is 1000 for the left panel and 2000 for both. diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m index d70bdb6e..dd76cc92 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m @@ -877,7 +877,25 @@ CGFloat const PanelAnimationDuration = 0.2; } - (UIStatusBarStyle)preferredStatusBarStyle { - return self.topAlertView.statusBarStyle; + if (self.topAlertView.topAlertObject) { + return self.topAlertView.statusBarStyle; + } else { + UIStatusBarStyle style = [self getDefaultStatusBarStyle]; + if (self.topAlertView.statusBarStyle != style) { + [self.topAlertView resetStatusBar]; + } + return style; + } +} + +- (UIStatusBarStyle)getDefaultStatusBarStyle { + UIViewController *viewController = [self getCurrentDetailViewController]; + if ([viewController conformsToProtocol:@protocol(MVMCoreUIDetailViewProtocol)] + && [viewController respondsToSelector:@selector(panelPreferredStatusBarStyle)] + && [((UIViewController *)viewController) panelPreferredStatusBarStyle]) { + return [((UIViewController *)viewController) panelPreferredStatusBarStyle]; + } + return UIStatusBarStyleDefault; } #pragma mark - Getters diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h index 46d56cb6..f4de6d5b 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h @@ -41,6 +41,9 @@ - (void)expandStatusBarView; - (void)collapseStatusBarView; +//reset status bar color to default based on splitview +- (void)resetStatusBar; + // Can be subclassed for custom views. - (nonnull MVMCoreUITopAlertBaseView *)topAlertViewForTopAlertObject:(nullable MVMCoreTopAlertObject *)topAlertObject animationDelegate:(nonnull id )animationDelegate statusBarColor:(UIColor *_Nullable *_Nullable)statusBarColor; diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m index 735f28d9..a582638c 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m @@ -189,7 +189,6 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed."; [weakSelf.superview layoutIfNeeded]; } completion:^(BOOL finished) { [weakSelf.animationDelegate topAlertViewFinishAnimation]; - [weakSelf setStatusBarColor:[UIColor whiteColor] statusBarStyle:UIStatusBarStyleDefault]; UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil); UIView *view = weakSelf.currentAlert; @@ -204,6 +203,9 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed."; [operation markAsFinished]; completionHandler(finished); weakSelf.topAlertObject = nil; + [MVMCoreDispatchUtility performBlockOnMainThread:^{ + [weakSelf resetStatusBar]; + }]; }]; }]; }]; @@ -242,4 +244,10 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed."; }]; } +- (void)resetStatusBar { + UIStatusBarStyle style = [[MVMCoreUISplitViewController mainSplitViewController] getDefaultStatusBarStyle]; + UIColor *backgroundColor = style == UIStatusBarStyleDefault ? [UIColor whiteColor] : [UIColor blackColor]; + [self setStatusBarColor:backgroundColor statusBarStyle:style]; +} + @end From 89427b1b7ad6799df911b06f49455d1a54bc205a Mon Sep 17 00:00:00 2001 From: panxi Date: Tue, 16 Apr 2019 11:46:53 -0400 Subject: [PATCH 02/12] update code based on comments --- .../MVMCoreUIDetailViewProtocol.h | 3 ++- .../MVMCoreUISplitViewController.h | 1 + .../MVMCoreUISplitViewController.m | 20 ++++++++++++------ MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h | 2 +- MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m | 21 ++++++++++++++----- 5 files changed, 34 insertions(+), 13 deletions(-) diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUIDetailViewProtocol.h b/MVMCoreUI/Containers/SplitViewController/MVMCoreUIDetailViewProtocol.h index 5eeafc9f..acb56ad1 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUIDetailViewProtocol.h +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUIDetailViewProtocol.h @@ -31,7 +31,8 @@ NS_ASSUME_NONNULL_BEGIN - (BOOL)isOverridingLeftButton; //return desired status bar style based on different View Controller -- (UIStatusBarStyle)panelPreferredStatusBarStyle; +- (UIStatusBarStyle)defaultStatusBarStyle; +- (nullable UIColor *)defaultStatusBarBackgroundColor; @end diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h index 88b61188..0d4c9ea4 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h @@ -107,6 +107,7 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) { // return subviewcontrollers' prefer status bar style - (UIStatusBarStyle)getDefaultStatusBarStyle; +- (nullable UIColor *)getDefaultStatusBarBackgroundColor; #pragma mark - Main Subclassables diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m index dd76cc92..7f34de85 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m @@ -881,9 +881,7 @@ CGFloat const PanelAnimationDuration = 0.2; return self.topAlertView.statusBarStyle; } else { UIStatusBarStyle style = [self getDefaultStatusBarStyle]; - if (self.topAlertView.statusBarStyle != style) { - [self.topAlertView resetStatusBar]; - } + [self.topAlertView resetDefaultStatusBarStyle:style backgroundColor:[self getDefaultStatusBarBackgroundColor]]; return style; } } @@ -891,13 +889,23 @@ CGFloat const PanelAnimationDuration = 0.2; - (UIStatusBarStyle)getDefaultStatusBarStyle { UIViewController *viewController = [self getCurrentDetailViewController]; if ([viewController conformsToProtocol:@protocol(MVMCoreUIDetailViewProtocol)] - && [viewController respondsToSelector:@selector(panelPreferredStatusBarStyle)] - && [((UIViewController *)viewController) panelPreferredStatusBarStyle]) { - return [((UIViewController *)viewController) panelPreferredStatusBarStyle]; + && [viewController respondsToSelector:@selector(defaultStatusBarStyle)] + && [((UIViewController *)viewController) defaultStatusBarStyle]) { + return [((UIViewController *)viewController) defaultStatusBarStyle]; } return UIStatusBarStyleDefault; } +- (UIColor *)getDefaultStatusBarBackgroundColor { + UIViewController *viewController = [self getCurrentDetailViewController]; + if ([viewController conformsToProtocol:@protocol(MVMCoreUIDetailViewProtocol)] + && [viewController respondsToSelector:@selector(defaultStatusBarBackgroundColor)] + && [((UIViewController *)viewController) defaultStatusBarBackgroundColor]) { + return [((UIViewController *)viewController) defaultStatusBarBackgroundColor]; + } + return nil; +} + #pragma mark - Getters // Returns the desired view or falls back. Hot fix until we can get away from using these functions... diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h index f4de6d5b..ac5219b0 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h @@ -42,7 +42,7 @@ - (void)collapseStatusBarView; //reset status bar color to default based on splitview -- (void)resetStatusBar; +- (void)resetDefaultStatusBarStyle:(UIStatusBarStyle)style backgroundColor:(nullable UIColor *)backgroundColor; // Can be subclassed for custom views. - (nonnull MVMCoreUITopAlertBaseView *)topAlertViewForTopAlertObject:(nullable MVMCoreTopAlertObject *)topAlertObject animationDelegate:(nonnull id )animationDelegate statusBarColor:(UIColor *_Nullable *_Nullable)statusBarColor; diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m index a582638c..3d2fb626 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m @@ -46,6 +46,9 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed."; @property (weak, nonatomic) MVMCoreUITopAlertExpandableView *topAlertClearspotView; @property (strong, nonatomic) NSString *time; +@property (nonatomic, assign) UIStatusBarStyle defaultStatusBarStyle; +@property (nonatomic, strong) UIColor *defaultStatusBarBackgroundColor; + @end @implementation MVMCoreUITopAlertView @@ -204,7 +207,7 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed."; completionHandler(finished); weakSelf.topAlertObject = nil; [MVMCoreDispatchUtility performBlockOnMainThread:^{ - [weakSelf resetStatusBar]; + [weakSelf resetDefaultStatusBarStyle:weakSelf.defaultStatusBarStyle backgroundColor:weakSelf.defaultStatusBarBackgroundColor]; }]; }]; }]; @@ -244,10 +247,18 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed."; }]; } -- (void)resetStatusBar { - UIStatusBarStyle style = [[MVMCoreUISplitViewController mainSplitViewController] getDefaultStatusBarStyle]; - UIColor *backgroundColor = style == UIStatusBarStyleDefault ? [UIColor whiteColor] : [UIColor blackColor]; - [self setStatusBarColor:backgroundColor statusBarStyle:style]; +- (void)resetDefaultStatusBarStyle:(UIStatusBarStyle)style backgroundColor:(UIColor *)backgroundColor { + self.defaultStatusBarStyle = style; + self.defaultStatusBarBackgroundColor = backgroundColor; + if (!backgroundColor) { + self.defaultStatusBarBackgroundColor = style == UIStatusBarStyleDefault ? [UIColor whiteColor] : [UIColor blackColor]; + } + if (!self.topAlertObject) { + //style or color doens't match the current default value + if (style != self.statusBarStyle || !CGColorEqualToColor(self.defaultStatusBarBackgroundColor.CGColor, self.statusBarView.backgroundColor.CGColor)) { + [self setStatusBarColor:self.defaultStatusBarBackgroundColor statusBarStyle:style]; + } + } } @end From 1b5d423659c0cfd9d0ae81bd89d522f458f83822 Mon Sep 17 00:00:00 2001 From: panxi Date: Tue, 16 Apr 2019 14:49:24 -0400 Subject: [PATCH 03/12] remove local default status bar style --- MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m index 3d2fb626..6753e67c 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m @@ -46,9 +46,6 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed."; @property (weak, nonatomic) MVMCoreUITopAlertExpandableView *topAlertClearspotView; @property (strong, nonatomic) NSString *time; -@property (nonatomic, assign) UIStatusBarStyle defaultStatusBarStyle; -@property (nonatomic, strong) UIColor *defaultStatusBarBackgroundColor; - @end @implementation MVMCoreUITopAlertView @@ -207,7 +204,8 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed."; completionHandler(finished); weakSelf.topAlertObject = nil; [MVMCoreDispatchUtility performBlockOnMainThread:^{ - [weakSelf resetDefaultStatusBarStyle:weakSelf.defaultStatusBarStyle backgroundColor:weakSelf.defaultStatusBarBackgroundColor]; + MVMCoreUISplitViewController *mainsplit = [MVMCoreUISplitViewController mainSplitViewController]; + [weakSelf resetDefaultStatusBarStyle:[mainsplit getDefaultStatusBarStyle] backgroundColor:[mainsplit getDefaultStatusBarBackgroundColor]]; }]; }]; }]; @@ -248,15 +246,14 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed."; } - (void)resetDefaultStatusBarStyle:(UIStatusBarStyle)style backgroundColor:(UIColor *)backgroundColor { - self.defaultStatusBarStyle = style; - self.defaultStatusBarBackgroundColor = backgroundColor; - if (!backgroundColor) { - self.defaultStatusBarBackgroundColor = style == UIStatusBarStyleDefault ? [UIColor whiteColor] : [UIColor blackColor]; + UIColor *defaultStatusBarBackgroundColor = backgroundColor; + if (!defaultStatusBarBackgroundColor) { + defaultStatusBarBackgroundColor = style == UIStatusBarStyleDefault ? [UIColor whiteColor] : [UIColor blackColor]; } if (!self.topAlertObject) { //style or color doens't match the current default value - if (style != self.statusBarStyle || !CGColorEqualToColor(self.defaultStatusBarBackgroundColor.CGColor, self.statusBarView.backgroundColor.CGColor)) { - [self setStatusBarColor:self.defaultStatusBarBackgroundColor statusBarStyle:style]; + if (style != self.statusBarStyle || !CGColorEqualToColor(defaultStatusBarBackgroundColor.CGColor, self.statusBarView.backgroundColor.CGColor)) { + [self setStatusBarColor:defaultStatusBarBackgroundColor statusBarStyle:style]; } } } From 76506a51b51c961be17c342a73e0c5a534ee1ddd Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Tue, 16 Apr 2019 15:33:34 -0400 Subject: [PATCH 04/12] ONVIK-14895 --- MVMCoreUI/Atoms/TextFields/MFTextField.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atoms/TextFields/MFTextField.m b/MVMCoreUI/Atoms/TextFields/MFTextField.m index 565e086c..fb157764 100644 --- a/MVMCoreUI/Atoms/TextFields/MFTextField.m +++ b/MVMCoreUI/Atoms/TextFields/MFTextField.m @@ -561,7 +561,7 @@ - (void)setWithJSON:(NSDictionary *)json delegate:(nullable id)delegate additionalData:(NSDictionary *)additionalData { [FormValidator setupValidationWithMolecule:self delegate:(id)delegate]; FormValidator *formValidator = [FormValidator getFormValidatorForDelegate:(id)delegate]; - [self setWithMap:json bothDelegates:formValidator]; + [self setWithMap:json bothDelegates: formValidator ?: delegate ]; } #pragma mark - FormValidationProtocol From 3655b4af8d7ae3c6f2c29b14074891b6ffb096fc Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Tue, 16 Apr 2019 15:51:15 -0400 Subject: [PATCH 05/12] remove space --- MVMCoreUI/Atoms/TextFields/MFTextField.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atoms/TextFields/MFTextField.m b/MVMCoreUI/Atoms/TextFields/MFTextField.m index fb157764..fa5a1506 100644 --- a/MVMCoreUI/Atoms/TextFields/MFTextField.m +++ b/MVMCoreUI/Atoms/TextFields/MFTextField.m @@ -561,7 +561,7 @@ - (void)setWithJSON:(NSDictionary *)json delegate:(nullable id)delegate additionalData:(NSDictionary *)additionalData { [FormValidator setupValidationWithMolecule:self delegate:(id)delegate]; FormValidator *formValidator = [FormValidator getFormValidatorForDelegate:(id)delegate]; - [self setWithMap:json bothDelegates: formValidator ?: delegate ]; + [self setWithMap:json bothDelegates:formValidator ?: delegate]; } #pragma mark - FormValidationProtocol From 53502a40c103cad5df8a2d1553ed4c4417acfc59 Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Wed, 17 Apr 2019 10:59:16 -0400 Subject: [PATCH 06/12] merge --- MVMCoreUI/Atoms/TextFields/MFTextField.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atoms/TextFields/MFTextField.m b/MVMCoreUI/Atoms/TextFields/MFTextField.m index 6fb728b2..065c1439 100644 --- a/MVMCoreUI/Atoms/TextFields/MFTextField.m +++ b/MVMCoreUI/Atoms/TextFields/MFTextField.m @@ -116,7 +116,7 @@ + (nullable instancetype)mfTextFieldWithMap:(nullable NSDictionary *)map bothDelegates:(nullable id)delegate { MFTextField *textField = [self mfTextField]; textField.translatesAutoresizingMaskIntoConstraints = NO; - [textField setWithJSON:map delegateObject:[MVMCoreUIDelegateObject createWithDelegateForAll:delegate] additionalData:nil]; + [textField setWithMap:map bothDelegates:delegate]; return textField; } @@ -562,7 +562,7 @@ if ([delegateObject isKindOfClass:[MVMCoreUIDelegateObject class]]) { [FormValidator setupValidationWithMolecule:self delegate:((MVMCoreUIDelegateObject *)delegateObject).formValidationProtocol]; FormValidator *formValidator = [FormValidator getFormValidatorForDelegate:((MVMCoreUIDelegateObject *)delegateObject).formValidationProtocol]; - [self setWithMap:json bothDelegates:formValidator ?: delegate]; + [self setWithMap:json bothDelegates:formValidator]; } } From a254e7d88286075ff8293eee6b135ac4fbe4b190 Mon Sep 17 00:00:00 2001 From: panxi Date: Wed, 17 Apr 2019 11:17:44 -0400 Subject: [PATCH 07/12] only change the status bar background color --- MVMCoreUI/BaseControllers/MFScrollingViewController.m | 2 +- .../MVMCoreUISplitViewController.m | 2 +- MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h | 4 ++-- MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m | 11 +++++------ 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/MVMCoreUI/BaseControllers/MFScrollingViewController.m b/MVMCoreUI/BaseControllers/MFScrollingViewController.m index f6e2c4d3..5486b54a 100644 --- a/MVMCoreUI/BaseControllers/MFScrollingViewController.m +++ b/MVMCoreUI/BaseControllers/MFScrollingViewController.m @@ -93,7 +93,7 @@ static NSTimeInterval const HandScrollAnimationTiming = 7.f; BOOL automaticInset = NO; if (@available(iOS 11.0, *)) { - automaticInset = self.scrollView.contentInsetAdjustmentBehavior == UIScrollViewContentInsetAdjustmentAutomatic; + automaticInset = self.navigationController && self.scrollView.contentInsetAdjustmentBehavior == UIScrollViewContentInsetAdjustmentAutomatic; } // Takes into account the navigation bar. diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m index 7f34de85..5509ca33 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m @@ -881,7 +881,7 @@ CGFloat const PanelAnimationDuration = 0.2; return self.topAlertView.statusBarStyle; } else { UIStatusBarStyle style = [self getDefaultStatusBarStyle]; - [self.topAlertView resetDefaultStatusBarStyle:style backgroundColor:[self getDefaultStatusBarBackgroundColor]]; + [self.topAlertView resetDefaultBackgroundColor:[self getDefaultStatusBarBackgroundColor] basedOnStatusBarStyle:[self getDefaultStatusBarStyle]]; return style; } } diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h index ac5219b0..04f8bc73 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h @@ -41,8 +41,8 @@ - (void)expandStatusBarView; - (void)collapseStatusBarView; -//reset status bar color to default based on splitview -- (void)resetDefaultStatusBarStyle:(UIStatusBarStyle)style backgroundColor:(nullable UIColor *)backgroundColor; +//reset status bar background color based on style +- (void)resetDefaultBackgroundColor:(nullable UIColor *)backgroundColor basedOnStatusBarStyle:(UIStatusBarStyle)style; // Can be subclassed for custom views. - (nonnull MVMCoreUITopAlertBaseView *)topAlertViewForTopAlertObject:(nullable MVMCoreTopAlertObject *)topAlertObject animationDelegate:(nonnull id )animationDelegate statusBarColor:(UIColor *_Nullable *_Nullable)statusBarColor; diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m index 6753e67c..0b1045a6 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m @@ -204,8 +204,7 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed."; completionHandler(finished); weakSelf.topAlertObject = nil; [MVMCoreDispatchUtility performBlockOnMainThread:^{ - MVMCoreUISplitViewController *mainsplit = [MVMCoreUISplitViewController mainSplitViewController]; - [weakSelf resetDefaultStatusBarStyle:[mainsplit getDefaultStatusBarStyle] backgroundColor:[mainsplit getDefaultStatusBarBackgroundColor]]; + [weakSelf setStatusBarColor:[UIColor whiteColor] statusBarStyle:UIStatusBarStyleDefault]; }]; }]; }]; @@ -245,15 +244,15 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed."; }]; } -- (void)resetDefaultStatusBarStyle:(UIStatusBarStyle)style backgroundColor:(UIColor *)backgroundColor { +- (void)resetDefaultBackgroundColor:(UIColor *)backgroundColor basedOnStatusBarStyle:(UIStatusBarStyle)style { UIColor *defaultStatusBarBackgroundColor = backgroundColor; if (!defaultStatusBarBackgroundColor) { defaultStatusBarBackgroundColor = style == UIStatusBarStyleDefault ? [UIColor whiteColor] : [UIColor blackColor]; } if (!self.topAlertObject) { - //style or color doens't match the current default value - if (style != self.statusBarStyle || !CGColorEqualToColor(defaultStatusBarBackgroundColor.CGColor, self.statusBarView.backgroundColor.CGColor)) { - [self setStatusBarColor:defaultStatusBarBackgroundColor statusBarStyle:style]; + //color doens't match the current default value + if (!CGColorEqualToColor(defaultStatusBarBackgroundColor.CGColor, self.statusBarView.backgroundColor.CGColor)) { + self.statusBarView.backgroundColor = defaultStatusBarBackgroundColor; } } } From 935b32ed6d01a6815cfd89b2fbc524ff007b27b1 Mon Sep 17 00:00:00 2001 From: panxi Date: Wed, 17 Apr 2019 12:37:02 -0400 Subject: [PATCH 08/12] update status bar for presented view controller --- MVMCoreUI/BaseControllers/MFViewController.m | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/MVMCoreUI/BaseControllers/MFViewController.m b/MVMCoreUI/BaseControllers/MFViewController.m index c378391a..0c3b3f3d 100644 --- a/MVMCoreUI/BaseControllers/MFViewController.m +++ b/MVMCoreUI/BaseControllers/MFViewController.m @@ -308,6 +308,8 @@ || self.manager || self.loadObject.requestParameters.tabWasPressed); } + } else { + [[MVMCoreUISession sharedGlobal].splitViewController.parentViewController setNeedsStatusBarAppearanceUpdate]; } } @@ -498,6 +500,15 @@ } } +//this method is needed for getting status bar style from present viewcotnroller +- (UIStatusBarStyle)preferredStatusBarStyle { + if ([self respondsToSelector:@selector(defaultStatusBarStyle)]) { + return [self defaultStatusBarStyle]; + } else { + return UIStatusBarStyleDefault; + } +} + - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; From f35b31b5b31648c5fed45f8bae51a1a95be63b4b Mon Sep 17 00:00:00 2001 From: "Robinson, Blake" Date: Wed, 17 Apr 2019 13:45:20 -0400 Subject: [PATCH 09/12] Makes a property public to allow for adding padding to the button accessory view --- .../LegacyControllers/TopLabelsAndBottomButtonsViewController.h | 1 + .../LegacyControllers/TopLabelsAndBottomButtonsViewController.m | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/LegacyControllers/TopLabelsAndBottomButtonsViewController.h b/MVMCoreUI/LegacyControllers/TopLabelsAndBottomButtonsViewController.h index 7d15d543..c59918ea 100644 --- a/MVMCoreUI/LegacyControllers/TopLabelsAndBottomButtonsViewController.h +++ b/MVMCoreUI/LegacyControllers/TopLabelsAndBottomButtonsViewController.h @@ -24,6 +24,7 @@ @property (nullable, weak, nonatomic) UIView *viewInScroll; @property (nullable, weak, nonatomic) UIView *viewOutOfScroll; @property (nullable, strong, nonatomic) UIView *safeAreaView; +@property (nullable, weak, nonatomic) ViewConstrainingView *bottomAccessoryView; // Set to overwrite which view is the top edge and/or bottom edge of the between view. must be added to the ui and constrained before buildViewsBetweenLabelsAndButtons. // Use these to create views that are pinned near the labels or buttons and are separate from any centered content. Add and set in buildInAdditionalViewsBeforeCenteredContent. diff --git a/MVMCoreUI/LegacyControllers/TopLabelsAndBottomButtonsViewController.m b/MVMCoreUI/LegacyControllers/TopLabelsAndBottomButtonsViewController.m index be14e149..03679f2f 100644 --- a/MVMCoreUI/LegacyControllers/TopLabelsAndBottomButtonsViewController.m +++ b/MVMCoreUI/LegacyControllers/TopLabelsAndBottomButtonsViewController.m @@ -30,7 +30,6 @@ @property (nullable, weak, nonatomic) NSArray *middleViews; @property (nullable, weak, nonatomic) UIView *betweenView; -@property (nullable, weak, nonatomic) ViewConstrainingView *bottomAccessoryView; // Adds the button view to the screen. Out of the scroll or in. - (void)addViewOutsideOfScrollView:(UIView *)bottomView; From 786d517517d478a780f3efb43e48c0e210f8d71a Mon Sep 17 00:00:00 2001 From: panxi Date: Wed, 17 Apr 2019 15:08:18 -0400 Subject: [PATCH 10/12] update comments --- MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h | 2 +- MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h index 04f8bc73..5f49eb13 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h @@ -41,7 +41,7 @@ - (void)expandStatusBarView; - (void)collapseStatusBarView; -//reset status bar background color based on style +/// reset status bar background color, when backgroundColor is nil corresponding background color will be set based on style - (void)resetDefaultBackgroundColor:(nullable UIColor *)backgroundColor basedOnStatusBarStyle:(UIStatusBarStyle)style; // Can be subclassed for custom views. diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m index 0b1045a6..02fb2ac6 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m @@ -250,7 +250,7 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed."; defaultStatusBarBackgroundColor = style == UIStatusBarStyleDefault ? [UIColor whiteColor] : [UIColor blackColor]; } if (!self.topAlertObject) { - //color doens't match the current default value + //color doesn't match the current default value if (!CGColorEqualToColor(defaultStatusBarBackgroundColor.CGColor, self.statusBarView.backgroundColor.CGColor)) { self.statusBarView.backgroundColor = defaultStatusBarBackgroundColor; } From 575721589a9f4856c91684539edaff6b329c0c37 Mon Sep 17 00:00:00 2001 From: panxi Date: Wed, 17 Apr 2019 15:13:54 -0400 Subject: [PATCH 11/12] add missing style --- .../SplitViewController/MVMCoreUISplitViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m index 5509ca33..bdfd6ecd 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m @@ -881,7 +881,7 @@ CGFloat const PanelAnimationDuration = 0.2; return self.topAlertView.statusBarStyle; } else { UIStatusBarStyle style = [self getDefaultStatusBarStyle]; - [self.topAlertView resetDefaultBackgroundColor:[self getDefaultStatusBarBackgroundColor] basedOnStatusBarStyle:[self getDefaultStatusBarStyle]]; + [self.topAlertView resetDefaultBackgroundColor:[self getDefaultStatusBarBackgroundColor] basedOnStatusBarStyle:style]; return style; } } From e59adf7e470c300b0ddc5ba128bd8f0fe7aa2585 Mon Sep 17 00:00:00 2001 From: panxi Date: Wed, 17 Apr 2019 15:20:56 -0400 Subject: [PATCH 12/12] change order of code --- MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m index 02fb2ac6..b65f7423 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m @@ -245,11 +245,12 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed."; } - (void)resetDefaultBackgroundColor:(UIColor *)backgroundColor basedOnStatusBarStyle:(UIStatusBarStyle)style { - UIColor *defaultStatusBarBackgroundColor = backgroundColor; - if (!defaultStatusBarBackgroundColor) { - defaultStatusBarBackgroundColor = style == UIStatusBarStyleDefault ? [UIColor whiteColor] : [UIColor blackColor]; - } if (!self.topAlertObject) { + UIColor *defaultStatusBarBackgroundColor = backgroundColor; + if (!defaultStatusBarBackgroundColor) { + defaultStatusBarBackgroundColor = style == UIStatusBarStyleDefault ? [UIColor whiteColor] : [UIColor blackColor]; + } + //color doesn't match the current default value if (!CGColorEqualToColor(defaultStatusBarBackgroundColor.CGColor, self.statusBarView.backgroundColor.CGColor)) { self.statusBarView.backgroundColor = defaultStatusBarBackgroundColor;