Skip to content

Commit

Permalink
Merge branch 'settings'
Browse files Browse the repository at this point in the history
  • Loading branch information
damienRifflart committed Sep 1, 2023
2 parents ee081d7 + ca2273f commit 37b8f89
Show file tree
Hide file tree
Showing 15 changed files with 214 additions and 54 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

Shapy.xcodeproj/project.xcworkspace/xcuserdata/damienrifflart.xcuserdatad/UserInterfaceState.xcuserstate
Binary file modified Graphics/Iphone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions Shapy.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

/* Begin PBXBuildFile section */
D72FCA302AA08680000CB4DE /* FinishView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D72FCA2F2AA08680000CB4DE /* FinishView.swift */; };
D74D33CA2AA0BB4A009B774F /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D74D33C92AA0BB4A009B774F /* SettingsView.swift */; };
D74D33CC2AA0F3C8009B774F /* DataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D74D33CB2AA0F3C8009B774F /* DataManager.swift */; };
D79BF0CB2AA085A3006A8C17 /* ShapyApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = D79BF0CA2AA085A2006A8C17 /* ShapyApp.swift */; };
D79BF0CD2AA085A3006A8C17 /* LandingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D79BF0CC2AA085A3006A8C17 /* LandingView.swift */; };
D79BF0CF2AA085A4006A8C17 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D79BF0CE2AA085A4006A8C17 /* Assets.xcassets */; };
Expand All @@ -18,6 +20,8 @@

/* Begin PBXFileReference section */
D72FCA2F2AA08680000CB4DE /* FinishView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FinishView.swift; sourceTree = "<group>"; };
D74D33C92AA0BB4A009B774F /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
D74D33CB2AA0F3C8009B774F /* DataManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataManager.swift; sourceTree = "<group>"; };
D79BF0C72AA085A2006A8C17 /* Shapy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Shapy.app; sourceTree = BUILT_PRODUCTS_DIR; };
D79BF0CA2AA085A2006A8C17 /* ShapyApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShapyApp.swift; sourceTree = "<group>"; };
D79BF0CC2AA085A3006A8C17 /* LandingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LandingView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -58,10 +62,12 @@
isa = PBXGroup;
children = (
D79BF0CA2AA085A2006A8C17 /* ShapyApp.swift */,
D74D33CB2AA0F3C8009B774F /* DataManager.swift */,
D79BF0CC2AA085A3006A8C17 /* LandingView.swift */,
D7BAF9BB2AA08620003FE9CF /* PausedView.swift */,
D7BAF9BD2AA0864C003FE9CF /* ExerciceView.swift */,
D72FCA2F2AA08680000CB4DE /* FinishView.swift */,
D74D33C92AA0BB4A009B774F /* SettingsView.swift */,
D79BF0CE2AA085A4006A8C17 /* Assets.xcassets */,
D79BF0D02AA085A4006A8C17 /* Preview Content */,
);
Expand Down Expand Up @@ -149,6 +155,8 @@
D7BAF9BE2AA0864C003FE9CF /* ExerciceView.swift in Sources */,
D72FCA302AA08680000CB4DE /* FinishView.swift in Sources */,
D79BF0CD2AA085A3006A8C17 /* LandingView.swift in Sources */,
D74D33CC2AA0F3C8009B774F /* DataManager.swift in Sources */,
D74D33CA2AA0BB4A009B774F /* SettingsView.swift in Sources */,
D7BAF9BC2AA08620003FE9CF /* PausedView.swift in Sources */,
D79BF0CB2AA085A3006A8C17 /* ShapyApp.swift in Sources */,
);
Expand Down
Binary file added Shapy/.DS_Store
Binary file not shown.
Binary file added Shapy/Assets.xcassets/.DS_Store
Binary file not shown.
Binary file modified Shapy/Assets.xcassets/mockup.imageset/Iphone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions Shapy/DataManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import SwiftUI

class DataManager: ObservableObject {
@Published var currentSerie: Int = 1
@Published var exerciceOne: String = "15 Pompes"
@Published var exerciceTwo: String = "30 Abdos"
@Published var exerciceThree: String = ""
@Published var exerciceFour: String = ""
@Published var exerciceIndex: Int = 0
}
15 changes: 2 additions & 13 deletions Shapy/ExerciceView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,9 @@

import SwiftUI

class Var: ObservableObject {
@Published var currentSerie: Int = 1
@Published var exerciceOne: String = "First"
@Published var exerciceTwo: String = "Second"
@Published var exerciceThree: String = ""
@Published var exerciceFour: String = ""
@Published var exerciceIndex: Int = 0

}

struct ExerciceView: View {
@State private var isPausedViewActive = false
@ObservedObject var variables: Var
@ObservedObject var variables: DataManager

var body: some View {

Expand Down Expand Up @@ -193,8 +183,7 @@ struct ExerciceView: View {

struct ExerciceView_Previews: PreviewProvider {
static var previews: some View {
let variables = Var()
return ExerciceView(variables: variables)
ExerciceView(variables: DataManager())
}
}

2 changes: 1 addition & 1 deletion Shapy/FinishView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct FinishView: View {
.padding(.bottom, 30)
}
.fullScreenCover(isPresented: $isLandingViewActive) {
LandingView()
LandingView(variables: DataManager())
}
}
}
Expand Down
82 changes: 46 additions & 36 deletions Shapy/LandingView.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
//
// LandingView.swift
// Shapy V1
//
// Created by Damien Rifflart on 27/08/2023.
//

import SwiftUI

extension Color {
Expand All @@ -16,10 +9,10 @@ extension Color {
}
}


struct LandingView: View {
@State private var isExerciceViewActive = false
@StateObject private var sharedVariables = Var()
@State private var isSettingsViewActive = false
@ObservedObject var variables: DataManager

var body: some View {
ZStack{
Expand All @@ -28,53 +21,70 @@ struct LandingView: View {
.ignoresSafeArea()

VStack{
HStack{
VStack{
// Title Text
Text(" Bienvenue")
.foregroundColor(Color.white)
.font(.system(size: 50))
.padding(.top, 110)

Text("Damien")
.foregroundColor(Color(hex: 0xE6D2F7))
.font(.system(size: 50))
.fontWeight(.semibold)

Spacer()

}
.padding(.leading, -25)
Spacer()
}
Spacer()
Spacer()
Spacer()
Spacer()

// Title Text
Text("Bienvenue")
.foregroundColor(Color.white)
.font(.system(size: 50))
.padding(.top, 150)

Text("Damien")
.foregroundColor(Color(hex: 0xE6D2F7))
.font(.system(size: 50))
.fontWeight(.semibold)
.padding(.bottom, 20)

Image("mockup")
.frame(height: 400)
Spacer()

// Second Page Button
// Settings Button
Button(action: { isSettingsViewActive.toggle()
}) {
Text("Paramètre")
.font(.system(size: 30, weight: .bold))
.foregroundColor(Color(hex: 0x0E0215))
.padding()
.frame(width: 300, height:60)
.background(Color(hex: 0xE6D2F7))
.cornerRadius(10)
.padding(.top, 20)
.padding(.bottom, 10)
}

// Start Button
Button(action: { isExerciceViewActive.toggle()
}) {
Text("Commencer")
.font(.system(size: 30, weight: .bold))
.foregroundColor(Color(hex: 0x0E0215))
.padding()
.frame(width: 300)
.frame(width: 300, height:60)
.background(Color(hex: 0xE6D2F7))
.cornerRadius(10)
.padding(.bottom, 130)
.padding(.bottom, 200)
}

}
.fullScreenCover(isPresented: $isExerciceViewActive) {
ExerciceView(variables: sharedVariables)
ExerciceView(variables: variables)
}

.fullScreenCover(isPresented: $isSettingsViewActive) {
SettingsView(variables: variables)

}
}
}
}


struct LandingView_Previews: PreviewProvider {
@StateObject static var dataManager = DataManager()

static var previews: some View {
LandingView()
LandingView(variables: dataManager)
}
}

5 changes: 2 additions & 3 deletions Shapy/PausedView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct PausedView: View {
@State private var timeRemaining: CGFloat = defaultTimeRemaining
@State private var isExerciceViewActive = false
@State private var isFinishedViewActive = false
@ObservedObject var variables: Var
@ObservedObject var variables: DataManager

let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()

Expand Down Expand Up @@ -279,8 +279,7 @@ struct PausedView: View {

struct ContentView_Previews: PreviewProvider {
static var previews: some View {
let variables = Var()
return PausedView(variables: variables)
PausedView(variables: DataManager())
}
}

Binary file added Shapy/Preview Content/.DS_Store
Binary file not shown.
142 changes: 142 additions & 0 deletions Shapy/SettingsView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
import SwiftUI

struct SettingsView: View {
@ObservedObject var variables: DataManager
@State private var isLandingViewActive = false
@State private var exerciceOneInput = ""
@State private var exerciceTwoInput = ""
@State private var exerciceThreeInput = ""
@State private var exerciceFourInput = ""

func saveButton(){
isLandingViewActive.toggle()
variables.exerciceOne = exerciceOneInput
variables.exerciceTwo = exerciceTwoInput
variables.exerciceThree = exerciceThreeInput
variables.exerciceFour = exerciceFourInput
}

var body: some View {

ZStack{
// Background Color
Color(hex: 0x0E0215)
.ignoresSafeArea()

VStack{
HStack{
// Back Button
Button(action: { isLandingViewActive.toggle() }) {
Text("Retour")
.font(.system(size: 30, weight: .bold))
.foregroundColor(Color(hex: 0x0E0215))
.padding()
.frame(width: 130, height:60)
.background(Color(hex: 0xE6D2F7))
.cornerRadius(10)
}
.padding(.leading, 20)

Spacer()

// Save Button
Button(action: { saveButton() }) {
Text("Enregistrer")
.font(.system(size: 30, weight: .bold))
.foregroundColor(Color(hex: 0x0E0215))
.padding()
.frame(width: 188, height:60)
.background(Color(hex: 0xE6D2F7))
.cornerRadius(10)
}
.padding(.trailing, 20)

}
.fullScreenCover(isPresented: $isLandingViewActive) {
LandingView(variables: variables)
}

Spacer()

// Exercice 1
Text("Exercice 1")
.foregroundColor(Color.white)
.font(.system(size:35, weight:.bold))
.padding(.leading, 40.0)
.frame(maxWidth: .infinity, alignment: .leading)

TextField(" 15 Pompes", text: $exerciceOneInput)
.background(Color.gray.opacity(0.2))
.foregroundColor(Color(hex: 0xE6D2F7))
.frame(width: 300)
.cornerRadius(6)
.font(.system(size:40))
.padding(.top, -20)
.padding(.bottom, 20)


// Exercice 2
Text("Exercice 2")
.foregroundColor(Color.white)
.font(.system(size:35, weight:.bold))
.padding(.leading, 40.0)
.frame(maxWidth: .infinity, alignment: .leading)

TextField(" 15 Pompes", text: $exerciceTwoInput)
.background(Color.gray.opacity(0.2))
.foregroundColor(Color(hex: 0xE6D2F7))
.frame(width: 300)
.cornerRadius(6)
.font(.system(size:40))
.padding(.top, -20)
.padding(.bottom, 20)


// Exercice 3
Text("Exercice 3")
.foregroundColor(Color.white)
.font(.system(size:35, weight:.bold))
.padding(.leading, 40.0)
.frame(maxWidth: .infinity, alignment: .leading)

TextField(" 15 Pompes", text: $exerciceThreeInput)
.background(Color.gray.opacity(0.2))
.foregroundColor(Color(hex: 0xE6D2F7))
.frame(width: 300)
.cornerRadius(6)
.font(.system(size:40))
.padding(.top, -20)
.padding(.bottom, 20)


// Exercice 4
Text("Exercice 4")
.foregroundColor(Color.white)
.font(.system(size:35, weight:.bold))
.padding(.leading, 40.0)
.frame(maxWidth: .infinity, alignment: .leading)

TextField(" 15 Pompes", text: $exerciceFourInput)
.background(Color.gray.opacity(0.2))
.foregroundColor(Color(hex: 0xE6D2F7))
.frame(width: 300)
.cornerRadius(6)
.font(.system(size:40))
.padding(.top, -20)



}
.padding(.bottom, 50.0)


}
}
}


struct SettingsView_Previews: PreviewProvider {
static var previews: some View {
SettingsView(variables: DataManager())
}
}
2 changes: 1 addition & 1 deletion Shapy/ShapyApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import SwiftUI
struct ShapyApp: App {
var body: some Scene {
WindowGroup {
LandingView()
LandingView(variables: DataManager())
}
}
}

0 comments on commit 37b8f89

Please sign in to comment.