Reducing argument number in session info view update method
This commit is contained in:
parent
72637b465f
commit
943ec7ee75
@ -35,7 +35,6 @@ import im.vector.app.core.resources.ColorProvider
|
|||||||
import im.vector.app.core.resources.DrawableProvider
|
import im.vector.app.core.resources.DrawableProvider
|
||||||
import im.vector.app.databinding.FragmentSessionOverviewBinding
|
import im.vector.app.databinding.FragmentSessionOverviewBinding
|
||||||
import im.vector.app.features.crypto.recover.SetupMode
|
import im.vector.app.features.crypto.recover.SetupMode
|
||||||
import im.vector.app.features.settings.devices.v2.DeviceFullInfo
|
|
||||||
import im.vector.app.features.settings.devices.v2.list.SessionInfoViewState
|
import im.vector.app.features.settings.devices.v2.list.SessionInfoViewState
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@ -107,11 +106,7 @@ class SessionOverviewFragment :
|
|||||||
override fun invalidate() = withState(viewModel) { state ->
|
override fun invalidate() = withState(viewModel) { state ->
|
||||||
updateToolbar(state.isCurrentSession)
|
updateToolbar(state.isCurrentSession)
|
||||||
updateEntryDetails(state.deviceId)
|
updateEntryDetails(state.deviceId)
|
||||||
if (state.deviceInfo is Success) {
|
updateSessionInfo(state)
|
||||||
renderSessionInfo(state.isCurrentSession, state.deviceInfo.invoke(), state.isCurrentSessionTrusted)
|
|
||||||
} else {
|
|
||||||
hideSessionInfo()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateToolbar(isCurrentSession: Boolean) {
|
private fun updateToolbar(isCurrentSession: Boolean) {
|
||||||
@ -127,21 +122,22 @@ class SessionOverviewFragment :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderSessionInfo(
|
private fun updateSessionInfo(viewState: SessionOverviewViewState) {
|
||||||
isCurrentSession: Boolean,
|
if (viewState.deviceInfo is Success) {
|
||||||
deviceFullInfo: DeviceFullInfo,
|
views.sessionOverviewInfo.isVisible = true
|
||||||
isCurrentSessionTrusted: Boolean,
|
val isCurrentSession = viewState.isCurrentSession
|
||||||
) {
|
val infoViewState = SessionInfoViewState(
|
||||||
views.sessionOverviewInfo.isVisible = true
|
isCurrentSession = isCurrentSession,
|
||||||
val viewState = SessionInfoViewState(
|
deviceFullInfo = viewState.deviceInfo.invoke(),
|
||||||
isCurrentSession = isCurrentSession,
|
isVerifyButtonVisible = isCurrentSession || viewState.isCurrentSessionTrusted,
|
||||||
deviceFullInfo = deviceFullInfo,
|
isDetailsButtonVisible = false,
|
||||||
isVerifyButtonVisible = isCurrentSession || isCurrentSessionTrusted,
|
isLearnMoreLinkVisible = true,
|
||||||
isDetailsButtonVisible = false,
|
isLastSeenDetailsVisible = true,
|
||||||
isLearnMoreLinkVisible = true,
|
)
|
||||||
isLastSeenDetailsVisible = true,
|
views.sessionOverviewInfo.render(infoViewState, dateFormatter, drawableProvider, colorProvider)
|
||||||
)
|
} else {
|
||||||
views.sessionOverviewInfo.render(viewState, dateFormatter, drawableProvider, colorProvider)
|
hideSessionInfo()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun hideSessionInfo() {
|
private fun hideSessionInfo() {
|
||||||
|
Loading…
Reference in New Issue
Block a user