Skip to content

Commit c072e59

Browse files
Camera screen design changes
1 parent 49368bb commit c072e59

File tree

5 files changed

+88
-42
lines changed

5 files changed

+88
-42
lines changed

Sources/SprenUI/UI/Screens/Flows/BodyComp/CameraScreen/CameraScreen.swift

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -73,31 +73,32 @@ struct CameraScreen: View {
7373

7474
Spacer()
7575

76-
if(isTimerOpen) {
77-
CameraScreenTimerSelectionContainer(model: model, buttonCallBack: {
78-
isTimerOpen = !isTimerOpen
79-
})
80-
}
81-
82-
ZStack {
83-
VisualEffectView(effect: UIBlurEffect(style: .dark)).edgesIgnoringSafeArea(.bottom)
84-
85-
HStack {
86-
Spacer().frame(width: Autoscale.convert(35))
87-
88-
timerButton
89-
90-
Spacer()
91-
92-
cameraButton
76+
HStack {
77+
if(isTimerOpen) {
78+
CameraScreenTimerSelectionContainer(model: model, buttonCallBack: {
79+
isTimerOpen = !isTimerOpen
80+
})
81+
}
82+
83+
Spacer()
84+
85+
ZStack {
86+
VisualEffectView(effect: UIBlurEffect(style: .dark)).edgesIgnoringSafeArea(.bottom)
9387

94-
Spacer()
88+
VStack {
89+
timerButton
9590

96-
switchButton
91+
cameraButton
9792

98-
Spacer().frame(width: Autoscale.convert(35))
99-
}
100-
}.frame(height: Autoscale.convert(158))
93+
switchButton
94+
}.padding(.horizontal, Autoscale.convert(10))
95+
}.fixedSize(horizontal: true, vertical: true).cornerRadius(Autoscale.convert(30), corners: [.topLeft, .bottomLeft])
96+
}
97+
98+
if(geometry.safeAreaInsets.bottom == 0){
99+
Spacer().frame(height: Autoscale.convert(10))
100+
}
101+
101102
}.onReceive(model.imageUpdated) {
102103
goAnalyzingScreen()
103104
}.onReceive(model.pointsUpdated) {
@@ -182,16 +183,23 @@ struct CameraScreen: View {
182183
Button {
183184
isTimerOpen = !isTimerOpen
184185
} label: {
185-
VStack {
186-
Spacer().frame(height: Autoscale.convert(25))
187-
Image("Timer", bundle: .module).colorMultiply(isTimerOpen ? .sprenUISecondaryColor : .white)
186+
ZStack(alignment: .top) {
187+
HStack {
188+
if let isTimerOn = model.isTimerOn {
189+
Text(String(isTimerOn) + "s")
190+
.font(.sprenParagraph)
191+
.foregroundColor(.white)
192+
.padding(.top, Autoscale.convert(10))
193+
}else{
194+
Text(" ")
195+
}
196+
Spacer()
197+
}
188198

189-
if let isTimerOn = model.isTimerOn {
190-
Text(String(isTimerOn) + "s")
191-
.font(.sprenParagraph)
192-
.foregroundColor(.white)
193-
}else{
194-
Text(" ")
199+
VStack {
200+
Spacer().frame(height: Autoscale.convert(25))
201+
Image("Timer", bundle: .module).colorMultiply(isTimerOpen ? .sprenUISecondaryColor : .white)
202+
Spacer().frame(height: Autoscale.convert(10))
195203
}
196204
}
197205
}
@@ -206,21 +214,22 @@ struct CameraScreen: View {
206214
}
207215
} label: {
208216
if(model.time ?? 0 > 0) {
209-
Image("Stop", bundle: .module)
217+
Image("Stop", bundle: .module).resizable().frame(width: Autoscale.convert(50), height: Autoscale.convert(50))
210218
} else {
211-
Image("Camera", bundle: .module)
219+
Image("Camera", bundle: .module).resizable()
220+
.frame(width: Autoscale.convert(50), height: Autoscale.convert(50))
212221
}
213-
}
222+
}.padding(.bottom, Autoscale.convert(5))
214223
}
215224

216225
var switchButton: some View {
217226
Button {
218227
model.flipCamera()
219228
} label: {
220229
VStack {
221-
Spacer().frame(height: Autoscale.convert(25))
230+
Spacer().frame(height: Autoscale.convert(10))
222231
Image("Switch", bundle: .module).colorMultiply(model.isCameraFlipped ? .sprenUISecondaryColor : .white)
223-
Text(" ")
232+
Spacer().frame(height: Autoscale.convert(25))
224233
}
225234
}
226235
}

Sources/SprenUI/UI/Screens/Flows/BodyComp/CameraScreen/CameraScreenInfoCard.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct CameraScreenInfoCard: View {
5555
.foregroundColor(.white)
5656
Spacer()
5757
}
58-
}.padding(Autoscale.convert(24)).padding(.horizontal, Autoscale.convert(20))
58+
}.padding(Autoscale.convert(24))
5959
}.fixedSize(horizontal: false, vertical: true).cornerRadius(Autoscale.convert(15)).padding()
6060
}
6161
}

Sources/SprenUI/UI/Screens/Flows/BodyComp/CameraScreen/CameraScreenTimerSelectionContainer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct CameraScreenTimerSelectionContainer: View {
1616
ZStack {
1717
VisualEffectView(effect: UIBlurEffect(style: .dark)).edgesIgnoringSafeArea(.bottom)
1818

19-
HStack(spacing: Autoscale.convert(30)) {
19+
HStack(spacing: Autoscale.convert(10)) {
2020
Button {
2121
model.setTimer(nil)
2222
buttonCallBack()

Sources/SprenUI/UI/Screens/Flows/BodyComp/CameraScreen/CanvasBoxes.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ struct CanvasBoxes: View {
1414
let leftAnkle: CGPoint?
1515
let rightAnkle: CGPoint?
1616

17-
let armsHeight = UIScreen.main.bounds.height/4
17+
let armsHeight = UIScreen.main.bounds.height/2.5
1818
let armsRightWidth = UIScreen.main.bounds.width
1919
let leftWidth = UIScreen.main.bounds.width / 2
2020
let rightWidth = UIScreen.main.bounds.width / 2 + 75
@@ -74,7 +74,7 @@ struct CanvasBoxes: View {
7474
}
7575
}
7676

77-
let bottomHeight = UIScreen.main.bounds.height + topPadding - Autoscale.convert(bottomPadding + 180)
77+
let bottomHeight = UIScreen.main.bounds.height + topPadding - Autoscale.convert(bottomPadding + 40)
7878

7979
if(leftAnkle.x > leftWidth - 49 && leftAnkle.x < rightWidth - 27 && leftAnkle.y > bottomHeight - 107 && leftAnkle.y < bottomHeight - 6){
8080
return true
@@ -98,7 +98,7 @@ struct CanvasBoxes: View {
9898
}
9999
}
100100

101-
let bottomHeight = UIScreen.main.bounds.height + topPadding - Autoscale.convert(bottomPadding + 180)
101+
let bottomHeight = UIScreen.main.bounds.height + topPadding - Autoscale.convert(bottomPadding + 40)
102102

103103
if(rightAnkle.x > leftWidth - 49 && rightAnkle.x < rightWidth - 27 && rightAnkle.y > bottomHeight - 107 && rightAnkle.y < bottomHeight - 6){
104104
return true
@@ -115,6 +115,7 @@ struct CanvasBoxes: View {
115115
var body: some View {
116116
GeometryReader { geometry in
117117
ZStack {
118+
// Color(.black)
118119
ZStack {
119120
//Top left
120121
Path { path in
@@ -223,7 +224,7 @@ struct CanvasBoxes: View {
223224

224225
ZStack {
225226
//Bottom
226-
let bottomHeight = UIScreen.main.bounds.height - (geometry.safeAreaInsets.top + geometry.safeAreaInsets.bottom + Autoscale.convert(160))
227+
let bottomHeight = UIScreen.main.bounds.height - (geometry.safeAreaInsets.top + geometry.safeAreaInsets.bottom + Autoscale.convert(20))
227228

228229
Path { path in
229230
let p1 = CGPoint(x: leftWidth - 34, y: bottomHeight - 106)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//
2+
// File.swift
3+
//
4+
//
5+
// Created by Fernando on 11/8/22.
6+
//
7+
8+
import SwiftUI
9+
10+
11+
struct CornerRadiusStyle: ViewModifier {
12+
var radius: CGFloat
13+
var corners: UIRectCorner
14+
15+
struct CornerRadiusShape: Shape {
16+
17+
var radius = CGFloat.infinity
18+
var corners = UIRectCorner.allCorners
19+
20+
func path(in rect: CGRect) -> Path {
21+
let path = UIBezierPath(roundedRect: rect, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
22+
return Path(path.cgPath)
23+
}
24+
}
25+
26+
func body(content: Content) -> some View {
27+
content
28+
.clipShape(CornerRadiusShape(radius: radius, corners: corners))
29+
}
30+
}
31+
32+
extension View {
33+
func cornerRadius(_ radius: CGFloat, corners: UIRectCorner) -> some View {
34+
ModifiedContent(content: self, modifier: CornerRadiusStyle(radius: radius, corners: corners))
35+
}
36+
}

0 commit comments

Comments
 (0)