Only set SHORTCUT_CATEGORY_CONVERSATION above API 25

This commit is contained in:
David Teresi 2021-08-27 16:19:25 -04:00
parent 2004d357d5
commit 15217d98ac

View file

@ -65,17 +65,19 @@ class ShortcutCreator @Inject constructor(
} catch (failure: Throwable) {
null
}
val categories = if (Build.VERSION.SDK_INT >= 25) {
setOf(directShareCategory, ShortcutInfo.SHORTCUT_CATEGORY_CONVERSATION)
} else {
setOf(directShareCategory)
}
return ShortcutInfoCompat.Builder(context, roomSummary.roomId)
.setShortLabel(roomSummary.displayName)
.setIcon(bitmap?.toProfileImageIcon())
.setIntent(intent)
.setLongLived(true)
.setRank(rank)
// Make it show up in the direct share menu
.setCategories(setOf(
directShareCategory,
ShortcutInfo.SHORTCUT_CATEGORY_CONVERSATION))
.setCategories(categories)
.build()
}