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>
20 lines
511 B
Swift
20 lines
511 B
Swift
import SwiftUI
|
|
import ComposeApp
|
|
|
|
struct AddDocumentView: View {
|
|
let residenceId: Int32?
|
|
let initialDocumentType: String
|
|
@Binding var isPresented: Bool
|
|
@ObservedObject var documentViewModel: DocumentViewModel
|
|
|
|
var body: some View {
|
|
DocumentFormView(
|
|
residenceId: residenceId,
|
|
existingDocument: nil,
|
|
initialDocumentType: initialDocumentType,
|
|
isPresented: $isPresented,
|
|
documentViewModel: documentViewModel
|
|
)
|
|
}
|
|
}
|