Merge branch 'develop' into feature/delegate_object

This commit is contained in:
Christiano, Kevin 2019-04-18 09:32:44 -04:00
commit 241ebf2ae8
10 changed files with 69 additions and 5 deletions

View File

@ -116,7 +116,7 @@
+ (nullable instancetype)mfTextFieldWithMap:(nullable NSDictionary *)map bothDelegates:(nullable id<UITextFieldDelegate, MFTextFieldDelegate>)delegate { + (nullable instancetype)mfTextFieldWithMap:(nullable NSDictionary *)map bothDelegates:(nullable id<UITextFieldDelegate, MFTextFieldDelegate>)delegate {
MFTextField *textField = [self mfTextField]; MFTextField *textField = [self mfTextField];
textField.translatesAutoresizingMaskIntoConstraints = NO; textField.translatesAutoresizingMaskIntoConstraints = NO;
[textField setWithJSON:map delegateObject:[MVMCoreUIDelegateObject createWithDelegateForAll:delegate] additionalData:nil]; [textField setWithMap:map bothDelegates:delegate];
return textField; return textField;
} }

View File

@ -93,7 +93,7 @@ static NSTimeInterval const HandScrollAnimationTiming = 7.f;
BOOL automaticInset = NO; BOOL automaticInset = NO;
if (@available(iOS 11.0, *)) { if (@available(iOS 11.0, *)) {
automaticInset = self.scrollView.contentInsetAdjustmentBehavior == UIScrollViewContentInsetAdjustmentAutomatic; automaticInset = self.navigationController && self.scrollView.contentInsetAdjustmentBehavior == UIScrollViewContentInsetAdjustmentAutomatic;
} }
// Takes into account the navigation bar. // Takes into account the navigation bar.

View File

@ -308,6 +308,8 @@
|| self.manager || self.manager
|| self.loadObject.requestParameters.tabWasPressed); || 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<UIViewControllerTransitionCoordinator>)coordinator { - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];

View File

@ -30,6 +30,10 @@ NS_ASSUME_NONNULL_BEGIN
// View Controller can override this method and do custom action instead of opening the left panel // View Controller can override this method and do custom action instead of opening the left panel
- (BOOL)isOverridingLeftButton; - (BOOL)isOverridingLeftButton;
//return desired status bar style based on different View Controller
- (UIStatusBarStyle)defaultStatusBarStyle;
- (nullable UIColor *)defaultStatusBarBackgroundColor;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@ -105,6 +105,10 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) {
+ (CGFloat)getApplicationViewWidth; + (CGFloat)getApplicationViewWidth;
+ (CGFloat)getApplicationViewMaxSize; + (CGFloat)getApplicationViewMaxSize;
// return subviewcontrollers' prefer status bar style
- (UIStatusBarStyle)getDefaultStatusBarStyle;
- (nullable UIColor *)getDefaultStatusBarBackgroundColor;
#pragma mark - Main Subclassables #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. // Can subclass to set threshold for when the drawers are permanently extended. Default is 1000 for the left panel and 2000 for both.

View File

@ -877,7 +877,33 @@ CGFloat const PanelAnimationDuration = 0.2;
} }
- (UIStatusBarStyle)preferredStatusBarStyle { - (UIStatusBarStyle)preferredStatusBarStyle {
return self.topAlertView.statusBarStyle; if (self.topAlertView.topAlertObject) {
return self.topAlertView.statusBarStyle;
} else {
UIStatusBarStyle style = [self getDefaultStatusBarStyle];
[self.topAlertView resetDefaultBackgroundColor:[self getDefaultStatusBarBackgroundColor] basedOnStatusBarStyle:style];
return style;
}
}
- (UIStatusBarStyle)getDefaultStatusBarStyle {
UIViewController *viewController = [self getCurrentDetailViewController];
if ([viewController conformsToProtocol:@protocol(MVMCoreUIDetailViewProtocol)]
&& [viewController respondsToSelector:@selector(defaultStatusBarStyle)]
&& [((UIViewController <MVMCoreUIDetailViewProtocol> *)viewController) defaultStatusBarStyle]) {
return [((UIViewController <MVMCoreUIDetailViewProtocol> *)viewController) defaultStatusBarStyle];
}
return UIStatusBarStyleDefault;
}
- (UIColor *)getDefaultStatusBarBackgroundColor {
UIViewController *viewController = [self getCurrentDetailViewController];
if ([viewController conformsToProtocol:@protocol(MVMCoreUIDetailViewProtocol)]
&& [viewController respondsToSelector:@selector(defaultStatusBarBackgroundColor)]
&& [((UIViewController <MVMCoreUIDetailViewProtocol> *)viewController) defaultStatusBarBackgroundColor]) {
return [((UIViewController <MVMCoreUIDetailViewProtocol> *)viewController) defaultStatusBarBackgroundColor];
}
return nil;
} }
#pragma mark - Getters #pragma mark - Getters

View File

@ -24,6 +24,7 @@
@property (nullable, weak, nonatomic) UIView *viewInScroll; @property (nullable, weak, nonatomic) UIView *viewInScroll;
@property (nullable, weak, nonatomic) UIView *viewOutOfScroll; @property (nullable, weak, nonatomic) UIView *viewOutOfScroll;
@property (nullable, strong, nonatomic) UIView *safeAreaView; @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. // 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. // 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.

View File

@ -30,7 +30,6 @@
@property (nullable, weak, nonatomic) NSArray *middleViews; @property (nullable, weak, nonatomic) NSArray *middleViews;
@property (nullable, weak, nonatomic) UIView *betweenView; @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. // Adds the button view to the screen. Out of the scroll or in.
- (void)addViewOutsideOfScrollView:(UIView *)bottomView; - (void)addViewOutsideOfScrollView:(UIView *)bottomView;

View File

@ -41,6 +41,9 @@
- (void)expandStatusBarView; - (void)expandStatusBarView;
- (void)collapseStatusBarView; - (void)collapseStatusBarView;
/// 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. // Can be subclassed for custom views.
- (nonnull MVMCoreUITopAlertBaseView *)topAlertViewForTopAlertObject:(nullable MVMCoreTopAlertObject *)topAlertObject animationDelegate:(nonnull id <MVMCoreTopAlertAnimationDelegateProtocol>)animationDelegate statusBarColor:(UIColor *_Nullable *_Nullable)statusBarColor; - (nonnull MVMCoreUITopAlertBaseView *)topAlertViewForTopAlertObject:(nullable MVMCoreTopAlertObject *)topAlertObject animationDelegate:(nonnull id <MVMCoreTopAlertAnimationDelegateProtocol>)animationDelegate statusBarColor:(UIColor *_Nullable *_Nullable)statusBarColor;

View File

@ -189,7 +189,6 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed.";
[weakSelf.superview layoutIfNeeded]; [weakSelf.superview layoutIfNeeded];
} completion:^(BOOL finished) { } completion:^(BOOL finished) {
[weakSelf.animationDelegate topAlertViewFinishAnimation]; [weakSelf.animationDelegate topAlertViewFinishAnimation];
[weakSelf setStatusBarColor:[UIColor whiteColor] statusBarStyle:UIStatusBarStyleDefault];
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil); UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil);
UIView *view = weakSelf.currentAlert; UIView *view = weakSelf.currentAlert;
@ -204,6 +203,9 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed.";
[operation markAsFinished]; [operation markAsFinished];
completionHandler(finished); completionHandler(finished);
weakSelf.topAlertObject = nil; weakSelf.topAlertObject = nil;
[MVMCoreDispatchUtility performBlockOnMainThread:^{
[weakSelf setStatusBarColor:[UIColor whiteColor] statusBarStyle:UIStatusBarStyleDefault];
}];
}]; }];
}]; }];
}]; }];
@ -242,4 +244,18 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed.";
}]; }];
} }
- (void)resetDefaultBackgroundColor:(UIColor *)backgroundColor basedOnStatusBarStyle:(UIStatusBarStyle)style {
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;
}
}
}
@end @end