Skip to content

Implement and polish invoice/bill scan transaction flow#3

Merged
gjong merged 8 commits into
mainfrom
cursor/invoice-scan-transaction-plan-d5bf
May 19, 2026
Merged

Implement and polish invoice/bill scan transaction flow#3
gjong merged 8 commits into
mainfrom
cursor/invoice-scan-transaction-plan-d5bf

Conversation

@gjong

@gjong gjong commented May 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add end-to-end invoice/bill scan MVP flow:
    • dashboard FAB action for scan
    • scan screen + scan view model
    • on-device OCR with ML Kit
    • backend text-to-transaction extraction wiring
    • prefill handoff into existing add-transaction form
  • improve scan UX to be easier and more visually appealing:
    • guided 3-step layout (Import -> Extract -> Review)
    • clearer section cards, status/progress feedback, and larger primary actions
    • richer draft preview with icons and confidence badge
    • sticky bottom CTA when draft is ready
    • explicit manual-entry fallback action
    • improved error card styling and helper copy
  • fix Kotlin compile issue on scan screen:
    • resolve smart-cast problem by capturing uiState.draft in a stable local value before lambda usage
  • localize scan feature text completely:
    • move remaining hardcoded scan error copy into string resources
    • add Dutch (values-nl) and German (values-de) translations for scan/FAB strings
  • add camera capture support in scan flow:
    • add Take a photo action next to gallery import
    • use ActivityResultContracts.TakePicture() with temporary content:// URI
    • configure FileProvider + res/xml/file_paths.xml for secure camera output
    • handle camera launch failures with localized error copy
  • fix camera button behavior when permission is missing:
    • explicitly request runtime CAMERA permission before capture
    • show localized errors when permission is denied or when no camera app is available
    • only launch camera intent after permission grant and camera-app availability check
  • improve OCR for invoice/bill tables with description + price columns:
    • add OcrTextFormatter to reconstruct row-aligned text from OCR bounding boxes
    • detect two-column layouts and pair left description cells with right amount cells by Y-position
    • emit cleaner tab-separated lines for better downstream transaction extraction
    • include unit tests for two-column pairing and single-column fallback behavior

Technical details

  • added TransactionExtractionDraft domain model
  • extended TransactionRepository with extractTransactionFromText(text)
  • wired extraction call in PledgerApiService
  • mapped extraction payload in TransactionRepositoryImpl
  • added InvoiceTextExtractor (ML Kit text recognition)
  • added InvoiceScanScreen + InvoiceScanViewModel
  • extended add-transaction route to accept optional prefill query params, parsed by TransactionFormViewModel

Testing

  • Added unit tests: OcrTextFormatterTest
  • Attempted compile/tests in cloud environment but Android SDK is not configured (ANDROID_HOME / local.properties missing)
Open in Web Open in Cursor 

cursoragent and others added 2 commits May 18, 2026 08:52
Co-authored-by: Gerben Jongerius <gjong@users.noreply.github.com>
Co-authored-by: Gerben Jongerius <gjong@users.noreply.github.com>
@cursor cursor Bot changed the title Add invoice/bill scan-to-transaction design plan Implement invoice/bill scan MVP flow and transaction prefill May 18, 2026
gjong and others added 2 commits May 18, 2026 19:31
Co-authored-by: Gerben Jongerius <gjong@users.noreply.github.com>
@cursor cursor Bot changed the title Implement invoice/bill scan MVP flow and transaction prefill Implement and polish invoice/bill scan transaction flow May 18, 2026
cursoragent and others added 4 commits May 18, 2026 17:47
Co-authored-by: Gerben Jongerius <gjong@users.noreply.github.com>
Co-authored-by: Gerben Jongerius <gjong@users.noreply.github.com>
Co-authored-by: Gerben Jongerius <gjong@users.noreply.github.com>
Co-authored-by: Gerben Jongerius <gjong@users.noreply.github.com>
@gjong gjong marked this pull request as ready for review May 19, 2026 13:36
@gjong gjong merged commit 328bae7 into main May 19, 2026
1 check passed
@gjong gjong deleted the cursor/invoice-scan-transaction-plan-d5bf branch May 19, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants