The ClipboardManager
interface was deprecated. What should I change?
The ClipboardManager
interface was deprecated in favor of Clipboard
interface.
Change all import androidx.compose.ui.platform.LocalClipboardManager
to import androidx.compose.ui.platform.LocalClipboard
and LocalClipboardManager
to LocalClipboard
Make the caller function suspend
or use rememberCoroutineScope().launch { ... }
If you were using function setText(AnnotatedString(text))
, then you can replace it with setClipEntry(ClipEntry(ClipData.newPlainText(text, text)))
According to the Jetpack Compose tests, the replacement for hasText()
is getClipEntry()?.clipData?.description?.hasMimeType("text/*")