diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 5eb1d762..8c8eb55e 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -7,6 +7,10 @@ objects = { /* Begin PBXBuildFile section */ + D206997721FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = D206997521FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D206997821FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D206997621FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.m */; }; + D28B4F8A21FF967C00712C7A /* MVMCoreUIObject.h in Headers */ = {isa = PBXBuildFile; fileRef = D28B4F8821FF967C00712C7A /* MVMCoreUIObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D28B4F8B21FF967C00712C7A /* MVMCoreUIObject.m in Sources */ = {isa = PBXBuildFile; fileRef = D28B4F8921FF967C00712C7A /* MVMCoreUIObject.m */; }; 01DF55E021F8FAA800CC099B /* MFTextFieldListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01DF55DF21F8FAA800CC099B /* MFTextFieldListView.swift */; }; 01DF567021FA5AB300CC099B /* MVMCoreUITextFieldListFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01DF566F21FA5AB300CC099B /* MVMCoreUITextFieldListFormViewController.swift */; }; D29770C821F7C4AE00B2F0D0 /* TopLabelsView.m in Sources */ = {isa = PBXBuildFile; fileRef = D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */; }; @@ -144,6 +148,10 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + D206997521FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUINavigationControllerViewController.h; sourceTree = ""; }; + D206997621FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUINavigationControllerViewController.m; sourceTree = ""; }; + D28B4F8821FF967C00712C7A /* MVMCoreUIObject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIObject.h; sourceTree = ""; }; + D28B4F8921FF967C00712C7A /* MVMCoreUIObject.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUIObject.m; sourceTree = ""; }; 01DF55DF21F8FAA800CC099B /* MFTextFieldListView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MFTextFieldListView.swift; sourceTree = ""; }; 01DF566F21FA5AB300CC099B /* MVMCoreUITextFieldListFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MVMCoreUITextFieldListFormViewController.swift; sourceTree = ""; }; D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopLabelsView.m; sourceTree = ""; }; @@ -319,7 +327,6 @@ children = ( D29DF31421ECECA7003B2FB9 /* SupportingFiles */, D29DF27021E79B2C003B2FB9 /* OtherHandlers */, - D29DF14E21E693BB003B2FB9 /* Session */, D29DF13A21E68682003B2FB9 /* Utility */, D29DF13321E68604003B2FB9 /* Styles */, D29DF11021E6805F003B2FB9 /* Categories */, @@ -415,6 +422,8 @@ children = ( D29DF2B721E7BE79003B2FB9 /* TabBarController */, D29DF2B621E7BE66003B2FB9 /* SplitViewController */, + D206997521FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.h */, + D206997621FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.m */, ); path = Containers; sourceTree = ""; @@ -472,15 +481,6 @@ path = Sizing; sourceTree = ""; }; - D29DF14E21E693BB003B2FB9 /* Session */ = { - isa = PBXGroup; - children = ( - D29DF27721E7A533003B2FB9 /* MVMCoreUISession.h */, - D29DF27821E7A533003B2FB9 /* MVMCoreUISession.m */, - ); - path = Session; - sourceTree = ""; - }; D29DF16821E69E1F003B2FB9 /* Buttons */ = { isa = PBXGroup; children = ( @@ -574,6 +574,10 @@ D29DF27021E79B2C003B2FB9 /* OtherHandlers */ = { isa = PBXGroup; children = ( + D28B4F8821FF967C00712C7A /* MVMCoreUIObject.h */, + D28B4F8921FF967C00712C7A /* MVMCoreUIObject.m */, + D29DF27721E7A533003B2FB9 /* MVMCoreUISession.h */, + D29DF27821E7A533003B2FB9 /* MVMCoreUISession.m */, D29DF27321E79E81003B2FB9 /* MVMCoreUILoggingHandler.h */, D29DF27421E79E81003B2FB9 /* MVMCoreUILoggingHandler.m */, D2C5001621F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.h */, @@ -650,6 +654,7 @@ D29DF26421E6A9D9003B2FB9 /* MFTransparentGIFView.h in Headers */, D29DF27921E7A533003B2FB9 /* MVMCoreUISession.h in Headers */, D29DF25C21E6A2B6003B2FB9 /* DashLine.h in Headers */, + D206997721FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.h in Headers */, D29DF29D21E7AE38003B2FB9 /* MFStyler.h in Headers */, D29DF2B021E7B3A4003B2FB9 /* MFTextView.h in Headers */, D29DF2A921E7B2F9003B2FB9 /* MVMCoreUIConstants.h in Headers */, @@ -688,6 +693,7 @@ D29DF16221E69996003B2FB9 /* MFViewController.h in Headers */, D29DF13121E6851E003B2FB9 /* MVMCoreUITopAlertExpandableView.h in Headers */, D29DF2C421E7BF57003B2FB9 /* MFTabBarSwipeAnimator.h in Headers */, + D28B4F8A21FF967C00712C7A /* MVMCoreUIObject.h in Headers */, D29DF2CA21E7BFC8003B2FB9 /* MFSizeThreshold.h in Headers */, D29770F821F7C73800B2F0D0 /* PrimaryButtonView.h in Headers */, D29DF28021E7AA51003B2FB9 /* MVMCoreUIDetailViewProtocol.h in Headers */, @@ -813,6 +819,7 @@ D29DF25421E6A177003B2FB9 /* MFMdnTextField.m in Sources */, D29DF26521E6A9D9003B2FB9 /* MFTransparentGIFView.m in Sources */, D29DF13021E6851E003B2FB9 /* MVMCoreUITopAlertShortView.m in Sources */, + D28B4F8B21FF967C00712C7A /* MVMCoreUIObject.m in Sources */, D29DF26D21E6AA0B003B2FB9 /* FLAnimatedImageView.m in Sources */, D29DF2EF21ECEAE1003B2FB9 /* MFFonts.m in Sources */, D29DF2AE21E7B3A4003B2FB9 /* MFTextView.m in Sources */, @@ -823,6 +830,7 @@ D29DF2BF21E7BEA4003B2FB9 /* MVMCoreUITabBarPageControlViewController.m in Sources */, D29DF28321E7AB24003B2FB9 /* MVMCoreUICommonViewsUtility.m in Sources */, D29DF28A21E7AC2B003B2FB9 /* MFLabel.m in Sources */, + D206997821FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.m in Sources */, D29DF27A21E7A533003B2FB9 /* MVMCoreUISession.m in Sources */, 01DF55E021F8FAA800CC099B /* MFTextFieldListView.swift in Sources */, D29DF2C921E7BFC6003B2FB9 /* MFSizeObject.m in Sources */, diff --git a/MVMCoreUI/Atoms/Views/MFLabel.h b/MVMCoreUI/Atoms/Views/MFLabel.h index 1284137b..a7386425 100644 --- a/MVMCoreUI/Atoms/Views/MFLabel.h +++ b/MVMCoreUI/Atoms/Views/MFLabel.h @@ -74,4 +74,7 @@ - (void)styleB1:(BOOL)scale; - (void)styleTableRow:(BOOL)scale; +// Without color +- (void)setFontH1:(BOOL)scale; + @end diff --git a/MVMCoreUI/Atoms/Views/MFLabel.m b/MVMCoreUI/Atoms/Views/MFLabel.m index 9167884e..39aeb851 100644 --- a/MVMCoreUI/Atoms/Views/MFLabel.m +++ b/MVMCoreUI/Atoms/Views/MFLabel.m @@ -308,6 +308,11 @@ [self setScale:scale]; } +- (void)setFontH1:(BOOL)scale { + self.font = [MFStyler fontH1:NO]; + [self setScale:scale]; +} + - (void)setAccessibilityTraits:(UIAccessibilityTraits)accessibilityTraits { if (accessibilityTraits& UIAccessibilityTraitHeader) { diff --git a/MVMCoreUI/BaseControllers/MFViewController.m b/MVMCoreUI/BaseControllers/MFViewController.m index 9ae4d2a0..383d923a 100644 --- a/MVMCoreUI/BaseControllers/MFViewController.m +++ b/MVMCoreUI/BaseControllers/MFViewController.m @@ -35,7 +35,7 @@ #import "MVMCoreUISession.h" #import "MVMCoreUILoggingHandler.h" #import "MVMCoreUITabBarPageControlViewController.h" - +#import "MVMCoreUINavigationControllerViewController.h" @import MVMAnimationFramework; @interface MFViewController () @@ -290,7 +290,7 @@ [[MVMCoreUISession sharedGlobal].splitViewController setNavigationIconColor:navigationBarTintColor]; // Update separator. - UIView *separatorView = (UIView *)[MVMCoreUISession sharedGlobal].splitViewController.navigationBarSeparator; + UIView *separatorView = (UIView *)[MVMCoreUISession sharedGlobal].navigationController.separatorView; separatorView.hidden = ([self isKindOfClass:[MVMCoreUITabBarPageControlViewController class]] || self.manager || self.loadObject.requestParameters.tabWasPressed); diff --git a/MVMCoreUI/BaseControllers/TopLabelsAndBottomButtonsTableViewController.h b/MVMCoreUI/BaseControllers/TopLabelsAndBottomButtonsTableViewController.h index e518e0da..04defbb4 100644 --- a/MVMCoreUI/BaseControllers/TopLabelsAndBottomButtonsTableViewController.h +++ b/MVMCoreUI/BaseControllers/TopLabelsAndBottomButtonsTableViewController.h @@ -33,8 +33,6 @@ - (void)showFooter; - (void)hideFooter; -- (void)tryToCleanUpMemory; - // showing/hiding left and right primary buttons - (void)setPrimaryLeftButtonHidden:(BOOL)left rightButtonHidden:(BOOL)right; diff --git a/MVMCoreUI/BaseControllers/TopLabelsAndBottomButtonsTableViewController.m b/MVMCoreUI/BaseControllers/TopLabelsAndBottomButtonsTableViewController.m index 2711aae9..0d4f7ebe 100644 --- a/MVMCoreUI/BaseControllers/TopLabelsAndBottomButtonsTableViewController.m +++ b/MVMCoreUI/BaseControllers/TopLabelsAndBottomButtonsTableViewController.m @@ -37,19 +37,6 @@ @implementation TopLabelsAndBottomButtonsTableViewController -- (void)backButtonPressed { - [super backButtonPressed]; - - //[self tryToCleanUpMemory]; -} - -- (void)tryToCleanUpMemory { - //[self.footerView removeFromSuperview]; - //self.footerView = nil; - //self.footerAccessoryView = nil; - //self.bottomView = nil; -} - - (void)initialLoad { [super initialLoad]; self.rebuildUIOnSizeChange = YES; @@ -156,9 +143,11 @@ [self.tableView reloadData]; } --(void)setHeadlineAndMessage { - [self.topLabelsView setHeadlineString:[[self mapForTopLabels] stringForKey:KeyTitle] messageString:[[self mapForTopLabels] stringForKey:KeyMessage]]; + +- (void)setHeadlineAndMessage { + [self.topLabelsView setWithJSON:[self mapForTopLabels]]; } + - (void)updateViewConstraints { [super updateViewConstraints]; @@ -217,10 +206,6 @@ } } -- (void)viewDidLoad { - [super viewDidLoad]; -} - - (void)setUpHeaderAccessoryView { UIView *headerAccessoryView = [[UIView alloc] initWithFrame:CGRectZero]; headerAccessoryView.translatesAutoresizingMaskIntoConstraints = NO; diff --git a/MVMCoreUI/BaseControllers/TopLabelsAndBottomButtonsViewController.m b/MVMCoreUI/BaseControllers/TopLabelsAndBottomButtonsViewController.m index e29c26dc..cc7cd627 100644 --- a/MVMCoreUI/BaseControllers/TopLabelsAndBottomButtonsViewController.m +++ b/MVMCoreUI/BaseControllers/TopLabelsAndBottomButtonsViewController.m @@ -113,6 +113,7 @@ self.topLabelsView = topLabelsView; topView = topLabelsView; self.topView = topView; + [topLabelsView setWithJSON:[self mapForTopLabels]]; } [self.contentView addSubview:topView]; [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[topView]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(topView)]]; @@ -263,11 +264,6 @@ [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[topBetweenEdgeView]-0-[spacer]-0-[bottomBetweenEdgeView]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(topBetweenEdgeView,spacer,bottomBetweenEdgeView)]]; } - - if (self.topLabelsView) { - [self.topLabelsView setHeadlineString:[[self mapForTopLabels] stringForKey:KeyTitle] messageString:[[self mapForTopLabels] stringForKey:KeyMessage]]; - } - } - (void)updateViewConstraints { diff --git a/MVMCoreUI/Containers/MVMCoreUINavigationControllerViewController.h b/MVMCoreUI/Containers/MVMCoreUINavigationControllerViewController.h new file mode 100644 index 00000000..2fe06d1e --- /dev/null +++ b/MVMCoreUI/Containers/MVMCoreUINavigationControllerViewController.h @@ -0,0 +1,28 @@ +// +// MVMCoreUINavigationControllerViewController.h +// MVMCoreUI +// +// Created by Scott Pfeil on 1/25/19. +// Copyright © 2019 Verizon Wireless. All rights reserved. +// + +#import +@class SeparatorView; +NS_ASSUME_NONNULL_BEGIN + +@interface MVMCoreUINavigationControllerViewController : UINavigationController + +// Convenience getter ++ (nullable instancetype)navigationController; + +// Returns a navigation controller with the mvm styling. Also sets the navigation controller in the appropriate handlers. ++ (nullable instancetype)setupNavigationController; + +// Returns a navigation controller with the mvm styling. Also sets the navigation controller in the appropriate handlers. Adds the default loading overlay screen as well. ++ (nullable instancetype)setupWithNavigationControllerAsMainController; + +// Separator at the bottom of the navigation bar used for styling. +@property (nullable, weak, nonatomic) SeparatorView *separatorView; +@end + +NS_ASSUME_NONNULL_END diff --git a/MVMCoreUI/Containers/MVMCoreUINavigationControllerViewController.m b/MVMCoreUI/Containers/MVMCoreUINavigationControllerViewController.m new file mode 100644 index 00000000..f0143315 --- /dev/null +++ b/MVMCoreUI/Containers/MVMCoreUINavigationControllerViewController.m @@ -0,0 +1,52 @@ +// +// MVMCoreUINavigationControllerViewController.m +// MVMCoreUI +// +// Created by Scott Pfeil on 1/25/19. +// Copyright © 2019 Verizon Wireless. All rights reserved. +// + +#import "MVMCoreUINavigationControllerViewController.h" +#import "UIColor+MFConvenience.h" +#import "SeparatorView.h" +#import "MFFonts.h" +#import "MFSizeObject.h" +#import "MVMCoreUISession.h" +@import MVMCore.MVMCoreActionUtility; +@import MVMCore.MVMCoreNavigationHandler; +@interface MVMCoreUINavigationControllerViewController () + +@end + +@implementation MVMCoreUINavigationControllerViewController + ++ (nullable instancetype)navigationController { + return [MVMCoreActionUtility initializerClassCheck:[MVMCoreUISession sharedGlobal].navigationController classToVerify:self]; +} + ++ (nullable instancetype)setupNavigationController { + MVMCoreUINavigationControllerViewController *navigationController = [[MVMCoreUINavigationControllerViewController alloc] init]; + [UIColor mfSetBackgroundColorForNavigationBar:[UIColor whiteColor] navigationBar:navigationController.navigationBar transparent:NO]; + [navigationController.navigationBar setShadowImage:[[UIImage alloc] init]]; + navigationController.navigationBar.translucent = NO; + navigationController.navigationBar.opaque = YES; + navigationController.navigationBar.tintColor = [UIColor blackColor]; + navigationController.separatorView = [SeparatorView separatorAddToView:navigationController.navigationBar position:SeparatorPositionBot withHorizontalPadding:0]; + [navigationController.separatorView setAsLight]; + [navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[MFFonts mfFont75Bd:[[MFSizeObject sizeObjectWithStandardSize:14 standardiPadPortraitSize:16 iPadProLandscapeSize:18] getValueBasedOnScreenSize]]}]; + + // Set standard + [MVMCoreUISession sharedGlobal].navigationController = navigationController; + [MVMCoreNavigationHandler sharedNavigationHandler].navigationController = navigationController; + [MVMCoreNavigationHandler sharedNavigationHandler].viewControllerToPresentOn = navigationController; + + return navigationController; +} + ++ (nullable instancetype)setupWithNavigationControllerAsMainController { + MVMCoreUINavigationControllerViewController *navigationController = [self setupNavigationController]; + [[MVMCoreUISession sharedGlobal] setupAsStandardLoadViewDelegate:navigationController]; + return navigationController; +} + +@end diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h index 2fb3c0e6..a5e5b6a9 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h @@ -9,11 +9,10 @@ #import @import MVMCore.MVMCoreActionDelegateProtocol; -@import MVMCore.MVMCoreLoadingOverlayDelegateProtocol; #import #import -@class SeparatorView; +@class MVMCoreUINavigationControllerViewController; @class MVMCoreUITopAlertView; @class MFViewController; @@ -23,7 +22,7 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) { MFTwoDrawer }; -@interface MVMCoreUISplitViewController : UIViewController +@interface MVMCoreUISplitViewController : UIViewController // Reference to the panels. @property (nullable, weak, nonatomic, readonly) UIViewController *leftPanel; @@ -35,11 +34,10 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) { @property (nullable, strong, nonatomic) UIBarButtonItem *backButton; -@property (nullable, weak, nonatomic, readonly) UINavigationController *navigationController; +@property (nullable, weak, nonatomic, readonly) MVMCoreUINavigationControllerViewController *navigationController; // Reference to the top alert view @property (nullable, weak, nonatomic) MVMCoreUITopAlertView *topAlertView; -@property (nullable, strong, nonatomic) SeparatorView *navigationBarSeparator; // References to the current navigation item settings. @property (nonatomic, readonly) BOOL leftPanelIsAccessible; @@ -49,6 +47,12 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) { // Convenience getter + (nullable instancetype)mainSplitViewController; +// Returns a split controller with the mvm styling. Also sets the appropriate handlers. ++ (nullable instancetype)setup; + +// Returns a split controller with the mvm styling. Also sets the appropriate handlers. Also sets up the default load screen ++ (nullable instancetype)setupAsMainController; + #pragma mark - Panel Functions // Sets if the left panel accessible for the view controller. Will show or hide the button. diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m index eadd6d57..bd150f59 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m @@ -9,21 +9,21 @@ #import "MVMCoreUISplitViewController.h" @import MVMCore.MVMCoreNavigationHandler; @import MVMCore.MVMCoreDispatchUtility; -@import MVMCore.MVMCoreViewControllerProtocol; @import MVMCore.MVMCoreViewManagerProtocol; @import MVMCore.MVMCoreObject; +@import MVMCore.MVMCoreActionUtility; #import "MVMCoreUIUtility.h" #import "UIColor+MFConvenience.h" #import "NSLayoutConstraint+MFConvenience.h" #import "MFViewController.h" #import "MFFonts.h" -#import "MFLoadingViewController.h" #import #import "SeparatorView.h" #import "MVMCoreUISession.h" #import "MVMCoreUIConstants.h" #import "MVMCoreUICommonViewsUtility.h" #import "MVMCoreUITopAlertView.h" +#import "MVMCoreUINavigationControllerViewController.h" @interface MVMCoreUISplitViewController () @@ -40,7 +40,7 @@ @property (weak, nonatomic, readwrite) UIViewController *leftPanel; @property (weak, nonatomic, readwrite) UIViewController *rightPanel; -@property (weak, nonatomic, readwrite) UINavigationController *navigationController; +@property (weak, nonatomic, readwrite) MVMCoreUINavigationControllerViewController *navigationController; // A view that covers the detail view when the master is out. @property (weak, nonatomic) IBOutlet UIView *mainViewCoverView; @@ -48,8 +48,6 @@ @property (weak, nonatomic) IBOutlet UIProgressView *bottomProgressBar; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *bottomProgressBarHeightConstraint; -@property (weak, nonatomic) MFLoadingViewController *loadingViewController; - @property (nonatomic, strong) UIGestureRecognizer *tapToDismissGesture; @property (nullable, readwrite, weak, nonatomic) NSObject *explictlyShowingPanel; @@ -77,7 +75,19 @@ typedef NS_OPTIONS(NSInteger, MFExtendedDrawer) { CGFloat const PanelAnimationDuration = 0.2; + (instancetype)mainSplitViewController { - return [MVMCoreUISession sharedGlobal].splitViewController; + return [MVMCoreActionUtility initializerClassCheck:[MVMCoreUISession sharedGlobal].splitViewController classToVerify:self]; +} + ++ (nullable instancetype)setup { + MVMCoreUISplitViewController *splitViewController = [[self alloc] init]; + [MVMCoreUISession sharedGlobal].splitViewController = splitViewController; + return splitViewController; +} + ++ (nullable instancetype)setupAsMainController { + MVMCoreUISplitViewController *splitViewController = [self setup]; + [[MVMCoreUISession sharedGlobal] setupAsStandardLoadViewDelegate:splitViewController]; + return splitViewController; } #pragma mark - Main Subclassables @@ -669,20 +679,10 @@ CGFloat const PanelAnimationDuration = 0.2; } // The main view. - UINavigationController *navigationController = [[UINavigationController alloc] init]; + MVMCoreUINavigationControllerViewController *navigationController = [MVMCoreUINavigationControllerViewController setupNavigationController]; self.navigationController = navigationController; self.automaticallyAdjustsScrollViewInsets = NO; - // Sets the navigation bar style - [UIColor mfSetBackgroundColorForNavigationBar:[UIColor whiteColor] navigationBar:navigationController.navigationBar transparent:NO]; - [navigationController.navigationBar setShadowImage:[[UIImage alloc] init]]; - navigationController.navigationBar.translucent = NO; - navigationController.navigationBar.opaque = YES; - navigationController.navigationBar.tintColor = [UIColor blackColor]; - self.navigationBarSeparator = [SeparatorView separatorAddToView:navigationController.navigationBar position:SeparatorPositionBot withHorizontalPadding:0]; - [self.navigationBarSeparator setAsLight]; - [navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[MFFonts mfFont75Bd:[[MFSizeObject sizeObjectWithStandardSize:14 standardiPadPortraitSize:16 iPadProLandscapeSize:18] getValueBasedOnScreenSize]]}]; - UIView *mainView = navigationController.view; mainView.translatesAutoresizingMaskIntoConstraints = NO; [self addChildViewController:navigationController]; @@ -890,7 +890,7 @@ CGFloat const PanelAnimationDuration = 0.2; } - (UIViewController *)getCurrentVisibleController { - UIViewController *baseViewController = [MVMCoreNavigationHandler sharedNavigationHandler].viewControllerToPresentOn; + UIViewController *baseViewController = [MVMCoreNavigationHandler sharedNavigationHandler].viewControllerToPresentOn ?: [UIApplication sharedApplication].keyWindow.rootViewController; UIViewController *viewController = nil; while (baseViewController.presentedViewController && !baseViewController.presentedViewController.isBeingDismissed) { viewController = baseViewController.presentedViewController; @@ -934,39 +934,4 @@ CGFloat const PanelAnimationDuration = 0.2; } } -#pragma mark - MVMCoreLoadingOverlayDelegateProtocol - -- (nonnull UIViewController *)getLoadingViewController { - - if (self.loadingViewController) { - return self.loadingViewController; - } else { - MFLoadingViewController *loadingViewController = [[MFLoadingViewController alloc] init]; - UIView *view = loadingViewController.view; - view.hidden = YES; - self.loadingViewController = loadingViewController; - - // Adds the overlay to the screen. - UIView *viewToPresentOn = self.view; - - [self addChildViewController:loadingViewController]; - [viewToPresentOn addSubview:view]; - [loadingViewController didMoveToParentViewController:self]; - - // Sets the constraints for autolayout - [view setTranslatesAutoresizingMaskIntoConstraints:NO]; - [NSLayoutConstraint constraintPinSubviewToSuperview:view]; - return loadingViewController; - } -} - -- (void)beginningLoading { - // Disables the UI when loading - self.view.userInteractionEnabled = NO; -} - -- (void)finishedLoading { - self.view.userInteractionEnabled = YES; -} - @end diff --git a/MVMCoreUI/MVMCoreUI.h b/MVMCoreUI/MVMCoreUI.h index 4779ba75..7821c746 100644 --- a/MVMCoreUI/MVMCoreUI.h +++ b/MVMCoreUI/MVMCoreUI.h @@ -25,6 +25,7 @@ FOUNDATION_EXPORT const unsigned char MVMCoreUIVersionString[]; #import #pragma mark - OtherHandlers +#import #import #import @@ -54,6 +55,8 @@ FOUNDATION_EXPORT const unsigned char MVMCoreUIVersionString[]; #import #pragma mark - Containers +#import + #import #import #import diff --git a/MVMCoreUI/Molecules/TopLabelsView.h b/MVMCoreUI/Molecules/TopLabelsView.h index e4e6494a..04c2d8be 100644 --- a/MVMCoreUI/Molecules/TopLabelsView.h +++ b/MVMCoreUI/Molecules/TopLabelsView.h @@ -50,4 +50,7 @@ - (void)setLeftConstant:(CGFloat)leftConstant; - (void)setRightConstant:(CGFloat)rightConstant; +// Sets up the ui based on the json +- (void)setWithJSON:(nullable NSDictionary *)json; + @end diff --git a/MVMCoreUI/Molecules/TopLabelsView.m b/MVMCoreUI/Molecules/TopLabelsView.m index 54275f75..028fcf32 100644 --- a/MVMCoreUI/Molecules/TopLabelsView.m +++ b/MVMCoreUI/Molecules/TopLabelsView.m @@ -14,6 +14,7 @@ #import #import #import +#import @interface TopLabelsView () @@ -30,8 +31,6 @@ @implementation TopLabelsView - - - (nullable instancetype)initWithTableView:(nullable TopLabelsAndBottomButtonsTableViewController *)tableView { if (self = [super init]) { self.tableView = tableView; @@ -216,5 +215,31 @@ self.rightConstraintSeparator.constant = rightConstant; } +- (void)setWithJSON:(nullable NSDictionary *)json { + [self setHeadlineString:[json stringForKey:KeyTitle] messageString:[json stringForKey:KeyMessage]]; + UIColor *textColor = [self colorForTopLabelsWithJSON:json]; + self.headlineLabel.textColor = textColor; + self.messageLabel.textColor = textColor; + self.backgroundColor = [self colorForBackgroundWithJSON:json]; + self.separatorView.hidden = ![json boolForKey:@"showBottomLine"]; +} + +- (nonnull UIColor *)colorForTopLabelsWithJSON:(nullable NSDictionary *)json { + NSString *titleColor = [json string:@"titleBgColor"]; + if (titleColor) { + return [UIColor mfGetColorForHex:titleColor]; + } else { + return [UIColor blackColor]; + } +} + +- (nonnull UIColor *)colorForBackgroundWithJSON:(nullable NSDictionary *)json { + NSString *color = [json string:@"backgroundColor"]; + if (color) { + return [UIColor mfGetColorForHex:color]; + } else { + return [UIColor clearColor]; + } +} @end diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUIObject.h b/MVMCoreUI/OtherHandlers/MVMCoreUIObject.h new file mode 100644 index 00000000..f9a3510d --- /dev/null +++ b/MVMCoreUI/OtherHandlers/MVMCoreUIObject.h @@ -0,0 +1,17 @@ +// +// MVMCoreUIObject.h +// MVMCoreUI +// +// Created by Scott Pfeil on 1/28/19. +// Copyright © 2019 Verizon Wireless. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface MVMCoreUIObject : MVMCoreObject + +@end + +NS_ASSUME_NONNULL_END diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUIObject.m b/MVMCoreUI/OtherHandlers/MVMCoreUIObject.m new file mode 100644 index 00000000..4c601e46 --- /dev/null +++ b/MVMCoreUI/OtherHandlers/MVMCoreUIObject.m @@ -0,0 +1,26 @@ +// +// MVMCoreUIObject.m +// MVMCoreUI +// +// Created by Scott Pfeil on 1/28/19. +// Copyright © 2019 Verizon Wireless. All rights reserved. +// + +#import "MVMCoreUIObject.h" +#import "MVMCoreUISession.h" +#import "MVMCoreUIViewControllerMappingObject.h" +#import "MVMCoreUILoggingHandler.h" + +@implementation MVMCoreUIObject + +- (void)defaultInitialSetup { + self.cache = [[MVMCoreCache alloc] init]; + self.sessionHandler = [[MVMCoreSessionTimeHandler alloc] init]; + self.actionHandler = [[MVMCoreActionHandler alloc] init]; + + self.session = [[MVMCoreUISession alloc] init]; + self.viewControllerMapping = [[MVMCoreUIViewControllerMappingObject alloc] init]; + self.loggingDelegate = [[MVMCoreUILoggingHandler alloc] init]; +} + +@end diff --git a/MVMCoreUI/Session/MVMCoreUISession.h b/MVMCoreUI/OtherHandlers/MVMCoreUISession.h similarity index 53% rename from MVMCoreUI/Session/MVMCoreUISession.h rename to MVMCoreUI/OtherHandlers/MVMCoreUISession.h index b3867ddd..72e7728e 100644 --- a/MVMCoreUI/Session/MVMCoreUISession.h +++ b/MVMCoreUI/OtherHandlers/MVMCoreUISession.h @@ -11,12 +11,16 @@ @class MVMCoreUITopAlertView; @class MVMCoreUISplitViewController; @class MFViewController; +@class MVMCoreUINavigationControllerViewController; +@class MFLoadingViewController; NS_ASSUME_NONNULL_BEGIN @interface MVMCoreUISession : MVMCoreSessionObject -@property (strong, nonatomic, nullable) MVMCoreUITopAlertView *topAlertView; -@property (strong, nonatomic, nullable) MVMCoreUISplitViewController *splitViewController; +@property (weak, nonatomic, nullable) MVMCoreUITopAlertView *topAlertView; +@property (weak, nonatomic, nullable) MVMCoreUISplitViewController *splitViewController; +@property (weak, nonatomic, nullable) MVMCoreUINavigationControllerViewController *navigationController; +@property (weak, nonatomic, nullable) MFLoadingViewController *loadingViewController; // for handscroll Animation on subclasses of MFScrollingViewController @property (assign, nonatomic) BOOL enableHandScrollAnimation; @@ -27,6 +31,9 @@ NS_ASSUME_NONNULL_BEGIN // Allows a global overload of the title view of navigation item. - (nullable UIView *)titleViewForController:(nonnull MFViewController *)controller; +// Sets up the session as delegate for standard load view controller. Pass the view controller that will be used to present and will be disabled when load view is presented. +- (void)setupAsStandardLoadViewDelegate:(nonnull UIViewController *)mainViewController; + @end NS_ASSUME_NONNULL_END diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUISession.m b/MVMCoreUI/OtherHandlers/MVMCoreUISession.m new file mode 100644 index 00000000..433b1ab1 --- /dev/null +++ b/MVMCoreUI/OtherHandlers/MVMCoreUISession.m @@ -0,0 +1,65 @@ +// +// MVMCoreUISession.m +// MVMCoreUI +// +// Created by Scott Pfeil on 1/10/19. +// Copyright © 2019 Verizon Wireless. All rights reserved. +// + +#import "MVMCoreUISession.h" +#import "MFLoadingViewController.h" +#import "NSLayoutConstraint+MFConvenience.h" +@import MVMCore.MVMCoreObject; + +@interface MVMCoreUISession () + +@property (weak, nonatomic, nullable) UIViewController *mainViewController; + +@end + +@implementation MVMCoreUISession + +- (nullable UIView *)titleViewForController:(nonnull MFViewController *)controller { + return nil; +} + +- (void)setupAsStandardLoadViewDelegate:(nonnull UIViewController *)mainViewController { + self.mainViewController = mainViewController; + [MVMCoreObject sharedInstance].loadingProtocol = self; +} + +#pragma mark - MVMCoreLoadingOverlayDelegateProtocol + +- (nonnull UIViewController *)getLoadingViewController { + + if (self.loadingViewController) { + return self.loadingViewController; + } else { + MFLoadingViewController *loadingViewController = [[MFLoadingViewController alloc] init]; + UIView *view = loadingViewController.view; + view.hidden = YES; + self.loadingViewController = loadingViewController; + + // Adds the overlay to the screen. + UIView *viewToPresentOn = self.mainViewController.view; + [self.mainViewController addChildViewController:loadingViewController]; + [viewToPresentOn addSubview:view]; + [loadingViewController didMoveToParentViewController:self.mainViewController]; + + // Sets the constraints for autolayout + [view setTranslatesAutoresizingMaskIntoConstraints:NO]; + [NSLayoutConstraint constraintPinSubviewToSuperview:view]; + return loadingViewController; + } +} + +- (void)beginningLoading { + // Disables the UI when loading + self.mainViewController.view.userInteractionEnabled = NO; +} + +- (void)finishedLoading { + self.mainViewController.view.userInteractionEnabled = YES; +} + +@end diff --git a/MVMCoreUI/Session/MVMCoreUISession.m b/MVMCoreUI/Session/MVMCoreUISession.m deleted file mode 100644 index afe99b76..00000000 --- a/MVMCoreUI/Session/MVMCoreUISession.m +++ /dev/null @@ -1,17 +0,0 @@ -// -// MVMCoreUISession.m -// MVMCoreUI -// -// Created by Scott Pfeil on 1/10/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -#import "MVMCoreUISession.h" - -@implementation MVMCoreUISession - -- (nullable UIView *)titleViewForController:(nonnull MFViewController *)controller { - return nil; -} - -@end diff --git a/MVMCoreUI/Templates/MVMCoreUILargeHeaderSingleLabelTemplate.h b/MVMCoreUI/Templates/MVMCoreUILargeHeaderSingleLabelTemplate.h index 75a7474e..a73dd8cc 100644 --- a/MVMCoreUI/Templates/MVMCoreUILargeHeaderSingleLabelTemplate.h +++ b/MVMCoreUI/Templates/MVMCoreUILargeHeaderSingleLabelTemplate.h @@ -8,10 +8,22 @@ #import #import - +@class LabelView; +@class LabelWithInternalButton; NS_ASSUME_NONNULL_BEGIN @interface MVMCoreUILargeHeaderSingleLabelTemplate : TopLabelsAndBottomButtonsViewController + +// A label that can go below the top labels. Can be a normal label or one with internal buttons. +@property (nullable, weak, nonatomic) LabelView *labelViewUnderTopLabels; +@property (nullable, weak, nonatomic) LabelWithInternalButton *labelUnderTopLabelsWithInternalButton; + +// Override to specifiy the label under top label. Default uses the value for key "description" in the page json. +- (nullable NSString *)stringForLabelUnderTopLabels; + +// Override to specifiy the label under top label with internal button. Default uses the value for key "Link" in the "ButtonMap" of the page json. +- (nullable NSDictionary *)actionMapForLabelUnderTopLabelsWithInternalButton; + @end NS_ASSUME_NONNULL_END diff --git a/MVMCoreUI/Templates/MVMCoreUILargeHeaderSingleLabelTemplate.m b/MVMCoreUI/Templates/MVMCoreUILargeHeaderSingleLabelTemplate.m index b11a8871..6f00dc6e 100644 --- a/MVMCoreUI/Templates/MVMCoreUILargeHeaderSingleLabelTemplate.m +++ b/MVMCoreUI/Templates/MVMCoreUILargeHeaderSingleLabelTemplate.m @@ -13,19 +13,13 @@ @interface MVMCoreUILargeHeaderSingleLabelTemplate () -// A label that can go below the top labels. Can be a normal label or one with internal buttons. -@property (nullable, weak, nonatomic) LabelView *labelViewUnderTopLabels; -@property (nullable, weak, nonatomic) LabelWithInternalButton *labelUnderTopLabelsWithInternalButton; - @end @implementation MVMCoreUILargeHeaderSingleLabelTemplate - (void)newDataBuildScreen { [super newDataBuildScreen]; - [self.topLabelsView.headlineLabel styleH1:YES]; - self.topLabelsView.separatorView.hidden = YES; - [self updateTopLabelsColor]; + [self.topLabelsView.headlineLabel setFontH1:YES]; } - (void)initialLoad { @@ -81,18 +75,6 @@ // Dispose of any resources that can be recreated. } -#pragma mark - Top labels style - -- (void)updateTopLabelsColor { - self.topLabelsView.headlineLabel.textColor = [UIColor blackColor]; - self.topLabelsView.messageLabel.textColor = [UIColor blackColor]; - NSString *titleColor = [[self mapForTopLabels] string:@"titleBgColor"]; - if (titleColor) { - self.topLabelsView.headlineLabel.textColor = [UIColor mfGetColorForHex:titleColor]; - self.topLabelsView.messageLabel.textColor = [UIColor mfGetColorForHex:titleColor]; - } -} - - (UIEdgeInsets)paddingForTopLabels { UIEdgeInsets edge = [super paddingForTopLabels]; edge.bottom = PaddingTwo;