Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RMET-2758 OSBarcodeLib-Android - Scan barcodes using zxing only #1

Merged
merged 31 commits into from
Nov 8, 2023

Conversation

alexgerardojacinto
Copy link
Collaborator

@alexgerardojacinto alexgerardojacinto commented Nov 6, 2023

Description

  • This PR includes the first implementation of the scan feature of the Barcode Android library, which only uses the zxing library to scan the barcodes.

    • OSBARCController is the library's entry point and as its name suggests, acts as the Controller in the library, following the MVC pattern.
    • OSBARCScannerActivity, which is implemented using Jetpack Compose, is the activity responsible for opening the Camera stream, using CameraX.
    • OSBARCBarcodeAnalyzer is a helper class that implements ImageAnalysis.Analyzer from CameraX, and is responsible for processing the image frames it receives and call the ZXing library to read barcodes.
      • Note: When we add MLKit to the solution, we will probably use the factory pattern to obtain an instance of the correct scanning library class, instead of using ZXing directly.
    • OSBARCScanParameters is a data class that represents the object with the Scan Parameters (e.g. scan instructions).
    • OSBARCError in an enum class that holds the errors that the library can return in the scan barcode feature.
    • The files in view/ui.theme are helper files that were automatically generated when setting up Jetpack Compose. These may change or be removed in the future.
  • The PR also includes the setup of the Azure pipeline (https://dev.azure.com/OutSystemsRD/Mobile%20Supported%20Plugins/_build?definitionId=4066) for the library.

  • It also includes the setup of the GitHub action that does code analysis using SonarCloud.

    • Extra: Fix GitHub Actions warning messages.
  • It also removes unnecessary files that came from https://github.com/OutSystems/OSLibraryTemplate-Android

  • Since in the next task we will be adding the scanning feature using MLKit besides Zxing, the code will still suffer a few organizational changes. Because of that, unit tests will be added in the context of the following task: https://outsystemsrd.atlassian.net/browse/RMET-2894

Context

References: https://outsystemsrd.atlassian.net/browse/RMET-2758

Type of changes

  • Fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Refactor (cosmetic changes)
  • Breaking change (change that would cause existing functionality to not work as expected)

Platforms affected

  • Android
  • iOS
  • JavaScript

Tests

Screenshots (if appropriate)

Following are videos displaying the possible flows of the Scan Barcode feature:

Successful scan of a barcode

screen-20231106-160714.mp4

Successful scan of a barcode that is upside down

screen-20231106-160745.mp4

Canceling a scanning

screen-20231106-160813.mp4

Permission for the camera is denied

screen-20231106-160922.1.mp4

Checklist

  • Pull request title follows the format RNMT-XXXX <title>
  • Code follows code style of this project
  • CHANGELOG.md file is correctly updated
  • Changes require an update to the documentation
    • Documentation has been updated accordingly

Context: This PR includes a first version of the scanBarcode feature, which uses CameraX, Jetpack Compose, and ZXing to implement the scanner.

References: https://outsystemsrd.atlassian.net/browse/RMET-2758
Context: We need to properly handle all possible outcomes of the scanning feature: success, cancelled, or some error that happened while scanning.

References: https://outsystemsrd.atlassian.net/browse/RMET-2758
Context: This pipeline will be used to build the library and publish the version defined in the pom.xml file in our Azure repository.

References: https://outsystemsrd.atlassian.net/browse/RMET-2758
Context: The version of the Android Gradle plugin we're using, that matches the one set by MABSA 10, requires Java 17 to run.

References: https://outsystemsrd.atlassian.net/browse/RMET-2758
Context: We use SonarCloud for test coverage, so these steps are unnecessary.

References: https://outsystemsrd.atlassian.net/browse/RMET-2758
Context: The version of the Android Gradle plugin the lib uses, which matches the one from MABS 10, requires Java 17 to run.

References: https://outsystemsrd.atlassian.net/browse/RMET-2758
Context: This is a required step in the SonarCloud configuration.

References: https://outsystemsrd.atlassian.net/browse/RMET-2758
Context: SonarCloud needs to be configured to look at the files where we want coverage to be analyzed.

References: https://outsystemsrd.atlassian.net/browse/RMET-2758
Copy link

sonarcloud bot commented Nov 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@alexgerardojacinto alexgerardojacinto merged commit 925f8b7 into development Nov 8, 2023
4 checks passed
@alexgerardojacinto alexgerardojacinto deleted the feat/RMET-2758/scan-code-zxing branch November 10, 2023 19:48
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.

3 participants