Complete iOS document form implementation and improve login error handling

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>
This commit is contained in:
Trey t
2025-11-12 11:35:41 -06:00
parent ec7c01e92d
commit b888315e0c
22 changed files with 2994 additions and 4086 deletions

View File

@@ -1,6 +1,8 @@
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"
@@ -18,6 +20,8 @@ struct DocumentTypeHelper {
}
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"