Introduce PdfExportService and platform interfaces#3758
Introduce PdfExportService and platform interfaces#3758andreia-ferreira wants to merge 15 commits into
Conversation
…at will handle the different steps
…to androidHostTest
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3758 +/- ##
============================================
+ Coverage 68.05% 68.12% +0.06%
+ Complexity 1617 1616 -1
============================================
Files 369 369
Lines 9542 9537 -5
Branches 1246 1248 +2
============================================
+ Hits 6494 6497 +3
+ Misses 2378 2368 -10
- Partials 670 672 +2
🚀 New features to boost your workflow:
|
| val images = imageProvider.load(request.qrContent, request.document.photoFilenames()) | ||
| try { | ||
| renderer.render(request.document, images, path) | ||
| } finally { |
There was a problem hiding this comment.
If renderer.render() throws an exception (e.g. out of memory, disk full, etc.), a partially written or corrupted 0-byte file might be left on the disk. To prevent opening/sharing broken PDFs, please consider catching exceptions during rendering and delete the corrupted file. Then re-throw the exception so it can be handled upstream
There was a problem hiding this comment.
thanks for catching this. Added the exception handling 👍
| .map { it.filter(::isSafeFileChar) } | ||
| .filter { it.isNotBlank() } |
There was a problem hiding this comment.
Will this work for other locales (e.g. japanese or arabic characters)?
There was a problem hiding this comment.
good point, this would not work. I updated it so now characters from all languages are preserved
Towards #3715
Introduces the scaffolding for PDF export of submission data. This is platform-independent and has the
PdfExportServiceas entry point. The provider/renderer/launcher interfaces will be implemented on the platform level on the next PR. This new code is part of a new KMP module:feature:pdfAdditionally, as a small cleanup, removed the jvm from the
core:uigradle config because otherwise all expect/actual logic would have to be also implemented on jvmMain. Also added androidLibrary target tocore:testingso that the fake testing classes are possible to be used by modules that contain that targetThis introduces no functionality changes.
@shobhitagarwal1612 PTAL?