Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 36 additions & 35 deletions Modules/Receipts/Sources/Views/ReceiptImportView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,39 +129,40 @@ struct ReceiptImportView: View {
}
}

// TODO: Re-enable Gmail import function once module dependencies are resolved
// private func importFromGmail() {
// isImporting = true
// importError = nil
//
// Task {
// do {
// let receipts = try await gmailModule.fetchReceipts()
//
// await MainActor.run {
// // Save receipts to repository
// for receipt in receipts {
// viewModel.saveReceipt(receipt)
// }
//
// importedCount = receipts.count
// isImporting = false
//
// // Show success message
// if receipts.isEmpty {
// importError = NSError(
// domain: "ReceiptImport",
// code: 0,
// userInfo: [NSLocalizedDescriptionKey: "No receipts found in Gmail"]
// )
// }
// }
// } catch {
// await MainActor.run {
// importError = error
// isImporting = false
// }
// }
// }
// }
/// Import receipts from Gmail
/// This method should be enabled once the Gmail module dependencies are resolved.
private func importFromGmail() {
isImporting = true
importError = nil

Task {
do {
let receipts = try await gmailModule.fetchReceipts()

await MainActor.run {
// Save receipts to repository
for receipt in receipts {
viewModel.saveReceipt(receipt)
}

importedCount = receipts.count
isImporting = false

// Show success message
if receipts.isEmpty {
importError = NSError(
domain: "ReceiptImport",
code: 0,
userInfo: [NSLocalizedDescriptionKey: "No receipts found in Gmail"]
)
}
}
} catch {
await MainActor.run {
importError = error
isImporting = false
}
}
}
}
}
Loading