diff --git a/app/src/main/java/com/github/libretube/extensions/ToastFromMainThread.kt b/app/src/main/java/com/github/libretube/extensions/ToastFromMainThread.kt index 32d36f87f..1e52be5bd 100644 --- a/app/src/main/java/com/github/libretube/extensions/ToastFromMainThread.kt +++ b/app/src/main/java/com/github/libretube/extensions/ToastFromMainThread.kt @@ -21,10 +21,10 @@ fun Context.toastFromMainThread(stringId: Int) { toastFromMainThread(getString(stringId)) } -suspend fun Context.toastFromMainDispatcher(text: String, length: Int = Toast.LENGTH_SHORT) = withContext( - Dispatchers.Main -) { - Toast.makeText(this@toastFromMainDispatcher, text, length).show() +suspend fun Context.toastFromMainDispatcher(text: String, length: Int = Toast.LENGTH_SHORT) { + withContext(Dispatchers.Main) { + Toast.makeText(this@toastFromMainDispatcher, text, length).show() + } } suspend fun Context.toastFromMainDispatcher(stringId: Int, length: Int = Toast.LENGTH_SHORT) {