Introduce PdfExportService and platform interfaces#3758
Introduce PdfExportService and platform interfaces#3758andreia-ferreira wants to merge 14 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.06% 68.11% +0.05%
+ Complexity 1612 1610 -2
============================================
Files 369 369
Lines 9534 9529 -5
Branches 1244 1246 +2
============================================
+ Hits 6489 6491 +2
+ Misses 2377 2368 -9
- Partials 668 670 +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?