Skip to content
This repository has been archived by the owner on Oct 15, 2018. It is now read-only.

Onboarding navigation update #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 40 additions & 117 deletions Gulps/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

19 changes: 7 additions & 12 deletions Gulps/Base.lproj/Onboarding.storyboard
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14F6a" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="By6-Ql-uIz">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="By6-Ql-uIz">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<customFonts key="customFonts">
Expand All @@ -13,7 +13,7 @@
<!--Onboarding View Controller-->
<scene sceneID="JCX-9k-L92">
<objects>
<viewController id="3Iy-ME-FoV" customClass="OnboardingViewController" customModule="Gulps" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="OnboardingViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="3Iy-ME-FoV" customClass="OnboardingViewController" customModule="Gulps" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="XG9-8W-ap2"/>
<viewControllerLayoutGuide type="bottom" id="a9y-6F-IFj"/>
Expand Down Expand Up @@ -94,7 +94,7 @@
<!--Measure View Controller-->
<scene sceneID="7xK-23-hdv">
<objects>
<viewController id="G0M-tk-SWS" customClass="MeasureViewController" customModule="Gulps" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="MeasureViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="G0M-tk-SWS" customClass="MeasureViewController" customModule="Gulps" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="k5a-UD-A8v"/>
<viewControllerLayoutGuide type="bottom" id="9AR-mY-hKU"/>
Expand Down Expand Up @@ -275,7 +275,7 @@ what measurement system do you prefer?</string>
<!--Gulps View Controller-->
<scene sceneID="H0O-CP-zMe">
<objects>
<viewController id="zCq-Eo-bzE" customClass="GulpsViewController" customModule="Gulps" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="GulpsViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="zCq-Eo-bzE" customClass="GulpsViewController" customModule="Gulps" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="c1S-tf-jdw"/>
<viewControllerLayoutGuide type="bottom" id="hbR-Yb-Sx1"/>
Expand Down Expand Up @@ -480,7 +480,7 @@ what measurement system do you prefer?</string>
<!--Goal View Controller-->
<scene sceneID="l6E-L5-1xE">
<objects>
<viewController id="axR-yE-00K" customClass="GoalViewController" customModule="Gulps" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="GoalViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="axR-yE-00K" customClass="GoalViewController" customModule="Gulps" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="VvQ-Aw-iSd"/>
<viewControllerLayoutGuide type="bottom" id="6PH-YY-LNP"/>
Expand Down Expand Up @@ -620,7 +620,7 @@ what measurement system do you prefer?</string>
<!--Notification View Controller-->
<scene sceneID="tvc-JM-hjT">
<objects>
<viewController id="UpA-CQ-AM6" customClass="NotificationViewController" customModule="Gulps" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="NotificationViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="UpA-CQ-AM6" customClass="NotificationViewController" customModule="Gulps" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="ICO-OY-AjV"/>
<viewControllerLayoutGuide type="bottom" id="4Dn-cW-4Td"/>
Expand Down Expand Up @@ -894,10 +894,5 @@ what measurement system do you prefer?</string>
<image name="prev-icon" width="40" height="40"/>
<image name="small-icon" width="40" height="40"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
<color key="tintColor" red="0.15686274510000001" green="0.3921568627" blue="0.7725490196" alpha="1" colorSpace="calibratedRGB"/>
</document>
4 changes: 2 additions & 2 deletions Gulps/ViewControllers/CalendarViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ private extension CalendarViewController {
}

func updateStats() {
daysCountLabel.countFromZeroTo(Float(EntryHandler.sharedHandler.daysTracked()))
quantityLabel.countFromZeroTo(Float(EntryHandler.sharedHandler.overallQuantity()))
daysCountLabel.countFromZeroTo(CGFloat(EntryHandler.sharedHandler.daysTracked()))
quantityLabel.countFromZeroTo(CGFloat(EntryHandler.sharedHandler.overallQuantity()))
measureLabel.text = String(format: NSLocalizedString("unit format", comment: ""), unitName())
}

Expand Down
2 changes: 1 addition & 1 deletion Gulps/ViewControllers/DrinkViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public class DrinkViewController: UIViewController, UIAlertViewDelegate, UIViewC

func updateUI() {
let percentage = EntryHandler.sharedHandler.currentPercentage()
percentageLabel.countFromCurrentValueTo(Float(round(percentage)))
percentageLabel.countFromCurrentValueTo(CGFloat(round(percentage)))
let fillTo = CGFloat(percentage / 100.0)
progressMeter?.fillTo(fillTo > 1 ? 1 : fillTo)
}
Expand Down
8 changes: 8 additions & 0 deletions Gulps/ViewControllers/Onboarding/GoalViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,12 @@ class GoalViewController: OnboardingViewController, UITextFieldDelegate {
self.goalSuffixLabel.text = unit.suffixForUnitOfMeasure()
}
}

override func goNextScreen(gesture: UIGestureRecognizer) {
self.navigationController?.pushViewController((self.storyboard?.instantiateViewControllerWithIdentifier("NotificationViewController"))!, animated: true)
}

override func goPrevScreen(gesture: UIGestureRecognizer) {
self.navigationController?.popViewControllerAnimated(true)
}
}
8 changes: 8 additions & 0 deletions Gulps/ViewControllers/Onboarding/GulpsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ class GulpsViewController: OnboardingViewController, UITextFieldDelegate {
NSNotificationCenter.defaultCenter().addObserver(self, selector: "keyboardWillShow:", name: UIKeyboardWillShowNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: "keyboardWillHide:", name: UIKeyboardWillHideNotification, object: nil)
}

override func goNextScreen(gesture: UIGestureRecognizer) {
self.navigationController?.pushViewController((self.storyboard?.instantiateViewControllerWithIdentifier("GoalViewController"))!, animated: true)
}

override func goPrevScreen(gesture: UIGestureRecognizer) {
self.navigationController?.popViewControllerAnimated(true)
}

func dismissAndSave() {
let numberFormatter = NSNumberFormatter()
Expand Down
8 changes: 8 additions & 0 deletions Gulps/ViewControllers/Onboarding/MeasureViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ class MeasureViewController: OnboardingViewController {
_ = [litersCheck, ouncesCheck].map({$0.transform = CGAffineTransformMakeScale(0.001, 0.001)})
}

override func goNextScreen(gesture: UIGestureRecognizer) {
self.navigationController?.pushViewController((self.storyboard?.instantiateViewControllerWithIdentifier("GulpsViewController"))!, animated: true)
}

override func goPrevScreen(gesture: UIGestureRecognizer) {
self.navigationController?.popViewControllerAnimated(true)
}

override func updateUI() {
let unit = Constants.UnitsOfMeasure(rawValue: self.userDefaults.integerForKey(Constants.General.UnitOfMeasure.key()))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ class NotificationViewController: OnboardingViewController, UIActionSheetDelegat
self.intervalLabel.text = "\(interval) \(hour)"
self.notificationSwitch.on = self.userDefaults.boolForKey(Constants.Notification.On.key())
}

override func goPrevScreen(gesture: UIGestureRecognizer) {
self.navigationController?.popViewControllerAnimated(true)
}

override func goNextScreen(gesture: UIGestureRecognizer) {

}

@IBAction func openFromSelection(sender: UIButton) {
self.fromActionSheet.show()
Expand Down
23 changes: 21 additions & 2 deletions Gulps/ViewControllers/Onboarding/OnboardingViewController.swift
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
import UIKit
import AMWaveTransition

class OnboardingViewController: AMWaveViewController {
class OnboardingViewController: AMWaveViewController, UIGestureRecognizerDelegate {

@IBOutlet var viewArray: [UIView]!

//var arrVC = ["OnboardingViewController", "MeasureViewController", "GulpsViewController", "GoalViewController", "NotificationViewController"] // this is the stack of viewControllers used on Onboarding.storyboard

override func viewDidLoad() {
super.viewDidLoad()

self.navigationController?.view.backgroundColor = UIColor.mainColor()
self.view.backgroundColor = UIColor.clearColor()

let lsg = UISwipeGestureRecognizer(target: self, action:"goNextScreen:")
lsg.direction = .Left
lsg.delegate = self
self.view.addGestureRecognizer(lsg)
let rsg = UISwipeGestureRecognizer(target: self, action:"goPrevScreen:")
rsg.direction = .Right
rsg.delegate = self
self.view.addGestureRecognizer(rsg)
updateUI()
}

func goNextScreen(gesture:UIGestureRecognizer)
{
self.navigationController?.pushViewController((self.storyboard?.instantiateViewControllerWithIdentifier("MeasureViewController"))!, animated: true)
}

func goPrevScreen(gesture:UIGestureRecognizer)
{

}

override func prefersStatusBarHidden() -> Bool {
return true
Expand Down