From d777880d2bf5abb5e01d9d368c7e2ec3525fdbb4 Mon Sep 17 00:00:00 2001 From: Trey t Date: Sat, 15 Nov 2025 23:12:57 -0600 Subject: [PATCH] Fix iOS build errors - Update TaskDetail model usage for Double cost fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed type conversion issues in iOS Swift files to handle KotlinDouble for cost fields instead of String. Updated all task-related views to properly convert between String (for TextField input) and KotlinDouble (for API calls). Changes: - TaskCard.swift: Updated preview data with new TaskDetail signature (added residenceName, createdBy, createdByUsername, intervalDays; changed estimatedCost from String to Double; removed actualCost and notes) - TasksSection.swift: Updated two preview TaskDetail instances with new signature - CompleteTaskView.swift: Convert actualCost String to KotlinDouble for API - EditTaskView.swift: Convert estimatedCost between KotlinDouble and String for display and API calls - TaskFormView.swift: Convert estimatedCost String to KotlinDouble for API Pattern used: - Display: KotlinDouble -> String using .doubleValue - API: String -> Double -> KotlinDouble using KotlinDouble(double:) Build now succeeds with all type conversions properly handling Decimal/Double values from backend instead of String. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- iosApp/iosApp/Subviews/Task/TaskCard.swift | 8 +++++--- iosApp/iosApp/Subviews/Task/TasksSection.swift | 16 ++++++++++------ iosApp/iosApp/Task/CompleteTaskView.swift | 2 +- iosApp/iosApp/Task/EditTaskView.swift | 4 ++-- iosApp/iosApp/Task/TaskFormView.swift | 2 +- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/iosApp/iosApp/Subviews/Task/TaskCard.swift b/iosApp/iosApp/Subviews/Task/TaskCard.swift index 4d08477..759f92a 100644 --- a/iosApp/iosApp/Subviews/Task/TaskCard.swift +++ b/iosApp/iosApp/Subviews/Task/TaskCard.swift @@ -258,6 +258,9 @@ struct TaskCard: View { task: TaskDetail( id: 1, residence: 1, + residenceName: "Main House", + createdBy: 1, + createdByUsername: "testuser", title: "Clean Gutters", description: "Remove all debris from gutters", category: TaskCategory(id: 1, name: "maintenance", orderId: 0, description: ""), @@ -265,9 +268,8 @@ struct TaskCard: View { frequency: TaskFrequency(id: 1, name: "monthly", lookupName: "", displayName: "30", daySpan: 0, notifyDays: 0), status: TaskStatus(id: 1, name: "pending", displayName: "", orderId: 0, description: ""), dueDate: "2024-12-15", - estimatedCost: "150.00", - actualCost: nil, - notes: nil, + intervalDays: 30, + estimatedCost: 150.00, archived: false, createdAt: "2024-01-01T00:00:00Z", updatedAt: "2024-01-01T00:00:00Z", diff --git a/iosApp/iosApp/Subviews/Task/TasksSection.swift b/iosApp/iosApp/Subviews/Task/TasksSection.swift index 7ccf423..c1a76c1 100644 --- a/iosApp/iosApp/Subviews/Task/TasksSection.swift +++ b/iosApp/iosApp/Subviews/Task/TasksSection.swift @@ -81,6 +81,9 @@ struct TasksSection: View { TaskDetail( id: 1, residence: 1, + residenceName: "Main House", + createdBy: 1, + createdByUsername: "testuser", title: "Clean Gutters", description: "Remove all debris", category: TaskCategory(id: 1, name: "maintenance", orderId: 1, description: ""), @@ -88,9 +91,8 @@ struct TasksSection: View { frequency: TaskFrequency(id: 1, name: "monthly", lookupName: "", displayName: "Monthly", daySpan: 0, notifyDays: 0), status: TaskStatus(id: 1, name: "pending", displayName: "Pending", orderId: 1, description: ""), dueDate: "2024-12-15", - estimatedCost: "150.00", - actualCost: nil, - notes: nil, + intervalDays: 30, + estimatedCost: 150.00, archived: false, createdAt: "2024-01-01T00:00:00Z", updatedAt: "2024-01-01T00:00:00Z", @@ -111,6 +113,9 @@ struct TasksSection: View { TaskDetail( id: 2, residence: 1, + residenceName: "Main House", + createdBy: 1, + createdByUsername: "testuser", title: "Fix Leaky Faucet", description: "Kitchen sink fixed", category: TaskCategory(id: 2, name: "plumbing", orderId: 1, description: ""), @@ -118,9 +123,8 @@ struct TasksSection: View { frequency: TaskFrequency(id: 6, name: "once", lookupName: "", displayName: "One Time", daySpan: 0, notifyDays: 0), status: TaskStatus(id: 3, name: "completed", displayName: "Completed", orderId: 1, description: ""), dueDate: "2024-11-01", - estimatedCost: "200.00", - actualCost: nil, - notes: nil, + intervalDays: nil, + estimatedCost: 200.00, archived: false, createdAt: "2024-10-01T00:00:00Z", updatedAt: "2024-11-05T00:00:00Z", diff --git a/iosApp/iosApp/Task/CompleteTaskView.swift b/iosApp/iosApp/Task/CompleteTaskView.swift index 9701843..fa267b1 100644 --- a/iosApp/iosApp/Task/CompleteTaskView.swift +++ b/iosApp/iosApp/Task/CompleteTaskView.swift @@ -308,7 +308,7 @@ struct CompleteTaskView: View { completedByEmail: "", companyName: selectedContractor?.company ?? "", completionDate: currentDate, - actualCost: actualCost.isEmpty ? nil : actualCost, + actualCost: actualCost.isEmpty ? nil : KotlinDouble(double: Double(actualCost) ?? 0.0), notes: notes.isEmpty ? nil : notes, rating: KotlinInt(int: Int32(rating)) ) diff --git a/iosApp/iosApp/Task/EditTaskView.swift b/iosApp/iosApp/Task/EditTaskView.swift index f529e62..9481449 100644 --- a/iosApp/iosApp/Task/EditTaskView.swift +++ b/iosApp/iosApp/Task/EditTaskView.swift @@ -37,7 +37,7 @@ struct EditTaskView: View { _selectedPriority = State(initialValue: task.priority) _selectedStatus = State(initialValue: task.status) _dueDate = State(initialValue: task.dueDate ?? "") - _estimatedCost = State(initialValue: task.estimatedCost ?? "") + _estimatedCost = State(initialValue: task.estimatedCost != nil ? String(task.estimatedCost!.doubleValue) : "") } var body: some View { @@ -174,7 +174,7 @@ struct EditTaskView: View { priority: priority.id, status: KotlinInt(value: status.id), dueDate: dueDate, - estimatedCost: estimatedCost.isEmpty ? nil : estimatedCost, + estimatedCost: estimatedCost.isEmpty ? nil : KotlinDouble(double: Double(estimatedCost) ?? 0.0), archived: task.archived ) diff --git a/iosApp/iosApp/Task/TaskFormView.swift b/iosApp/iosApp/Task/TaskFormView.swift index af6a395..7f0bab7 100644 --- a/iosApp/iosApp/Task/TaskFormView.swift +++ b/iosApp/iosApp/Task/TaskFormView.swift @@ -318,7 +318,7 @@ struct TaskFormView: View { priority: Int32(priority.id), status: selectedStatus.map { KotlinInt(value: $0.id) }, dueDate: dueDateString, - estimatedCost: estimatedCost.isEmpty ? nil : estimatedCost, + estimatedCost: estimatedCost.isEmpty ? nil : KotlinDouble(double: Double(estimatedCost) ?? 0.0), archived: false )