mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-28 05:59:05 +03:00
Persist selected space on home fragment pause
Change-Id: Ib7771d83c0adb7a9e228261a55bac2f1de0f118f
This commit is contained in:
parent
ca31577858
commit
36c290f112
2 changed files with 22 additions and 0 deletions
|
@ -164,4 +164,19 @@ class AppStateHandler @Inject constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun persistSelectedSpace() {
|
||||
val currentValue = selectedSpaceDataSourceSc.currentValue?.orNull() ?: return
|
||||
val currentMethod = currentValue.first as? RoomGroupingMethod.BySpace ?: return
|
||||
val uSession = activeSessionHolder.getSafeActiveSession() ?: return
|
||||
|
||||
// We want to persist it, so we also want to remove the pendingSwipe status
|
||||
if (currentValue.second) {
|
||||
selectedSpaceDataSourceSc.post(Option.just(Pair(currentMethod, false)))
|
||||
}
|
||||
|
||||
// Persist it across app restarts
|
||||
uiStateRepository.storeGroupingMethod(true, uSession.sessionId)
|
||||
uiStateRepository.storeSelectedSpace(currentMethod.spaceSummary?.roomId, uSession.sessionId)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -274,6 +274,13 @@ class HomeDetailFragment @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
|
||||
// Persist swiped
|
||||
appStateHandler.persistSelectedSpace()
|
||||
}
|
||||
|
||||
private fun checkNotificationTabStatus(enableDialPad: Boolean? = null) {
|
||||
val wasVisible = views.bottomNavigationView.menu.findItem(R.id.bottom_action_notification).isVisible
|
||||
val combinedOverview = vectorPreferences.combinedOverview()
|
||||
|
|
Loading…
Reference in a new issue