wip
This commit is contained in:
@@ -1,59 +0,0 @@
|
||||
//
|
||||
// OnboardingData.swift
|
||||
// Feels (iOS)
|
||||
//
|
||||
// Created by Trey Tartt on 1/22/22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UserNotifications
|
||||
|
||||
// this is getting passed around and filled out
|
||||
// class and vars
|
||||
final class OnboardingData: NSObject, ObservableObject, Codable {
|
||||
@Published var date: Date = Date()
|
||||
@Published var inputDay: DayOptions = .Today
|
||||
|
||||
enum CodingKeys: CodingKey {
|
||||
case date, inputDay
|
||||
}
|
||||
|
||||
func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
|
||||
try container.encode(date, forKey: .date)
|
||||
try container.encode(inputDay, forKey: .inputDay)
|
||||
}
|
||||
|
||||
required init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
|
||||
date = try container.decode(Date.self, forKey: .date)
|
||||
inputDay = try container.decode(DayOptions.self, forKey: .inputDay)
|
||||
}
|
||||
|
||||
override init() { }
|
||||
}
|
||||
|
||||
extension OnboardingData: RawRepresentable {
|
||||
convenience init?(rawValue: String) {
|
||||
guard let data = rawValue.data(using: .utf8),
|
||||
let result = try? JSONDecoder().decode(OnboardingData.self, from: data)
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
self.init()
|
||||
|
||||
self.date = result.date
|
||||
self.inputDay = result.inputDay
|
||||
}
|
||||
|
||||
public var rawValue: String {
|
||||
guard let data = try? JSONEncoder().encode(self),
|
||||
let result = String(data: data, encoding: .utf8)
|
||||
else {
|
||||
return "[]"
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
//
|
||||
// OnboardingCustomizeOne.swift
|
||||
// Feels (iOS)
|
||||
//
|
||||
// Created by Trey Tartt on 4/5/22.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct OnboardingCustomizeOne: View {
|
||||
@ObservedObject var onboardingData: OnboardingData
|
||||
|
||||
var formatter: DateFormatter {
|
||||
let dateFormatter = DateFormatter()
|
||||
dateFormatter.timeStyle = .short
|
||||
return dateFormatter
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
GeometryReader { geometry in
|
||||
VStack {
|
||||
Spacer()
|
||||
Image("good", bundle: .main)
|
||||
.foregroundColor(Color(UIColor.darkText))
|
||||
.opacity(0.04)
|
||||
.scaleEffect(1.2, anchor: .trailing)
|
||||
Spacer()
|
||||
}
|
||||
|
||||
|
||||
ScrollView {
|
||||
VStack(alignment: .leading) {
|
||||
Text(String(localized: "onboarding_title_customize_one_title"))
|
||||
.font(.title)
|
||||
.padding()
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.foregroundColor(.black)
|
||||
|
||||
Text(String(localized: "onboarding_title_customize_one_section_one_title"))
|
||||
.font(.title3)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.padding()
|
||||
.foregroundColor(.black)
|
||||
.multilineTextAlignment(.leading)
|
||||
IconPickerView()
|
||||
|
||||
Text(String(localized: "onboarding_title_customize_one_section_two_title"))
|
||||
.font(.title3)
|
||||
.padding()
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.foregroundColor(.black)
|
||||
|
||||
DayFilterPickerView()
|
||||
|
||||
Text(String(localized: "onboarding_title_customize_one_section_two_note"))
|
||||
.font(.title3)
|
||||
.padding()
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.foregroundColor(.black)
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
.background(Color(hex: "ffd709"))
|
||||
}
|
||||
}
|
||||
|
||||
struct OnboardingCustomizeOne_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
OnboardingCustomizeOne(onboardingData: OnboardingData())
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
//
|
||||
// OnboardingCustomizeTwo.swift
|
||||
// Feels (iOS)
|
||||
//
|
||||
// Created by Trey Tartt on 4/5/22.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct OnboardingCustomizeTwo: View {
|
||||
@ObservedObject var onboardingData: OnboardingData
|
||||
|
||||
var formatter: DateFormatter {
|
||||
let dateFormatter = DateFormatter()
|
||||
dateFormatter.timeStyle = .short
|
||||
return dateFormatter
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
GeometryReader { geometry in
|
||||
VStack {
|
||||
Spacer()
|
||||
Image("average", bundle: .main)
|
||||
.foregroundColor(Color(UIColor.darkText))
|
||||
.opacity(0.04)
|
||||
.scaleEffect(1.2, anchor: .trailing)
|
||||
Spacer()
|
||||
}
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text(String(localized: "onboarding_title_customize_two_title"))
|
||||
.font(.title)
|
||||
.padding()
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.foregroundColor(.white)
|
||||
|
||||
SampleEntryView()
|
||||
.padding([.top])
|
||||
|
||||
ScrollView {
|
||||
VStack(alignment: .leading) {
|
||||
Text(String(localized: "onboarding_title_customize_two_section_one_title"))
|
||||
.font(.title3)
|
||||
.padding()
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.foregroundColor(.white)
|
||||
ImagePackPickerView()
|
||||
|
||||
Text(String(localized: "onboarding_title_customize_two_section_two_title"))
|
||||
.font(.title3)
|
||||
.padding()
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.foregroundColor(.white)
|
||||
|
||||
|
||||
TintPickerView()
|
||||
|
||||
Text(String(localized: "onboarding_title_customize_two_section_three_title"))
|
||||
.font(.title3)
|
||||
.padding()
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.foregroundColor(.white)
|
||||
|
||||
|
||||
TextColorPickerView()
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
.background(Color(hex: "0b84ff"))
|
||||
}
|
||||
}
|
||||
|
||||
struct OnboardingCustomizeTwo_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
OnboardingCustomizeTwo(onboardingData: OnboardingData())
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
//
|
||||
// OnboardingDay.swift
|
||||
// Feels (iOS)
|
||||
//
|
||||
// Created by Trey Tartt on 1/20/22.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
enum DayOptions: Int, CaseIterable, RawRepresentable, Codable {
|
||||
case Today
|
||||
case Previous
|
||||
|
||||
var localizedValue: String {
|
||||
switch self {
|
||||
|
||||
case .Today:
|
||||
return String(localized: "onboarding_day_options_today")
|
||||
case .Previous:
|
||||
return String(localized: "onboarding_day_options_yesterday")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct OnboardingDay: View {
|
||||
@ObservedObject var onboardingData: OnboardingData
|
||||
|
||||
var previewText: String {
|
||||
switch onboardingData.inputDay {
|
||||
case .Today:
|
||||
return String(localized: "onboarding_day_preview_text_today")
|
||||
case .Previous:
|
||||
return String(localized: "onboarding_day_preview_text_yesterday")
|
||||
}
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
GeometryReader { geometry in
|
||||
VStack {
|
||||
Spacer()
|
||||
Image("bad", bundle: .main)
|
||||
.foregroundColor(Color(UIColor.darkText))
|
||||
.opacity(0.04)
|
||||
.scaleEffect(1.2, anchor: .trailing)
|
||||
Spacer()
|
||||
}
|
||||
|
||||
ScrollView {
|
||||
VStack(alignment: .leading) {
|
||||
Text(String(localized: "onboarding_day_title"))
|
||||
.font(.title)
|
||||
.padding()
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.foregroundColor(.white)
|
||||
|
||||
|
||||
Picker(selection: $onboardingData.inputDay,
|
||||
label: Text("")) {
|
||||
ForEach(DayOptions.allCases, id: \.self) { day in
|
||||
Text(day.localizedValue)
|
||||
}
|
||||
}
|
||||
.labelsHidden()
|
||||
.frame(minWidth: 0, maxWidth: .infinity)
|
||||
.padding()
|
||||
.pickerStyle(SegmentedPickerStyle())
|
||||
.colorScheme(.dark)
|
||||
|
||||
Text(previewText)
|
||||
.font(.title3)
|
||||
.padding()
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.foregroundColor(.white)
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
.background(Color(hex: "ff9e0b"))
|
||||
}
|
||||
}
|
||||
|
||||
struct OnboardingDay_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
Group{
|
||||
OnboardingDay(onboardingData: OnboardingData())
|
||||
|
||||
OnboardingDay(onboardingData: OnboardingData())
|
||||
.preferredColorScheme(.dark)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
//
|
||||
// OnboardingMain.swift
|
||||
// Feels (iOS)
|
||||
//
|
||||
// Created by Trey Tartt on 1/20/22.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct OnboardingMain: View {
|
||||
@Environment(\.presentationMode) var presentationMode
|
||||
@State var onboardingData: OnboardingData
|
||||
|
||||
let updateBoardingDataClosure: ((OnboardingData) -> Void)
|
||||
|
||||
var body: some View {
|
||||
TabView {
|
||||
OnboardingTime(onboardingData: onboardingData)
|
||||
|
||||
OnboardingDay(onboardingData: onboardingData)
|
||||
|
||||
OnboardingCustomizeTwo(onboardingData: onboardingData)
|
||||
|
||||
OnboardingCustomizeOne(onboardingData: onboardingData)
|
||||
|
||||
// OnboardingTitle(onboardingData: onboardingData)
|
||||
|
||||
OnboardingWrapup(onboardingData: onboardingData,
|
||||
completionClosure: { _ in
|
||||
updateBoardingDataClosure(onboardingData)
|
||||
})
|
||||
}
|
||||
.ignoresSafeArea()
|
||||
.tabViewStyle(.page)
|
||||
.onAppear {
|
||||
setupAppearance()
|
||||
}
|
||||
.interactiveDismissDisabled()
|
||||
}
|
||||
|
||||
func setupAppearance() {
|
||||
UIPageControl.appearance().currentPageIndicatorTintColor = .white
|
||||
UIPageControl.appearance().pageIndicatorTintColor = UIColor.black.withAlphaComponent(0.2)
|
||||
}
|
||||
}
|
||||
|
||||
struct OnboardingMain_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
OnboardingMain(onboardingData: OnboardingData(),
|
||||
updateBoardingDataClosure: { _ in
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
//
|
||||
// OnboardingTime.swift
|
||||
// Feels (iOS)
|
||||
//
|
||||
// Created by Trey Tartt on 1/20/22.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct OnboardingTime: View {
|
||||
@ObservedObject var onboardingData: OnboardingData
|
||||
|
||||
var formatter: DateFormatter {
|
||||
let dateFormatter = DateFormatter()
|
||||
dateFormatter.timeStyle = .short
|
||||
return dateFormatter
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
GeometryReader { geometry in
|
||||
VStack(alignment: .leading) {
|
||||
Spacer()
|
||||
Image("horrible", bundle: .main)
|
||||
.foregroundColor(Color(UIColor.darkText))
|
||||
.opacity(0.04)
|
||||
.scaleEffect(1.2, anchor: .trailing)
|
||||
Spacer()
|
||||
}
|
||||
|
||||
|
||||
ScrollView {
|
||||
Text(String(localized: "onboarding_time_title"))
|
||||
.font(.title)
|
||||
.padding()
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.foregroundColor(Color(UIColor.white))
|
||||
|
||||
DatePicker("", selection: $onboardingData.date,
|
||||
displayedComponents: .hourAndMinute)
|
||||
.scaleEffect(2)
|
||||
.labelsHidden()
|
||||
.frame(minWidth: 0, maxWidth: .infinity)
|
||||
.padding()
|
||||
.padding([.top, .bottom], 25)
|
||||
.colorScheme(.dark)
|
||||
|
||||
Text(String(format: String(localized: "onboarding_time_body"),
|
||||
formatter.string(from: onboardingData.date)))
|
||||
.font(.title3)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.padding()
|
||||
.foregroundColor(Color(UIColor.white))
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
.background(Color(hex: "ff453a"))
|
||||
}
|
||||
}
|
||||
|
||||
struct OnboardingTime_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
Group {
|
||||
OnboardingTime(onboardingData: OnboardingData())
|
||||
|
||||
OnboardingTime(onboardingData: OnboardingData())
|
||||
.preferredColorScheme(.dark)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
//
|
||||
// OnboardingTitle.swift
|
||||
// Feels (iOS)
|
||||
//
|
||||
// Created by Trey Tartt on 1/20/22.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct OnboardingTitle: View {
|
||||
static let titleOptions = [
|
||||
String(localized: "onboarding_title_title_option_1"),
|
||||
String(localized: "onboarding_title_title_option_2"),
|
||||
String(localized: "onboarding_title_title_option_3")]
|
||||
|
||||
@ObservedObject var onboardingData: OnboardingData
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
|
||||
Image("average", bundle: .main)
|
||||
.foregroundColor(Color(UIColor.darkText))
|
||||
.opacity(0.04)
|
||||
.scaleEffect(1.2)
|
||||
.padding(.bottom, 55)
|
||||
|
||||
ScrollView {
|
||||
VStack{
|
||||
Text(String(localized: "onboarding_title_title"))
|
||||
.font(.title)
|
||||
.foregroundColor(Color(UIColor.white))
|
||||
.padding([.trailing, .leading], 55)
|
||||
.padding([.top], 25)
|
||||
|
||||
ForEach(OnboardingTitle.titleOptions, id: \.self) { option in
|
||||
Button(action: {
|
||||
// onboardingData.title = option
|
||||
}, label: {
|
||||
Text(option)
|
||||
.font(.system(size: 15))
|
||||
.fontWeight(.bold)
|
||||
.foregroundColor(.white)
|
||||
.padding(10)
|
||||
.background(RoundedRectangle(cornerRadius: 10).stroke().foregroundColor(Color.white))
|
||||
.cornerRadius(10)
|
||||
})
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
.padding([.top], 10)
|
||||
}
|
||||
|
||||
Text(String(localized: "onboarding_title_type_your_own"))
|
||||
.font(.body)
|
||||
.foregroundColor(Color(UIColor.white))
|
||||
.padding([.top], 25)
|
||||
.padding([.trailing, .leading], 55)
|
||||
|
||||
// TextField("Notification", text: $onboardingData.title)
|
||||
// .frame(height: 44)
|
||||
// .foregroundColor(Color(UIColor.white))
|
||||
// .textFieldStyle(PlainTextFieldStyle())
|
||||
// .padding([.leading, .trailing], 4)
|
||||
// .cornerRadius(16)
|
||||
// .overlay(RoundedRectangle(cornerRadius: 16).stroke(Color.white))
|
||||
// .padding([.leading, .trailing], 75)
|
||||
// .padding([.top], 45)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
.background(.orange)
|
||||
}
|
||||
}
|
||||
|
||||
struct OnboardingTitle_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
Group {
|
||||
OnboardingTitle(onboardingData: OnboardingData())
|
||||
|
||||
OnboardingTitle(onboardingData: OnboardingData())
|
||||
.preferredColorScheme(.dark)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
//
|
||||
// OnboardingWrapup.swift
|
||||
// Feels (iOS)
|
||||
//
|
||||
// Created by Trey Tartt on 1/21/22.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct OnboardingWrapup: View {
|
||||
@ObservedObject var onboardingData: OnboardingData
|
||||
|
||||
let completionClosure: ((OnboardingData) -> Void)
|
||||
|
||||
var formatter: DateFormatter {
|
||||
let dateFormatter = DateFormatter()
|
||||
dateFormatter.timeStyle = .short
|
||||
return dateFormatter
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
GeometryReader { geometry in
|
||||
VStack {
|
||||
Spacer()
|
||||
Image("great", bundle: .main)
|
||||
.foregroundColor(Color(UIColor.darkText))
|
||||
.opacity(0.04)
|
||||
.scaleEffect(1.2, anchor: .trailing)
|
||||
Spacer()
|
||||
}
|
||||
|
||||
VStack {
|
||||
ScrollView {
|
||||
|
||||
Spacer()
|
||||
|
||||
Text(String(localized: "onboarding_wrap_up_1"))
|
||||
.padding(.top)
|
||||
.padding()
|
||||
.font(.title)
|
||||
.foregroundColor(Color(UIColor.white))
|
||||
|
||||
Text(formatter.string(from: onboardingData.date))
|
||||
.font(.title)
|
||||
.fontWeight(.bold)
|
||||
.padding()
|
||||
.foregroundColor(Color(UIColor.white))
|
||||
|
||||
Text(String(localized: "onboarding_wrap_up_3"))
|
||||
.font(.title)
|
||||
.padding()
|
||||
.foregroundColor(Color(UIColor.white))
|
||||
|
||||
Text(onboardingData.inputDay.localizedValue)
|
||||
.font(.title)
|
||||
.fontWeight(.bold)
|
||||
.padding()
|
||||
.foregroundColor(Color(UIColor.white))
|
||||
|
||||
Button(action: {
|
||||
EventLogger.log(event: "onboarding_complete")
|
||||
EventLogger.log(event: "onboarding_complete_day_id",
|
||||
withData: ["id": onboardingData.inputDay.rawValue])
|
||||
completionClosure(onboardingData)
|
||||
}, label: {
|
||||
Text(String(localized: "onboarding_wrap_up_complete_button"))
|
||||
.font(.title)
|
||||
.fontWeight(.bold)
|
||||
.foregroundColor(Color(hex: "31d158"))
|
||||
.padding()
|
||||
.background(RoundedRectangle(cornerRadius: 10).fill().foregroundColor(Color.white))
|
||||
.cornerRadius(10)
|
||||
})
|
||||
.padding([.top], 65)
|
||||
}
|
||||
.multilineTextAlignment(.center)
|
||||
}
|
||||
.frame(maxWidth: geometry.size.width)
|
||||
}
|
||||
}
|
||||
.background(Color(hex: "31d158"))
|
||||
}
|
||||
}
|
||||
|
||||
struct OnboardingWrapup_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
Group {
|
||||
OnboardingWrapup(onboardingData: OnboardingData(), completionClosure: { _ in
|
||||
|
||||
})
|
||||
|
||||
OnboardingWrapup(onboardingData: OnboardingData(), completionClosure: { _ in
|
||||
|
||||
})
|
||||
.preferredColorScheme(.dark)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user