Limit the number of pushed shortcuts
This commit is contained in:
parent
f3655d4664
commit
e8fb408579
|
@ -50,6 +50,7 @@ class ShortcutsHandler @Inject constructor(
|
||||||
) : 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 = AtomicBoolean(true)
|
private var hasPinCode = AtomicBoolean(true)
|
||||||
|
@ -101,7 +102,9 @@ 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
|
||||||
|
.take(maxShortcutCountPerActivity)
|
||||||
|
.mapIndexed { index, room ->
|
||||||
shortcutCreator.create(room, index)
|
shortcutCreator.create(room, index)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue