Skip to content

Commit e383c7f

Browse files
committed
knock requests : use proper banner string resources
1 parent 7957973 commit e383c7f

File tree

5 files changed

+18
-16
lines changed

5 files changed

+18
-16
lines changed

features/knockrequests/impl/src/main/kotlin/io/element/android/features/knockrequests/impl/banner/KnockRequestsBannerState.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ import androidx.compose.runtime.Composable
1111
import androidx.compose.ui.res.pluralStringResource
1212
import androidx.compose.ui.res.stringResource
1313
import io.element.android.features.knockrequests.impl.KnockRequest
14+
import io.element.android.features.knockrequests.impl.R
1415
import io.element.android.features.knockrequests.impl.getBestName
1516
import io.element.android.libraries.architecture.AsyncAction
16-
import io.element.android.libraries.ui.strings.CommonPlurals
17-
import io.element.android.libraries.ui.strings.CommonStrings
1817
import kotlinx.collections.immutable.ImmutableList
1918

2019
data class KnockRequestsBannerState(
@@ -40,12 +39,12 @@ data class KnockRequestsBannerState(
4039
fun formattedTitle(): String {
4140
return when (knockRequests.size) {
4241
0 -> ""
43-
1 -> stringResource(CommonStrings.screen_room_single_knock_request_title, knockRequests.first().getBestName())
42+
1 -> stringResource(R.string.screen_room_single_knock_request_title, knockRequests.first().getBestName())
4443
else -> {
4544
val firstRequest = knockRequests.first()
4645
val otherRequestsCount = knockRequests.size - 1
4746
pluralStringResource(
48-
id = CommonPlurals.screen_room_multiple_knock_requests_title,
47+
id = R.plurals.screen_room_multiple_knock_requests_title,
4948
count = otherRequestsCount,
5049
firstRequest.getBestName(),
5150
otherRequestsCount

features/knockrequests/impl/src/main/kotlin/io/element/android/features/knockrequests/impl/banner/KnockRequestsBannerView.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import androidx.compose.ui.zIndex
3737
import io.element.android.compound.theme.ElementTheme
3838
import io.element.android.compound.tokens.generated.CompoundIcons
3939
import io.element.android.features.knockrequests.impl.KnockRequest
40+
import io.element.android.features.knockrequests.impl.R
4041
import io.element.android.features.knockrequests.impl.getAvatarData
4142
import io.element.android.libraries.designsystem.components.avatar.Avatar
4243
import io.element.android.libraries.designsystem.components.avatar.AvatarSize
@@ -133,21 +134,21 @@ private fun KnockRequestsBannerContent(
133134
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(12.dp)) {
134135
if (state.knockRequests.size > 1) {
135136
Button(
136-
text = "View all",
137+
text = stringResource(R.string.screen_room_multiple_knock_requests_view_all_button_title),
137138
onClick = onViewRequestsClick,
138139
size = ButtonSize.MediumLowPadding,
139140
modifier = Modifier.weight(1f),
140141
)
141142
} else {
142143
OutlinedButton(
143-
text = "View",
144+
text = stringResource(R.string.screen_room_single_knock_request_view_button_title),
144145
onClick = onViewRequestsClick,
145146
size = ButtonSize.MediumLowPadding,
146147
modifier = Modifier.weight(1f),
147148
)
148149
if (state.canAccept) {
149150
Button(
150-
text = "Accept",
151+
text = stringResource(R.string.screen_room_single_knock_request_accept_button_title),
151152
onClick = {},
152153
size = ButtonSize.MediumLowPadding,
153154
modifier = Modifier.weight(1f),

features/knockrequests/impl/src/main/res/values/localazy.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,12 @@
1414
<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>
1515
<string name="screen_knock_requests_list_empty_state_title">"No pending request to join"</string>
1616
<string name="screen_knock_requests_list_title">"Requests to join"</string>
17+
<plurals name="screen_room_multiple_knock_requests_title">
18+
<item quantity="one">"%1$s +%2$d other want to join this room"</item>
19+
<item quantity="other">"%1$s +%2$d others want to join this room"</item>
20+
</plurals>
21+
<string name="screen_room_multiple_knock_requests_view_all_button_title">"View all"</string>
22+
<string name="screen_room_single_knock_request_accept_button_title">"Accept"</string>
23+
<string name="screen_room_single_knock_request_title">"%1$s wants to join this room"</string>
24+
<string name="screen_room_single_knock_request_view_button_title">"View"</string>
1725
</resources>

libraries/ui-strings/src/main/res/values/localazy.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -322,18 +322,10 @@ Reason: %1$s."</string>
322322
<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>
323323
<string name="screen_room_error_failed_processing_media">"Failed processing media to upload, please try again."</string>
324324
<string name="screen_room_error_failed_retrieving_user_details">"Could not retrieve user details"</string>
325-
<plurals name="screen_room_multiple_knock_requests_title">
326-
<item quantity="one">"%1$s +%2$d other want to join this room"</item>
327-
<item quantity="other">"%1$s +%2$d others want to join this room"</item>
328-
</plurals>
329-
<string name="screen_room_multiple_knock_requests_view_all_button_title">"View all"</string>
330325
<string name="screen_room_pinned_banner_indicator">"%1$s of %2$s"</string>
331326
<string name="screen_room_pinned_banner_indicator_description">"%1$s Pinned messages"</string>
332327
<string name="screen_room_pinned_banner_loading_description">"Loading message…"</string>
333328
<string name="screen_room_pinned_banner_view_all_button_title">"View All"</string>
334-
<string name="screen_room_single_knock_request_accept_button_title">"Accept"</string>
335-
<string name="screen_room_single_knock_request_title">"%1$s wants to join this room"</string>
336-
<string name="screen_room_single_knock_request_view_button_title">"View"</string>
337329
<string name="screen_room_title">"Chat"</string>
338330
<string name="screen_roomlist_knock_event_sent_description">"Request to join sent"</string>
339331
<string name="screen_share_location_title">"Share location"</string>

tools/localazy/config.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,9 @@
291291
{
292292
"name" : ":features:knockrequests:impl",
293293
"includeRegex" : [
294-
"screen\\.knock_requests_list\\..*"
294+
"screen\\.knock_requests_list\\..*",
295+
"screen\\.room\\.single_knock_request.*",
296+
"screen\\.room\\.multiple_knock_requests.*"
295297
]
296298
}
297299
]

0 commit comments

Comments
 (0)