knock requests : use proper banner string resources
This commit is contained in:
@@ -11,10 +11,9 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.res.pluralStringResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import io.element.android.features.knockrequests.impl.KnockRequest
|
||||
import io.element.android.features.knockrequests.impl.R
|
||||
import io.element.android.features.knockrequests.impl.getBestName
|
||||
import io.element.android.libraries.architecture.AsyncAction
|
||||
import io.element.android.libraries.ui.strings.CommonPlurals
|
||||
import io.element.android.libraries.ui.strings.CommonStrings
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
|
||||
data class KnockRequestsBannerState(
|
||||
@@ -40,12 +39,12 @@ data class KnockRequestsBannerState(
|
||||
fun formattedTitle(): String {
|
||||
return when (knockRequests.size) {
|
||||
0 -> ""
|
||||
1 -> stringResource(CommonStrings.screen_room_single_knock_request_title, knockRequests.first().getBestName())
|
||||
1 -> stringResource(R.string.screen_room_single_knock_request_title, knockRequests.first().getBestName())
|
||||
else -> {
|
||||
val firstRequest = knockRequests.first()
|
||||
val otherRequestsCount = knockRequests.size - 1
|
||||
pluralStringResource(
|
||||
id = CommonPlurals.screen_room_multiple_knock_requests_title,
|
||||
id = R.plurals.screen_room_multiple_knock_requests_title,
|
||||
count = otherRequestsCount,
|
||||
firstRequest.getBestName(),
|
||||
otherRequestsCount
|
||||
|
||||
@@ -37,6 +37,7 @@ import androidx.compose.ui.zIndex
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.compound.tokens.generated.CompoundIcons
|
||||
import io.element.android.features.knockrequests.impl.KnockRequest
|
||||
import io.element.android.features.knockrequests.impl.R
|
||||
import io.element.android.features.knockrequests.impl.getAvatarData
|
||||
import io.element.android.libraries.designsystem.components.avatar.Avatar
|
||||
import io.element.android.libraries.designsystem.components.avatar.AvatarSize
|
||||
@@ -133,21 +134,21 @@ private fun KnockRequestsBannerContent(
|
||||
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||
if (state.knockRequests.size > 1) {
|
||||
Button(
|
||||
text = "View all",
|
||||
text = stringResource(R.string.screen_room_multiple_knock_requests_view_all_button_title),
|
||||
onClick = onViewRequestsClick,
|
||||
size = ButtonSize.MediumLowPadding,
|
||||
modifier = Modifier.weight(1f),
|
||||
)
|
||||
} else {
|
||||
OutlinedButton(
|
||||
text = "View",
|
||||
text = stringResource(R.string.screen_room_single_knock_request_view_button_title),
|
||||
onClick = onViewRequestsClick,
|
||||
size = ButtonSize.MediumLowPadding,
|
||||
modifier = Modifier.weight(1f),
|
||||
)
|
||||
if (state.canAccept) {
|
||||
Button(
|
||||
text = "Accept",
|
||||
text = stringResource(R.string.screen_room_single_knock_request_accept_button_title),
|
||||
onClick = {},
|
||||
size = ButtonSize.MediumLowPadding,
|
||||
modifier = Modifier.weight(1f),
|
||||
|
||||
@@ -14,4 +14,12 @@
|
||||
<string name="screen_knock_requests_list_empty_state_description">"When somebody will ask to join the room, you’ll be able to see their request here."</string>
|
||||
<string name="screen_knock_requests_list_empty_state_title">"No pending request to join"</string>
|
||||
<string name="screen_knock_requests_list_title">"Requests to join"</string>
|
||||
<plurals name="screen_room_multiple_knock_requests_title">
|
||||
<item quantity="one">"%1$s +%2$d other want to join this room"</item>
|
||||
<item quantity="other">"%1$s +%2$d others want to join this room"</item>
|
||||
</plurals>
|
||||
<string name="screen_room_multiple_knock_requests_view_all_button_title">"View all"</string>
|
||||
<string name="screen_room_single_knock_request_accept_button_title">"Accept"</string>
|
||||
<string name="screen_room_single_knock_request_title">"%1$s wants to join this room"</string>
|
||||
<string name="screen_room_single_knock_request_view_button_title">"View"</string>
|
||||
</resources>
|
||||
|
||||
@@ -322,18 +322,10 @@ Reason: %1$s."</string>
|
||||
<string name="screen_resolve_send_failure_you_unsigned_device_title">"Your message was not sent because you have not verified one or more of your devices"</string>
|
||||
<string name="screen_room_error_failed_processing_media">"Failed processing media to upload, please try again."</string>
|
||||
<string name="screen_room_error_failed_retrieving_user_details">"Could not retrieve user details"</string>
|
||||
<plurals name="screen_room_multiple_knock_requests_title">
|
||||
<item quantity="one">"%1$s +%2$d other want to join this room"</item>
|
||||
<item quantity="other">"%1$s +%2$d others want to join this room"</item>
|
||||
</plurals>
|
||||
<string name="screen_room_multiple_knock_requests_view_all_button_title">"View all"</string>
|
||||
<string name="screen_room_pinned_banner_indicator">"%1$s of %2$s"</string>
|
||||
<string name="screen_room_pinned_banner_indicator_description">"%1$s Pinned messages"</string>
|
||||
<string name="screen_room_pinned_banner_loading_description">"Loading message…"</string>
|
||||
<string name="screen_room_pinned_banner_view_all_button_title">"View All"</string>
|
||||
<string name="screen_room_single_knock_request_accept_button_title">"Accept"</string>
|
||||
<string name="screen_room_single_knock_request_title">"%1$s wants to join this room"</string>
|
||||
<string name="screen_room_single_knock_request_view_button_title">"View"</string>
|
||||
<string name="screen_room_title">"Chat"</string>
|
||||
<string name="screen_roomlist_knock_event_sent_description">"Request to join sent"</string>
|
||||
<string name="screen_share_location_title">"Share location"</string>
|
||||
|
||||
@@ -291,7 +291,9 @@
|
||||
{
|
||||
"name" : ":features:knockrequests:impl",
|
||||
"includeRegex" : [
|
||||
"screen\\.knock_requests_list\\..*"
|
||||
"screen\\.knock_requests_list\\..*",
|
||||
"screen\\.room\\.single_knock_request.*",
|
||||
"screen\\.room\\.multiple_knock_requests.*"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user