diff --git a/app/src/main/kotlin/it/fast4x/rimusic/utils/ClipBoard.kt b/app/src/main/kotlin/it/fast4x/rimusic/utils/ClipBoard.kt index b17b10e0b2..985f41d4e0 100644 --- a/app/src/main/kotlin/it/fast4x/rimusic/utils/ClipBoard.kt +++ b/app/src/main/kotlin/it/fast4x/rimusic/utils/ClipBoard.kt @@ -14,6 +14,7 @@ import androidx.compose.ui.res.stringResource import it.fast4x.rimusic.R import it.fast4x.rimusic.enums.PopupType import it.fast4x.rimusic.ui.components.themed.SmartMessage +import timber.log.Timber @Composable fun TextCopyToClipboard(textCopied:String) { @@ -22,7 +23,8 @@ fun TextCopyToClipboard(textCopied:String) { runCatching { clipboardManager.setPrimaryClip(ClipData.newPlainText("", textCopied)) }.onFailure { - SmartMessage("Failed to copy text to clipbaoard ${it.stackTraceToString()}", type = PopupType.Error, context = context) + Timber.e(it.stackTraceToString()) + SmartMessage("Failed to copy text to clipbaoard, try again", type = PopupType.Error, context = context) } // Only show a toast for Android 12 and lower. if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2) @@ -37,11 +39,12 @@ fun textCopyFromClipboard(): String { runCatching { textCopied = clipboardManager.primaryClip?.getItemAt(0)?.coerceToText(context).toString() }.onFailure { - SmartMessage("Failed to copy text from clipbaoard ${it.stackTraceToString()}", type = PopupType.Error, context = context) + Timber.e(it.stackTraceToString()) + SmartMessage("Failed to copy text from clipbaoard, try again", type = PopupType.Error, context = context) } // Only show a toast for Android 12 and lower. - //if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2) - // SmartToast(context.resources.getString(R.string.value_copied), type = PopupType.Info) + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2) + SmartMessage(context.resources.getString(R.string.value_copied), type = PopupType.Info, context = context) return textCopied } \ No newline at end of file