mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-16 03:08:58 +03:00
Remove dead shortcuts
This commit is contained in:
parent
69d0ed3fb8
commit
996b4e7a45
1 changed files with 7 additions and 0 deletions
|
@ -49,6 +49,13 @@ class ShortcutsHandler @Inject constructor(
|
|||
)
|
||||
?.asObservable()
|
||||
?.subscribe { rooms ->
|
||||
// Remove dead shortcuts (i.e. deleted rooms)
|
||||
val roomIds = rooms.map { it.roomId }
|
||||
val deadShortcutIds = ShortcutManagerCompat.getShortcuts(context, ShortcutManagerCompat.FLAG_MATCH_DYNAMIC)
|
||||
.map { it.id }
|
||||
.filter { !roomIds.contains(it) }
|
||||
ShortcutManagerCompat.removeLongLivedShortcuts(context, deadShortcutIds)
|
||||
|
||||
val shortcuts = rooms
|
||||
.sortedBy { room ->
|
||||
// pushDynamicShortcut adds each shortcut to the top of the shortcut ranking,
|
||||
|
|
Loading…
Add table
Reference in a new issue