From 0be12b8d07f2632deb2100b4e8e025626c0fe85a Mon Sep 17 00:00:00 2001 From: SlipkHunter Date: Sun, 10 Sep 2023 19:34:36 -0300 Subject: [PATCH] ui: only show a snackbar for Android 12 and lower Signed-off-by: SlipkHunter Signed-off-by: Harsh Shandilya --- .../main/java/com/wireguard/android/util/ClipboardUtils.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/src/main/java/com/wireguard/android/util/ClipboardUtils.kt b/ui/src/main/java/com/wireguard/android/util/ClipboardUtils.kt index 6a0d54ba..c9a7f59d 100644 --- a/ui/src/main/java/com/wireguard/android/util/ClipboardUtils.kt +++ b/ui/src/main/java/com/wireguard/android/util/ClipboardUtils.kt @@ -6,6 +6,7 @@ package com.wireguard.android.util import android.content.ClipData import android.content.ClipboardManager +import android.os.Build import android.view.View import android.widget.TextView import androidx.core.content.getSystemService @@ -29,6 +30,8 @@ object ClipboardUtils { } val service = view.context.getSystemService() ?: return service.setPrimaryClip(ClipData.newPlainText(data.second, data.first)) - Snackbar.make(view, view.context.getString(R.string.copied_to_clipboard, data.second), Snackbar.LENGTH_LONG).show() + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) { + Snackbar.make(view, view.context.getString(R.string.copied_to_clipboard, data.second), Snackbar.LENGTH_LONG).show() + } } }