From c8471f6629aabcc887b58947706ee79d6b89bab9 Mon Sep 17 00:00:00 2001 From: Walker Selby Date: Thu, 26 Oct 2023 15:42:45 +0100 Subject: Internal Change: Avoid hardcoded dispatcher (#589) --- src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/main/java/at/hannibal2/skyhanni/utils') diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt index 035259a1a..31008d9b4 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt @@ -14,6 +14,7 @@ import java.awt.datatransfer.UnsupportedFlavorException import kotlin.time.Duration.Companion.milliseconds object ClipboardUtils { + private var dispatcher = Dispatchers.IO private var lastClipboardAccessTime = SimpleTimeMark.farPast() private fun canAccessClipboard(): Boolean { @@ -55,7 +56,7 @@ object ClipboardUtils { suspend fun readFromClipboard(step: Int = 0): String? { try { return try { - withContext(Dispatchers.IO) { + withContext(dispatcher) { getClipboard()?.getData(DataFlavor.stringFlavor)?.toString() } } catch (e: UnsupportedFlavorException) { -- cgit