Skip to content

Commit

Permalink
Merge pull request #2 from dankimio/onboarding
Browse files Browse the repository at this point in the history
Onboarding
  • Loading branch information
dankimio authored Dec 12, 2020
2 parents 59bc6c4 + 6970e5a commit 6edb082
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 2 deletions.
12 changes: 12 additions & 0 deletions FlipTimer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,24 @@
/* Begin PBXBuildFile section */
370D194525800A00000FAA08 /* PrimaryButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 370D194425800A00000FAA08 /* PrimaryButtonStyle.swift */; };
370D195225802FD0000FAA08 /* TimerLength.swift in Sources */ = {isa = PBXBuildFile; fileRef = 370D195125802FD0000FAA08 /* TimerLength.swift */; };
3732B7D12584102A00F72F79 /* OnboardingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3732B7D02584102A00F72F79 /* OnboardingView.swift */; };
3732B7D42584158C00F72F79 /* FeatureCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3732B7D32584158C00F72F79 /* FeatureCell.swift */; };
374A674025791BAA00F56C72 /* FlipTimerApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 374A673F25791BAA00F56C72 /* FlipTimerApp.swift */; };
374A674225791BAA00F56C72 /* TimerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 374A674125791BAA00F56C72 /* TimerView.swift */; };
374A674425791BAB00F56C72 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 374A674325791BAB00F56C72 /* Assets.xcassets */; };
374A674725791BAB00F56C72 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 374A674625791BAB00F56C72 /* Preview Assets.xcassets */; };
3783EA59257991470058C69E /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3783EA58257991470058C69E /* SettingsView.swift */; };
37A33CBA257C19A2003F2B96 /* TimerMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37A33CB9257C19A2003F2B96 /* TimerMode.swift */; };
37ACBD9F25842D0000AD7702 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37ACBD9E25842D0000AD7702 /* ContentView.swift */; };
37BC0AB9257ABE5900238884 /* TimerViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37BC0AB8257ABE5900238884 /* TimerViewModel.swift */; };
37C155702581353B000349BA /* SettingsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37C1556F2581353B000349BA /* SettingsViewModel.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
370D194425800A00000FAA08 /* PrimaryButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrimaryButtonStyle.swift; sourceTree = "<group>"; };
370D195125802FD0000FAA08 /* TimerLength.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimerLength.swift; sourceTree = "<group>"; };
3732B7D02584102A00F72F79 /* OnboardingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingView.swift; sourceTree = "<group>"; };
3732B7D32584158C00F72F79 /* FeatureCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeatureCell.swift; sourceTree = "<group>"; };
374A673C25791BAA00F56C72 /* FlipTimer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FlipTimer.app; sourceTree = BUILT_PRODUCTS_DIR; };
374A673F25791BAA00F56C72 /* FlipTimerApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlipTimerApp.swift; sourceTree = "<group>"; };
374A674125791BAA00F56C72 /* TimerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimerView.swift; sourceTree = "<group>"; };
Expand All @@ -30,6 +35,7 @@
374A674825791BAB00F56C72 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3783EA58257991470058C69E /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
37A33CB9257C19A2003F2B96 /* TimerMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimerMode.swift; sourceTree = "<group>"; };
37ACBD9E25842D0000AD7702 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
37BC0AB8257ABE5900238884 /* TimerViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimerViewModel.swift; sourceTree = "<group>"; };
37BEE116257ADD3F00F1F787 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
37C1556F2581353B000349BA /* SettingsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewModel.swift; sourceTree = "<group>"; };
Expand All @@ -52,6 +58,9 @@
374A674125791BAA00F56C72 /* TimerView.swift */,
3783EA58257991470058C69E /* SettingsView.swift */,
370D194425800A00000FAA08 /* PrimaryButtonStyle.swift */,
3732B7D02584102A00F72F79 /* OnboardingView.swift */,
3732B7D32584158C00F72F79 /* FeatureCell.swift */,
37ACBD9E25842D0000AD7702 /* ContentView.swift */,
);
path = Views;
sourceTree = "<group>";
Expand Down Expand Up @@ -183,12 +192,15 @@
buildActionMask = 2147483647;
files = (
370D194525800A00000FAA08 /* PrimaryButtonStyle.swift in Sources */,
37ACBD9F25842D0000AD7702 /* ContentView.swift in Sources */,
3783EA59257991470058C69E /* SettingsView.swift in Sources */,
370D195225802FD0000FAA08 /* TimerLength.swift in Sources */,
3732B7D12584102A00F72F79 /* OnboardingView.swift in Sources */,
37BC0AB9257ABE5900238884 /* TimerViewModel.swift in Sources */,
37A33CBA257C19A2003F2B96 /* TimerMode.swift in Sources */,
374A674225791BAA00F56C72 /* TimerView.swift in Sources */,
374A674025791BAA00F56C72 /* FlipTimerApp.swift in Sources */,
3732B7D42584158C00F72F79 /* FeatureCell.swift in Sources */,
37C155702581353B000349BA /* SettingsViewModel.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
2 changes: 1 addition & 1 deletion FlipTimer/FlipTimerApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SwiftUI
struct FlipTimerApp: App {
var body: some Scene {
WindowGroup {
TimerView()
ContentView()
}
}
}
19 changes: 19 additions & 0 deletions FlipTimer/Views/ContentView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import SwiftUI

struct ContentView: View {
@AppStorage("onboardingDismissed") private var onboardingDismissed = false

var body: some View {
if onboardingDismissed {
TimerView()
} else {
OnboardingView()
}
}
}

struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
38 changes: 38 additions & 0 deletions FlipTimer/Views/FeatureCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import SwiftUI

struct FeatureCell: View {
var imageName: String
var title: String
var subtitle: String

var body: some View {
HStack(alignment: .top, spacing: 24) {
Image(systemName: imageName)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 32)
.foregroundColor(.blue)

VStack(alignment: .leading, spacing: 4, content: {
Text(title)
.font(.subheadline)
.fontWeight(.semibold)
Text(subtitle)
.foregroundColor(.secondary)
.font(.subheadline)
})

Spacer()
}
}
}

struct FeatureCell_Previews: PreviewProvider {
static var previews: some View {
FeatureCell(
imageName: "text.badge.checkmark",
title: "Some Feature",
subtitle: "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
)
}
}
66 changes: 66 additions & 0 deletions FlipTimer/Views/OnboardingView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import SwiftUI

struct OnboardingView: View {
@AppStorage("onboardingDismissed") private var onboardingDismissed = false

var body: some View {
VStack {
Spacer()

Text("Welcome to\nFlip Timer!")
.font(.largeTitle)
.fontWeight(.bold)
.multilineTextAlignment(.center)
.padding()

Spacer()

VStack(spacing: 24) {
FeatureCell(
imageName: "hourglass",
title: "Timer Interval",
subtitle: "Tap on the timer label and choose your timer length."
)
FeatureCell(
imageName: "arrow.turn.right.down",
title: "No Screen Time",
subtitle: "Put your device on the table screen facing down to start the timer."
)
FeatureCell(
imageName: "speaker.wave.2.fill",
title: "Take a Break",
subtitle: "You will hear a sound when the timer is finished. Take a break and restart when you're ready!"
)
}
.padding()

// TODO: find out if spacers can have weight
Spacer()
Spacer()

Button(
action: {
onboardingDismissed = true
},
label: {
HStack {
Spacer()
Text("Continue")
.font(.headline)
.foregroundColor(.white)
Spacer()
}
.padding()
.background(Color.blue)
.cornerRadius(12)
})
}
.padding()
}
}

struct OnboardingView_Previews: PreviewProvider {
static var previews: some View {
OnboardingView()
}
}
2 changes: 1 addition & 1 deletion FlipTimer/Views/TimerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ struct TimerView: View {
}
}

struct ContentView_Previews: PreviewProvider {
struct TimerView_Previews: PreviewProvider {
static var previews: some View {
Group {
TimerView()
Expand Down

0 comments on commit 6edb082

Please sign in to comment.