Skip to content
Snippets Groups Projects
Commit 32870e58 authored by Oliver Wiese's avatar Oliver Wiese
Browse files

merge

parents c23a1c4b eb9542c7
No related branches found
No related tags found
No related merge requests found
......@@ -56,6 +56,10 @@ typedef void (^action_callback)(OnboardingViewController *onboardController);
*/
@property (nonatomic, strong) UILabel *bodyLabel;
/**
* @brief The textfield.
*/
@property (nonatomic, strong) UIView *inputView;
/**
* @brief The button used to call the action handler if one was provided.
......@@ -167,7 +171,7 @@ NS_ASSUME_NONNULL_END
* @brief Convenience class initializer for creating an onboarding content view controller with a video.
* @return An instance of OnboardingViewController with the provided information.
*/
+ (nonnull instancetype)contentWithTitle:(nullable NSString *)title body:(nullable NSString *)body videoURL:(nullable NSURL *)videoURL buttonText:(nullable NSString *)buttonText action:(nullable dispatch_block_t)action;
+ (nonnull instancetype)contentWithTitle:(nullable NSString *)title body:(nullable NSString *)body videoURL:(nullable NSURL *)videoURL inputView:(UIView *)inputView buttonText:(nullable NSString *)buttonText action:(nullable dispatch_block_t)action;
/**
......@@ -197,6 +201,10 @@ NS_ASSUME_NONNULL_END
*/
- (nonnull instancetype)initWithTitle:(nullable NSString *)title body:(nullable NSString *)body image:(nullable UIImage *)image videoURL:(nullable NSURL *)videoURL buttonText:(nullable NSString *)buttonText actionBlock:(nullable action_callback)actionBlock;
<<<<<<< HEAD
=======
- (nonnull instancetype)initWithTitle:(nullable NSString *)title body:(nullable NSString *)body image:(nullable UIImage *)image videoURL:(nullable NSURL *)videoURL inputView:(nullable UIView *)inputView buttonText:(nullable NSString *)buttonText actionBlock:(nullable action_callback)actionBlock;
>>>>>>> eb9542c70251e074f35bc20a9257b4f829892cc9
/**
* @brief Method used to update the alpha value for all floating subviews (image, title, body, etc.)
......
......@@ -31,6 +31,10 @@ static CGFloat const kMainPageControlHeight = 35;
NSString * const kOnboardMainTextAccessibilityIdentifier = @"OnboardMainTextAccessibilityIdentifier";
NSString * const kOnboardSubTextAccessibilityIdentifier = @"OnboardSubTextAccessibilityIdentifier";
NSString * const kOnboardActionButtonAccessibilityIdentifier = @"OnboardActionButtonAccessibilityIdentifier";
<<<<<<< HEAD
=======
NSString * const kOnboardInputViewAccessibilityIdentifier = @"OnboardInputViewAccessibilityIdentifier";
>>>>>>> eb9542c70251e074f35bc20a9257b4f829892cc9
@interface OnboardingContentViewController ()
......@@ -70,6 +74,13 @@ NSString * const kOnboardActionButtonAccessibilityIdentifier = @"OnboardActionBu
return [[self alloc] initWithTitle:title body:body videoURL:videoURL buttonText:buttonText action:action];
}
<<<<<<< HEAD
=======
+ (instancetype)contentWithTitle:(NSString *)title body:(NSString *)body videoURL:(NSURL *)videoURL inputView:(UIView *)inputView buttonText:(NSString *)buttonText action:(dispatch_block_t)action {
return [[self alloc] initWithTitle:title body:body videoURL:videoURL buttonText:buttonText action:action];
}
>>>>>>> eb9542c70251e074f35bc20a9257b4f829892cc9
- (instancetype)initWithTitle:(NSString *)title body:(NSString *)body videoURL:(NSURL *)videoURL buttonText:(NSString *)buttonText action:(dispatch_block_t)action {
return [self initWithTitle:title body:body image:nil videoURL:videoURL buttonText:buttonText actionBlock:^(OnboardingViewController *onboardController) {
if (action) {
......@@ -149,6 +160,75 @@ NSString * const kOnboardActionButtonAccessibilityIdentifier = @"OnboardActionBu
}
- (instancetype)initWithTitle:(NSString *)title body:(NSString *)body image:(UIImage *)image videoURL:(NSURL *)videoURL inputView:(UIView *)inputView buttonText:(NSString *)buttonText actionBlock:(action_callback)actionBlock {
self = [super init];
if (self == nil) {
return nil;
}
// Icon image view
self.iconImageView = [[UIImageView alloc] initWithImage:image];
self.iconWidth = image ? image.size.width : kDefaultImageViewSize;
self.iconHeight = image ? image.size.height : kDefaultImageViewSize;
// Title label
self.titleLabel = [UILabel new];
self.titleLabel.accessibilityIdentifier = kOnboardMainTextAccessibilityIdentifier;
self.titleLabel.text = title;
self.titleLabel.textColor = DEFAULT_TEXT_COLOR;
self.titleLabel.font = [UIFont fontWithName:kDefaultOnboardingFont size:kDefaultTitleFontSize];
self.titleLabel.numberOfLines = 0;
self.titleLabel.textAlignment = NSTextAlignmentCenter;
// Body label
self.bodyLabel = [UILabel new];
self.bodyLabel.accessibilityIdentifier = kOnboardSubTextAccessibilityIdentifier;
self.bodyLabel.text = body;
self.bodyLabel.textColor = DEFAULT_TEXT_COLOR;
self.bodyLabel.font = [UIFont fontWithName:kDefaultOnboardingFont size:kDefaultBodyFontSize];
self.bodyLabel.numberOfLines = 0;
self.bodyLabel.textAlignment = NSTextAlignmentCenter;
// Input view
self.inputView = inputView;
if (self.inputView) {
self.inputView.accessibilityIdentifier = kOnboardInputViewAccessibilityIdentifier;
}
// Action button
self.actionButton = [UIButton new];
self.actionButton.accessibilityIdentifier = kOnboardActionButtonAccessibilityIdentifier;
self.actionButton.titleLabel.font = [UIFont fontWithName:kDefaultOnboardingFont size:kDefaultButtonFontSize];
[self.actionButton setTitle:buttonText forState:UIControlStateNormal];
[self.actionButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[self.actionButton addTarget:self action:@selector(handleButtonPressed) forControlEvents:UIControlEventTouchUpInside];
self.buttonActionHandler = actionBlock ?: ^(OnboardingViewController *controller){};
// Movie player
self.videoURL = videoURL;
// Auto-navigation
self.movesToNextViewController = NO;
// Default padding values
self.topPadding = kDefaultTopPadding;
self.underIconPadding = kDefaultUnderIconPadding;
self.underTitlePadding = kDefaultUnderTitlePadding;
self.bottomPadding = kDefaultBottomPadding;
self.underPageControlPadding = kDefaultUnderPageControlPadding;
// Default blocks
self.viewWillAppearBlock = ^{};
self.viewDidAppearBlock = ^{};
self.viewWillDisappearBlock = ^{};
self.viewDidDisappearBlock = ^{};
return self;
}
#pragma mark - View life cycle
- (void)viewDidLoad {
......@@ -172,6 +252,9 @@ NSString * const kOnboardActionButtonAccessibilityIdentifier = @"OnboardActionBu
[self.view addSubview:self.iconImageView];
[self.view addSubview:self.titleLabel];
[self.view addSubview:self.bodyLabel];
if (self.inputView) {
[self.view addSubview:self.inputView];
}
[self.view addSubview:self.actionButton];
}
......@@ -284,7 +367,15 @@ NSString * const kOnboardActionButtonAccessibilityIdentifier = @"OnboardActionBu
[self.bodyLabel sizeToFit];
self.bodyLabel.frame = CGRectMake(xPadding, bodyYOrigin, contentWidth, CGRectGetHeight(self.bodyLabel.frame));
self.actionButton.frame = CGRectMake((CGRectGetMaxX(self.view.frame) / 2) - (contentWidth / 2), CGRectGetMaxY(self.view.frame) - self.underPageControlPadding - kMainPageControlHeight - kActionButtonHeight - self.bottomPadding, contentWidth, kActionButtonHeight);
CGFloat inputYOrigin = CGRectGetMaxY(self.bodyLabel.frame) + self.underTitlePadding;
if (self.inputView) {
self.inputView.frame = CGRectMake(xPadding, inputYOrigin, contentWidth, CGRectGetHeight(self.inputView.frame));
self.actionButton.frame = CGRectMake((CGRectGetMaxX(self.view.frame) / 2) - (contentWidth / 2), CGRectGetMaxY(self.view.frame) - self.underPageControlPadding - kMainPageControlHeight - kActionButtonHeight - self.bottomPadding - CGRectGetMaxY(self.inputView.frame), contentWidth, kActionButtonHeight);
}
}
......
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForAnalyzing = "YES"
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES">
<BuildableReference
BuildableIdentifier = 'primary'
BlueprintIdentifier = 'D7FF48F3092783E4E42B336F0DEF2D1A'
BlueprintName = 'Onboard'
ReferencedContainer = 'container:Pods.xcodeproj'
BuildableName = 'Onboard.framework'>
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
buildConfiguration = "Debug"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment