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

feat: Add content descriptions #34

Merged
merged 2 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import androidx.compose.ui.zIndex
import com.keyvalue.siren.androidsdk.AuthorizeUserAction.authenticationStatus
Expand Down Expand Up @@ -127,9 +129,10 @@ abstract class SDKCoreUI(context: Context, userToken: String, recipientId: Strin
}
} else {
Icon(
painter = painterResource(id = if (props.darkMode == true) R.drawable.bell_dark else R.drawable.bell_light),
contentDescription = "notification icon with unread notifications indicator",
modifier = Modifier.size(iconStyle?.size!!),
painter = painterResource(id = R.drawable.bell_dark),
contentDescription = "siren-notification-icon",
tint = if (props.darkMode == true) Color.White else Color.Black,
modifier = Modifier.size(iconStyle?.size!!).semantics { contentDescription = "siren-notification-icon" },
)
}

Expand Down Expand Up @@ -581,7 +584,8 @@ abstract class SDKCoreUI(context: Context, userToken: String, recipientId: Strin
Modifier
.weight(1f)
.fillMaxWidth()
.pullRefresh(pullRefreshState),
.pullRefresh(pullRefreshState)
.semantics { contentDescription = "siren-notification-list" },
state = listState,
) {
items(notificationListState) { notificationData ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import androidx.compose.ui.draw.alpha
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.TextUnit
Expand Down Expand Up @@ -71,7 +73,7 @@ fun Header(
}
?: Icon(
imageVector = Icons.AutoMirrored.Filled.KeyboardArrowLeft,
contentDescription = "notification icon with unread notifications indicator",
contentDescription = "siren-header-back",
modifier =
Modifier
.size(30.dp)
Expand All @@ -80,7 +82,8 @@ fun Header(
if (handleBackNavigation != null) {
handleBackNavigation()
}
},
}
.semantics { contentDescription = "siren-header-back" },
)
}
Text(
Expand All @@ -100,7 +103,8 @@ fun Header(
enabled = enableClearAll,
onClick = onClearAllClick,
)
.alpha(if (enableClearAll) 1f else 0.4f),
.alpha(if (enableClearAll) 1f else 0.4f)
.semantics { contentDescription = "siren-header-clear-all" },
) {
Image(
painter = painterResource(id = R.drawable.clear_all),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
Expand All @@ -41,7 +43,8 @@ fun InboxEmptyScreen(
.fillMaxSize()
.shadow(0.dp)
.pullRefresh(pullRefreshState)
.background(backgroundColor),
.background(backgroundColor)
.semantics { contentDescription = "siren-empty-state" },
) {
item {
Image(painter = painterResource(id = if (isDarkMode) R.drawable.empty_state_dark else R.drawable.empty_state_light), contentDescription = "Error state", modifier = Modifier.size(150.dp))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
Expand All @@ -41,7 +43,8 @@ fun InboxErrorScreen(
.fillMaxSize()
.shadow(0.dp)
.pullRefresh(pullRefreshState)
.background(backgroundColor),
.background(backgroundColor)
.semantics { contentDescription = "siren-error-state" },
) {
item {
Image(painter = painterResource(id = if (isDarkMode) R.drawable.error_state_dark else R.drawable.error_state_light), contentDescription = "Error state", modifier = Modifier.size(150.dp))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Dp
Expand Down Expand Up @@ -81,7 +83,8 @@ fun NotificationCard(
.border(
width = notificationCardStyle?.borderWidth!!,
color = notificationCardStyle.borderColor!!,
),
)
.semantics { contentDescription = "siren-notification-card-${notification?.id}" },
) {
val borderStroke =
if (notification?.isRead == false) {
Expand Down Expand Up @@ -115,12 +118,13 @@ fun NotificationCard(
if (cardProps?.hideAvatar != true) {
Image(
painter = painter,
contentDescription = null,
contentDescription = "siren-notification-avatar-${notification?.id}",
modifier =
Modifier
.size(notificationCardStyle.avatarSize!!)
.clip(CircleShape)
.weight(1f),
.weight(1f)
.semantics { contentDescription = "siren-notification-avatar-${notification?.id}" },
)
} else {
Spacer(
Expand Down Expand Up @@ -200,12 +204,13 @@ fun NotificationCard(
Box(modifier = Modifier.weight(1f).padding(end = 6.dp), contentAlignment = Alignment.CenterEnd) {
Icon(
imageVector = Icons.Default.Clear,
contentDescription = "Delete icon",
contentDescription = "siren-notification-delete-${notification?.id}",
tint = themeColors?.deleteIcon!!,
modifier =
Modifier
.size(notificationCardStyle.deleteIconSize!!)
.clickable { deleteNotificationCallback() },
.clickable { deleteNotificationCallback() }
.semantics { contentDescription = "siren-notification-delete-${notification?.id}" },
)
}
}
Expand Down
13 changes: 0 additions & 13 deletions siren-sdk/src/main/res/drawable/bell_light.xml

This file was deleted.

Loading