Add lead workflows, PDF signing, AR projects and photo gallery integration
This commit is contained in:
27
GasTankAR/Services/Signing/LeadSignedPDFUploadService.swift
Normal file
27
GasTankAR/Services/Signing/LeadSignedPDFUploadService.swift
Normal file
@ -0,0 +1,27 @@
|
||||
import Foundation
|
||||
|
||||
enum LeadPDFUploadResult: Sendable {
|
||||
case uploaded
|
||||
case simulated
|
||||
}
|
||||
|
||||
@MainActor
|
||||
protocol LeadSignedPDFUploadService {
|
||||
var isSimulation: Bool { get }
|
||||
func upload(_ files: [URL], leadID: String, offerID: String, salesCode: String) async throws -> LeadPDFUploadResult
|
||||
}
|
||||
|
||||
/// UI demonstration until the PDF upload endpoint is available. Sends no data.
|
||||
struct StubLeadSignedPDFUploadService: LeadSignedPDFUploadService {
|
||||
let isSimulation = true
|
||||
var delay: Duration = .seconds(2)
|
||||
|
||||
func upload(_ files: [URL], leadID: String, offerID: String, salesCode: String) async throws -> LeadPDFUploadResult {
|
||||
guard !files.isEmpty, files.allSatisfy({ FileManager.default.fileExists(atPath: $0.path) }) else {
|
||||
throw PDFSigningError.invalidDocument
|
||||
}
|
||||
try await Task.sleep(for: delay)
|
||||
try Task.checkCancellation()
|
||||
return .simulated
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user