Merge branch 'feature/chatbotremove' into 'develop'

Remove right panel protocol

See merge request BPHV_MIPS/mvm_core_ui!290
This commit is contained in:
Pan, Xinlei (Ryan) 2020-03-04 15:27:20 -05:00
commit b54694690e
2 changed files with 18 additions and 29 deletions

View File

@ -50,11 +50,14 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) {
// Convenience getter // Convenience getter
+ (nullable instancetype)mainSplitViewController; + (nullable instancetype)mainSplitViewController;
/// Initializes the splitviewcontroller with the passed in panels.
- (nullable instancetype)initWithLeftPanel:(nullable UIViewController <MVMCoreUIPanelProtocol> *)leftPanel rightPanel:(nullable UIViewController <MVMCoreUIPanelProtocol> *)rightPanel;
// Returns a split controller with the mvm styling. Also sets the appropriate handlers. // Returns a split controller with the mvm styling. Also sets the appropriate handlers.
+ (nullable instancetype)setup; + (nullable instancetype)setup:(nullable UIViewController <MVMCoreUIPanelProtocol> *)leftPanel rightPanel:(nullable UIViewController <MVMCoreUIPanelProtocol> *)rightPanel;
// Returns a split controller with the mvm styling. Also sets the appropriate handlers. Also sets up the default load screen // Returns a split controller with the mvm styling. Also sets the appropriate handlers. Also sets up the default load screen
+ (nullable instancetype)setupAsMainController; + (nullable instancetype)setupAsMainController:(nullable UIViewController <MVMCoreUIPanelProtocol> *)leftPanel rightPanel:(nullable UIViewController <MVMCoreUIPanelProtocol> *)rightPanel;
#pragma mark - Panel Functions #pragma mark - Panel Functions
@ -83,9 +86,6 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) {
// contains speicaly logic to set the icon color // contains speicaly logic to set the icon color
- (void)setNavigationIconColor:(nullable UIColor *)color; - (void)setNavigationIconColor:(nullable UIColor *)color;
///create right and left panel. if left and right panel is already created, will replace them
- (void)createPanels;
/// Updates the panels that are used. /// Updates the panels that are used.
- (void)setupPanels; - (void)setupPanels;
@ -123,10 +123,6 @@ 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. // 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; - (MFNumberOfDrawers)numberOfDrawersShouldShow:(nullable NSNumber *)forWidth;
// subclass to return default global panels. kept alive after creation.
- (nullable UIViewController <MVMCoreUIPanelProtocol> *)createLeftPanelViewController;
- (nullable UIViewController <MVMCoreUIPanelProtocol> *)createRightPanelViewController;
// subclass to change image of back button // subclass to change image of back button
- (nullable UIImage *)imageForBackButton; - (nullable UIImage *)imageForBackButton;

View File

@ -76,18 +76,26 @@ CGFloat const PanelAnimationDuration = 0.2;
return [MVMCoreActionUtility initializerClassCheck:[MVMCoreUISession sharedGlobal].splitViewController classToVerify:self]; return [MVMCoreActionUtility initializerClassCheck:[MVMCoreUISession sharedGlobal].splitViewController classToVerify:self];
} }
+ (nullable instancetype)setup { + (nullable instancetype)setup:(nullable UIViewController <MVMCoreUIPanelProtocol> *)leftPanel rightPanel:(nullable UIViewController <MVMCoreUIPanelProtocol> *)rightPanel {
MVMCoreUISplitViewController *splitViewController = [[self alloc] init]; MVMCoreUISplitViewController *splitViewController = [[self alloc] initWithLeftPanel:leftPanel rightPanel:rightPanel];
[MVMCoreUISession sharedGlobal].splitViewController = splitViewController; [MVMCoreUISession sharedGlobal].splitViewController = splitViewController;
return splitViewController; return splitViewController;
} }
+ (nullable instancetype)setupAsMainController { + (nullable instancetype)setupAsMainController:(nullable UIViewController <MVMCoreUIPanelProtocol> *)leftPanel rightPanel:(nullable UIViewController <MVMCoreUIPanelProtocol> *)rightPanel {
MVMCoreUISplitViewController *splitViewController = [self setup]; MVMCoreUISplitViewController *splitViewController = [self setup:leftPanel rightPanel:rightPanel];
[[MVMCoreUISession sharedGlobal] setupAsStandardLoadViewDelegate:splitViewController]; [[MVMCoreUISession sharedGlobal] setupAsStandardLoadViewDelegate:splitViewController];
return splitViewController; return splitViewController;
} }
- (nullable instancetype)initWithLeftPanel:(nullable UIViewController <MVMCoreUIPanelProtocol> *)leftPanel rightPanel:(nullable UIViewController <MVMCoreUIPanelProtocol> *)rightPanel {
if (self = [super init]) {
self.globalLeftPanel = leftPanel;
self.globalRightPanel = rightPanel;
}
return self;
}
#pragma mark - Main Subclassables #pragma mark - Main Subclassables
- (MFNumberOfDrawers)numberOfDrawersShouldShow:(NSNumber *)forWidth { - (MFNumberOfDrawers)numberOfDrawersShouldShow:(NSNumber *)forWidth {
@ -100,14 +108,6 @@ CGFloat const PanelAnimationDuration = 0.2;
return (width > 2000 ? MFTwoDrawer : (width > 1000 ? MFOneDrawer : MFNoDrawer)); return (width > 2000 ? MFTwoDrawer : (width > 1000 ? MFOneDrawer : MFNoDrawer));
} }
- (nullable UIViewController <MVMCoreUIPanelProtocol> *)createLeftPanelViewController {
return nil;
}
- (nullable UIViewController <MVMCoreUIPanelProtocol> *)createRightPanelViewController {
return nil;
}
- (nullable NSArray <UIBarButtonItem *>*)additionalLeftButtons { - (nullable NSArray <UIBarButtonItem *>*)additionalLeftButtons {
return nil; return nil;
} }
@ -766,13 +766,6 @@ CGFloat const PanelAnimationDuration = 0.2;
} }
} }
- (void)createPanels {
// Create panels
self.globalLeftPanel = [self createLeftPanelViewController];
self.globalRightPanel = [self createRightPanelViewController];
[self setupPanels];
}
- (void)setupPanels { - (void)setupPanels {
[self forceHideBothDrawers]; [self forceHideBothDrawers];
[self setupLeftPanel]; [self setupLeftPanel];
@ -869,7 +862,7 @@ 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: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; [NSLayoutConstraint constraintWithItem:coverView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0].active = YES;
[self createPanels]; [self setupPanels];
} }
- (void)viewDidLoad { - (void)viewDidLoad {