diff --git a/vector/src/main/java/im/vector/app/features/home/ShortcutsHandler.kt b/vector/src/main/java/im/vector/app/features/home/ShortcutsHandler.kt index 612e2dcf87..e63d8cf5b2 100644 --- a/vector/src/main/java/im/vector/app/features/home/ShortcutsHandler.kt +++ b/vector/src/main/java/im/vector/app/features/home/ShortcutsHandler.kt @@ -41,6 +41,7 @@ class ShortcutsHandler @Inject constructor( private val pinCodeStore: PinCodeStore ) : PinCodeStoreListener { private val isRequestPinShortcutSupported = ShortcutManagerCompat.isRequestPinShortcutSupported(context) + private val maxShortcutCountPerActivity = ShortcutManagerCompat.getMaxShortcutCountPerActivity(context) // Value will be set correctly if necessary private var hasPinCode = true @@ -93,9 +94,11 @@ class ShortcutsHandler @Inject constructor( // No shortcut in this case (privacy) ShortcutManagerCompat.removeAllDynamicShortcuts(context) } else { - val shortcuts = rooms.mapIndexed { index, room -> - shortcutCreator.create(room, index) - } + val shortcuts = rooms + .take(maxShortcutCountPerActivity) + .mapIndexed { index, room -> + shortcutCreator.create(room, index) + } shortcuts.forEach { shortcut -> ShortcutManagerCompat.pushDynamicShortcut(context, shortcut)