Skip to content

Commit f4d6657

Browse files
BAL-183-GP-BPM-CONFIGURATION (#184)
- BPM Step configuration on profile section - Cell adjust (width)
1 parent ea6b6e4 commit f4d6657

14 files changed

+140
-19
lines changed

Balance/Balance.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ struct Balance: App {
5656
if !userModel.existLocalUser(uid: demoID) {
5757
userModel.createDemoUser()
5858
}
59+
60+
let bmpStep = UserDefaults.standard.value(forKey: bpmKEY)
61+
if bmpStep == nil {
62+
UserDefaults.standard.setValue(defaultBPM, forKey: bpmKEY)
63+
}
5964
})
6065
.onChange(of: scenePhase) { phase in
6166
switch phase {

Balance/Chill/ChillCellView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ struct ChillCellView: View {
3636
}
3737
}
3838
.padding(EdgeInsets(top: 24, leading: 24, bottom: 24, trailing: 0))
39-
.frame(maxWidth: 311, maxHeight: 114)
39+
.frame(maxWidth: UIScreen.screenWidth - 20)
40+
.frame(height: 120)
4041
.foregroundColor(darkBlueColor)
4142
.background(RoundedRectangle(cornerRadius: 20).fill(.white))
4243
.clipped()

Balance/Distraction/DistractionCellView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ struct DistractionCellView: View {
2525
Spacer()
2626
}
2727
}
28-
.frame(maxWidth: 311, maxHeight: 120)
28+
.frame(maxWidth: UIScreen.screenWidth - 20)
29+
.frame(height: 120)
2930
.foregroundColor(darkBlueColor)
3031
.background(RoundedRectangle(cornerRadius: 20).fill(.white))
3132
.clipped()

Balance/Distraction/Drawing/DrawView.swift

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ struct DrawingView: UIViewRepresentable {
2929
canvas.maximumZoomScale = 10
3030
canvas.contentSize = CGSize(width: 1000, height: 1000)
3131
canvas.contentInset = UIEdgeInsets(top: 500, left: 500, bottom: 500, right: 500)
32+
canvas.isScrollEnabled = false
3233
return canvas
3334
}
3435

@@ -64,7 +65,7 @@ struct DrawView: View {
6465
@State var eraserWidth: Double = 99.0
6566
@State var lineWidth: CGFloat = 1.0
6667
@State var showLineWith = false
67-
68+
6869
var body: some View {
6970
ZStack {
7071
Color.white.edgesIgnoringSafeArea(.all)
@@ -125,7 +126,9 @@ struct DrawView: View {
125126
if self.title.isEmpty {
126127
self.emptyDrawAlert = true
127128
} else {
128-
saveImage()
129+
Task {
130+
await saveImage()
131+
}
129132
}
130133
} label: {
131134
Text("Save")
@@ -143,7 +146,11 @@ struct DrawView: View {
143146
.buttonStyle(ActivityLogButtonStyle(activityDescription: isColoring == true ? "Coloring Draw SAVED" : "Draw SAVED"))
144147
.alert("Enter the title of the drawing", isPresented: $emptyDrawAlert) {
145148
TextField("Title", text: $title)
146-
Button("OK", action: saveImage)
149+
Button("OK") {
150+
Task {
151+
await saveImage()
152+
}
153+
}
147154
}
148155
}
149156

@@ -377,7 +384,7 @@ struct DrawView: View {
377384
}
378385
}
379386

380-
func saveImage() {
387+
func saveImage() async {
381388
let newDraw = Draw(
382389
id: currentDraw.id,
383390
title: title,

Balance/Distraction/Drawing/Sketch/Classes/Main.storyboard

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22154" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
33
<device id="retina6_5" orientation="portrait" appearance="light"/>
44
<dependencies>
55
<deployment identifier="iOS"/>
6-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22130"/>
77
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
88
</dependencies>
99
<scenes>
@@ -45,7 +45,7 @@
4545
<outlet property="delegate" destination="vXZ-lx-hvc" id="u92-QC-S2R"/>
4646
</connections>
4747
</scrollView>
48-
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vWS-wj-bz5">
48+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vWS-wj-bz5">
4949
<rect key="frame" x="40" y="786" width="334" height="36"/>
5050
<color key="tintColor" red="0.2666509151" green="0.78627187009999999" blue="0.94962674380000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
5151
<state key="normal" title="Button"/>
@@ -54,7 +54,7 @@
5454
<fragment content="Save">
5555
<attributes>
5656
<color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
57-
<font key="NSFont" size="18" name="Montserrat-Regular"/>
57+
<font key="NSFont" metaFont="system" size="18"/>
5858
<font key="NSOriginalFont" size="12" name="Helvetica"/>
5959
</attributes>
6060
</fragment>

Balance/Distraction/Drawing/Sketch/Classes/SketchViewController.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,20 @@ class SketchViewController: UIViewController, ButtonViewInterface, UIScrollViewD
6363
alert.addAction(UIAlertAction(title: "Save", style: .default, handler: { [weak alert] (_) in
6464
let textField = alert?.textFields![0]
6565
self.draw?.title = textField!.text!
66-
self.save()
66+
Task {
67+
await self.save()
68+
}
6769
}))
6870

6971
self.present(alert, animated: true, completion: nil)
7072
} else {
71-
save()
73+
Task {
74+
await save()
75+
}
7276
}
7377
}
7478

75-
func save() {
79+
func save() async{
7680
let imageData = (self.sketchView.image?.pngData())!
7781
self.draw?.image = imageData
7882
self.coloringStore!.saveDraw((self.draw)!)

Balance/Distraction/Games/GamesCellView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ struct GamesCellView: View {
1616
iconView
1717
textView
1818
}
19-
.frame(maxWidth: 311, maxHeight: 120)
19+
.frame(maxWidth: UIScreen.screenWidth - 20)
20+
.frame(height: 120)
2021
.foregroundColor(darkBlueColor)
2122
.background(RoundedRectangle(cornerRadius: 20).fill(.white))
2223
.clipped()

Balance/Home/CellView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ struct CellView: View {
1616
iconView
1717
textView
1818
}
19-
.frame(maxWidth: 311, maxHeight: 120)
19+
.frame(maxWidth: UIScreen.screenWidth - 20)
20+
.frame(height: 120)
2021
.foregroundColor(darkBlueColor)
2122
.background(RoundedRectangle(cornerRadius: 20).fill(.white))
2223
.clipped()

Balance/Home/Home.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct HomeView: View {
4646
}
4747
}
4848
.onChange(of: counter.count, perform: { _ in
49-
if counter.count > 100 {
49+
if counter.count > UserDefaults.standard.double(forKey: bpmKEY) {
5050
print(counter.count)
5151
alertHeartRate()
5252
}

Balance/Home/NavigationView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ struct NavView: View {
2828
.frame(maxWidth: .infinity)
2929
}
3030
.padding(EdgeInsets(top: 24, leading: 24, bottom: 24, trailing: 0))
31-
.frame(maxWidth: 311, maxHeight: 114)
31+
.frame(maxWidth: UIScreen.screenWidth - 20)
32+
.frame(height: 120)
3233
.foregroundColor(darkBlueColor)
3334
.background(RoundedRectangle(cornerRadius: 20).fill(.white))
3435
.clipped()

0 commit comments

Comments
 (0)