mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-23 10:43:05 +00:00
multiplatform: remove unused clipboard state polling that froze desktop UI (#7237)
The desktop app polled full clipboard contents every second on the AWT event thread to update ChatModel.clipboardHasText. On X11, each read blocks up to sun.awt.datatransfer.timeout (10s) when the selection owner does not respond (e.g. after KeePassXC's clipboard auto-clear), making every click/scroll wait ~9s. clipboardHasText has had no readers since its only consumer was removed in #4398, so the whole mechanism (desktop poll, Android clip listener, onResume refresh, expect/actual, state field) is deleted. See plans/2026-07-11-fix-desktop-clipboard-freeze.md.
This commit is contained in:
1 parent
7fc2a6e6bd
commit
3615927db5
9 files changed
+62
-53
No files matched your search
-16
@@ -1,7 +1,5 @@
|
||||
package chat.simplex.common.views.helpers
|
||||
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.content.res.Resources
|
||||
import android.graphics.*
|
||||
import android.graphics.Typeface
|
||||
@@ -14,7 +12,6 @@ import android.text.SpannedString
|
||||
import android.text.style.*
|
||||
import android.util.Base64
|
||||
import android.view.WindowManager
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.graphics.*
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.*
|
||||
@@ -58,19 +55,6 @@ fun keepScreenOn(on: Boolean) {
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
actual fun SetupClipboardListener() {
|
||||
DisposableEffect(Unit) {
|
||||
val service = androidAppContext.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
val listener = { chatModel.clipboardHasText.value = service.hasPrimaryClip() }
|
||||
chatModel.clipboardHasText.value = service.hasPrimaryClip()
|
||||
service.addPrimaryClipChangedListener(listener)
|
||||
onDispose {
|
||||
service.removePrimaryClipChangedListener(listener)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
actual fun escapedHtmlToAnnotatedString(text: String, density: Density): AnnotatedString {
|
||||
return spannableStringToAnnotatedString(HtmlCompat.fromHtml(text, HtmlCompat.FROM_HTML_MODE_LEGACY), density)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user