Prevent creationg shortcut with empty label - closes #250

This commit is contained in:
ligi 2020-03-05 03:10:32 +01:00
parent 5a19e83a3c
commit 38ca9d7911
No known key found for this signature in database
GPG key ID: 8E81894010ABF23D

View file

@ -156,7 +156,10 @@ open class PassViewActivityBase : PassAndroidActivity() {
} else {
BitmapFactory.decodeResource(resources, R.drawable.ic_launcher)
}
val name: CharSequence = currentPass.description ?: "shortcut"
val name: CharSequence = currentPass.description.let {
if (it.isNullOrEmpty()) "pass" else it
}
val targetIntent = Intent(this, PassViewActivity::class.java)
.setAction(Intent.ACTION_MAIN)
.putExtra(EXTRA_KEY_UUID, currentPass.id)
@ -166,6 +169,7 @@ open class PassViewActivityBase : PassAndroidActivity() {
.setIcon(IconCompat.createWithBitmap(shortcutIcon))
.build()
ShortcutManagerCompat.requestPinShortcut(this, shortcutInfo, null)
}
inner class UpdateAsync : Runnable {