diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListNode.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListNode.kt index 57af770d5b..292a77ba6a 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListNode.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListNode.kt @@ -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 diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelineView.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelineView.kt index b3f69f0e2b..73a15b797f 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelineView.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelineView.kt @@ -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, ) } diff --git a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/RoomDetailsView.kt b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/RoomDetailsView.kt index de0a2cba1b..046c64d906 100644 --- a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/RoomDetailsView.kt +++ b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/RoomDetailsView.kt @@ -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, ) }, ) diff --git a/features/securebackup/impl/src/main/kotlin/io/element/android/features/securebackup/impl/setup/SecureBackupSetupView.kt b/features/securebackup/impl/src/main/kotlin/io/element/android/features/securebackup/impl/setup/SecureBackupSetupView.kt index 8a87fc8983..497c64f072 100644 --- a/features/securebackup/impl/src/main/kotlin/io/element/android/features/securebackup/impl/setup/SecureBackupSetupView.kt +++ b/features/securebackup/impl/src/main/kotlin/io/element/android/features/securebackup/impl/setup/SecureBackupSetupView.kt @@ -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) } diff --git a/features/viewfolder/impl/src/main/kotlin/io/element/android/features/viewfolder/impl/file/FileContent.kt b/features/viewfolder/impl/src/main/kotlin/io/element/android/features/viewfolder/impl/file/FileContent.kt index 614e45a7b8..c68d630869 100644 --- a/features/viewfolder/impl/src/main/kotlin/io/element/android/features/viewfolder/impl/file/FileContent.kt +++ b/features/viewfolder/impl/src/main/kotlin/io/element/android/features/viewfolder/impl/file/FileContent.kt @@ -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, ) }) ) { diff --git a/libraries/matrixui/src/main/kotlin/io/element/android/libraries/matrix/ui/model/InviteSender.kt b/libraries/matrixui/src/main/kotlin/io/element/android/libraries/matrix/ui/model/InviteSender.kt index 34e95f63dc..dd8655af26 100644 --- a/libraries/matrixui/src/main/kotlin/io/element/android/libraries/matrix/ui/model/InviteSender.kt +++ b/libraries/matrixui/src/main/kotlin/io/element/android/libraries/matrix/ui/model/InviteSender.kt @@ -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(