ui: only show a snackbar for Android 12 and lower

Signed-off-by: SlipkHunter <abrito025@gmail.com>
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
SlipkHunter 2023-09-10 19:34:36 -03:00 committed by Harsh Shandilya
parent 56be913fa4
commit 0be12b8d07
No known key found for this signature in database

View File

@ -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<ClipboardManager>() ?: 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()
}
}
}