Merge branch 'hotfix/1.3.7-oom' into main

This commit is contained in:
Benoit Marty 2021-11-05 15:35:25 +01:00
commit 8b98c8fe1d

View file

@ -41,6 +41,7 @@ class ShortcutsHandler @Inject constructor(
private val pinCodeStore: PinCodeStore private val pinCodeStore: PinCodeStore
) : PinCodeStoreListener { ) : PinCodeStoreListener {
private val isRequestPinShortcutSupported = ShortcutManagerCompat.isRequestPinShortcutSupported(context) private val isRequestPinShortcutSupported = ShortcutManagerCompat.isRequestPinShortcutSupported(context)
private val maxShortcutCountPerActivity = ShortcutManagerCompat.getMaxShortcutCountPerActivity(context)
// Value will be set correctly if necessary // Value will be set correctly if necessary
private var hasPinCode = true private var hasPinCode = true
@ -93,9 +94,11 @@ class ShortcutsHandler @Inject constructor(
// No shortcut in this case (privacy) // No shortcut in this case (privacy)
ShortcutManagerCompat.removeAllDynamicShortcuts(context) ShortcutManagerCompat.removeAllDynamicShortcuts(context)
} else { } else {
val shortcuts = rooms.mapIndexed { index, room -> val shortcuts = rooms
shortcutCreator.create(room, index) .take(maxShortcutCountPerActivity)
} .mapIndexed { index, room ->
shortcutCreator.create(room, index)
}
shortcuts.forEach { shortcut -> shortcuts.forEach { shortcut ->
ShortcutManagerCompat.pushDynamicShortcut(context, shortcut) ShortcutManagerCompat.pushDynamicShortcut(context, shortcut)