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