decoupling of split view

This commit is contained in:
Pfeil, Scott Robert 2019-01-11 15:37:44 -05:00
parent 72f5ba18ec
commit c95d1a8983
8 changed files with 682 additions and 864 deletions

View File

@ -69,7 +69,7 @@
D29DF27621E79E81003B2FB9 /* MVMCoreUILoggingHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = D29DF27421E79E81003B2FB9 /* MVMCoreUILoggingHandler.m */; };
D29DF27921E7A533003B2FB9 /* MVMCoreUISession.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF27721E7A533003B2FB9 /* MVMCoreUISession.h */; settings = {ATTRIBUTES = (Public, ); }; };
D29DF27A21E7A533003B2FB9 /* MVMCoreUISession.m in Sources */ = {isa = PBXBuildFile; fileRef = D29DF27821E7A533003B2FB9 /* MVMCoreUISession.m */; };
D29DF28021E7AA51003B2FB9 /* MVMCoreDetailViewProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF27F21E7AA50003B2FB9 /* MVMCoreDetailViewProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
D29DF28021E7AA51003B2FB9 /* MVMCoreUIDetailViewProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF27F21E7AA50003B2FB9 /* MVMCoreUIDetailViewProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
D29DF28321E7AB24003B2FB9 /* MVMCoreUICommonViewsUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = D29DF28121E7AB23003B2FB9 /* MVMCoreUICommonViewsUtility.m */; };
D29DF28421E7AB24003B2FB9 /* MVMCoreUICommonViewsUtility.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF28221E7AB24003B2FB9 /* MVMCoreUICommonViewsUtility.h */; };
D29DF28921E7AC2B003B2FB9 /* MFLabel.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF28521E7AC2B003B2FB9 /* MFLabel.h */; settings = {ATTRIBUTES = (Public, ); }; };
@ -112,6 +112,7 @@
D29DF2CE21E7C104003B2FB9 /* MFLoadingViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF2CC21E7C104003B2FB9 /* MFLoadingViewController.h */; };
D29DF2CF21E7C104003B2FB9 /* MFLoadingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D29DF2CD21E7C104003B2FB9 /* MFLoadingViewController.m */; };
D29DF2D121E7C1C8003B2FB9 /* MVMAnimationFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D29DF2D021E7C1C8003B2FB9 /* MVMAnimationFramework.framework */; };
D29DF2E121E9240B003B2FB9 /* MVMCoreUIPanelProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF2E021E9240B003B2FB9 /* MVMCoreUIPanelProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@ -187,7 +188,7 @@
D29DF27421E79E81003B2FB9 /* MVMCoreUILoggingHandler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUILoggingHandler.m; sourceTree = "<group>"; };
D29DF27721E7A533003B2FB9 /* MVMCoreUISession.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUISession.h; sourceTree = "<group>"; };
D29DF27821E7A533003B2FB9 /* MVMCoreUISession.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUISession.m; sourceTree = "<group>"; };
D29DF27F21E7AA50003B2FB9 /* MVMCoreDetailViewProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreDetailViewProtocol.h; sourceTree = "<group>"; };
D29DF27F21E7AA50003B2FB9 /* MVMCoreUIDetailViewProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIDetailViewProtocol.h; sourceTree = "<group>"; };
D29DF28121E7AB23003B2FB9 /* MVMCoreUICommonViewsUtility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUICommonViewsUtility.m; sourceTree = "<group>"; };
D29DF28221E7AB24003B2FB9 /* MVMCoreUICommonViewsUtility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreUICommonViewsUtility.h; sourceTree = "<group>"; };
D29DF28521E7AC2B003B2FB9 /* MFLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFLabel.h; sourceTree = "<group>"; };
@ -224,6 +225,7 @@
D29DF2CC21E7C104003B2FB9 /* MFLoadingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFLoadingViewController.h; sourceTree = "<group>"; };
D29DF2CD21E7C104003B2FB9 /* MFLoadingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFLoadingViewController.m; sourceTree = "<group>"; };
D29DF2D021E7C1C8003B2FB9 /* MVMAnimationFramework.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MVMAnimationFramework.framework; path = ../SharedFrameworks/MVMAnimationFramework.framework; sourceTree = "<group>"; };
D29DF2E021E9240B003B2FB9 /* MVMCoreUIPanelProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIPanelProtocol.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -507,7 +509,8 @@
D29DF2B621E7BE66003B2FB9 /* SplitViewController */ = {
isa = PBXGroup;
children = (
D29DF27F21E7AA50003B2FB9 /* MVMCoreDetailViewProtocol.h */,
D29DF2E021E9240B003B2FB9 /* MVMCoreUIPanelProtocol.h */,
D29DF27F21E7AA50003B2FB9 /* MVMCoreUIDetailViewProtocol.h */,
D29DF15321E69760003B2FB9 /* MVMCoreUIPanelButtonProtocol.h */,
D29DF11A21E684A9003B2FB9 /* MVMCoreUISplitViewController.h */,
D29DF11B21E684A9003B2FB9 /* MVMCoreUISplitViewController.m */,
@ -577,7 +580,7 @@
D29DF13121E6851E003B2FB9 /* MVMCoreUITopAlertExpandableView.h in Headers */,
D29DF2C421E7BF57003B2FB9 /* MFTabBarSwipeAnimator.h in Headers */,
D29DF2CA21E7BFC8003B2FB9 /* MFSizeThreshold.h in Headers */,
D29DF28021E7AA51003B2FB9 /* MVMCoreDetailViewProtocol.h in Headers */,
D29DF28021E7AA51003B2FB9 /* MVMCoreUIDetailViewProtocol.h in Headers */,
D29DF2BD21E7BEA4003B2FB9 /* MVMCoreUITabBarPageControlViewController.h in Headers */,
D29DF12D21E6851E003B2FB9 /* MVMCoreUITopAlertBaseView.h in Headers */,
D29DF24E21E6A177003B2FB9 /* MFDigitTextField.h in Headers */,
@ -588,6 +591,7 @@
D29DF2A121E7AF4E003B2FB9 /* MVMCoreUIUtility.h in Headers */,
D29DF17621E69E1F003B2FB9 /* PrimaryButton.h in Headers */,
D29DF2C821E7BFC1003B2FB9 /* MFSizeObject.h in Headers */,
D29DF2E121E9240B003B2FB9 /* MVMCoreUIPanelProtocol.h in Headers */,
D29DF12921E6851E003B2FB9 /* MVMCoreUITopAlertMainView.h in Headers */,
D29DF12C21E6851E003B2FB9 /* MVMCoreUITopAlertShortView.h in Headers */,
);

View File

@ -1,26 +0,0 @@
//
// MVMCoreDetailViewProtocol.h
// MobileFirstFramework
//
// Created by Yang, Tianhang (Chris) on 11/14/18.
// Copyright © 2018 Verizon Wireless. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <MVMCore/PanelProtocol.h>
NS_ASSUME_NONNULL_BEGIN
@protocol MVMCoreDetailViewProtocol <NSObject>
@optional
- (void)panelWillAppear:(nonnull NSObject <PanelProtocol>*)panel;
- (void)panelDidAppear:(nonnull NSObject <PanelProtocol>*)panel;
- (void)panelWillDisappear:(nonnull NSObject <PanelProtocol>*)panel;
- (void)panelDidDisappear:(nonnull NSObject <PanelProtocol>*)panel;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,29 @@
//
// MVMCoreUIDetailViewProtocol.h
// MobileFirstFramework
//
// Created by Yang, Tianhang (Chris) on 11/14/18.
// Copyright © 2018 Verizon Wireless. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <MVMCoreUI/MVMCoreUIPanelProtocol.h>
NS_ASSUME_NONNULL_BEGIN
@protocol MVMCoreUIDetailViewProtocol <NSObject>
@optional
- (void)panelWillAppear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel;
- (void)panelDidAppear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel;
- (void)panelWillDisappear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel;
- (void)panelDidDisappear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel;
// Called when the back button is pressed. Overwrite for special functionality.
- (void)backButtonPressed;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,41 @@
//
// MVMCoreUIPanelProtocol.h
// mobilefirst
//
// Created by Seshamani, Shreyas on 6/2/17.
// Copyright © 2017 Verizon Wireless. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol MVMCoreUIPanelProtocol <NSObject>
#pragma mark - life cycle
@optional
// The panel can return if it should be available or not.
- (BOOL)panelAvailable;
// Notified when it is appearing and disappearing. Called by the container.
- (void)willOpenWithActionInformation:(nullable NSDictionary *)actionInformation;
- (void)willAppear:(BOOL)animated;
- (void)didAppear:(BOOL)animated;
- (void)willDisappear:(BOOL)animated;
- (void)didDisappear:(BOOL)animated;
// Can overide to return the image to use for the standard panel button.
- (nonnull UIImage *)imageForButtonForPanel;
// Can overide to return the button to use for the panel. The selector should be the appropriate container selector otherwise the container will not work.
- (nonnull UIBarButtonItem *)buttonForPanel;
// Notifies the panel if it should show its close button or hide it. Depends on width of screen if automatic extension.
- (void)showArrow;
- (void)hideArrow;
// Gets called when we are restarting or clearing a session.
- (void)clearData;
- (void)resetIconToDefault;
@end

View File

@ -8,15 +8,13 @@
// The main splitview controller. Handles the hamburger menu and other content. Used because at the time, apple's UISplitViewController wasn't robust enough to satisfy our needs.
#import <UIKit/UIKit.h>
#import <MVMCore/PanelProtocol.h>
#import <MVMCore/MVMCoreMainSplitViewProtocol.h>
#import <MVMCore/MVMCoreActionDelegateProtocol.h>
#import <MVMCore/MVMCoreLoadingOverlayDelegateProtocol.h>
#import "MVMCoreUIPanelButtonProtocol.h"
#import <MVMCoreUI/MVMCoreUIPanelProtocol.h>
#import <MVMCoreUI/MVMCoreUIPanelButtonProtocol.h>
@class SeparatorView;
@class MVMCoreUITopAlertView;
@class MFSupportBarButtonItem;
@class MFViewController;
typedef NS_ENUM(NSInteger, MFNumberOfDrawers) {
@ -27,13 +25,13 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) {
@interface MVMCoreUISplitViewController : UIViewController <MVMCoreLoadingOverlayDelegateProtocol>
// Reference to the main menu.
@property (nullable, weak, nonatomic, readonly) MFViewController <MVMCoreViewControllerProtocol,PanelProtocol> *masterMenu;
// Reference to the panels.
@property (nullable, weak, nonatomic, readonly) UIViewController <MVMCoreUIPanelProtocol> *leftPanel;
@property (nullable, weak, nonatomic, readonly) UIViewController <MVMCoreUIPanelProtocol> *rightPanel;
// Reference to the support panel
@property (nullable, weak, nonatomic, readonly) MFViewController <MVMCoreViewControllerProtocol,PanelProtocol> *supportPanel;
@property (nullable, strong, nonatomic) MFSupportBarButtonItem <MVMCoreUIPanelButtonProtocol> *animatedSupportButton;
// Can be of protocol MVMCoreUIPanelButtonProtocol
@property (nullable, strong, nonatomic) UIBarButtonItem *leftPanelButton;
@property (nullable, strong, nonatomic) UIBarButtonItem *rightPanelButton;
@property (nullable, weak, nonatomic, readonly) UINavigationController *navigationController;
@ -41,35 +39,22 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) {
@property (nullable, weak, nonatomic) MVMCoreUITopAlertView *topAlertView;
@property (nullable, strong, nonatomic) SeparatorView *navigationBarSeparator;
@property (nullable, strong, nonatomic) NSDictionary *actionMapForCommunity;
@property (nullable, weak, nonatomic) UIView *notificationDot;
// Convenience getter
+ (nullable instancetype)mainSplitViewController;
// Sets if the master accessible for the view controller. Will show or hide the button.
- (void)setMasterIsAccessible:(BOOL)masterIsAccessible forViewController:(nonnull UIViewController *)viewController;
#pragma mark - Panel Functions
// Sets if the support accessible for the view controller. Will show or hide the button.
- (void)setSupportIsAccessible:(BOOL)supportIsAccessible forViewController:(nonnull UIViewController *)viewController;
// Sets if the left panel accessible for the view controller. Will show or hide the button.
- (void)setLeftPanelIsAccessible:(BOOL)leftPanelIsAccessible forViewController:(nonnull UIViewController *)viewController;
// Sets if community is accessible for the view controller. Will show or hide the button.
- (void)setCommunityIsAccessible:(BOOL)communityisAccessile forViewController:(nonnull UIViewController *)viewController;
// Sets if the right panel accessible for the view controller. Will show or hide the button.
- (void)setRightPanelIsAccessible:(BOOL)rightPanelIsAccessible forViewController:(nonnull UIViewController *)viewController;
// Sets the accessibility for the support and cart buttons, set close button if closeActionMap is available
- (void)setSupportIsAccessible:(BOOL)supportIsAccessible cartIsAccessible:(BOOL)cartIsAccessible communityIsAccessible:(BOOL)communityIsAccessible closeButtonActionMap:(nullable NSDictionary *)closeActionMap forViewController:(nonnull UIViewController *)viewController;
- (void)hideLeftPanelIfNeededAnimated:(BOOL)animated;
- (void)showLeftPanelAnimated:(BOOL)animated;
// Hides the master.
- (void)hideMasterIfNeededAnimated:(BOOL)animated;
// Shows the master.
- (void)showMasterAnimated:(BOOL)animated;
// Hides the support.
- (void)hideSupportIfNeededAnimated:(BOOL)animated;
// Shows the support.
- (void)showSupportAnimated:(BOOL)animated;
- (void)hideRightPanelIfNeededAnimated:(BOOL)animated;
- (void)showRightPanelAnimated:(BOOL)animated;
// Force hides both drawers. Does not animate or open always extended drawers on ipad either.
- (void)forceHideBothDrawers;
@ -77,6 +62,15 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) {
// reset drawers
- (void)resetDrawers;
// contains speicaly logic to set the support icon color
- (void)setNavigationIconColor:(nullable UIColor *)color;
#pragma mark - Bottom Progress Bar
- (void)setBottomProgressBarProgress:(float)progress;
#pragma mark - Getters
// Returns the topmost visible view controller. This can also be the top level presented view controller.
- (nullable UIViewController *)getCurrentVisibleController;
@ -86,15 +80,6 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) {
// Returns the current detail view controller only if it is an MFViewController.
- (nullable MFViewController *)getCurrentDetailMFViewController;
- (void)setActionMapForCartButton:(nullable NSDictionary *)actionMap delegate:(nullable NSObject <MVMCoreActionDelegateProtocol> *)delegate;
//- (void)setCloseButtonAccessibleWithCartIsAccessible:(BOOL)cartIsAccessible actionMap:(nullable NSDictionary *)actionMap forViewController:(nonnull UIViewController *)viewController;
- (void)setBottomProgressBarProgress:(float)progress;
// contains speicaly logic to set the support icon color
- (void)setNavigationIconColor:(nullable UIColor *)color;
// Provides the width of the detail view.
+ (CGFloat)getDetailViewWidth;
@ -108,7 +93,34 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) {
+ (CGFloat)getApplicationViewWidth;
+ (CGFloat)getApplicationViewMaxSize;
// Show or hide the Notification dot on the menu button
- (void)showOrHideMenuButtonNotificationDot:(BOOL)hide;
#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.
- (MFNumberOfDrawers)numberOfDrawersShouldShow:(NSNumber *)forWidth;
// subclass to return panels
- (nullable UIViewController <MVMCoreUIPanelProtocol> *)createLeftPanelViewController;
- (nullable UIViewController <MVMCoreUIPanelProtocol> *)createRightPanelViewController;
// subclass to change image of back button
- (nullable UIImage *)imageForBackButton;
// Can overide to provide other global buttons to be on the navigation bar.
- (nullable NSArray <UIBarButtonItem *>*)additionalLeftButtons;
- (nullable NSArray <UIBarButtonItem *>*)additionalRightButtons;
// The width of the panel when it is permanently extended. Default 320.
- (CGFloat)leftPanelExtendedWidth;
- (CGFloat)rightPanelExtendedWidth;
// The maximum width of the panel. It will never grow past these sizes. Otherwise it is the size of the main view.
- (CGFloat)leftPanelMaxWidth; // Default 415
- (CGFloat)rightPanelMaxWidth; // Default 500
#pragma mark - Button Presses
- (IBAction)leftPanelButtonPressed:(id)sender;
- (IBAction)backButtonPressed:(id)sender;
- (IBAction)rightPanelButtonPressed:(id)sender;
@end

View File

@ -36,9 +36,11 @@ FOUNDATION_EXPORT const unsigned char MVMCoreUIVersionString[];
#import <MVMCoreUI/StackableViewController.h>
#pragma mark - Containers
#import <MVMCoreUI/MVMCoreDetailViewProtocol.h>
#import <MVMCoreUI/MVMCoreUISplitViewController.h>
#import <MVMCoreUI/MVMCoreUIPanelProtocol.h>
#import <MVMCoreUI/MVMCoreUIDetailViewProtocol.h>
#import <MVMCoreUI/MVMCoreUIPanelButtonProtocol.h>
#import <MVMCoreUI/MVMCoreUISplitViewController.h>
#import <MVMCoreUI/TopTabbar.h>
#import <MVMCoreUI/MVMCoreUITabBarPageControlViewController.h>

View File

@ -8,6 +8,8 @@
#import <UIKit/UIKit.h>
#define fequalwiththreshold(a,b,c) (fabs((a) - (b)) < c)
NS_ASSUME_NONNULL_BEGIN
@interface MVMCoreUIUtility : NSObject