From a5232b13bb5c3ccd3144ad4f960cdb0e75d906fe Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Thu, 11 Jun 2026 17:08:38 -0400 Subject: [PATCH 1/6] feat: add accessibility labels to torch and cancel buttons The torch and cancel buttons were icon-only with no alternative text, so screen readers could not announce them. Add default English content descriptions and expose optional cancelButtonAccessibilityLabel, torchButtonOnAccessibilityLabel and torchButtonOffAccessibilityLabel scan parameters so consumers can customize/localize them. Closes #54 --- CHANGELOG.md | 7 +++ .../barcode/model/OSBARCScanParameters.kt | 5 ++- .../barcode/view/OSBARCScannerActivity.kt | 43 +++++++++++++++---- 3 files changed, 46 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 663cb94..2d1eee3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 The changes documented here do not include those from the original repository. +# [2.0.2] + +### 2026-06-11 + +- Add alternative text (content description) to the Torch and Cancel buttons for screen readers, defaulting to English (https://github.com/OutSystems/OSBarcodeLib-Android/issues/54) +- Add optional `cancelButtonAccessibilityLabel`, `torchButtonOnAccessibilityLabel` and `torchButtonOffAccessibilityLabel` scan parameters so consumers can customize/localize those accessibility labels + # [2.0.1] ### 2025-10-02 diff --git a/src/main/kotlin/com/outsystems/plugins/barcode/model/OSBARCScanParameters.kt b/src/main/kotlin/com/outsystems/plugins/barcode/model/OSBARCScanParameters.kt index aaee198..280291c 100644 --- a/src/main/kotlin/com/outsystems/plugins/barcode/model/OSBARCScanParameters.kt +++ b/src/main/kotlin/com/outsystems/plugins/barcode/model/OSBARCScanParameters.kt @@ -13,5 +13,8 @@ data class OSBARCScanParameters( @SerializedName("scanButton") val scanButton: Boolean, @SerializedName("scanText") val scanText: String, @SerializedName("hint") val hint: OSBARCScannerHint?, - @SerializedName("androidScanningLibrary") val androidScanningLibrary: String? + @SerializedName("androidScanningLibrary") val androidScanningLibrary: String?, + @SerializedName("cancelButtonAccessibilityLabel") val cancelButtonAccessibilityLabel: String? = null, + @SerializedName("torchButtonOnAccessibilityLabel") val torchButtonOnAccessibilityLabel: String? = null, + @SerializedName("torchButtonOffAccessibilityLabel") val torchButtonOffAccessibilityLabel: String? = null ) : Serializable \ No newline at end of file diff --git a/src/main/kotlin/com/outsystems/plugins/barcode/view/OSBARCScannerActivity.kt b/src/main/kotlin/com/outsystems/plugins/barcode/view/OSBARCScannerActivity.kt index 6d48d90..e6bf462 100644 --- a/src/main/kotlin/com/outsystems/plugins/barcode/view/OSBARCScannerActivity.kt +++ b/src/main/kotlin/com/outsystems/plugins/barcode/view/OSBARCScannerActivity.kt @@ -157,6 +157,11 @@ class OSBARCScannerActivity : ComponentActivity() { private const val CAM_DIRECTION_FRONT = 2 private const val ORIENTATION_PORTRAIT = 1 private const val ORIENTATION_LANDSCAPE = 2 + + // default English accessibility labels, used when the consumer does not provide custom ones + private const val DEFAULT_CANCEL_ACCESSIBILITY_LABEL = "Cancel scanning" + private const val DEFAULT_TORCH_ON_ACCESSIBILITY_LABEL = "Turn off flashlight" + private const val DEFAULT_TORCH_OFF_ACCESSIBILITY_LABEL = "Turn on flashlight" } /** @@ -534,7 +539,8 @@ class OSBARCScannerActivity : ComponentActivity() { CloseButton( modifier = Modifier .padding(top = ScannerBorderPadding, end = ScannerBorderPadding) - .align(Alignment.TopEnd) + .align(Alignment.TopEnd), + accessibilityLabel = parameters.cancelButtonAccessibilityLabel ) } @@ -595,7 +601,9 @@ class OSBARCScannerActivity : ComponentActivity() { TorchButton( modifier = Modifier .padding(bottom = ScannerBorderPadding, end = ScannerBorderPadding) - .align(Alignment.BottomEnd) + .align(Alignment.BottomEnd), + onAccessibilityLabel = parameters.torchButtonOnAccessibilityLabel, + offAccessibilityLabel = parameters.torchButtonOffAccessibilityLabel ) } } @@ -684,7 +692,8 @@ class OSBARCScannerActivity : ComponentActivity() { CloseButton( modifier = Modifier .padding(top = ScannerBorderPadding, end = ScannerBorderPadding) - .align(Alignment.TopEnd) + .align(Alignment.TopEnd), + accessibilityLabel = parameters.cancelButtonAccessibilityLabel ) Column( @@ -701,7 +710,9 @@ class OSBARCScannerActivity : ComponentActivity() { if (showTorch) { TorchButton( modifier = Modifier - .align(Alignment.End) + .align(Alignment.End), + onAccessibilityLabel = parameters.torchButtonOnAccessibilityLabel, + offAccessibilityLabel = parameters.torchButtonOffAccessibilityLabel ) Spacer(modifier = Modifier.height(16.dp)) } @@ -724,12 +735,15 @@ class OSBARCScannerActivity : ComponentActivity() { /** * Composable function, responsible rendering the close button * @param modifier the custom modifier for the button + * @param accessibilityLabel optional text to override the default content description used by screen readers */ @Composable - fun CloseButton(modifier: Modifier) { + fun CloseButton(modifier: Modifier, accessibilityLabel: String? = null) { + val contentDescription = accessibilityLabel?.takeIf { it.isNotBlank() } + ?: DEFAULT_CANCEL_ACCESSIBILITY_LABEL Icon( painter = painterResource(id = R.drawable.close), - contentDescription = null, + contentDescription = contentDescription, tint = Color.White, modifier = modifier .background(color = CloseButtonBackground, shape = CircleShape) @@ -744,17 +758,30 @@ class OSBARCScannerActivity : ComponentActivity() { /** * Composable function, responsible rendering the torch button * @param modifier the custom modifier for the button + * @param onAccessibilityLabel optional text to override the default content description used by screen readers when the torch is on + * @param offAccessibilityLabel optional text to override the default content description used by screen readers when the torch is off */ @Composable - fun TorchButton(modifier: Modifier) { + fun TorchButton( + modifier: Modifier, + onAccessibilityLabel: String? = null, + offAccessibilityLabel: String? = null + ) { var isFlashlightOn by remember { mutableStateOf(false) } val onIcon = painterResource(id = R.drawable.flash_on) val offIcon = painterResource(id = R.drawable.flash_off) val icon = if (isFlashlightOn) onIcon else offIcon + val torchContentDescription = if (isFlashlightOn) { + onAccessibilityLabel?.takeIf { it.isNotBlank() } + ?: DEFAULT_TORCH_ON_ACCESSIBILITY_LABEL + } else { + offAccessibilityLabel?.takeIf { it.isNotBlank() } + ?: DEFAULT_TORCH_OFF_ACCESSIBILITY_LABEL + } Image( painter = icon, - contentDescription = null, + contentDescription = torchContentDescription, modifier = modifier .clickable { try { From 297e7e22238e64fc4e1d982ffa112a321ef81b04 Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Sun, 14 Jun 2026 15:20:39 -0400 Subject: [PATCH 2/6] refactor: make button accessibility labels opt-in with no default When a label is not provided (null/blank), no content description is set, keeping the previous behavior unchanged. The English default labels are removed; consumers supply the (localized) labels via the scan parameters. --- CHANGELOG.md | 3 +-- .../barcode/view/OSBARCScannerActivity.kt | 17 ++++------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d1eee3..919d45f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,8 +10,7 @@ The changes documented here do not include those from the original repository. ### 2026-06-11 -- Add alternative text (content description) to the Torch and Cancel buttons for screen readers, defaulting to English (https://github.com/OutSystems/OSBarcodeLib-Android/issues/54) -- Add optional `cancelButtonAccessibilityLabel`, `torchButtonOnAccessibilityLabel` and `torchButtonOffAccessibilityLabel` scan parameters so consumers can customize/localize those accessibility labels +- Add optional `cancelButtonAccessibilityLabel`, `torchButtonOnAccessibilityLabel` and `torchButtonOffAccessibilityLabel` scan parameters to set the alternative text (content description) read by screen readers on the Cancel and Torch buttons. When not provided, no label is set, keeping the previous behavior unchanged. (https://github.com/OutSystems/OSBarcodeLib-Android/issues/54) # [2.0.1] diff --git a/src/main/kotlin/com/outsystems/plugins/barcode/view/OSBARCScannerActivity.kt b/src/main/kotlin/com/outsystems/plugins/barcode/view/OSBARCScannerActivity.kt index e6bf462..b8adab2 100644 --- a/src/main/kotlin/com/outsystems/plugins/barcode/view/OSBARCScannerActivity.kt +++ b/src/main/kotlin/com/outsystems/plugins/barcode/view/OSBARCScannerActivity.kt @@ -157,11 +157,6 @@ class OSBARCScannerActivity : ComponentActivity() { private const val CAM_DIRECTION_FRONT = 2 private const val ORIENTATION_PORTRAIT = 1 private const val ORIENTATION_LANDSCAPE = 2 - - // default English accessibility labels, used when the consumer does not provide custom ones - private const val DEFAULT_CANCEL_ACCESSIBILITY_LABEL = "Cancel scanning" - private const val DEFAULT_TORCH_ON_ACCESSIBILITY_LABEL = "Turn off flashlight" - private const val DEFAULT_TORCH_OFF_ACCESSIBILITY_LABEL = "Turn on flashlight" } /** @@ -735,15 +730,13 @@ class OSBARCScannerActivity : ComponentActivity() { /** * Composable function, responsible rendering the close button * @param modifier the custom modifier for the button - * @param accessibilityLabel optional text to override the default content description used by screen readers + * @param accessibilityLabel optional content description read by screen readers; when null or blank no label is set (default behavior) */ @Composable fun CloseButton(modifier: Modifier, accessibilityLabel: String? = null) { - val contentDescription = accessibilityLabel?.takeIf { it.isNotBlank() } - ?: DEFAULT_CANCEL_ACCESSIBILITY_LABEL Icon( painter = painterResource(id = R.drawable.close), - contentDescription = contentDescription, + contentDescription = accessibilityLabel?.takeIf { it.isNotBlank() }, tint = Color.White, modifier = modifier .background(color = CloseButtonBackground, shape = CircleShape) @@ -758,8 +751,8 @@ class OSBARCScannerActivity : ComponentActivity() { /** * Composable function, responsible rendering the torch button * @param modifier the custom modifier for the button - * @param onAccessibilityLabel optional text to override the default content description used by screen readers when the torch is on - * @param offAccessibilityLabel optional text to override the default content description used by screen readers when the torch is off + * @param onAccessibilityLabel optional content description read by screen readers when the torch is on; when null or blank no label is set (default behavior) + * @param offAccessibilityLabel optional content description read by screen readers when the torch is off; when null or blank no label is set (default behavior) */ @Composable fun TorchButton( @@ -773,10 +766,8 @@ class OSBARCScannerActivity : ComponentActivity() { val icon = if (isFlashlightOn) onIcon else offIcon val torchContentDescription = if (isFlashlightOn) { onAccessibilityLabel?.takeIf { it.isNotBlank() } - ?: DEFAULT_TORCH_ON_ACCESSIBILITY_LABEL } else { offAccessibilityLabel?.takeIf { it.isNotBlank() } - ?: DEFAULT_TORCH_OFF_ACCESSIBILITY_LABEL } Image( From c35cd23eaa4e81f84a2df65a6185176924a3c751 Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Wed, 17 Jun 2026 10:38:57 -0400 Subject: [PATCH 3/6] docs: correct CHANGELOG version to 2.1.0 (minor bump for new params) --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 919d45f..e947cf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 The changes documented here do not include those from the original repository. -# [2.0.2] +# [2.1.0] ### 2026-06-11 From 880922b1ac7691e1613ea713bd83616d3e9c9d40 Mon Sep 17 00:00:00 2001 From: OS-pedrogustavobilro Date: Tue, 23 Jun 2026 09:59:02 +0100 Subject: [PATCH 4/6] ci: comment failing Sonarcloud step Not being used these days, might as well comment to see if CI passes --- .github/workflows/run-unit-tests.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/run-unit-tests.yml b/.github/workflows/run-unit-tests.yml index cb4c7e4..d5440ab 100644 --- a/.github/workflows/run-unit-tests.yml +++ b/.github/workflows/run-unit-tests.yml @@ -34,8 +34,8 @@ jobs: - name: Setup sonarqube uses: warchant/setup-sonar-scanner@v8 - - name: Send to Sonarcloud - run: bundle exec fastlane sonarqube - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file + #- name: Send to Sonarcloud + # run: bundle exec fastlane sonarqube + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file From f165ecba677af79f07e3550ee4f7227535a19744 Mon Sep 17 00:00:00 2001 From: OS-pedrogustavobilro Date: Tue, 23 Jun 2026 09:59:29 +0100 Subject: [PATCH 5/6] chore: finish preparing for 2.1.0 release --- docs/README.md | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/README.md b/docs/README.md index cc338eb..5234453 100644 --- a/docs/README.md +++ b/docs/README.md @@ -46,7 +46,7 @@ In your app-level gradle file, import the OSBarcodeLib library like so: ```gradle dependencies { - implementation("com.github.outsystems:osbarcode-android:2.0.1@aar") + implementation("com.github.outsystems:osbarcode-android:2.1.0@aar") } ``` diff --git a/pom.xml b/pom.xml index 6859f68..5ae04cd 100644 --- a/pom.xml +++ b/pom.xml @@ -7,5 +7,5 @@ 4.0.0 io.ionic.libs ionbarcode-android - 2.0.1 + 2.1.0 From 7f44406afc25a62ec20cea5026783cfd1c6c70e6 Mon Sep 17 00:00:00 2001 From: OS-pedrogustavobilro Date: Fri, 26 Jun 2026 12:38:07 +0100 Subject: [PATCH 6/6] docs: Update date for consistencies sake --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d4c8612..1b178c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ The changes documented here do not include those from the original repository. # [2.1.0] -### 2026-06-11 +### 2026-06-26 - Add optional `cancelButtonAccessibilityLabel`, `torchButtonOnAccessibilityLabel` and `torchButtonOffAccessibilityLabel` scan parameters to set the alternative text (content description) read by screen readers on the Cancel and Torch buttons. When not provided, no label is set, keeping the previous behavior unchanged. (https://github.com/OutSystems/OSBarcodeLib-Android/issues/54)