diff --git a/Pods/Onboard/LICENSE.txt b/Pods/Onboard/LICENSE.txt new file mode 100755 index 0000000000000000000000000000000000000000..cd18561cafc4214dc7d84b6b61bcd8327959fdb2 --- /dev/null +++ b/Pods/Onboard/LICENSE.txt @@ -0,0 +1,21 @@ +Copyright (c) 2014 Michael Amaral + +MIT LICENSE + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/Pods/Onboard/README.md b/Pods/Onboard/README.md new file mode 100644 index 0000000000000000000000000000000000000000..545ceec2a95b11262cf99bb131572d824ef49e6e --- /dev/null +++ b/Pods/Onboard/README.md @@ -0,0 +1,174 @@ +#Onboard + +[](https://travis-ci.org/mamaral/Onboard) +[](https://github.com/Carthage/Carthage) +[](http://doge.mit-license.org) + + + + + + + +#[Click Here For More Examples](examples.md) + + +Usage +===== + +Adding the following to your `Podfile` and running `pod install` should do the trick: + +``` +pod 'Onboard' +``` + +*If you don't want to use CocoaPods*, you can use Carthage or grab the files located in the *Source* folder and pull them into your project manually. + +Each onboarding experience is comprised of two primary components - the background and the content pages. The background includes the static background image/video, the page control, and the skip button. The content pages are made up of four pieces, an image/icon, title, body, and action button. + +Create individual pages by creating instances of `OnboardingContentViewController`. Provide a title, body, image, text for an action button, and within the action block handle whatever you want to do when the users press the button. If you don't want a button, you can leave both the button text and action handler nil. + +####Objective-C +```objective-c +OnboardingContentViewController *firstPage = [OnboardingContentViewController contentWithTitle:@"Page Title" body:@"Page body goes here." image:[UIImage imageNamed:@"icon"] buttonText:@"Text For Button" action:^{ + // do something here when users press the button, like ask for location services permissions, register for push notifications, connect to social media, or finish the onboarding process +}]; +``` +####Swift +```Swift +let firstPage = OnboardingContentViewController(title: "Page Title", body: "Page body goes here.", image: UIImage(named: "icon"), buttonText: "Text For Button") { () -> Void in + // do something here when users press the button, like ask for location services permissions, register for push notifications, connect to social media, or finish the onboarding process + } +``` + +Then create the `OnboardingViewController` by providing either a background image or a URL to a local video file in your project, and an array of content view controllers you just created. You can then present the view modally and get the onboarding process started! + +####Objective-C +```objective-c +// Image +OnboardingViewController *onboardingVC = [OnboardingViewController onboardWithBackgroundImage:[UIImage imageNamed:@"background"] contents:@[firstPage, secondPage, thirdPage]]; + +// Video +NSBundle *bundle = [NSBundle mainBundle]; +NSString *moviePath = [bundle pathForResource:@"yourVid" ofType:@"mp4"]; +NSURL *movieURL = [NSURL fileURLWithPath:moviePath]; + +OnboardingViewController *onboardingVC = [OnboardingViewController onboardWithBackgroundVideoURL:movieURL contents:@[firstPage, secondPage, thirdPage]]; +``` +####Swift +```swift +// Image +let onboardingVC = OnboardingViewController(backgroundImage: UIImage(named: "background"), contents: [firstPage, secondPage, thirdPage]) + +// Video +let bundle = NSBundle.mainBundle() +let moviePath = bundle.pathForResource("yourVid", ofType: "mp4") +let movieURL = NSURL(fileURLWithPath: moviePath!) + +let onboardingVC = OnboardingViewController(backgroundVideoURL: movieUrl, contents: [firstPage, secondPage, thirdPage]) +``` + + +With only a few lines of code you have a beautiful, end-to-end onboarding process that will get your users excited to use your awesome application. + + +Customization +============= + +The `iconImageView`, `titleLabel`, `bodyLabel`, and `actionButton` properties are exposed for customizing fonts, sizing, etc., and the spacing between elements on the content pages can be customized as well: + +```objective-c +onboardingVC.topPadding = 20; +onboardingVC.underIconPadding = 10; +onboardingVC.underTitlePadding = 15; +onboardingVC.bottomPadding = 20; + +``` + + + +Blurring, Masking, and Fading +============= + +By default, the image you use for the background will have a mask applied over it, darkening it a bit. This is to add a little bit of contrast so the text can more easily be seen. This can easily be disabled if your image is already edited or looks fine as-is: + +```objective-c +onboardingVC.shouldMaskBackground = NO; // defaults to YES +``` + +We can also apply a blur to your background image: + +```objective-c +onboardingVC.shouldBlurBackground = YES; // defaults to NO +``` + +Apply a fade effect to the icons, text, and buttons, while transitioning between pages. Contents fade out as you scroll away, and the contents for the next page fade in as they scroll in. + +```objective-c +onboardingVC.shouldFadeTransitions = YES; // defaults to NO +``` + +***Note:*** Ensure you do not cause the onboard view controller's view to be loaded prior to setting these properties, as these values only take effect when the view controller's `viewDidLoad` is called, so doing something like setting your `onboardingVC.view.backgroundColor = [UIColor whiteColor];` before setting this values would lead to the setting of these to not take effect. + +You can tweak these settings in a few different combinations to get your desired effect: + + + + + + +Auto-Navigation +============= + +If you want to automatically move users to the next page in the onboarding process when they press the action button simply set the `movesToNextViewController` property to `YES` on any `OnboardingContentViewController` that isn’t the last view controller in the onboarding process. Coupled with this, you can disable the ability to swipe between contents by setting the `swipingEnabled` property on the `OnboardingViewController` to `NO`. This allows you to have greater control over the onboarding process if you desire. Finally, if your design lends itself to not having a page control, or if it is only one page, you can set the `hidePageControl` property to `YES` and the page control dots will not appear. + +```objective-c +contentVC.movesToNextViewController = YES; +onboardingVC.swipingEnabled = NO; +onboardingVC.hidePageControl = YES; +``` + +Skipping +============= + +If you want to allow users to skip the onboarding process, enable skipping on the onboarding view controller and set a block to be executed when the skip button is pressed. + +```objective-c +onboardingVC.allowSkipping = YES; +onboardingVC.skipHandler = ^{ + // Dismiss, fade out, etc... +}; +``` + +Blocks +========= + +There may be cases in which you want to do *something* when the content pages are about to appear, and when they did appear. In this case, you can set the viewWillAppearBlock and viewDidAppearBlock properties on any or all of the content pages to handle whatever you’d like. + +```objective-c +contentVC.viewWillAppearBlock = ^{ + // do something when the view will appear here… +} + +contentVC.viewDidAppearBlock = ^{ + // do something when the view appears here… +} +``` + + +Notes +===== + +I'm not currently supporting landscape at the moment, so I would recommend either using this in an application that only supports portrait, or wrapping it in a subclassed UINavigationController that only supports portrait. + + +Community +===== + +Questions, comments, issues, and pull requests welcomed!! + + +License +===== + +This project is made available under the MIT license. See LICENSE.txt for details. diff --git a/Pods/Onboard/Source/OnboardingContentViewController.h b/Pods/Onboard/Source/OnboardingContentViewController.h new file mode 100644 index 0000000000000000000000000000000000000000..586d34512c7057c95fd3d035db6fb8ee18f2fcb9 --- /dev/null +++ b/Pods/Onboard/Source/OnboardingContentViewController.h @@ -0,0 +1,206 @@ +// +// OnboardingContentViewController.h +// Onboard +// +// Created by Mike on 8/17/14. +// Copyright (c) 2014 Mike Amaral. All rights reserved. +// + +#import <UIKit/UIKit.h> +@import AVKit; + +NS_ASSUME_NONNULL_BEGIN + +@class OnboardingViewController; +@class OnboardingContentViewController; + +@protocol OnboardingContentViewControllerDelegate <NSObject> + +@required +- (void)setNextPage:(OnboardingContentViewController *)contentVC; +- (void)setCurrentPage:(OnboardingContentViewController *)contentVC; + +@end + +extern NSString * const kOnboardMainTextAccessibilityIdentifier; +extern NSString * const kOnboardSubTextAccessibilityIdentifier; +extern NSString * const kOnboardActionButtonAccessibilityIdentifier; + +typedef void (^action_callback)(OnboardingViewController *onboardController); + + +@interface OnboardingContentViewController : UIViewController + +@property (nonatomic, weak) OnboardingViewController<OnboardingContentViewControllerDelegate> *delegate; + +/** + * @brief Determines if the next page is automatically shown when the action button is pressed. + */ +@property (nonatomic) BOOL movesToNextViewController; + + +/** + * @brief The image view used to show the top icon. + */ +@property (nonatomic, strong) UIImageView *iconImageView; + + +/** + * @brief The title label. + */ +@property (nonatomic, strong) UILabel *titleLabel; + + +/** + * @brief The body label. + */ +@property (nonatomic, strong) UILabel *bodyLabel; + + +/** + * @brief The button used to call the action handler if one was provided. + */ +@property (nonatomic, strong) UIButton *actionButton; + + +/** + * @brief The width of the icon image view. + */ +@property (nonatomic) CGFloat iconWidth; + + +/** + * @brief The height of the icon image view. + */ +@property (nonatomic) CGFloat iconHeight; + + +/** + * @brief The padding between the top of the screen and the top of the icon image view. + */ +@property (nonatomic) CGFloat topPadding; + + +/** + * @brief The padding between the icon image view and the title label. + */ +@property (nonatomic) CGFloat underIconPadding; + + +/** + * @brief The padding between the title label and the body label; + */ +@property (nonatomic) CGFloat underTitlePadding; + + +/** + * @brief The padding between the bottom of the action button and the page control. + */ +@property (nonatomic) CGFloat bottomPadding; + + +/** + * @brief The padding between the bottom of the screen and the page control. + */ +@property (nonatomic) CGFloat underPageControlPadding; + + +/** + * @brief The block executed when the action button is pressed. + */ +@property (nonatomic, copy) action_callback buttonActionHandler; + + +/** + * @brief The block executed when the content view controller's viewWillAppear method is called. + */ +@property (nonatomic, copy) dispatch_block_t viewWillAppearBlock; + + +/** + * @brief The block executed when the content view controller's viewDidAppear method is called. + */ +@property (nonatomic, copy) dispatch_block_t viewDidAppearBlock; + + +/** + * @brief The block executed when the content view controller's viewWillDisappear method is called. + */ +@property (nonatomic, copy) dispatch_block_t viewWillDisappearBlock; + + +/** + * @brief The block executed when the content view controller's viewDidDisappear method is called. + */ +@property (nonatomic, copy) dispatch_block_t viewDidDisappearBlock; + + +/** + * @brief The movie player controller used to play background movies. + */ +@property (nonatomic, strong) AVPlayerViewController *moviePlayerController; + +NS_ASSUME_NONNULL_END + +/** + * @brief Convenience class initializer for creating an onboarding content view controller. + * @return An instance of OnboardingViewController with the provided information. + */ ++ (nonnull instancetype)contentWithTitle:(nullable NSString *)title body:(nullable NSString *)body image:(nullable UIImage *)image buttonText:(nullable NSString *)buttonText action:(nullable dispatch_block_t)action; + + +/** + * @brief Initializer for creating an onboarding content view controller. + * @return An instance of OnboardingViewController with the provided information. + */ +- (nonnull instancetype)initWithTitle:(nullable NSString *)title body:(nullable NSString *)body image:(nullable UIImage *)image buttonText:(nullable NSString *)buttonText action:(nullable dispatch_block_t)action; + + +/** + * @brief Convenience class initializer for creating an onboarding content view controller with an action_callback block. + * @return An instance of OnboardingViewController with the provided information. + */ ++ (nonnull instancetype)contentWithTitle:(nullable NSString *)title body:(nullable NSString *)body image:(nullable UIImage *)image buttonText:(nullable NSString *)buttonText actionBlock:(nullable action_callback)actionBlock; + + +/** + * @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; + + +/** + * @brief Initializer for creating an onboarding content view controller with a video. + * @return An instance of OnboardingViewController with the provided information. + */ +- (nonnull instancetype)initWithTitle:(nullable NSString *)title body:(nullable NSString *)body videoURL:(nullable NSURL *)videoURL buttonText:(nullable NSString *)buttonText action:(nullable dispatch_block_t)action; + + +/** + * @brief Convenience class initializer for creating an onboarding content view controller with a video and an action_callback block. + * @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 actionBlock:(nullable action_callback)actionBlock; + + +/** + * @brief Initializer for creating an onboarding content view controller with a video and an action_callback block. + * @return An instance of OnboardingViewController with the provided information. + */ +- (nonnull instancetype)initWithTitle:(nullable NSString *)title body:(nullable NSString *)body image:(nullable UIImage *)image buttonText:(nullable NSString *)buttonText actionBlock:(nullable action_callback)actionBlock; + + +/** + * @brief Initializer for creating an onboarding content view controller with a video and an action_callback block. + * @return An instance of OnboardingViewController with the provided information. + */ +- (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; + + +/** + * @brief Method used to update the alpha value for all floating subviews (image, title, body, etc.) + */ +- (void)updateAlphas:(CGFloat)newAlpha; + +@end diff --git a/Pods/Onboard/Source/OnboardingContentViewController.m b/Pods/Onboard/Source/OnboardingContentViewController.m new file mode 100644 index 0000000000000000000000000000000000000000..1e9272dbcb1594bc262af5922123fc450438c28d --- /dev/null +++ b/Pods/Onboard/Source/OnboardingContentViewController.m @@ -0,0 +1,316 @@ +// +// OnboardingContentViewController.m +// Onboard +// +// Created by Mike on 8/17/14. +// Copyright (c) 2014 Mike Amaral. All rights reserved. +// + +#import "OnboardingContentViewController.h" +#import "OnboardingViewController.h" +@import AVFoundation; + +static NSString * const kDefaultOnboardingFont = @"Helvetica-Light"; + +#define DEFAULT_TEXT_COLOR [UIColor whiteColor]; + +static CGFloat const kContentWidthMultiplier = 0.9; +static CGFloat const kDefaultImageViewSize = 100; +static CGFloat const kDefaultTopPadding = 60; +static CGFloat const kDefaultUnderIconPadding = 30; +static CGFloat const kDefaultUnderTitlePadding = 30; +static CGFloat const kDefaultBottomPadding = 0; +static CGFloat const kDefaultUnderPageControlPadding = 0; +static CGFloat const kDefaultTitleFontSize = 38; +static CGFloat const kDefaultBodyFontSize = 28; +static CGFloat const kDefaultButtonFontSize = 24; + +static CGFloat const kActionButtonHeight = 50; +static CGFloat const kMainPageControlHeight = 35; + +NSString * const kOnboardMainTextAccessibilityIdentifier = @"OnboardMainTextAccessibilityIdentifier"; +NSString * const kOnboardSubTextAccessibilityIdentifier = @"OnboardSubTextAccessibilityIdentifier"; +NSString * const kOnboardActionButtonAccessibilityIdentifier = @"OnboardActionButtonAccessibilityIdentifier"; + +@interface OnboardingContentViewController () + +@property (nonatomic, strong) AVPlayer *player; +@property (nonatomic, strong) NSURL *videoURL; + +@property (nonatomic) BOOL wasPreviouslyVisible; + +@end + +@implementation OnboardingContentViewController + +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + + +#pragma mark - Initializers + ++ (instancetype)contentWithTitle:(NSString *)title body:(NSString *)body image:(UIImage *)image buttonText:(NSString *)buttonText action:(dispatch_block_t)action { + return [[self alloc] initWithTitle:title body:body image:image buttonText:buttonText action:action]; +} + +- (instancetype)initWithTitle:(NSString *)title body:(NSString *)body image:(UIImage *)image buttonText:(NSString *)buttonText action:(dispatch_block_t)action { + return [self initWithTitle:title body:body image:image buttonText:buttonText actionBlock:^(OnboardingViewController *onboardController) { + if (action) { + action(); + } + }]; +} + ++ (instancetype)contentWithTitle:(NSString *)title body:(NSString *)body image:(UIImage *)image buttonText:(NSString *)buttonText actionBlock:(action_callback)actionBlock { + return [[self alloc] initWithTitle:title body:body image:image buttonText:buttonText actionBlock:actionBlock]; +} + ++ (instancetype)contentWithTitle:(NSString *)title body:(NSString *)body videoURL:(NSURL *)videoURL buttonText:(NSString *)buttonText action:(dispatch_block_t)action { + return [[self alloc] initWithTitle:title body:body videoURL:videoURL buttonText:buttonText action:action]; +} + +- (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) { + action(); + } + }]; +} + ++ (instancetype)contentWithTitle:(NSString *)title body:(NSString *)body videoURL:(NSURL *)videoURL buttonText:(NSString *)buttonText actionBlock:(action_callback)actionBlock { + return [[self alloc] initWithTitle:title body:body image:nil videoURL:videoURL buttonText:buttonText actionBlock:actionBlock]; +} + +- (instancetype)initWithTitle:(NSString *)title body:(NSString *)body image:(UIImage *)image buttonText:(NSString *)buttonText actionBlock:(action_callback)actionBlock { + return [self initWithTitle:title body:body image:image videoURL:nil buttonText:buttonText actionBlock:actionBlock]; +} + +- (instancetype)initWithTitle:(NSString *)title body:(NSString *)body image:(UIImage *)image videoURL:(NSURL *)videoURL 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; + + // 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 { + [super viewDidLoad]; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleAppEnteredForeground) name:UIApplicationDidBecomeActiveNotification object:nil]; + + self.view.backgroundColor = [UIColor clearColor]; + + // Add all our subviews + if (self.videoURL) { + self.player = [[AVPlayer alloc] initWithURL:self.videoURL]; + + self.moviePlayerController = [AVPlayerViewController new]; + self.moviePlayerController.player = self.player; + self.moviePlayerController.showsPlaybackControls = NO; + + [self.view addSubview:self.moviePlayerController.view]; + } + + [self.view addSubview:self.iconImageView]; + [self.view addSubview:self.titleLabel]; + [self.view addSubview:self.bodyLabel]; + [self.view addSubview:self.actionButton]; +} + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + + // If we have a delegate set, mark ourselves as the next page now that we're + // about to appear + if (self.delegate) { + [self.delegate setNextPage:self]; + } + + // If we have a video URL, start playing + if (self.videoURL) { + [self.player play]; + } + + // Call our view will appear block + if (self.viewWillAppearBlock) { + dispatch_async(dispatch_get_main_queue(), ^{ + self.viewWillAppearBlock(); + }); + } + + self.wasPreviouslyVisible = YES; +} + +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + + // If we have a delegate set, mark ourselves as the current page now that + // we've appeared + if (self.delegate) { + [self.delegate setCurrentPage:self]; + } + + // Call our view did appear block + if (self.viewDidAppearBlock) { + dispatch_async(dispatch_get_main_queue(), ^{ + self.viewDidAppearBlock(); + }); + } +} + +- (void)viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; + + // Call our view will disappear block + if (self.viewWillDisappearBlock) { + dispatch_async(dispatch_get_main_queue(), ^{ + self.viewWillDisappearBlock(); + }); + } + + self.wasPreviouslyVisible = NO; +} + +- (void)viewDidDisappear:(BOOL)animated { + [super viewDidDisappear:animated]; + + // Call our view did disappear block + if (self.viewDidDisappearBlock) { + dispatch_async(dispatch_get_main_queue(), ^{ + self.viewDidDisappearBlock(); + }); + } + + // Pause our video if we have one. + if ((self.player.rate != 0.0) && !self.player.error) { + [self.player pause]; + } +} + + +#pragma mark - App life cycle + +- (void)handleAppEnteredForeground { + // If we have a video URL and this view controller was previously on screen + // restart it as it will be paused when the app enters the foreground. + if (self.videoURL && self.wasPreviouslyVisible) { + [self.player play]; + } +} + + +#pragma mark - Layout + +- (void)viewWillLayoutSubviews { + [super viewWillLayoutSubviews]; + + if (self.videoURL) { + self.moviePlayerController.view.frame = self.view.frame; + } + + CGFloat viewWidth = CGRectGetWidth(self.view.frame); + CGFloat contentWidth = viewWidth * kContentWidthMultiplier; + CGFloat xPadding = (viewWidth - contentWidth) / 2.0; + + [self.iconImageView setFrame:CGRectMake((viewWidth / 2.0) - (self.iconWidth / 2.0), self.topPadding, self.iconWidth, self.iconHeight)]; + + CGFloat titleYOrigin = CGRectGetMaxY(self.iconImageView.frame) + self.underIconPadding; + + self.titleLabel.frame = CGRectMake(xPadding, titleYOrigin, contentWidth, 0); + [self.titleLabel sizeToFit]; + self.titleLabel.frame = CGRectMake(xPadding, titleYOrigin, contentWidth, CGRectGetHeight(self.titleLabel.frame)); + + CGFloat bodyYOrigin = CGRectGetMaxY(self.titleLabel.frame) + self.underTitlePadding; + + self.bodyLabel.frame = CGRectMake(xPadding, bodyYOrigin, contentWidth, 0); + [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); +} + + +#pragma mark - Transition alpha + +- (void)updateAlphas:(CGFloat)newAlpha { + self.iconImageView.alpha = newAlpha; + self.titleLabel.alpha = newAlpha; + self.bodyLabel.alpha = newAlpha; + self.actionButton.alpha = newAlpha; +} + + +#pragma mark - Action button stuff + +- (void)handleButtonPressed { + // if we want to navigate to the next view controller, tell our delegate + // to handle it + if (self.movesToNextViewController) { + [self.delegate moveNextPage]; + } + + // call the provided action handler + if (self.buttonActionHandler) { + self.buttonActionHandler(self.delegate); + } +} + +@end diff --git a/Pods/Onboard/Source/OnboardingViewController.h b/Pods/Onboard/Source/OnboardingViewController.h new file mode 100644 index 0000000000000000000000000000000000000000..2f73d6780f646137e125c7a706f3d93e2bfdde72 --- /dev/null +++ b/Pods/Onboard/Source/OnboardingViewController.h @@ -0,0 +1,138 @@ +// +// OnboardingViewController.h +// Onboard +// +// Created by Mike on 8/17/14. +// Copyright (c) 2014 Mike Amaral. All rights reserved. +// + +#import <UIKit/UIKit.h> +#import "OnboardingContentViewController.h" +@import AVKit; + +@interface OnboardingViewController : UIViewController <UIPageViewControllerDataSource, UIPageViewControllerDelegate, UIScrollViewDelegate, OnboardingContentViewControllerDelegate> + +/** + * @brief The onboarding content view controllers. + */ +@property (nonatomic, strong) NSArray *viewControllers; + + +/** + * @brief The background image that will be visible through the content view controllers. + */ +@property (nonatomic, strong) UIImage *backgroundImage; + + +/** + * @brief Determines whether or not the background will be masked. The default value of this property is YES. + */ +@property (nonatomic) BOOL shouldMaskBackground; + + +/** + * @brief Determines whether or not the background will be blurred. The default value of this property is NO; + */ +@property (nonatomic) BOOL shouldBlurBackground; + + +/** + * @brief Determines whether or not the contents on screen will fade as the user swipes between pages. The default value of this property is NO. + */ +@property (nonatomic) BOOL shouldFadeTransitions; + + +/** + * @brief Determines whether or not the background will be masked. The default value of this property is NO. + */ +@property (nonatomic) BOOL fadePageControlOnLastPage; + + +/** + * @brief Determines whether or not the skip button will fade away on the last page. The default value of this property is NO. + */ +@property (nonatomic) BOOL fadeSkipButtonOnLastPage; + + +/** + * @brief Determines whether or not the ship button will be shown. The default value of this property is NO. + */ +@property (nonatomic) BOOL allowSkipping; + + +/** + * @brief A block that will be executed when the skip button is pressed. + */ +@property (nonatomic, strong) dispatch_block_t skipHandler; + + +/** + * @brief Determines whether or not swiping is enabled between pages. The default value of this property is YES. + */ +@property (nonatomic) BOOL swipingEnabled; + + +/** + * @brief Determines whether or not the page cotrol will be visible. + */ +@property (nonatomic, strong) UIPageControl *pageControl; + + +/** + * @brief The skip button that allows users to skip onboarding anytime. + */ +@property (nonatomic, strong) UIButton *skipButton; + + +/** + * @brief Determines whether or not the movie player stops playing when the view disappears. + */ +@property (nonatomic) BOOL stopMoviePlayerWhenDisappear; + + +/** + * @brief The movie player controller used to play background movies. + */ +@property (nonatomic, strong) AVPlayerViewController *moviePlayerController; + + +/** + * @brief The padding between the bottom of the screen and the bottom of the page control. + */ +@property (nonatomic) CGFloat underPageControlPadding; + + +/** + * @brief Convenience class initializer for onboarding with a backround image. + * @return An instance of OnboardingViewController with the provided background image and content view controllers. + */ ++ (instancetype)onboardWithBackgroundImage:(UIImage *)backgroundImage contents:(NSArray *)contents; + + +/** + * @brief Initializer for onboarding with a backround video. + * @return An instance of OnboardingViewController with the provided background video and content view controllers. + */ +- (instancetype)initWithBackgroundImage:(UIImage *)backgroundImage contents:(NSArray *)contents; + + +/** + * @brief Convenience class initializer for onboarding with a backround video. + * @return An instance of OnboardingViewController with the provided background video and content view controllers. + */ ++ (instancetype)onboardWithBackgroundVideoURL:(NSURL *)backgroundVideoURL contents:(NSArray *)contents; + + +/** + * @brief Initializer for onboarding with a backround video. + * @return An instance of OnboardingViewController with the provided background video and content view controllers. + */ +- (instancetype)initWithBackgroundVideoURL:(NSURL *)backgroundVideoURL contents:(NSArray *)contents; + + +/** + * @brief Method to tell the onboarding view controller to automatically move to the next page. + */ +- (void)moveNextPage; + +@end diff --git a/Pods/Onboard/Source/OnboardingViewController.m b/Pods/Onboard/Source/OnboardingViewController.m new file mode 100644 index 0000000000000000000000000000000000000000..1c50a98e5a75546c2b01e458244c612fafebd51c --- /dev/null +++ b/Pods/Onboard/Source/OnboardingViewController.m @@ -0,0 +1,504 @@ +// +// OnboardingViewController.m +// Onboard +// +// Created by Mike on 8/17/14. +// Copyright (c) 2014 Mike Amaral. All rights reserved. +// + +#import "OnboardingViewController.h" +#import "OnboardingContentViewController.h" +@import AVFoundation; +@import Accelerate; + +static CGFloat const kPageControlHeight = 35; +static CGFloat const kSkipButtonWidth = 100; +static CGFloat const kSkipButtonHeight = 44; +static CGFloat const kBackgroundMaskAlpha = 0.6; +static CGFloat const kDefaultBlurRadius = 20; +static CGFloat const kDefaultSaturationDeltaFactor = 1.8; + +static NSString * const kSkipButtonText = @"Skip"; + + +@interface OnboardingViewController () + +@property (nonatomic, strong) OnboardingContentViewController *currentPage; +@property (nonatomic, strong) OnboardingContentViewController *upcomingPage; + +@property (nonatomic, strong) UIPageViewController *pageVC; +@property (nonatomic, strong) AVPlayer *player; +@property (nonatomic, strong) NSURL *videoURL; + +@end + + +@implementation OnboardingViewController + +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +#pragma mark - Initializing with images + ++ (instancetype)onboardWithBackgroundImage:(UIImage *)backgroundImage contents:(NSArray *)contents { + return [[self alloc] initWithBackgroundImage:backgroundImage contents:contents]; + } + +- (instancetype)initWithBackgroundImage:(UIImage *)backgroundImage contents:(NSArray *)contents { + self = [self initWithContents:contents]; + + if (!self) { + return nil; + } + + self.backgroundImage = backgroundImage; + + return self; +} + + +#pragma mark - Initializing with video files + ++ (instancetype)onboardWithBackgroundVideoURL:(NSURL *)backgroundVideoURL contents:(NSArray *)contents { + return [[self alloc] initWithBackgroundVideoURL:backgroundVideoURL contents:contents]; +} + +- (instancetype)initWithBackgroundVideoURL:(NSURL *)backgroundVideoURL contents:(NSArray *)contents { + self = [self initWithContents:contents]; + + if (!self) { + return nil; + } + + self.videoURL = backgroundVideoURL; + + return self; +} + + +#pragma mark - Initialization + +- (instancetype)initWithContents:(NSArray *)contents { + self = [super init]; + + if (!self) { + return nil; + } + + // Store the passed in view controllers array + self.viewControllers = contents; + + // Set the default properties + self.shouldMaskBackground = YES; + self.shouldBlurBackground = NO; + self.shouldFadeTransitions = NO; + self.fadePageControlOnLastPage = NO; + self.fadeSkipButtonOnLastPage = NO; + self.swipingEnabled = YES; + + self.allowSkipping = NO; + self.skipHandler = ^{}; + + // Create the initial exposed components so they can be customized + self.pageControl = [UIPageControl new]; + self.pageControl.numberOfPages = self.viewControllers.count; + self.pageControl.userInteractionEnabled = NO; + + self.skipButton = [UIButton new]; + [self.skipButton setTitle:kSkipButtonText forState:UIControlStateNormal]; + [self.skipButton addTarget:self action:@selector(handleSkipButtonPressed) forControlEvents:UIControlEventTouchUpInside]; + self.skipButton.titleLabel.adjustsFontSizeToFitWidth = YES; + + return self; +} + + +#pragma mark - View life cycle + +- (void)viewDidLoad { + [super viewDidLoad]; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleAppEnteredForeground) name:UIApplicationDidBecomeActiveNotification object:nil]; + + // now that the view has loaded, we can generate the content + [self generateView]; +} + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + + // if we have a video URL, start playing + if (self.videoURL) { + [self.player play]; + } +} + +- (void)viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; + + if ((self.player.rate != 0.0) && !self.player.error && self.stopMoviePlayerWhenDisappear) { + [self.player pause]; + } +} + +- (void)viewWillLayoutSubviews { + [super viewWillLayoutSubviews]; + + self.pageVC.view.frame = self.view.frame; + self.moviePlayerController.view.frame = self.view.frame; + self.skipButton.frame = CGRectMake(CGRectGetMaxX(self.view.frame) - kSkipButtonWidth, CGRectGetMaxY(self.view.frame) - self.underPageControlPadding - kSkipButtonHeight, kSkipButtonWidth, kSkipButtonHeight); + self.pageControl.frame = CGRectMake(0, CGRectGetMaxY(self.view.frame) - self.underPageControlPadding - kPageControlHeight, self.view.frame.size.width, kPageControlHeight); +} + +- (void)generateView { + // create our page view controller + self.pageVC = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil]; + self.pageVC.view.backgroundColor = [UIColor whiteColor]; + self.pageVC.delegate = self; + self.pageVC.dataSource = self.swipingEnabled ? self : nil; + + if (self.shouldBlurBackground) { + [self blurBackground]; + } + + UIImageView *backgroundImageView; + + // create the background image view and set it to aspect fill so it isn't skewed + if (self.backgroundImage) { + backgroundImageView = [[UIImageView alloc] initWithFrame:self.view.bounds]; + backgroundImageView.clipsToBounds = YES; + backgroundImageView.contentMode = UIViewContentModeScaleAspectFill; + [backgroundImageView setImage:self.backgroundImage]; + [self.view addSubview:backgroundImageView]; + } + + // as long as the shouldMaskBackground setting hasn't been set to NO, we want to + // create a partially opaque view and add it on top of the image view, so that it + // darkens it a bit for better contrast + UIView *backgroundMaskView; + if (self.shouldMaskBackground) { + backgroundMaskView = [[UIView alloc] initWithFrame:self.pageVC.view.frame]; + backgroundMaskView.backgroundColor = [UIColor colorWithWhite:0.0 alpha:kBackgroundMaskAlpha]; + [self.pageVC.view addSubview:backgroundMaskView]; + } + + // set ourself as the delegate on all of the content views, to handle fading + // and auto-navigation + for (OnboardingContentViewController *contentVC in self.viewControllers) { + contentVC.delegate = self; + } + + // set the initial current page as the first page provided + _currentPage = [self.viewControllers firstObject]; + + // more page controller setup + [self.pageVC setViewControllers:@[self.currentPage] direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:nil]; + self.pageVC.view.backgroundColor = [UIColor clearColor]; + [self addChildViewController:self.pageVC]; + [self.view addSubview:self.pageVC.view]; + [self.pageVC didMoveToParentViewController:self]; + [self.pageVC.view sendSubviewToBack:backgroundMaskView]; + + // send the background image view to the back if we have one + if (backgroundImageView) { + [self.pageVC.view sendSubviewToBack:backgroundImageView]; + } + + // otherwise send the video view to the back if we have one + else if (self.videoURL) { + self.player = [[AVPlayer alloc] initWithURL:self.videoURL]; + + self.moviePlayerController = [AVPlayerViewController new]; + self.moviePlayerController.player = self.player; + self.moviePlayerController.showsPlaybackControls = NO; + + [self.pageVC.view addSubview:self.moviePlayerController.view]; + [self.pageVC.view sendSubviewToBack:self.moviePlayerController.view]; + } + + // create the page control + [self.view addSubview:self.pageControl]; + + // if we allow skipping, setup the skip button + if (self.allowSkipping) { + [self.view addSubview:self.skipButton]; + } + + // if we want to fade the transitions, we need to tap into the underlying scrollview + // so we can set ourself as the delegate, this is sort of hackish but the only current + // solution I am aware of using a page view controller + if (self.shouldFadeTransitions) { + for (UIView *view in self.pageVC.view.subviews) { + if ([view isKindOfClass:[UIScrollView class]]) { + [(UIScrollView *)view setDelegate:self]; + } + } + } +} + + +#pragma mark - App life cycle + +- (void)handleAppEnteredForeground { + // If we have a video URL, restart it as it will be paused when + // the app enters the foreground. + if (self.videoURL) { + [self.player play]; + } +} + + +#pragma mark - Skipping + +- (void)handleSkipButtonPressed { + if (self.skipHandler) { + self.skipHandler(); + } +} + +- (void)setUnderPageControlPadding:(CGFloat)underPageControlPadding { + _underPageControlPadding = underPageControlPadding; + + for (OnboardingContentViewController *contentVC in self.viewControllers) { + contentVC.underPageControlPadding = underPageControlPadding; + } +} + +#pragma mark - Page view controller data source + +- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController { + // return the previous view controller in the array unless we're at the beginning + if (viewController == [self.viewControllers firstObject]) { + return nil; + } else { + NSInteger priorPageIndex = [self.viewControllers indexOfObject:viewController] - 1; + return self.viewControllers[priorPageIndex]; + } +} + +- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController { + // return the next view controller in the array unless we're at the end + if (viewController == [self.viewControllers lastObject]) { + return nil; + } else { + NSInteger nextPageIndex = [_viewControllers indexOfObject:viewController] + 1; + return self.viewControllers[nextPageIndex]; + } +} + + +#pragma mark - Page view controller delegate + +- (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray *)previousViewControllers transitionCompleted:(BOOL)completed { + // if we haven't completed animating yet, we don't want to do anything because it could be cancelled + if (!completed) { + return; + } + + // get the view controller we are moving towards, then get the index, then set it as the current page + // for the page control dots + UIViewController *viewController = [pageViewController.viewControllers lastObject]; + NSInteger newIndex = [self.viewControllers indexOfObject:viewController]; + [self.pageControl setCurrentPage:newIndex]; +} + +- (void)moveNextPage { + NSUInteger indexOfNextPage = [self.viewControllers indexOfObject:_currentPage] + 1; + + if (indexOfNextPage < self.viewControllers.count) { + [self.pageVC setViewControllers:@[self.viewControllers[indexOfNextPage]] direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:nil]; + [self.pageControl setCurrentPage:indexOfNextPage]; + } +} + + +#pragma mark - Onboarding content view controller delegate + +- (void)setCurrentPage:(OnboardingContentViewController *)currentPage { + _currentPage = currentPage; +} + +- (void)setNextPage:(OnboardingContentViewController *)nextPage { + _upcomingPage = nextPage; +} + + +#pragma mark - Page scroll status + +- (void)scrollViewDidScroll:(UIScrollView *)scrollView { + // calculate the percent complete of the transition of the current page given the + // scrollview's offset and the width of the screen + CGFloat percentComplete = fabs(scrollView.contentOffset.x - self.view.frame.size.width) / self.view.frame.size.width; + CGFloat percentCompleteInverse = 1.0 - percentComplete; + + // these cases have some funky results given the way this method is called, like stuff + // just disappearing, so we want to do nothing in these cases + if (percentComplete == 0) { + return; + } + + // set the next page's alpha to be the percent complete, so if we're 90% of the way + // scrolling towards the next page, its content's alpha should be 90% + [_upcomingPage updateAlphas:percentComplete]; + + // set the current page's alpha to the difference between 100% and this percent value, + // so we're 90% scrolling towards the next page, the current content's alpha sshould be 10% + [_currentPage updateAlphas:percentCompleteInverse]; + + // determine if we're transitioning to or from our last page + BOOL transitioningToLastPage = (_currentPage != self.viewControllers.lastObject && _upcomingPage == self.viewControllers.lastObject); + BOOL transitioningFromLastPage = (_currentPage == self.viewControllers.lastObject) && (_upcomingPage == self.viewControllers[self.viewControllers.count - 2]); + + // fade the page control to and from the last page + if (self.fadePageControlOnLastPage) { + if (transitioningToLastPage) { + self.pageControl.alpha = percentCompleteInverse; + } + + else if (transitioningFromLastPage) { + self.pageControl.alpha = percentComplete; + } + } + + // fade the skip button to and from the last page + if (self.fadeSkipButtonOnLastPage) { + if (transitioningToLastPage) { + self.skipButton.alpha = percentCompleteInverse; + } + + else if (transitioningFromLastPage) { + self.skipButton.alpha = percentComplete; + } + } +} + + +#pragma mark - Image blurring + +- (void)blurBackground { + // Check pre-conditions. + if (self.backgroundImage.size.width < 1 || self.backgroundImage.size.height < 1) { + NSLog (@"*** error: invalid size: (%.2f x %.2f). Both dimensions must be >= 1: %@", self.backgroundImage.size.width, self.backgroundImage.size.height, self.backgroundImage); + return; + } + if (!self.backgroundImage.CGImage) { + NSLog (@"*** error: image must be backed by a CGImage: %@", self.backgroundImage); + return; + } + + UIColor *tintColor = [UIColor colorWithWhite:0.7 alpha:0.3]; + CGFloat blurRadius = kDefaultBlurRadius; + CGFloat saturationDeltaFactor = kDefaultSaturationDeltaFactor; + CGRect imageRect = { CGPointZero, self.backgroundImage.size }; + UIImage *effectImage = self.backgroundImage; + + BOOL hasBlur = blurRadius > __FLT_EPSILON__; + BOOL hasSaturationChange = fabs(saturationDeltaFactor - 1.) > __FLT_EPSILON__; + if (hasBlur || hasSaturationChange) { + UIGraphicsBeginImageContextWithOptions(self.backgroundImage.size, NO, [[UIScreen mainScreen] scale]); + CGContextRef effectInContext = UIGraphicsGetCurrentContext(); + CGContextScaleCTM(effectInContext, 1.0, -1.0); + CGContextTranslateCTM(effectInContext, 0, -self.backgroundImage.size.height); + CGContextDrawImage(effectInContext, imageRect, self.backgroundImage.CGImage); + + vImage_Buffer effectInBuffer; + effectInBuffer.data = CGBitmapContextGetData(effectInContext); + effectInBuffer.width = CGBitmapContextGetWidth(effectInContext); + effectInBuffer.height = CGBitmapContextGetHeight(effectInContext); + effectInBuffer.rowBytes = CGBitmapContextGetBytesPerRow(effectInContext); + + UIGraphicsBeginImageContextWithOptions(self.backgroundImage.size, NO, [[UIScreen mainScreen] scale]); + CGContextRef effectOutContext = UIGraphicsGetCurrentContext(); + vImage_Buffer effectOutBuffer; + effectOutBuffer.data = CGBitmapContextGetData(effectOutContext); + effectOutBuffer.width = CGBitmapContextGetWidth(effectOutContext); + effectOutBuffer.height = CGBitmapContextGetHeight(effectOutContext); + effectOutBuffer.rowBytes = CGBitmapContextGetBytesPerRow(effectOutContext); + + if (hasBlur) { + // A description of how to compute the box kernel width from the Gaussian + // radius (aka standard deviation) appears in the SVG spec: + // http://www.w3.org/TR/SVG/filters.html#feGaussianBlurElement + // + // For larger values of 's' (s >= 2.0), an approximation can be used: Three + // successive box-blurs build a piece-wise quadratic convolution kernel, which + // approximates the Gaussian kernel to within roughly 3%. + // + // let d = floor(s * 3*sqrt(2*pi)/4 + 0.5) + // + // ... if d is odd, use three box-blurs of size 'd', centered on the output pixel. + // + CGFloat inputRadius = blurRadius * [[UIScreen mainScreen] scale]; + unsigned int radius = floor(inputRadius * 3. * sqrt(2 * M_PI) / 4 + 0.5); + if (radius % 2 != 1) { + radius += 1; // force radius to be odd so that the three box-blur methodology works. + } + vImageBoxConvolve_ARGB8888(&effectInBuffer, &effectOutBuffer, NULL, 0, 0, radius, radius, 0, kvImageEdgeExtend); + vImageBoxConvolve_ARGB8888(&effectOutBuffer, &effectInBuffer, NULL, 0, 0, radius, radius, 0, kvImageEdgeExtend); + vImageBoxConvolve_ARGB8888(&effectInBuffer, &effectOutBuffer, NULL, 0, 0, radius, radius, 0, kvImageEdgeExtend); + } + BOOL effectImageBuffersAreSwapped = NO; + if (hasSaturationChange) { + CGFloat s = saturationDeltaFactor; + CGFloat floatingPointSaturationMatrix[] = { + 0.0722 + 0.9278 * s, 0.0722 - 0.0722 * s, 0.0722 - 0.0722 * s, 0, + 0.7152 - 0.7152 * s, 0.7152 + 0.2848 * s, 0.7152 - 0.7152 * s, 0, + 0.2126 - 0.2126 * s, 0.2126 - 0.2126 * s, 0.2126 + 0.7873 * s, 0, + 0, 0, 0, 1, + }; + const int32_t divisor = 256; + NSUInteger matrixSize = sizeof(floatingPointSaturationMatrix)/sizeof(floatingPointSaturationMatrix[0]); + int16_t saturationMatrix[matrixSize]; + for (NSUInteger i = 0; i < matrixSize; ++i) { + saturationMatrix[i] = (int16_t)roundf(floatingPointSaturationMatrix[i] * divisor); + } + if (hasBlur) { + vImageMatrixMultiply_ARGB8888(&effectOutBuffer, &effectInBuffer, saturationMatrix, divisor, NULL, NULL, kvImageNoFlags); + effectImageBuffersAreSwapped = YES; + } + else { + vImageMatrixMultiply_ARGB8888(&effectInBuffer, &effectOutBuffer, saturationMatrix, divisor, NULL, NULL, kvImageNoFlags); + } + } + if (!effectImageBuffersAreSwapped) + effectImage = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + + if (effectImageBuffersAreSwapped) + effectImage = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + } + + // Set up output context. + UIGraphicsBeginImageContextWithOptions(self.backgroundImage.size, NO, [[UIScreen mainScreen] scale]); + CGContextRef outputContext = UIGraphicsGetCurrentContext(); + CGContextScaleCTM(outputContext, 1.0, -1.0); + CGContextTranslateCTM(outputContext, 0, -self.backgroundImage.size.height); + + // Draw base image. + CGContextDrawImage(outputContext, imageRect, self.backgroundImage.CGImage); + + // Draw effect image. + if (hasBlur) { + CGContextSaveGState(outputContext); + CGContextDrawImage(outputContext, imageRect, effectImage.CGImage); + CGContextRestoreGState(outputContext); + } + + // Add in color tint. + if (tintColor) { + CGContextSaveGState(outputContext); + CGContextSetFillColorWithColor(outputContext, tintColor.CGColor); + CGContextFillRect(outputContext, imageRect); + CGContextRestoreGState(outputContext); + } + + // Output image is ready. + UIImage *outputImage = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + + self.backgroundImage = outputImage; +} + +@end diff --git a/Pods/Target Support Files/Onboard/Info.plist b/Pods/Target Support Files/Onboard/Info.plist new file mode 100644 index 0000000000000000000000000000000000000000..a7b58ed3b3761fae0a0df4ccb181d07eabb3c47a --- /dev/null +++ b/Pods/Target Support Files/Onboard/Info.plist @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>en</string> + <key>CFBundleExecutable</key> + <string>${EXECUTABLE_NAME}</string> + <key>CFBundleIdentifier</key> + <string>${PRODUCT_BUNDLE_IDENTIFIER}</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundlePackageType</key> + <string>FMWK</string> + <key>CFBundleShortVersionString</key> + <string>2.3.1</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>${CURRENT_PROJECT_VERSION}</string> + <key>NSPrincipalClass</key> + <string></string> +</dict> +</plist> diff --git a/Pods/Target Support Files/Onboard/Onboard-dummy.m b/Pods/Target Support Files/Onboard/Onboard-dummy.m new file mode 100644 index 0000000000000000000000000000000000000000..f8f4b3fdcfea538c0471ebb939b760363386f6e3 --- /dev/null +++ b/Pods/Target Support Files/Onboard/Onboard-dummy.m @@ -0,0 +1,5 @@ +#import <Foundation/Foundation.h> +@interface PodsDummy_Onboard : NSObject +@end +@implementation PodsDummy_Onboard +@end diff --git a/Pods/Target Support Files/Onboard/Onboard-prefix.pch b/Pods/Target Support Files/Onboard/Onboard-prefix.pch new file mode 100644 index 0000000000000000000000000000000000000000..aa992a4adb2f208fa00c7a562b1097259693a90c --- /dev/null +++ b/Pods/Target Support Files/Onboard/Onboard-prefix.pch @@ -0,0 +1,4 @@ +#ifdef __OBJC__ +#import <UIKit/UIKit.h> +#endif + diff --git a/Pods/Target Support Files/Onboard/Onboard-umbrella.h b/Pods/Target Support Files/Onboard/Onboard-umbrella.h new file mode 100644 index 0000000000000000000000000000000000000000..3072f4bcccd75df5e1682fb9f459aa1d4d513ead --- /dev/null +++ b/Pods/Target Support Files/Onboard/Onboard-umbrella.h @@ -0,0 +1,10 @@ +#ifdef __OBJC__ +#import <UIKit/UIKit.h> +#endif + +#import "OnboardingViewController.h" +#import "OnboardingContentViewController.h" + +FOUNDATION_EXPORT double OnboardVersionNumber; +FOUNDATION_EXPORT const unsigned char OnboardVersionString[]; + diff --git a/Pods/Target Support Files/Onboard/Onboard.modulemap b/Pods/Target Support Files/Onboard/Onboard.modulemap new file mode 100644 index 0000000000000000000000000000000000000000..df082e319bd68e2e70b729769fdb2abbe7fb770a --- /dev/null +++ b/Pods/Target Support Files/Onboard/Onboard.modulemap @@ -0,0 +1,6 @@ +framework module Onboard { + umbrella header "Onboard-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/Onboard/Onboard.xcconfig b/Pods/Target Support Files/Onboard/Onboard.xcconfig new file mode 100644 index 0000000000000000000000000000000000000000..ebb246c07f39f92458ba0bda67a5ff36f5e1fc12 --- /dev/null +++ b/Pods/Target Support Files/Onboard/Onboard.xcconfig @@ -0,0 +1,8 @@ +CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/Onboard +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/OpenSSL-Universal" "${PODS_ROOT}/Headers/Public/mailcore2-ios" +PODS_BUILD_DIR = $BUILD_DIR +PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES