Removing duplication of rendering session info
This commit is contained in:
parent
ea0c99011f
commit
a48131baad
|
@ -24,7 +24,6 @@ import android.view.View
|
|||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isVisible
|
||||
import com.airbnb.mvrx.Success
|
||||
import com.airbnb.mvrx.fragmentViewModel
|
||||
|
@ -42,7 +41,6 @@ import im.vector.app.core.resources.StringProvider
|
|||
import im.vector.app.databinding.FragmentSessionOverviewBinding
|
||||
import im.vector.app.features.auth.ReAuthActivity
|
||||
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.more.SessionLearnMoreBottomSheet
|
||||
import im.vector.app.features.workers.signout.SignOutUiWorker
|
||||
|
@ -181,11 +179,6 @@ class SessionOverviewFragment :
|
|||
updateSessionInfo(state)
|
||||
updateLoading(state.isLoading)
|
||||
updatePushNotificationToggle(state.deviceId, state.pushers.invoke().orEmpty())
|
||||
if (state.deviceInfo is Success) {
|
||||
renderSessionInfo(state.isCurrentSessionTrusted, state.deviceInfo.invoke())
|
||||
} else {
|
||||
hideSessionInfo()
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateToolbar(viewState: SessionOverviewViewState) {
|
||||
|
@ -243,18 +236,6 @@ class SessionOverviewFragment :
|
|||
}
|
||||
}
|
||||
|
||||
private fun renderSessionInfo(isCurrentSession: Boolean, deviceFullInfo: DeviceFullInfo) {
|
||||
views.sessionOverviewInfo.isVisible = true
|
||||
val viewState = SessionInfoViewState(
|
||||
isCurrentSession = isCurrentSession,
|
||||
deviceFullInfo = deviceFullInfo,
|
||||
isDetailsButtonVisible = false,
|
||||
isLearnMoreLinkVisible = true,
|
||||
isLastSeenDetailsVisible = true,
|
||||
)
|
||||
views.sessionOverviewInfo.render(viewState, dateFormatter, drawableProvider, colorProvider, stringProvider)
|
||||
}
|
||||
|
||||
private fun updateLoading(isLoading: Boolean) {
|
||||
if (isLoading) {
|
||||
showLoading(null)
|
||||
|
@ -313,8 +294,4 @@ class SessionOverviewFragment :
|
|||
)
|
||||
SessionLearnMoreBottomSheet.show(childFragmentManager, args)
|
||||
}
|
||||
|
||||
private fun hideSessionInfo() {
|
||||
views.sessionOverviewInfo.isGone = true
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue