Skip to content

Commit

Permalink
Onboarding done
Browse files Browse the repository at this point in the history
  • Loading branch information
barvian committed Mar 1, 2015
1 parent 6f65e3c commit cb8cad9
Show file tree
Hide file tree
Showing 39 changed files with 823 additions and 632 deletions.
56 changes: 28 additions & 28 deletions Thesis.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Thesis/AppDelegate.swift
Expand Up @@ -17,6 +17,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
SDCloudUserDefaults.registerForNotifications()
SDCloudUserDefaults.hasSeenWelcome = false
applyStylesheet()

if let launchOptions = launchOptions {
Expand Down
4 changes: 3 additions & 1 deletion Thesis/FadeTransitionManager.swift
Expand Up @@ -12,11 +12,13 @@ class FadeTransitionManager: NSObject, UIViewControllerAnimatedTransitioning, UI

private var _presenting = false

var backgroundColor = UIColor.blackColor()

// MARK: UIViewControllerAnimatedTransitioning

func animateTransition(transitionContext: UIViewControllerContextTransitioning) {
let container = transitionContext.containerView()
container.backgroundColor = UIColor.blackColor()
container.backgroundColor = self.backgroundColor

let screens = (from: transitionContext.viewControllerForKey(UITransitionContextFromViewControllerKey)!, to: transitionContext.viewControllerForKey(UITransitionContextToViewControllerKey)!)
let fromView = screens.from.view, toView = screens.to.view
Expand Down
4 changes: 4 additions & 0 deletions Thesis/FullScreenController.swift
Expand Up @@ -34,6 +34,10 @@ func setupFullScreenControllerView(controller: FullScreenViewController) {
cover.tintColor = controller.backgroundColor
vc.view.addSubview(cover)
objc_setAssociatedObject(vc, &_statusBarCoverAssociationKey, cover, objc_AssociationPolicy(OBJC_ASSOCIATION_ASSIGN))

if let slidingViewController = vc as? SlidingViewController {
slidingViewController.pageControlCover.tintColor = controller.backgroundColor
}
}

func setupFullScreenControllerViewConstraints(controller: FullScreenViewController) {
Expand Down
23 changes: 23 additions & 0 deletions Thesis/Images.xcassets/LearnTab.imageset/Contents.json
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "LearnTab.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "LearnTab@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "LearnTab@3x.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions Thesis/Images.xcassets/PageControlBlur.imageset/Contents.json
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "PageControlBlur.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "PageControlBlur@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "PageControlBlur@3x.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions Thesis/Images.xcassets/ReflectTab.imageset/Contents.json
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "ReflectTab.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "ReflectTab@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "ReflectTab@3x.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions Thesis/Images.xcassets/RelaxTab.imageset/Contents.json
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "RelaxTab.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "RelaxTab@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "RelaxTab@3x.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 11 additions & 2 deletions Thesis/LearnViewController.swift
Expand Up @@ -18,6 +18,13 @@ class LearnViewController: UIViewController, FullScreenViewController, UITableVi
let navigationBarHidden = true
let navigationBarTranslucent = false

private(set) lazy var transitionManager: UIViewControllerTransitioningDelegate = {
let manager = FadeTransitionManager()
manager.backgroundColor = UIColor.whiteColor()

return manager
}()

private(set) lazy var 📖: NSArray = {
let path = NSBundle.mainBundle().pathForResource("Readings", ofType: "plist")!
let data = NSArray(contentsOfFile: path)!
Expand Down Expand Up @@ -130,8 +137,10 @@ class LearnViewController: UIViewController, FullScreenViewController, UITableVi
// MARK: LearnHeaderViewDelegate {

func learnHeaderView(learnHeaderView: LearnHeaderView, didTapHowToUseButton howToUseButton: UIButton!) {
let welcomeController = OnboardingViewController()
UIApplication.rootViewController.presentViewController(welcomeController, animated: true, completion: nil)
let tutorialController = OnboardingSlideController(contentView: OnboardingTutorialSlide())
tutorialController.transitioningDelegate = transitionManager
tutorialController.modalPresentationStyle = .Custom
UIApplication.rootViewController.presentViewController(tutorialController, animated: true, completion: nil)
}

}
116 changes: 0 additions & 116 deletions Thesis/OnboardingCompleteController.swift

This file was deleted.

76 changes: 76 additions & 0 deletions Thesis/OnboardingCompleteSlide.swift
@@ -0,0 +1,76 @@
//
// OnboardingCompleteSlide.swift
// Thesis
//
// Created by Maxwell Barvian on 3/1/15.
// Copyright (c) 2015 Maxwell Barvian. All rights reserved.
//

import UIKit

@objc protocol OnboardingCompleteSlideDelegate {
optional func onboardingCompleteSlide(onboardingCompleteslide: OnboardingCompleteSlide, didTapDoneButton doneButton: UIButton!)
}

class OnboardingCompleteSlide: OnboardingSlide {

weak var delegate: OnboardingCompleteSlideDelegate?

private(set) lazy var doneButton: UIButton = {
let button = UIButton.buttonWithType(.System) as! UIButton
button.setTranslatesAutoresizingMaskIntoConstraints(false)
button.setTitle("Get Started!", forState: .Normal)

button.addTarget(self, action: "didTapDoneButton:", forControlEvents: .TouchUpInside)

return button
}()

override init(header: String, subheader: String) {
super.init(header: header, subheader: subheader)

addSubview(doneButton)
}

convenience init() {
self.init(header: "Perfect!", subheader: "You're now well on your way to begin incorporating daily relaxation and positive reflection into your everyday life. Remember: recovering from anxiety is a process, but the benefits of these techniques can be enjoyed at every step along the way.")
}

required init(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

// MARK: Constraints

private var _didSetupConstraints = false

override func updateConstraints() {
super.updateConstraints()

if !_didSetupConstraints {
let views: [NSObject: AnyObject] = [
"doneButton": doneButton
]

let margin: CGFloat = 26
let metrics = [
"margin": margin
]

removeConstraint(subheaderBottomConstraint)
subheaderBottomConstraint = NSLayoutConstraint(item: subheaderLabel, attribute: .Bottom, relatedBy: .Equal, toItem: doneButton, attribute: .Top, multiplier: 1, constant: -margin)
addConstraint(subheaderBottomConstraint)
addConstraint(NSLayoutConstraint(item: doneButton, attribute: .CenterX, relatedBy: .Equal, toItem: self, attribute: .CenterX, multiplier: 1, constant: 0))
addConstraint(NSLayoutConstraint(item: doneButton, attribute: .Bottom, relatedBy: .Equal, toItem: self, attribute: .Bottom, multiplier: 1, constant: 0))

_didSetupConstraints = true
}
}

// MARK: Handlers

func didTapDoneButton(button: UIButton!) {
delegate?.onboardingCompleteSlide?(self, didTapDoneButton: button)
}

}

0 comments on commit cb8cad9

Please sign in to comment.