Fix issue detected by lint.
This commit is contained in:
@@ -15,6 +15,7 @@ import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalView
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import com.bumble.appyx.core.modality.BuildContext
|
||||
import com.bumble.appyx.core.node.Node
|
||||
import com.bumble.appyx.core.plugin.Plugin
|
||||
@@ -100,6 +101,7 @@ class PinnedMessagesListNode(
|
||||
LocalTimelineItemPresenterFactories provides timelineItemPresenterFactories,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val toastMessage = stringResource(CommonStrings.common_copied_to_clipboard)
|
||||
val view = LocalView.current
|
||||
val state = presenter.present()
|
||||
PinnedMessagesListView(
|
||||
@@ -113,8 +115,8 @@ class PinnedMessagesListNode(
|
||||
HapticFeedbackConstants.LONG_PRESS
|
||||
)
|
||||
context.copyToClipboard(
|
||||
it.url,
|
||||
context.getString(CommonStrings.common_copied_to_clipboard)
|
||||
text = it.url,
|
||||
toastMessage = toastMessage,
|
||||
)
|
||||
},
|
||||
modifier = modifier
|
||||
|
||||
@@ -123,6 +123,7 @@ fun TimelineView(
|
||||
}
|
||||
|
||||
val context = LocalContext.current
|
||||
val toastMessage = stringResource(CommonStrings.common_copied_to_clipboard)
|
||||
val view = LocalView.current
|
||||
// Disable reverse layout when TalkBack is enabled to avoid incorrect ordering issues seen in the current Compose UI version
|
||||
val useReverseLayout = !isTalkbackActive()
|
||||
@@ -136,8 +137,8 @@ fun TimelineView(
|
||||
HapticFeedbackConstants.LONG_PRESS
|
||||
)
|
||||
context.copyToClipboard(
|
||||
link.url,
|
||||
context.getString(CommonStrings.common_copied_to_clipboard)
|
||||
text = link.url,
|
||||
toastMessage = toastMessage,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -721,6 +721,7 @@ private fun DebugInfoSection(
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
PreferenceCategory(showTopDivider = true) {
|
||||
val toastMessage = stringResource(CommonStrings.common_copied_to_clipboard)
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
Text("Internal room ID")
|
||||
@@ -736,8 +737,8 @@ private fun DebugInfoSection(
|
||||
trailingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Copy())),
|
||||
onClick = {
|
||||
context.copyToClipboard(
|
||||
roomId.value,
|
||||
context.getString(CommonStrings.common_copied_to_clipboard)
|
||||
text = roomId.value,
|
||||
toastMessage = toastMessage,
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
@@ -116,11 +116,12 @@ private fun Content(
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val formattedRecoveryKey = state.recoveryKeyViewState.formattedRecoveryKey
|
||||
val toastMessage = stringResource(R.string.screen_recovery_key_copied_to_clipboard)
|
||||
val clickLambda = if (formattedRecoveryKey != null) {
|
||||
{
|
||||
context.copyToClipboard(
|
||||
formattedRecoveryKey,
|
||||
context.getString(R.string.screen_recovery_key_copied_to_clipboard)
|
||||
text = formattedRecoveryKey,
|
||||
toastMessage = toastMessage,
|
||||
)
|
||||
state.eventSink.invoke(SecureBackupSetupEvents.RecoveryKeyHasBeenSaved)
|
||||
}
|
||||
|
||||
@@ -73,13 +73,14 @@ private fun LineRow(
|
||||
colorationMode: ColorationMode,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val toastMessage = stringResource(CommonStrings.common_line_copied_to_clipboard)
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clickable(onClick = {
|
||||
context.copyToClipboard(
|
||||
text = line,
|
||||
toastMessage = context.getString(CommonStrings.common_line_copied_to_clipboard),
|
||||
toastMessage = toastMessage,
|
||||
)
|
||||
})
|
||||
) {
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
package io.element.android.libraries.matrix.ui.model
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.AnnotatedString
|
||||
import androidx.compose.ui.text.SpanStyle
|
||||
@@ -30,7 +29,7 @@ data class InviteSender(
|
||||
@Composable
|
||||
fun annotatedString(): AnnotatedString {
|
||||
return stringResource(R.string.screen_invites_invited_you, displayName, userId.value).let { text ->
|
||||
val senderNameStart = LocalContext.current.getString(R.string.screen_invites_invited_you).indexOf("%1\$s")
|
||||
val senderNameStart = stringResource(R.string.screen_invites_invited_you).indexOf($$"%1$s")
|
||||
AnnotatedString(
|
||||
text = text,
|
||||
spanStyles = listOf(
|
||||
|
||||
Reference in New Issue
Block a user