Fix iOS build errors and notification time picker crash

- Remove invalid 'summary' parameter from TaskColumnsResponse calls
- Remove invalid 'totalDueSoon' parameter from TotalSummary call
- Fix TimePickerSheet crash when scrolling by properly initializing @State
  with State(initialValue:) and pre-computing hours array

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Trey t
2025-12-16 17:40:03 -06:00
parent fbe45da9ff
commit 59a827f692
4 changed files with 16 additions and 6 deletions

View File

@@ -562,11 +562,21 @@ struct NotificationTimePickerRow: View {
// MARK: - TimePickerSheet // MARK: - TimePickerSheet
struct TimePickerSheet: View { struct TimePickerSheet: View {
@State var selectedHour: Int @State private var selectedHour: Int
let onSave: (Int) -> Void let onSave: (Int) -> Void
let onCancel: () -> Void let onCancel: () -> Void
let formatHour: (Int) -> String let formatHour: (Int) -> String
// Pre-computed hours array to avoid range issues with wheel picker
private let hours: [Int] = Array(0..<24)
init(selectedHour: Int, onSave: @escaping (Int) -> Void, onCancel: @escaping () -> Void, formatHour: @escaping (Int) -> String) {
_selectedHour = State(initialValue: selectedHour)
self.onSave = onSave
self.onCancel = onCancel
self.formatHour = formatHour
}
var body: some View { var body: some View {
NavigationStack { NavigationStack {
VStack(spacing: 24) { VStack(spacing: 24) {
@@ -576,7 +586,7 @@ struct TimePickerSheet: View {
.padding(.top) .padding(.top)
Picker("Hour", selection: $selectedHour) { Picker("Hour", selection: $selectedHour) {
ForEach(0..<24, id: \.self) { hour in ForEach(hours, id: \.self) { hour in
Text(formatHour(hour)) Text(formatHour(hour))
.tag(hour) .tag(hour)
} }

View File

@@ -24,7 +24,7 @@ struct ResidencesListView: View {
errorMessage: viewModel.errorMessage, errorMessage: viewModel.errorMessage,
content: { residences in content: { residences in
ResidencesContent( ResidencesContent(
summary: viewModel.totalSummary ?? TotalSummary(totalResidences: Int32(residences.count), totalTasks: 0, totalOverdue: 0, totalDueSoon: 0, totalPending: 0, tasksDueNextWeek: 0, tasksDueNextMonth: 0), summary: viewModel.totalSummary ?? TotalSummary(totalResidences: Int32(residences.count), totalTasks: 0, totalPending: 0, totalOverdue: 0, tasksDueNextWeek: 0, tasksDueNextMonth: 0),
residences: residences residences: residences
) )
}, },

View File

@@ -185,7 +185,7 @@ struct SwipeHintView: View {
) )
], ],
daysThreshold: 30, daysThreshold: 30,
residenceId: "1", summary: nil residenceId: "1"
), ),
onEditTask: { _ in }, onEditTask: { _ in },
onCancelTask: { _ in }, onCancelTask: { _ in },

View File

@@ -402,7 +402,7 @@ class TaskViewModel: ObservableObject {
tasksResponse = TaskColumnsResponse( tasksResponse = TaskColumnsResponse(
columns: newColumns, columns: newColumns,
daysThreshold: currentResponse.daysThreshold, daysThreshold: currentResponse.daysThreshold,
residenceId: currentResponse.residenceId, summary: nil residenceId: currentResponse.residenceId
) )
} }
@@ -430,7 +430,7 @@ class TaskViewModel: ObservableObject {
tasksResponse = TaskColumnsResponse( tasksResponse = TaskColumnsResponse(
columns: newColumns, columns: newColumns,
daysThreshold: currentResponse.daysThreshold, daysThreshold: currentResponse.daysThreshold,
residenceId: currentResponse.residenceId, summary: nil residenceId: currentResponse.residenceId
) )
} }