This commit completes the DRY refactoring by implementing the missing document form functionality and enhancing user experience with better error messages. ## iOS Document Forms - Implemented complete createDocument() method in DocumentViewModel: - Support for all warranty-specific fields (itemName, modelNumber, serialNumber, provider, etc.) - Multiple image uploads with JPEG compression - Proper UIImage to KotlinByteArray conversion - Async completion handlers - Implemented updateDocument() method with full field support - Completed DocumentFormView submitForm() implementation with proper API calls - Fixed type conversion issues (Bool/KotlinBoolean, Int32/KotlinInt) - Added proper error handling and user feedback ## iOS Login Error Handling - Enhanced error messages to be user-friendly and concise - Added specific messages for common HTTP error codes (400, 401, 403, 404, 500+) - Implemented cleanErrorMessage() helper to remove technical jargon - Added network-specific error handling (connection, timeout) - Fixed MainActor isolation warnings with proper Task wrapping ## Code Quality - Removed ~4,086 lines of duplicate code through form consolidation - Added 429 lines of new shared form components - Fixed Swift compiler performance issues - Ensured both iOS and Android builds succeed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
39 lines
1.3 KiB
Swift
39 lines
1.3 KiB
Swift
import Foundation
|
|
|
|
struct DocumentTypeHelper {
|
|
static let allTypes = ["warranty", "manual", "receipt", "inspection", "insurance", "other"]
|
|
|
|
static func displayName(for value: String) -> String {
|
|
switch value {
|
|
case "warranty": return "Warranty"
|
|
case "manual": return "User Manual"
|
|
case "receipt": return "Receipt/Invoice"
|
|
case "inspection": return "Inspection Report"
|
|
case "permit": return "Permit"
|
|
case "deed": return "Deed/Title"
|
|
case "insurance": return "Insurance"
|
|
case "contract": return "Contract"
|
|
case "photo": return "Photo"
|
|
default: return "Other"
|
|
}
|
|
}
|
|
}
|
|
|
|
struct DocumentCategoryHelper {
|
|
static let allCategories = ["appliance", "hvac", "plumbing", "electrical", "roofing", "flooring", "other"]
|
|
|
|
static func displayName(for value: String) -> String {
|
|
switch value {
|
|
case "appliance": return "Appliance"
|
|
case "hvac": return "HVAC"
|
|
case "plumbing": return "Plumbing"
|
|
case "electrical": return "Electrical"
|
|
case "roofing": return "Roofing"
|
|
case "structural": return "Structural"
|
|
case "landscaping": return "Landscaping"
|
|
case "general": return "General"
|
|
default: return "Other"
|
|
}
|
|
}
|
|
}
|