Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "WEIGHTS.pdf",
"filename" : "WEIGHT_TRAINING.pdf",
"idiom" : "universal"
}
],
Expand Down
Binary file not shown.
6 changes: 3 additions & 3 deletions RecordManagment/Domain/Entitiy/Calendar/CalendarDetail.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct ExerciseResponse: Decodable, Equatable, Hashable {
let caloriesBurned: Int?
let exerciseTimeMinutes: Int?
let stepCount: Int?
let weight: Int?
let weight: Double?
let dailyNote: String
let imageUrls: [String]

Expand All @@ -76,7 +76,7 @@ struct ExerciseResponse: Decodable, Equatable, Hashable {
caloriesBurned: Int? = nil,
exerciseTimeMinutes: Int? = nil,
stepCount: Int? = nil,
weight: Int? = nil,
weight: Double? = nil,
dailyNote: String,
imageUrls: [String] = []
) {
Expand All @@ -103,7 +103,7 @@ struct ExerciseResponse: Decodable, Equatable, Hashable {
let caloriesBurned = try container.decodeIfPresent(Int.self, forKey: .caloriesBurned)
let exerciseTimeMinutes = try container.decodeIfPresent(Int.self, forKey: .exerciseTimeMinutes)
let stepCount = try container.decodeIfPresent(Int.self, forKey: .stepCount)
let weight = try container.decodeIfPresent(Int.self, forKey: .weight)
let weight = try container.decodeIfPresent(Double.self, forKey: .weight)
let dailyNote = try container.decode(String.self, forKey: .dailyNote)
self.base = RecordResponse(id: id, type: type, recordDate: recordDate, recordTime: recordTime, createdAt: createdAt, updatedAt: updatedAt)
self.exerciseType = exerciseType
Expand Down
2 changes: 1 addition & 1 deletion RecordManagment/Domain/Entitiy/Exercise/ExerciseDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ struct ExerciseBody: Codable {
let caloriesBurned: Int
let exerciseTimeMinutes: Int
let stepCount: Int
let weight: Int
let weight: Double
let dailyNote: String
var imageUrls: [String]
let recordDate: String?
Expand Down
2 changes: 1 addition & 1 deletion RecordManagment/Domain/Entitiy/Exercise/ExerciseObj.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ enum ExerciseObj: String, CaseIterable {
"야구"
case .yoga:
"요가"
case .weight_training:
case .weight_training:
"웨이트 트레이닝"
case .cycling:
"자전거"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ struct ExerciseRecordView: View {
inputGroup(title: "소모 칼로리", placeHolder: "0 kcal", number: $vm.kcal, focused: .kcal)
inputGroup(title: "운동 시간", placeHolder: "0 분", number: $vm.time, focused: .time)
inputGroup(title: "걸음 수", placeHolder: "0 걸음", number: $vm.step, focused: .step)
inputGroup(title: "몸무게", placeHolder: "0 Kg", number: $vm.weight, focused: .weight)
weightGroup(title: "몸무게", placeHolder: "0 Kg", number: $vm.weight, focused: .weight)
Divider().foregroundStyle(Color.Gray._200())
inputGroup(title: "나의 하루", placeHolder: "NAN", isMultiField: true)
ImagesHStack(selectedImages: $vm.selectedImages, selectedItems: $vm.selectedItems, isFocused: $isFocused)
Expand Down Expand Up @@ -252,6 +252,58 @@ struct ExerciseRecordView: View {
}
}

// TODO: TextLabel Group 뷰 ( 몸무게 )
private func weightGroup(title: String, placeHolder: String, number: Binding<Double> = .constant(0), isMultiField: Bool = false, focused: Field? = nil) -> some View {

var numberText: Binding<String> {
Binding(
get: {
if let focused = focused {
if isFocused == focused {
return number.wrappedValue == 0 ? "" : String(format: "%g", number.wrappedValue)
} else {
return number.wrappedValue == 0 ? "" : "\(String(format: "%g", number.wrappedValue)) \(focused.getName())"
}
}
return ""
},
set: { newValue in
var filtered = ""
var decimalAdded = false
for char in newValue {
if char.isWholeNumber {
filtered.append(char)
} else if char == "." && !decimalAdded {
filtered.append(char)
decimalAdded = true
}
}
if let value = Double(filtered) {
number.wrappedValue = value
} else if isFocused == focused {
number.wrappedValue = 0
}
}
)
}

return VStack(spacing: 10) {
Text(title)
.typography(.p14SemiBold)
.frame(maxWidth: .infinity, alignment: .leading)
if isMultiField {
MultiTextField(text: $vm.text, isFocused: $isFocused)
} else {
TextField(placeHolder, text: numberText)
.focused($isFocused, equals: focused)
.padding(14)
.background(Color.Gray._100())
.clipShape(.rect(cornerRadius: 8))
.keyboardType(.decimalPad)
}
}
}

// TODO: Exercise ReSelection View
private var exerciseReSelectionView: some View {
NavigationStack {
Expand Down Expand Up @@ -295,3 +347,4 @@ struct ExerciseRecordView: View {
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ extension ExerciseRecordView {
@Published var kcal: Int = 0
@Published var time: Int = 0
@Published var step: Int = 0
@Published var weight: Int = 0
@Published var weight: Double = 0
@Published var text: String = ""
@Published var selectedItems: [PhotosPickerItem] = []
@Published var selectedImages: [PhotoTransfer] = []
Expand Down