Skip to content

Commit 7279aa0

Browse files
committed
Pinned events : clean up more banner code
1 parent d2a9a25 commit 7279aa0

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/banner/PinnedMessagesBannerView.kt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17-
@file:OptIn(ExperimentalFoundationApi::class)
18-
1917
package io.element.android.features.messages.impl.pinned.banner
2018

21-
import androidx.compose.foundation.ExperimentalFoundationApi
2219
import androidx.compose.foundation.background
2320
import androidx.compose.foundation.clickable
2421
import androidx.compose.foundation.layout.Arrangement.spacedBy
@@ -44,6 +41,7 @@ import androidx.compose.ui.draw.drawBehind
4441
import androidx.compose.ui.draw.shadow
4542
import androidx.compose.ui.geometry.Offset
4643
import androidx.compose.ui.graphics.Color
44+
import androidx.compose.ui.res.stringResource
4745
import androidx.compose.ui.text.style.TextOverflow
4846
import androidx.compose.ui.tooling.preview.PreviewParameter
4947
import androidx.compose.ui.unit.dp
@@ -57,6 +55,7 @@ import io.element.android.libraries.designsystem.theme.components.TextButton
5755
import io.element.android.libraries.designsystem.theme.pinnedMessageBannerBorder
5856
import io.element.android.libraries.designsystem.theme.pinnedMessageBannerIndicator
5957
import io.element.android.libraries.designsystem.utils.annotatedTextWithBold
58+
import io.element.android.libraries.ui.strings.CommonStrings
6059

6160
@Composable
6261
fun PinnedMessagesBannerView(
@@ -110,7 +109,7 @@ fun PinnedMessagesBannerView(
110109
message = "This is a pinned message",
111110
modifier = Modifier.weight(1f)
112111
)
113-
TextButton(text = "View all", onClick = { /*TODO*/ })
112+
TextButton(text = stringResource(id = CommonStrings.screen_room_pinned_banner_view_all_button_title), onClick = { /*TODO*/ })
114113
}
115114
}
116115

@@ -168,13 +167,13 @@ private fun PinnedMessageItem(
168167
message: String,
169168
modifier: Modifier = Modifier,
170169
) {
171-
val countMessage = "${index + 1} of $totalCount"
172-
val fullMessage = "$countMessage Pinned messages"
170+
val countMessage = stringResource(id = CommonStrings.screen_room_pinned_banner_indicator, index + 1, totalCount)
171+
val fullCountMessage = stringResource(id = CommonStrings.screen_room_pinned_banner_indicator_description, countMessage)
173172
Column(modifier = modifier) {
174173
if (totalCount > 1) {
175174
Text(
176175
text = annotatedTextWithBold(
177-
text = fullMessage,
176+
text = fullCountMessage,
178177
boldText = countMessage,
179178
),
180179
style = ElementTheme.typography.fontBodySmMedium,

features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/pinned/banner/PinnedMessagesBannerPresenterTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import kotlinx.coroutines.test.runTest
2222
import org.junit.Test
2323

2424
class PinnedMessagesBannerPresenterTest {
25-
2625
@Test
2726
fun `present - initial state`() = runTest {
2827
val presenter = createPinnedMessagesBannerPresenter()

0 commit comments

Comments
 (0)