Skip to content
Merged
10 changes: 5 additions & 5 deletions .github/workflows/run-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
#- name: Send to Sonarcloud
# run: bundle exec fastlane sonarqube
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ 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.1.0]

### 2026-06-11

- 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]

### 2025-10-02
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
```

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.ionic.libs</groupId>
<artifactId>ionbarcode-android</artifactId>
<version>2.0.1</version>
<version>2.1.0</version>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment thread
OS-pedrogustavobilro marked this conversation as resolved.
) : Serializable
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,8 @@ class OSBARCScannerActivity : ComponentActivity() {
CloseButton(
modifier = Modifier
.padding(top = ScannerBorderPadding, end = ScannerBorderPadding)
.align(Alignment.TopEnd)
.align(Alignment.TopEnd),
accessibilityLabel = parameters.cancelButtonAccessibilityLabel
)
}

Expand Down Expand Up @@ -595,7 +596,9 @@ class OSBARCScannerActivity : ComponentActivity() {
TorchButton(
modifier = Modifier
.padding(bottom = ScannerBorderPadding, end = ScannerBorderPadding)
.align(Alignment.BottomEnd)
.align(Alignment.BottomEnd),
onAccessibilityLabel = parameters.torchButtonOnAccessibilityLabel,
offAccessibilityLabel = parameters.torchButtonOffAccessibilityLabel
)
}
}
Expand Down Expand Up @@ -684,7 +687,8 @@ class OSBARCScannerActivity : ComponentActivity() {
CloseButton(
modifier = Modifier
.padding(top = ScannerBorderPadding, end = ScannerBorderPadding)
.align(Alignment.TopEnd)
.align(Alignment.TopEnd),
accessibilityLabel = parameters.cancelButtonAccessibilityLabel
)

Column(
Expand All @@ -701,7 +705,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))
}
Expand All @@ -724,12 +730,13 @@ class OSBARCScannerActivity : ComponentActivity() {
/**
* Composable function, responsible rendering the close button
* @param modifier the custom modifier for the button
* @param accessibilityLabel optional content description read by screen readers; when null or blank no label is set (default behavior)
*/
@Composable
fun CloseButton(modifier: Modifier) {
fun CloseButton(modifier: Modifier, accessibilityLabel: String? = null) {
Icon(
painter = painterResource(id = R.drawable.close),
contentDescription = null,
contentDescription = accessibilityLabel?.takeIf { it.isNotBlank() },
tint = Color.White,
modifier = modifier
.background(color = CloseButtonBackground, shape = CircleShape)
Expand All @@ -744,17 +751,28 @@ class OSBARCScannerActivity : ComponentActivity() {
/**
* Composable function, responsible rendering the torch button
* @param modifier the custom modifier for the button
* @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(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() }
} else {
offAccessibilityLabel?.takeIf { it.isNotBlank() }
}

Image(
painter = icon,
contentDescription = null,
contentDescription = torchContentDescription,
modifier = modifier
.clickable {
try {
Expand Down
Loading