Skip to content

Commit b5d15ee

Browse files
committed
Fix issue detected by lint.
1 parent e8d7c0b commit b5d15ee

File tree

6 files changed

+16
-11
lines changed

6 files changed

+16
-11
lines changed

features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListNode.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import androidx.compose.runtime.CompositionLocalProvider
1515
import androidx.compose.ui.Modifier
1616
import androidx.compose.ui.platform.LocalContext
1717
import androidx.compose.ui.platform.LocalView
18+
import androidx.compose.ui.res.stringResource
1819
import com.bumble.appyx.core.modality.BuildContext
1920
import com.bumble.appyx.core.node.Node
2021
import com.bumble.appyx.core.plugin.Plugin
@@ -100,6 +101,7 @@ class PinnedMessagesListNode(
100101
LocalTimelineItemPresenterFactories provides timelineItemPresenterFactories,
101102
) {
102103
val context = LocalContext.current
104+
val toastMessage = stringResource(CommonStrings.common_copied_to_clipboard)
103105
val view = LocalView.current
104106
val state = presenter.present()
105107
PinnedMessagesListView(
@@ -113,8 +115,8 @@ class PinnedMessagesListNode(
113115
HapticFeedbackConstants.LONG_PRESS
114116
)
115117
context.copyToClipboard(
116-
it.url,
117-
context.getString(CommonStrings.common_copied_to_clipboard)
118+
text = it.url,
119+
toastMessage = toastMessage,
118120
)
119121
},
120122
modifier = modifier

features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelineView.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ fun TimelineView(
123123
}
124124

125125
val context = LocalContext.current
126+
val toastMessage = stringResource(CommonStrings.common_copied_to_clipboard)
126127
val view = LocalView.current
127128
// Disable reverse layout when TalkBack is enabled to avoid incorrect ordering issues seen in the current Compose UI version
128129
val useReverseLayout = !isTalkbackActive()
@@ -136,8 +137,8 @@ fun TimelineView(
136137
HapticFeedbackConstants.LONG_PRESS
137138
)
138139
context.copyToClipboard(
139-
link.url,
140-
context.getString(CommonStrings.common_copied_to_clipboard)
140+
text = link.url,
141+
toastMessage = toastMessage,
141142
)
142143
}
143144

features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/RoomDetailsView.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,7 @@ private fun DebugInfoSection(
721721
) {
722722
val context = LocalContext.current
723723
PreferenceCategory(showTopDivider = true) {
724+
val toastMessage = stringResource(CommonStrings.common_copied_to_clipboard)
724725
ListItem(
725726
headlineContent = {
726727
Text("Internal room ID")
@@ -736,8 +737,8 @@ private fun DebugInfoSection(
736737
trailingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Copy())),
737738
onClick = {
738739
context.copyToClipboard(
739-
roomId.value,
740-
context.getString(CommonStrings.common_copied_to_clipboard)
740+
text = roomId.value,
741+
toastMessage = toastMessage,
741742
)
742743
},
743744
)

features/securebackup/impl/src/main/kotlin/io/element/android/features/securebackup/impl/setup/SecureBackupSetupView.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,12 @@ private fun Content(
116116
) {
117117
val context = LocalContext.current
118118
val formattedRecoveryKey = state.recoveryKeyViewState.formattedRecoveryKey
119+
val toastMessage = stringResource(R.string.screen_recovery_key_copied_to_clipboard)
119120
val clickLambda = if (formattedRecoveryKey != null) {
120121
{
121122
context.copyToClipboard(
122-
formattedRecoveryKey,
123-
context.getString(R.string.screen_recovery_key_copied_to_clipboard)
123+
text = formattedRecoveryKey,
124+
toastMessage = toastMessage,
124125
)
125126
state.eventSink.invoke(SecureBackupSetupEvents.RecoveryKeyHasBeenSaved)
126127
}

features/viewfolder/impl/src/main/kotlin/io/element/android/features/viewfolder/impl/file/FileContent.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,14 @@ private fun LineRow(
7373
colorationMode: ColorationMode,
7474
) {
7575
val context = LocalContext.current
76+
val toastMessage = stringResource(CommonStrings.common_line_copied_to_clipboard)
7677
Row(
7778
modifier = Modifier
7879
.fillMaxWidth()
7980
.clickable(onClick = {
8081
context.copyToClipboard(
8182
text = line,
82-
toastMessage = context.getString(CommonStrings.common_line_copied_to_clipboard),
83+
toastMessage = toastMessage,
8384
)
8485
})
8586
) {

libraries/matrixui/src/main/kotlin/io/element/android/libraries/matrix/ui/model/InviteSender.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
package io.element.android.libraries.matrix.ui.model
1010

1111
import androidx.compose.runtime.Composable
12-
import androidx.compose.ui.platform.LocalContext
1312
import androidx.compose.ui.res.stringResource
1413
import androidx.compose.ui.text.AnnotatedString
1514
import androidx.compose.ui.text.SpanStyle
@@ -30,7 +29,7 @@ data class InviteSender(
3029
@Composable
3130
fun annotatedString(): AnnotatedString {
3231
return stringResource(R.string.screen_invites_invited_you, displayName, userId.value).let { text ->
33-
val senderNameStart = LocalContext.current.getString(R.string.screen_invites_invited_you).indexOf("%1\$s")
32+
val senderNameStart = stringResource(R.string.screen_invites_invited_you).indexOf($$"%1$s")
3433
AnnotatedString(
3534
text = text,
3635
spanStyles = listOf(

0 commit comments

Comments
 (0)