mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 17:35:54 +03:00
Improve Rx sequence regarding listener
This commit is contained in:
parent
6691edb59d
commit
34e8cf84dc
1 changed files with 2 additions and 4 deletions
|
@ -54,7 +54,6 @@ class ShortcutsHandler @Inject constructor(
|
|||
hasPinCode = pinCodeStore.getEncodedPin() != null
|
||||
|
||||
val session = activeSessionHolder.getSafeActiveSession() ?: return Disposables.empty()
|
||||
pinCodeStore.addListener(this)
|
||||
return session.getRoomSummariesLive(
|
||||
roomSummaryQueryParams {
|
||||
memberships = listOf(Membership.JOIN)
|
||||
|
@ -62,9 +61,8 @@ class ShortcutsHandler @Inject constructor(
|
|||
sortOrder = RoomSortOrder.PRIORITY_AND_ACTIVITY
|
||||
)
|
||||
.asObservable()
|
||||
.doOnDispose {
|
||||
pinCodeStore.removeListener(this)
|
||||
}
|
||||
.doOnSubscribe { pinCodeStore.addListener(this) }
|
||||
.doFinally { pinCodeStore.removeListener(this) }
|
||||
.subscribe { rooms ->
|
||||
// Remove dead shortcuts (i.e. deleted rooms)
|
||||
removeDeadShortcut(rooms.map { it.roomId })
|
||||
|
|
Loading…
Reference in a new issue