-
Notifications
You must be signed in to change notification settings - Fork 4
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-2761 OSBarcodeLib-Android - Scan Instructions and Scan Button #7
RMET-2761 OSBarcodeLib-Android - Scan Instructions and Scan Button #7
Conversation
Context: If there are scan instructions in the scan parameters, we present them in a Text composable (https://developer.android.com/jetpack/compose/text). References: https://outsystemsrd.atlassian.net/browse/RMET-2761
Context: This way, when the text has to be presented in more than 1 line, it is centered. References: https://outsystemsrd.atlassian.net/browse/RMET-2761
Context: When there's a scan button, we only want to start scanning when the button in clicked. For now, this behaviour is "faked" by us only sending the barcode result when the button in clicked. References: https://outsystemsrd.atlassian.net/browse/RMET-2762
Context: This refactor was necessary to reduce the cognitive complexity of the ScanScreen method, as pointed out by SonarCloud. References: https://outsystemsrd.atlassian.net/browse/RMET-2762
src/main/kotlin/com/outsystems/plugins/barcode/view/OSBARCScannerActivity.kt
Outdated
Show resolved
Hide resolved
import com.outsystems.plugins.barcode.controller.OSBARCBarcodeAnalyzer | ||
import com.outsystems.plugins.barcode.controller.OSBARCScanLibraryFactory | ||
import com.outsystems.plugins.barcode.controller.helper.OSBARCMLKitHelper | ||
import com.outsystems.plugins.barcode.controller.helper.OSBARCZXingHelper | ||
import com.outsystems.plugins.barcode.model.OSBARCError | ||
import com.outsystems.plugins.barcode.model.OSBARCScanParameters | ||
import com.outsystems.plugins.barcode.view.ui.theme.BarcodeScannerTheme | ||
import com.outsystems.plugins.barcode.view.ui.theme.CustomGray | ||
import com.outsystems.plugins.barcode.R |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to make sure this compiles on MABS because because the R class won't always be under this package.
For instance, on camera, this was the solution:
https://github.com/OutSystems/OSCameraLib-Android/blob/ae2c03c57c82cf8fe852a23a099fc273bb6f2651/src/main/kotlin/com/outsystems/plugins/camera/view/ImageEditorView.kt#L99
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a good point. However, since this is the Android library, the path to the package of the R class will always be the same - import com.outsystems.plugins.barcode.R
. Moreover, it is safer to access a resource directly through the R class than using a getResource
function based on the resource's id
, that may not exist.
dialogTitle = "Camera Access Not Enabled", | ||
dialogText = "To continue, please go to the Settings app and enable it.", | ||
confirmButtonText = "Settings", | ||
dismissButtonText = "Ok" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a thought.
Could theses strings be moved into the res/strings.xml
file? 🤔
I'm not sure though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a good point. I believe we can do that when we tackle dynamic values for these fields, using different Locales.
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Description
Text
composable.Button
composable. Ascanning
variable is used, and we only want to process scan results when it istrue
, which can happen either when there's no scan button at all, or after the scan button has been pressed.Context
References:
Type of changes
Platforms affected
Tests
Tested on Android 14 (Pixel 7)
Screenshots (if appropriate)
screen-20231117-101012.mp4
Checklist
RNMT-XXXX <title>