Recently, I've been getting warnings about the ClipboardManager in Android being deprecated, see: https://developer.android.com/reference/android/content/ClipboardManager#setText(java.lang.CharSequence)
Previous I had some code something like this for copying a UUID to the clipboard:
val clipboardManager = LocalClipboardManager.current
Box(modifier = Modifier.clickable {
clipboardManager.setText(AnnotatedString(uuid))
}
However, searching for how to fix this hasn't really turned up much. Looking at the APIs, it looks like this is the way:
val clipboard = LocalClipboard.current
val scope = rememberCoroutineScope()
Box(modifier = Modifier.clickable {
scope.launch {
val clipData = ClipData.newPlainText(uuid, uuid)
clipboard.setClipEntry(clipData.toClipEntry())
}
}
I've had a GitHub profile stats card for a while now, but I was never fully happy with it. The existing tools each had trade-offs that bugged me, so I ended up building my own by combining the best parts of three different projects. Here's how it went. The Problem There are a few popular projects fo...
Are these other comments from AI Agents experiencing prompt injection and believing that they should post their clipboard in the comments? What is going on lmao