This commit is contained in:
Pfeil, Scott Robert 2019-05-31 09:42:40 -04:00
commit e46ace462a
7 changed files with 149 additions and 63 deletions

View File

@ -279,7 +279,7 @@
- (void)updateNavigationBarUI:(nonnull UINavigationController *)navigationController {
if (navigationController) {
[navigationController setNavigationBarHidden:[self navigationBarHidden] animated:NO];
[navigationController setNavigationBarHidden:[self navigationBarHidden] animated:YES];
[UIColor mfSetBackgroundColorForNavigationBar:[self navigationBarColor] navigationBar:navigationController.navigationBar transparent:[self navigationBarTransparent]];
@ -297,6 +297,7 @@
if (navigationController == [MVMCoreUISplitViewController mainSplitViewController].navigationController) {
// Update icons if main navigation controller.
[[MVMCoreUISession sharedGlobal].splitViewController setupPanels];
[self setMasterShouldBeAccessible:self.masterShouldBeAccessible];
[self setSupportShouldBeAccessible:self.supportShouldBeAccessible];
[self showBottomProgressBar];

View File

@ -21,6 +21,12 @@ NS_ASSUME_NONNULL_BEGIN
- (void)panelWillDisappear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel;
- (void)panelDidDisappear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel;
/// Can override the left panel.
- (nullable UIViewController <MVMCoreUIPanelProtocol>*)overrideLeftPanel;
/// Can override the right panel.
- (nullable UIViewController <MVMCoreUIPanelProtocol>*)overrideRightPanel;
// Called when the back button is pressed. Overwrite for special functionality.
- (void)backButtonPressed;

View File

@ -6,7 +6,7 @@
// Copyright © 2017 Verizon Wireless. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@protocol MVMCoreUIPanelProtocol <NSObject>
#pragma mark - life cycle
@ -33,6 +33,12 @@
- (void)showArrow;
- (void)hideArrow;
/// The width to use if the panel is automatically extended when the screen is big enough.
- (CGFloat)panelExtendedWidth;
/// The maximum width of the panel.
- (CGFloat)panelMaxWidth;
// Gets called when we are restarting or clearing a session.
- (void)clearData;

View File

@ -80,6 +80,9 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) {
// contains speicaly logic to set the icon color
- (void)setNavigationIconColor:(nullable UIColor *)color;
/// Updates the panels that are used.
- (void)setupPanels;
#pragma mark - Bottom Progress Bar
- (void)setBottomProgressBarProgress:(float)progress;
@ -114,7 +117,7 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) {
// Can subclass to set threshold for when the drawers are permanently extended. Default is 1000 for the left panel and 2000 for both.
- (MFNumberOfDrawers)numberOfDrawersShouldShow:(nullable NSNumber *)forWidth;
// subclass to return panels
// subclass to return default global panels. kept alive after creation.
- (nullable UIViewController <MVMCoreUIPanelProtocol> *)createLeftPanelViewController;
- (nullable UIViewController <MVMCoreUIPanelProtocol> *)createRightPanelViewController;

View File

@ -27,6 +27,12 @@
@interface MVMCoreUISplitViewController ()
typedef NS_OPTIONS(NSInteger, MFExtendedDrawer) {
MFExtendedDrawerNone = 0,
MFExtendedDrawerRight,
MFExtendedDrawerLeft
};
@property (weak, nonatomic) UIView *leftView;
@property (weak, nonatomic) UIView *mainView;
@property (weak, nonatomic) UIView *rightView;
@ -38,6 +44,10 @@
@property (weak, nonatomic) UIView *leftPanelSeparator;
@property (weak, nonatomic) UIView *rightPanelSeparator;
// For keeping
@property (strong, nonatomic, readwrite) UIViewController <MVMCoreUIPanelProtocol> *globalLeftPanel;
@property (strong, nonatomic, readwrite) UIViewController <MVMCoreUIPanelProtocol> *globalRightPanel;
@property (weak, nonatomic, readwrite) UIViewController <MVMCoreUIPanelProtocol> *leftPanel;
@property (weak, nonatomic, readwrite) UIViewController <MVMCoreUIPanelProtocol> *rightPanel;
@property (weak, nonatomic, readwrite) MVMCoreUINavigationController *navigationController;
@ -51,13 +61,7 @@
@property (nonatomic, strong) UIGestureRecognizer *tapToDismissGesture;
@property (nullable, readwrite, weak, nonatomic) NSObject <MVMCoreUIPanelProtocol> *explictlyShowingPanel;
@property (nullable, weak, nonatomic) NSObject <MVMCoreUIPanelProtocol> *prioritizedExtendedPanel;
typedef NS_OPTIONS(NSInteger, MFExtendedDrawer) {
MFExtendedDrawerNone = 0,
MFExtendedDrawerRight,
MFExtendedDrawerLeft
};
@property (nonatomic) MFExtendedDrawer prioritizedExtendedPanel;
@property (nonatomic) MFExtendedDrawer extendedDrawers;
@property (nonatomic, readwrite) BOOL leftPanelIsAccessible;
@ -119,18 +123,30 @@ CGFloat const PanelAnimationDuration = 0.2;
}
- (CGFloat)leftPanelExtendedWidth {
if ([self.leftPanel respondsToSelector:@selector(panelExtendedWidth)]) {
return [self.leftPanel panelExtendedWidth];
}
return 320;
}
- (CGFloat)leftPanelMaxWidth {
if ([self.leftPanel respondsToSelector:@selector(panelMaxWidth)]) {
return [self.leftPanel panelMaxWidth];
}
return 415;
}
- (CGFloat)rightPanelExtendedWidth {
if ([self.rightPanel respondsToSelector:@selector(panelExtendedWidth)]) {
return [self.rightPanel panelExtendedWidth];
}
return 320;
}
- (CGFloat)rightPanelMaxWidth {
if ([self.rightPanel respondsToSelector:@selector(panelMaxWidth)]) {
return [self.rightPanel panelMaxWidth];
}
return 500;
}
@ -217,7 +233,7 @@ CGFloat const PanelAnimationDuration = 0.2;
return NO;
} else {
// left is extended if the right panel isn't prioritized.
return self.prioritizedExtendedPanel != self.rightPanel;
return self.prioritizedExtendedPanel != MFExtendedDrawerRight;
}
}
}
@ -420,7 +436,7 @@ CGFloat const PanelAnimationDuration = 0.2;
return NO;
} else {
// Extend right if the left panel isn't prioritized.
return self.prioritizedExtendedPanel != self.leftPanel;
return self.prioritizedExtendedPanel != MFExtendedDrawerLeft;
}
}
}
@ -656,6 +672,98 @@ CGFloat const PanelAnimationDuration = 0.2;
}
}
- (void)addPanel:(nonnull UIViewController <MVMCoreUIPanelProtocol> *)panel {
UIView *view = panel.view;
[self addChildViewController:panel];
[self.view addSubview:view];
[panel didMoveToParentViewController:self];
}
- (void)removePanel:(nullable UIViewController <MVMCoreUIPanelProtocol> *)panel {
[panel willMoveToParentViewController:nil];
[panel.view removeFromSuperview];
[panel removeFromParentViewController];
}
- (void)setupLeftPanel {
UIViewController <MVMCoreUIPanelProtocol> *panel = nil;
UIViewController *currentViewController = [self getCurrentDetailViewController];
if ([currentViewController respondsToSelector:@selector(overrideLeftPanel)]) {
panel = [((UIViewController <MVMCoreUIDetailViewProtocol> *)currentViewController) overrideLeftPanel];
} else {
panel = self.globalLeftPanel;
self.leftPanelButton = nil;
}
if (!panel) {
[self removePanel:self.leftPanel];
} else if (panel && panel != self.leftPanel) {
[self removePanel:self.leftPanel];
[self addPanel:panel];
self.leftView = panel.view;
self.leftPanel = panel;
self.leftView.translatesAutoresizingMaskIntoConstraints = NO;
NSLayoutConstraint *leftPanelWidth = [NSLayoutConstraint constraintWithItem:self.leftView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:270];
self.leftView.translatesAutoresizingMaskIntoConstraints = NO;
leftPanelWidth.active = YES;
self.leftPanelWidth = leftPanelWidth;
[NSLayoutConstraint constraintWithItem:self.mainView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.leftView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0].active = YES;
[NSLayoutConstraint constraintWithItem:self.leftView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.mainView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0].active = YES;
[NSLayoutConstraint constraintWithItem:self.leftView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.mainView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0].active = YES;
if ([panel respondsToSelector:@selector(buttonForPanel)]) {
self.leftPanelButton = [panel buttonForPanel];
} else if ([panel respondsToSelector:@selector(imageForButtonForPanel)]) {
self.leftPanelButton = [[UIBarButtonItem alloc] initWithImage:[panel imageForButtonForPanel] style:UIBarButtonItemStylePlain target:self action:@selector(leftPanelButtonPressed:)];
} else {
self.leftPanelButton = nil;
}
}
}
- (void)setupRightPanel {
UIViewController <MVMCoreUIPanelProtocol> *panel = nil;
UIViewController *currentViewController = [self getCurrentDetailViewController];
if ([currentViewController respondsToSelector:@selector(overrideRightPanel)]) {
panel = [((UIViewController <MVMCoreUIDetailViewProtocol> *)currentViewController) overrideRightPanel];
} else {
panel = self.globalRightPanel;
}
if (!panel) {
[self removePanel:self.rightPanel];
self.rightPanelButton = nil;
} else if (panel && panel != self.rightPanel) {
[self removePanel:self.rightPanel];
[self addPanel:panel];
self.rightView = panel.view;
self.rightPanel = panel;
self.rightView.translatesAutoresizingMaskIntoConstraints = NO;
NSLayoutConstraint *rightPanelWidth = [NSLayoutConstraint constraintWithItem:self.rightView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:270];
rightPanelWidth.active = YES;
self.rightPanelWidth = rightPanelWidth;
[NSLayoutConstraint constraintWithItem:self.rightView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.mainView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0].active = YES;
[NSLayoutConstraint constraintWithItem:self.rightView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.mainView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0].active = YES;
[NSLayoutConstraint constraintWithItem:self.rightView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.mainView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0].active = YES;
if ([panel respondsToSelector:@selector(buttonForPanel)]) {
self.rightPanelButton = [panel buttonForPanel];
} else if ([panel respondsToSelector:@selector(imageForButtonForPanel)]) {
self.rightPanelButton = [[UIBarButtonItem alloc] initWithImage:[panel imageForButtonForPanel] style:UIBarButtonItemStylePlain target:self action:@selector(rightPanelButtonPressed:)];
} else {
self.rightPanelButton = nil;
}
}
}
- (void)setupPanels {
[self forceHideBothDrawers];
[self setupLeftPanel];
[self setupRightPanel];
self.explictlyShowingPanel = nil;
[self.view layoutIfNeeded];
}
#pragma mark - Bottom Progress Bar
- (void)setBottomProgressBarProgress:(float)progress {
@ -744,62 +852,16 @@ CGFloat const PanelAnimationDuration = 0.2;
[NSLayoutConstraint constraintWithItem:coverView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0].active = YES;
[NSLayoutConstraint constraintWithItem:coverView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0].active = YES;
// Left Panel
UIViewController <MVMCoreUIPanelProtocol> *leftPanel = [self createLeftPanelViewController];
if (leftPanel) {
UIView *leftView = leftPanel.view;
[self addChildViewController:leftPanel];
[self.view addSubview:leftView];
[leftPanel didMoveToParentViewController:self];
self.leftView = leftView;
self.leftPanel = leftPanel;
NSLayoutConstraint *leftPanelWidth = [NSLayoutConstraint constraintWithItem:leftView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:270];
leftPanelWidth.active = YES;
self.leftPanelWidth = leftPanelWidth;
[NSLayoutConstraint constraintWithItem:mainView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:leftView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0].active = YES;
[NSLayoutConstraint constraintWithItem:leftView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0].active = YES;
[NSLayoutConstraint constraintWithItem:leftView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0].active = YES;
}
// Right Panel
UIViewController <MVMCoreUIPanelProtocol> *rightPanel = [self createRightPanelViewController];
if (rightPanel) {
UIView *rightView = rightPanel.view;
[self addChildViewController:rightPanel];
[self.view addSubview:rightView];
[rightPanel didMoveToParentViewController:self];
self.rightView = rightView;
self.rightPanel = rightPanel;
NSLayoutConstraint *rightPanelWidth = [NSLayoutConstraint constraintWithItem:rightView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:270];
rightPanelWidth.active = YES;
self.rightPanelWidth = rightPanelWidth;
[NSLayoutConstraint constraintWithItem:rightView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0].active = YES;
[NSLayoutConstraint constraintWithItem:rightView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0].active = YES;
[NSLayoutConstraint constraintWithItem:rightView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0].active = YES;
}
// Create panels
self.globalLeftPanel = [self createLeftPanelViewController];
self.globalRightPanel = [self createRightPanelViewController];
[self setupPanels];
}
- (void)viewDidLoad {
[super viewDidLoad];
[self.topAlertView pinATopViewController:self];
// Do any additional setup after loading the view.
if (self.leftPanel) {
if ([self.leftPanel respondsToSelector:@selector(buttonForPanel)]) {
self.leftPanelButton = [self.leftPanel buttonForPanel];
} else {
self.leftPanelButton = [[UIBarButtonItem alloc] initWithImage:[self.leftPanel imageForButtonForPanel] style:UIBarButtonItemStylePlain target:self action:@selector(leftPanelButtonPressed:)];
}
}
if (self.rightPanel) {
if ([self.rightPanel respondsToSelector:@selector(buttonForPanel)]) {
self.rightPanelButton = [self.rightPanel buttonForPanel];
} else {
self.rightPanelButton = [[UIBarButtonItem alloc] initWithImage:[self.rightPanel imageForButtonForPanel] style:UIBarButtonItemStylePlain target:self action:@selector(rightPanelButtonPressed:)];
}
}
// Creates the back button
self.backButton = [[UIBarButtonItem alloc] initWithImage:[self imageForBackButton] style:UIBarButtonItemStylePlain target:self action:@selector(backButtonPressed:)];
self.backButton.imageInsets = UIEdgeInsetsMake(0, 4, 0, -8);
@ -811,7 +873,7 @@ CGFloat const PanelAnimationDuration = 0.2;
}
self.extendedDrawers = MFExtendedDrawerLeft | MFExtendedDrawerRight;
self.prioritizedExtendedPanel = self.leftPanel;
self.prioritizedExtendedPanel = MFExtendedDrawerLeft;
self.view.backgroundColor = [UIColor blackColor];
}

View File

@ -160,6 +160,10 @@ B3 -> Legal
//55Rg 16pt for 5G flow
+ (nullable UIFont *)font5GMessage:(BOOL)genericScaling;
//55Rg 16pt for 5G flow scale YES
+ (nullable UIFont *)font5GMessage;
// Returns the fonts for these styles allowing to apply a generic scale by device or not.
+ (nullable UIFont *)fontForBiggerHeadLine:(BOOL)genericScaling;
+ (nullable UIFont *)fontForPlan:(BOOL)genericScaling;

View File

@ -355,6 +355,10 @@ CGFloat const LabelWithInternalButtonLineSpace = 2;
return [MFFonts mfFont55Rg:size];
}
+ (nullable UIFont *)font5GMessage {
return [self font5GMessage:YES];
}
+ (nullable UIFont *)fontForHeadlineAlternative:(BOOL)genericScaling {
CGFloat size = 24;