mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 17:35:54 +03:00
Limit the number of pushed shortcuts
This commit is contained in:
parent
f3655d4664
commit
e8fb408579
1 changed files with 6 additions and 3 deletions
|
@ -50,6 +50,7 @@ class ShortcutsHandler @Inject constructor(
|
|||
) : PinCodeStoreListener {
|
||||
|
||||
private val isRequestPinShortcutSupported = ShortcutManagerCompat.isRequestPinShortcutSupported(context)
|
||||
private val maxShortcutCountPerActivity = ShortcutManagerCompat.getMaxShortcutCountPerActivity(context)
|
||||
|
||||
// Value will be set correctly if necessary
|
||||
private var hasPinCode = AtomicBoolean(true)
|
||||
|
@ -101,9 +102,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)
|
||||
|
|
Loading…
Reference in a new issue