Merge pull request #6 in BPHVB/mvm_core_ui from feature/migration to develop

* commit 'ddd5970546a82883f27e65de1aef9b2e0b8720db':
  exposed the loading
  replace type
  Convenience for setting up session and core object
  Convenience for load screen re-link framework
  default presentation view controller. Re-use function
  remove old code
  fix to class check for nil convenience functions init functions
  attempt to standardize json for top labels
This commit is contained in:
Pfeil, Scott Robert 2019-01-29 10:05:40 -05:00
commit 8b4ab2c075
21 changed files with 304 additions and 137 deletions

View File

@ -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 = "<group>"; };
D206997621FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUINavigationControllerViewController.m; sourceTree = "<group>"; };
D28B4F8821FF967C00712C7A /* MVMCoreUIObject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIObject.h; sourceTree = "<group>"; };
D28B4F8921FF967C00712C7A /* MVMCoreUIObject.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUIObject.m; sourceTree = "<group>"; };
01DF55DF21F8FAA800CC099B /* MFTextFieldListView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MFTextFieldListView.swift; sourceTree = "<group>"; };
01DF566F21FA5AB300CC099B /* MVMCoreUITextFieldListFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MVMCoreUITextFieldListFormViewController.swift; sourceTree = "<group>"; };
D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopLabelsView.m; sourceTree = "<group>"; };
@ -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 = "<group>";
@ -472,15 +481,6 @@
path = Sizing;
sourceTree = "<group>";
};
D29DF14E21E693BB003B2FB9 /* Session */ = {
isa = PBXGroup;
children = (
D29DF27721E7A533003B2FB9 /* MVMCoreUISession.h */,
D29DF27821E7A533003B2FB9 /* MVMCoreUISession.m */,
);
path = Session;
sourceTree = "<group>";
};
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 */,

View File

@ -74,4 +74,7 @@
- (void)styleB1:(BOOL)scale;
- (void)styleTableRow:(BOOL)scale;
// Without color
- (void)setFontH1:(BOOL)scale;
@end

View File

@ -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) {

View File

@ -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);

View File

@ -33,8 +33,6 @@
- (void)showFooter;
- (void)hideFooter;
- (void)tryToCleanUpMemory;
// showing/hiding left and right primary buttons
- (void)setPrimaryLeftButtonHidden:(BOOL)left rightButtonHidden:(BOOL)right;

View File

@ -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;

View File

@ -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 {

View File

@ -0,0 +1,28 @@
//
// MVMCoreUINavigationControllerViewController.h
// MVMCoreUI
//
// Created by Scott Pfeil on 1/25/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
#import <UIKit/UIKit.h>
@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

View File

@ -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

View File

@ -9,11 +9,10 @@
#import <UIKit/UIKit.h>
@import MVMCore.MVMCoreActionDelegateProtocol;
@import MVMCore.MVMCoreLoadingOverlayDelegateProtocol;
#import <MVMCoreUI/MVMCoreUIPanelProtocol.h>
#import <MVMCoreUI/MVMCoreUIPanelButtonProtocol.h>
@class SeparatorView;
@class MVMCoreUINavigationControllerViewController;
@class MVMCoreUITopAlertView;
@class MFViewController;
@ -23,7 +22,7 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) {
MFTwoDrawer
};
@interface MVMCoreUISplitViewController : UIViewController <MVMCoreLoadingOverlayDelegateProtocol>
@interface MVMCoreUISplitViewController : UIViewController
// Reference to the panels.
@property (nullable, weak, nonatomic, readonly) UIViewController <MVMCoreUIPanelProtocol> *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.

View File

@ -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 <MVMCoreUI/MFSizeObject.h>
#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 <MVMCoreUIPanelProtocol> *leftPanel;
@property (weak, nonatomic, readwrite) UIViewController <MVMCoreUIPanelProtocol> *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 <MVMCoreUIPanelProtocol> *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 <MVMCoreLoadingViewControllerProtocol> *)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

View File

@ -25,6 +25,7 @@ FOUNDATION_EXPORT const unsigned char MVMCoreUIVersionString[];
#import <MVMCoreUI/MVMCoreUITopAlertExpandableView.h>
#pragma mark - OtherHandlers
#import <MVMCoreUI/MVMCoreUIObject.h>
#import <MVMCoreUI/MVMCoreUILoggingHandler.h>
#import <MVMCoreUI/MVMCoreUIViewControllerMappingObject.h>
@ -54,6 +55,8 @@ FOUNDATION_EXPORT const unsigned char MVMCoreUIVersionString[];
#import <MVMCoreUI/TopLabelsAndBottomButtonsTableViewController.h>
#pragma mark - Containers
#import <MVMCoreUI/MVMCoreUINavigationControllerViewController.h>
#import <MVMCoreUI/MVMCoreUIPanelProtocol.h>
#import <MVMCoreUI/MVMCoreUIDetailViewProtocol.h>
#import <MVMCoreUI/MVMCoreUIPanelButtonProtocol.h>

View File

@ -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

View File

@ -14,6 +14,7 @@
#import <MVMCoreUI/MFStyler.h>
#import <MVMCore/MVMCoreConstants.h>
#import <MVMCoreUI/NSLayoutConstraint+MFConvenience.h>
#import <MVMCoreUI/UIColor+MFConvenience.h>
@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

View File

@ -0,0 +1,17 @@
//
// MVMCoreUIObject.h
// MVMCoreUI
//
// Created by Scott Pfeil on 1/28/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
#import <MVMCore/MVMCore.h>
NS_ASSUME_NONNULL_BEGIN
@interface MVMCoreUIObject : MVMCoreObject
@end
NS_ASSUME_NONNULL_END

View File

@ -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

View File

@ -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

View File

@ -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 () <MVMCoreLoadingOverlayDelegateProtocol>
@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 <MVMCoreLoadingViewControllerProtocol> *)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

View File

@ -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

View File

@ -8,10 +8,22 @@
#import <UIKit/UIKit.h>
#import <MVMCoreUI/TopLabelsAndBottomButtonsViewController.h>
@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

View File

@ -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;