feat(doc-scan): Query for FairScan, if built-in scanning not available#16427
Open
feat(doc-scan): Query for FairScan, if built-in scanning not available#16427
Conversation
To enable the document scanning feature for a specific build variant,
previously two places had to be adjusted:
- The build.gradle.kts, in the "region AppScan"
- A variant-specific implementation for VariantModule.kt
Now, only the first one is required and the VariantModule.kt handles it
automatically.
Benefits: Only a single place to change. And no code duplication
Drawback: Reflection is a bit more brittle - it all depends on the package
and class name to not change
Signed-off-by: Philipp Hasper <vcs@hasper.info>
Testing two main variants, one without appscan, and one with it. However, as of now the automated test for the gplay flavor does not run automatically in the CI, as we only test the generic flavor. So the test's purpose was just to verify the reflection approach locally. Signed-off-by: Philipp Hasper <vcs@hasper.info>
Built-in scanning is not available for all build variants - e.g. not for "generic", which is the flavor for the F-Droid release. It doesn't allow the non-reproducible TinyOpenCV build. If this is the case, we are checking whether the open source scanning app FairScan is available (https://github.com/pynicolas/FairScan) and open that one for scanning. The declaration in the AndroidManifest is required since Android 11 (API level 30), otherwise the Intent would always be null. See https://developer.android.com/training/package-visibility Signed-off-by: Philipp Hasper <vcs@hasper.info>
Before, the filename from FairScan just was <unixTimestamp>.pdf. Now, we are giving it our own timestamped name, just like we do for images and videos captured via the camera intent. This uses the same fileDisplayNameTransformer as PR #16298 Signed-off-by: Philipp Hasper <vcs@hasper.info>
|
blue-Light-Screenshot test failed, but no output was generated. Maybe a preliminary stage failed. |
|
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/16427.apk |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Built-in scanning is not available for all build variants - e.g. not for "generic", which is the flavor for the F-Droid release. It doesn't allow the non-reproducible TinyOpenCV build.
If this is the case, we are checking whether the open source scanning app FairScan is available (https://github.com/pynicolas/FairScan) and open that one for scanning.
This approach was selected based on the discussion here: #12624 (comment)
Result
Screen_recording_20260201_143916.webm
Behind the scenes
1769952395766.pdf.fileDisplayNameTransformeras in my other current PR When uploading a single file, offer input field to change file name #16298.