Skip to content

Commit

Permalink
Only set SHORTCUT_CATEGORY_CONVERSATION above API 25
Browse files Browse the repository at this point in the history
  • Loading branch information
dkter committed Aug 27, 2021
1 parent 2004d35 commit 3092de8
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit 3092de8

Please sign in to comment.