Some cleanup:

- use invalidate() from MvRx
- use throttleFirst instead of debounce
- remove useless observe on main thread
- remove useless calls to super.invalidate()
This commit is contained in:
Benoit Marty 2020-05-29 11:36:27 +02:00
parent 7be3434136
commit d125cb5c01
16 changed files with 32 additions and 81 deletions

View file

@ -95,7 +95,6 @@ abstract class VectorBaseActivity : AppCompatActivity(), HasScreenInjector {
protected val viewModelProvider protected val viewModelProvider
get() = ViewModelProvider(this, viewModelFactory) get() = ViewModelProvider(this, viewModelFactory)
// TODO Other Activity should use this also
protected fun <T : VectorViewEvents> VectorViewModel<*, *, T>.observeViewEvents(observer: (T) -> Unit) { protected fun <T : VectorViewEvents> VectorViewModel<*, *, T>.observeViewEvents(observer: (T) -> Unit) {
viewEvents viewEvents
.observe() .observe()

View file

@ -31,7 +31,6 @@ import im.vector.riotx.core.di.ScreenComponent
import im.vector.riotx.core.error.ErrorFormatter import im.vector.riotx.core.error.ErrorFormatter
import im.vector.riotx.core.extensions.commitTransaction import im.vector.riotx.core.extensions.commitTransaction
import im.vector.riotx.core.platform.SimpleFragmentActivity import im.vector.riotx.core.platform.SimpleFragmentActivity
import io.reactivex.android.schedulers.AndroidSchedulers
import kotlinx.android.parcel.Parcelize import kotlinx.android.parcel.Parcelize
import kotlinx.android.synthetic.main.activity.* import kotlinx.android.synthetic.main.activity.*
import javax.inject.Inject import javax.inject.Inject
@ -59,17 +58,9 @@ class SharedSecureStorageActivity : SimpleFragmentActivity() {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
toolbar.visibility = View.GONE toolbar.visibility = View.GONE
viewModel.viewEvents viewModel.observeViewEvents { observeViewEvents(it) }
.observe()
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
observeViewEvents(it)
}
.disposeOnDestroy()
viewModel.subscribe(this) { viewModel.subscribe(this) { renderState(it) }
renderState(it)
}
} }
override fun onBackPressed() { override fun onBackPressed() {

View file

@ -22,22 +22,17 @@ import android.os.Bundle
import android.view.View import android.view.View
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import com.airbnb.mvrx.activityViewModel import com.airbnb.mvrx.activityViewModel
import com.airbnb.mvrx.withState
import com.jakewharton.rxbinding3.widget.editorActionEvents import com.jakewharton.rxbinding3.widget.editorActionEvents
import com.jakewharton.rxbinding3.widget.textChanges import com.jakewharton.rxbinding3.widget.textChanges
import im.vector.matrix.android.api.extensions.tryThis import im.vector.matrix.android.api.extensions.tryThis
import im.vector.riotx.R import im.vector.riotx.R
import im.vector.riotx.core.platform.VectorBaseFragment import im.vector.riotx.core.platform.VectorBaseFragment
import im.vector.riotx.core.resources.ColorProvider
import im.vector.riotx.core.utils.startImportTextFromFileIntent import im.vector.riotx.core.utils.startImportTextFromFileIntent
import io.reactivex.android.schedulers.AndroidSchedulers
import kotlinx.android.synthetic.main.fragment_ssss_access_from_key.* import kotlinx.android.synthetic.main.fragment_ssss_access_from_key.*
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import javax.inject.Inject import javax.inject.Inject
class SharedSecuredStorageKeyFragment @Inject constructor( class SharedSecuredStorageKeyFragment @Inject constructor() : VectorBaseFragment() {
private val colorProvider: ColorProvider
) : VectorBaseFragment() {
override fun getLayoutResId() = R.layout.fragment_ssss_access_from_key override fun getLayoutResId() = R.layout.fragment_ssss_access_from_key
@ -48,8 +43,7 @@ class SharedSecuredStorageKeyFragment @Inject constructor(
ssss_restore_with_key_text.text = getString(R.string.enter_secret_storage_input_key) ssss_restore_with_key_text.text = getString(R.string.enter_secret_storage_input_key)
ssss_key_enter_edittext.editorActionEvents() ssss_key_enter_edittext.editorActionEvents()
.debounce(300, TimeUnit.MILLISECONDS) .throttleFirst(300, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe { .subscribe {
if (it.actionId == EditorInfo.IME_ACTION_DONE) { if (it.actionId == EditorInfo.IME_ACTION_DONE) {
submit() submit()
@ -102,9 +96,6 @@ class SharedSecuredStorageKeyFragment @Inject constructor(
super.onActivityResult(requestCode, resultCode, data) super.onActivityResult(requestCode, resultCode, data)
} }
override fun invalidate() = withState(sharedViewModel) { _ ->
}
companion object { companion object {
private const val IMPORT_FILE_REQ = 0 private const val IMPORT_FILE_REQ = 0
} }

View file

@ -29,7 +29,6 @@ import im.vector.riotx.core.extensions.showPassword
import im.vector.riotx.core.platform.VectorBaseFragment import im.vector.riotx.core.platform.VectorBaseFragment
import im.vector.riotx.core.resources.ColorProvider import im.vector.riotx.core.resources.ColorProvider
import im.vector.riotx.core.utils.colorizeMatchingText import im.vector.riotx.core.utils.colorizeMatchingText
import io.reactivex.android.schedulers.AndroidSchedulers
import kotlinx.android.synthetic.main.fragment_ssss_access_from_passphrase.* import kotlinx.android.synthetic.main.fragment_ssss_access_from_passphrase.*
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import javax.inject.Inject import javax.inject.Inject
@ -58,8 +57,7 @@ class SharedSecuredStoragePassphraseFragment @Inject constructor(
.colorizeMatchingText(key, colorProvider.getColorFromAttribute(android.R.attr.textColorLink)) .colorizeMatchingText(key, colorProvider.getColorFromAttribute(android.R.attr.textColorLink))
ssss_passphrase_enter_edittext.editorActionEvents() ssss_passphrase_enter_edittext.editorActionEvents()
.debounce(300, TimeUnit.MILLISECONDS) .throttleFirst(300, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe { .subscribe {
if (it.actionId == EditorInfo.IME_ACTION_DONE) { if (it.actionId == EditorInfo.IME_ACTION_DONE) {
submit() submit()

View file

@ -30,7 +30,6 @@ import im.vector.riotx.core.extensions.showPassword
import im.vector.riotx.core.platform.VectorBaseFragment import im.vector.riotx.core.platform.VectorBaseFragment
import im.vector.riotx.core.resources.ColorProvider import im.vector.riotx.core.resources.ColorProvider
import im.vector.riotx.core.utils.colorizeMatchingText import im.vector.riotx.core.utils.colorizeMatchingText
import io.reactivex.android.schedulers.AndroidSchedulers
import kotlinx.android.synthetic.main.fragment_bootstrap_enter_account_password.* import kotlinx.android.synthetic.main.fragment_bootstrap_enter_account_password.*
import kotlinx.android.synthetic.main.fragment_bootstrap_enter_passphrase.bootstrapDescriptionText import kotlinx.android.synthetic.main.fragment_bootstrap_enter_passphrase.bootstrapDescriptionText
import kotlinx.android.synthetic.main.fragment_bootstrap_enter_passphrase.ssss_view_show_password import kotlinx.android.synthetic.main.fragment_bootstrap_enter_passphrase.ssss_view_show_password
@ -56,8 +55,7 @@ class BootstrapAccountPasswordFragment @Inject constructor(
bootstrapAccountPasswordEditText.hint = getString(R.string.account_password) bootstrapAccountPasswordEditText.hint = getString(R.string.account_password)
bootstrapAccountPasswordEditText.editorActionEvents() bootstrapAccountPasswordEditText.editorActionEvents()
.debounce(300, TimeUnit.MILLISECONDS) .throttleFirst(300, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe { .subscribe {
if (it.actionId == EditorInfo.IME_ACTION_DONE) { if (it.actionId == EditorInfo.IME_ACTION_DONE) {
submit() submit()
@ -98,8 +96,6 @@ class BootstrapAccountPasswordFragment @Inject constructor(
} }
override fun invalidate() = withState(sharedViewModel) { state -> override fun invalidate() = withState(sharedViewModel) { state ->
super.invalidate()
if (state.step is BootstrapStep.AccountPassword) { if (state.step is BootstrapStep.AccountPassword) {
val isPasswordVisible = state.step.isPasswordVisible val isPasswordVisible = state.step.isPasswordVisible
bootstrapAccountPasswordEditText.showPassword(isPasswordVisible, updateCursor = false) bootstrapAccountPasswordEditText.showPassword(isPasswordVisible, updateCursor = false)

View file

@ -31,7 +31,6 @@ import im.vector.riotx.core.extensions.showPassword
import im.vector.riotx.core.platform.VectorBaseFragment import im.vector.riotx.core.platform.VectorBaseFragment
import im.vector.riotx.core.resources.ColorProvider import im.vector.riotx.core.resources.ColorProvider
import im.vector.riotx.core.utils.colorizeMatchingText import im.vector.riotx.core.utils.colorizeMatchingText
import io.reactivex.android.schedulers.AndroidSchedulers
import kotlinx.android.synthetic.main.fragment_bootstrap_enter_passphrase.* import kotlinx.android.synthetic.main.fragment_bootstrap_enter_passphrase.*
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import javax.inject.Inject import javax.inject.Inject
@ -63,8 +62,7 @@ class BootstrapConfirmPassphraseFragment @Inject constructor(
} }
ssss_passphrase_enter_edittext.editorActionEvents() ssss_passphrase_enter_edittext.editorActionEvents()
.debounce(300, TimeUnit.MILLISECONDS) .throttleFirst(300, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe { .subscribe {
if (it.actionId == EditorInfo.IME_ACTION_DONE) { if (it.actionId == EditorInfo.IME_ACTION_DONE) {
submit() submit()
@ -96,15 +94,17 @@ class BootstrapConfirmPassphraseFragment @Inject constructor(
return@withState return@withState
} }
val passphrase = ssss_passphrase_enter_edittext.text?.toString() val passphrase = ssss_passphrase_enter_edittext.text?.toString()
if (passphrase.isNullOrBlank()) { when {
passphrase.isNullOrBlank() ->
ssss_passphrase_enter_til.error = getString(R.string.passphrase_empty_error_message) ssss_passphrase_enter_til.error = getString(R.string.passphrase_empty_error_message)
} else if (passphrase != state.passphrase) { passphrase != state.passphrase ->
ssss_passphrase_enter_til.error = getString(R.string.passphrase_passphrase_does_not_match) ssss_passphrase_enter_til.error = getString(R.string.passphrase_passphrase_does_not_match)
} else { else -> {
view?.hideKeyboard() view?.hideKeyboard()
sharedViewModel.handle(BootstrapActions.DoInitialize(passphrase)) sharedViewModel.handle(BootstrapActions.DoInitialize(passphrase))
} }
} }
}
override fun invalidate() = withState(sharedViewModel) { state -> override fun invalidate() = withState(sharedViewModel) { state ->
if (state.step is BootstrapStep.ConfirmPassphrase) { if (state.step is BootstrapStep.ConfirmPassphrase) {

View file

@ -30,7 +30,6 @@ import im.vector.riotx.core.platform.VectorBaseFragment
import im.vector.riotx.core.resources.ColorProvider import im.vector.riotx.core.resources.ColorProvider
import im.vector.riotx.core.utils.colorizeMatchingText import im.vector.riotx.core.utils.colorizeMatchingText
import im.vector.riotx.features.settings.VectorLocale import im.vector.riotx.features.settings.VectorLocale
import io.reactivex.android.schedulers.AndroidSchedulers
import kotlinx.android.synthetic.main.fragment_bootstrap_enter_passphrase.* import kotlinx.android.synthetic.main.fragment_bootstrap_enter_passphrase.*
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import javax.inject.Inject import javax.inject.Inject
@ -53,12 +52,11 @@ class BootstrapEnterPassphraseFragment @Inject constructor(
ssss_passphrase_enter_edittext.hint = getString(R.string.passphrase_enter_passphrase) ssss_passphrase_enter_edittext.hint = getString(R.string.passphrase_enter_passphrase)
withState(sharedViewModel) { withState(sharedViewModel) {
// set initial value (usefull when coming back) // set initial value (useful when coming back)
ssss_passphrase_enter_edittext.setText(it.passphrase ?: "") ssss_passphrase_enter_edittext.setText(it.passphrase ?: "")
} }
ssss_passphrase_enter_edittext.editorActionEvents() ssss_passphrase_enter_edittext.editorActionEvents()
.debounce(300, TimeUnit.MILLISECONDS) .throttleFirst(300, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe { .subscribe {
if (it.actionId == EditorInfo.IME_ACTION_DONE) { if (it.actionId == EditorInfo.IME_ACTION_DONE) {
submit() submit()

View file

@ -39,7 +39,6 @@ import im.vector.riotx.core.platform.VectorBaseFragment
import im.vector.riotx.core.resources.ColorProvider import im.vector.riotx.core.resources.ColorProvider
import im.vector.riotx.core.utils.colorizeMatchingText import im.vector.riotx.core.utils.colorizeMatchingText
import im.vector.riotx.core.utils.startImportTextFromFileIntent import im.vector.riotx.core.utils.startImportTextFromFileIntent
import io.reactivex.android.schedulers.AndroidSchedulers
import kotlinx.android.synthetic.main.fragment_bootstrap_enter_passphrase.bootstrapDescriptionText import kotlinx.android.synthetic.main.fragment_bootstrap_enter_passphrase.bootstrapDescriptionText
import kotlinx.android.synthetic.main.fragment_bootstrap_migrate_backup.* import kotlinx.android.synthetic.main.fragment_bootstrap_migrate_backup.*
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
@ -57,12 +56,11 @@ class BootstrapMigrateBackupFragment @Inject constructor(
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
withState(sharedViewModel) { withState(sharedViewModel) {
// set initial value (usefull when coming back) // set initial value (useful when coming back)
bootstrapMigrateEditText.setText(it.passphrase ?: "") bootstrapMigrateEditText.setText(it.passphrase ?: "")
} }
bootstrapMigrateEditText.editorActionEvents() bootstrapMigrateEditText.editorActionEvents()
.debounce(300, TimeUnit.MILLISECONDS) .throttleFirst(300, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe { .subscribe {
if (it.actionId == EditorInfo.IME_ACTION_DONE) { if (it.actionId == EditorInfo.IME_ACTION_DONE) {
submit() submit()

View file

@ -22,6 +22,7 @@ import android.view.View
import com.airbnb.mvrx.Incomplete import com.airbnb.mvrx.Incomplete
import com.airbnb.mvrx.Success import com.airbnb.mvrx.Success
import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.fragmentViewModel
import com.airbnb.mvrx.withState
import im.vector.matrix.android.api.session.group.model.GroupSummary import im.vector.matrix.android.api.session.group.model.GroupSummary
import im.vector.riotx.R import im.vector.riotx.R
import im.vector.riotx.core.extensions.cleanup import im.vector.riotx.core.extensions.cleanup
@ -50,7 +51,6 @@ class GroupListFragment @Inject constructor(
groupController.callback = this groupController.callback = this
stateView.contentView = groupListView stateView.contentView = groupListView
groupListView.configureWith(groupController) groupListView.configureWith(groupController)
viewModel.subscribe { renderState(it) }
viewModel.observeViewEvents { viewModel.observeViewEvents {
when (it) { when (it) {
is GroupListViewEvents.OpenGroupSummary -> sharedActionViewModel.post(HomeActivitySharedAction.OpenGroup) is GroupListViewEvents.OpenGroupSummary -> sharedActionViewModel.post(HomeActivitySharedAction.OpenGroup)
@ -64,7 +64,7 @@ class GroupListFragment @Inject constructor(
super.onDestroyView() super.onDestroyView()
} }
private fun renderState(state: GroupListViewState) { override fun invalidate() = withState(viewModel) { state ->
when (state.asyncGroups) { when (state.asyncGroups) {
is Incomplete -> stateView.state = StateView.State.Loading is Incomplete -> stateView.state = StateView.State.Loading
is Success -> stateView.state = StateView.State.Content is Success -> stateView.state = StateView.State.Content

View file

@ -19,6 +19,7 @@ package im.vector.riotx.features.home.room.breadcrumbs
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.fragmentViewModel
import com.airbnb.mvrx.withState
import im.vector.riotx.R import im.vector.riotx.R
import im.vector.riotx.core.extensions.cleanup import im.vector.riotx.core.extensions.cleanup
import im.vector.riotx.core.extensions.configureWith import im.vector.riotx.core.extensions.configureWith
@ -42,8 +43,6 @@ class BreadcrumbsFragment @Inject constructor(
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
setupRecyclerView() setupRecyclerView()
sharedActionViewModel = activityViewModelProvider.get(RoomDetailSharedActionViewModel::class.java) sharedActionViewModel = activityViewModelProvider.get(RoomDetailSharedActionViewModel::class.java)
breadcrumbsViewModel.subscribe { renderState(it) }
} }
override fun onDestroyView() { override fun onDestroyView() {
@ -57,8 +56,7 @@ class BreadcrumbsFragment @Inject constructor(
breadcrumbsController.listener = this breadcrumbsController.listener = this
} }
// TODO Use invalidate() ? override fun invalidate() = withState(breadcrumbsViewModel) { state ->
private fun renderState(state: BreadcrumbsViewState) {
breadcrumbsController.update(state) breadcrumbsController.update(state)
} }

View file

@ -262,7 +262,6 @@ class RoomDetailFragment @Inject constructor(
roomToolbarContentView.debouncedClicks { roomToolbarContentView.debouncedClicks {
navigator.openRoomProfile(requireActivity(), roomDetailArgs.roomId) navigator.openRoomProfile(requireActivity(), roomDetailArgs.roomId)
} }
roomDetailViewModel.subscribe { renderState(it) }
sharedActionViewModel sharedActionViewModel
.observe() .observe()
@ -672,7 +671,7 @@ class RoomDetailFragment @Inject constructor(
inviteView.callback = this inviteView.callback = this
} }
private fun renderState(state: RoomDetailViewState) { override fun invalidate() = withState(roomDetailViewModel) { state ->
renderRoomSummary(state) renderRoomSummary(state)
val summary = state.asyncRoomSummary() val summary = state.asyncRoomSummary()
val inviter = state.asyncInviter() val inviter = state.asyncInviter()

View file

@ -32,6 +32,7 @@ import com.airbnb.mvrx.Incomplete
import com.airbnb.mvrx.Success import com.airbnb.mvrx.Success
import com.airbnb.mvrx.args import com.airbnb.mvrx.args
import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.fragmentViewModel
import com.airbnb.mvrx.withState
import im.vector.matrix.android.api.failure.Failure import im.vector.matrix.android.api.failure.Failure
import im.vector.matrix.android.api.session.room.model.Membership import im.vector.matrix.android.api.session.room.model.Membership
import im.vector.matrix.android.api.session.room.model.RoomSummary import im.vector.matrix.android.api.session.room.model.RoomSummary
@ -99,7 +100,6 @@ class RoomListFragment @Inject constructor(
setupCreateRoomButton() setupCreateRoomButton()
setupRecyclerView() setupRecyclerView()
sharedActionViewModel = activityViewModelProvider.get(RoomListQuickActionsSharedActionViewModel::class.java) sharedActionViewModel = activityViewModelProvider.get(RoomListQuickActionsSharedActionViewModel::class.java)
roomListViewModel.subscribe { renderState(it) }
roomListViewModel.observeViewEvents { roomListViewModel.observeViewEvents {
when (it) { when (it) {
is RoomListViewEvents.Loading -> showLoading(it.message) is RoomListViewEvents.Loading -> showLoading(it.message)
@ -243,7 +243,7 @@ class RoomListFragment @Inject constructor(
} }
} }
private fun renderState(state: RoomListViewState) { override fun invalidate() = withState(roomListViewModel) { state ->
when (state.asyncFilteredRooms) { when (state.asyncFilteredRooms) {
is Incomplete -> renderLoading() is Incomplete -> renderLoading()
is Success -> renderSuccess(state) is Success -> renderSuccess(state)

View file

@ -45,7 +45,6 @@ import im.vector.riotx.features.home.HomeActivity
import im.vector.riotx.features.login.terms.LoginTermsFragment import im.vector.riotx.features.login.terms.LoginTermsFragment
import im.vector.riotx.features.login.terms.LoginTermsFragmentArgument import im.vector.riotx.features.login.terms.LoginTermsFragmentArgument
import im.vector.riotx.features.login.terms.toLocalizedLoginTerms import im.vector.riotx.features.login.terms.toLocalizedLoginTerms
import io.reactivex.android.schedulers.AndroidSchedulers
import kotlinx.android.synthetic.main.activity_login.* import kotlinx.android.synthetic.main.activity_login.*
import javax.inject.Inject import javax.inject.Inject
@ -103,13 +102,7 @@ open class LoginActivity : VectorBaseActivity(), ToolbarConfigurable {
updateWithState(it) updateWithState(it)
} }
loginViewModel.viewEvents loginViewModel.observeViewEvents { handleLoginViewEvents(it) }
.observe()
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
handleLoginViewEvents(it)
}
.disposeOnDestroy()
} }
protected open fun addFirstFragment() { protected open fun addFirstFragment() {

View file

@ -58,7 +58,6 @@ class DeviceListFragment @Inject constructor(
override fun invalidate() = withState(viewModel) { override fun invalidate() = withState(viewModel) {
epoxyController.setData(it) epoxyController.setData(it)
super.invalidate()
} }
override fun onDeviceSelected(device: CryptoDeviceInfo) { override fun onDeviceSelected(device: CryptoDeviceInfo) {

View file

@ -58,7 +58,6 @@ class DeviceTrustInfoActionFragment @Inject constructor(
override fun invalidate() = withState(viewModel) { override fun invalidate() = withState(viewModel) {
epoxyController.setData(it) epoxyController.setData(it)
super.invalidate()
} }
override fun onVerifyManually(device: CryptoDeviceInfo) { override fun onVerifyManually(device: CryptoDeviceInfo) {

View file

@ -32,7 +32,6 @@ import im.vector.riotx.core.extensions.replaceFragment
import im.vector.riotx.features.MainActivity import im.vector.riotx.features.MainActivity
import im.vector.riotx.features.MainActivityArgs import im.vector.riotx.features.MainActivityArgs
import im.vector.riotx.features.login.LoginActivity import im.vector.riotx.features.login.LoginActivity
import io.reactivex.android.schedulers.AndroidSchedulers
import kotlinx.android.synthetic.main.activity_login.* import kotlinx.android.synthetic.main.activity_login.*
import timber.log.Timber import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject
@ -57,18 +56,11 @@ class SoftLogoutActivity : LoginActivity() {
override fun initUiAndData() { override fun initUiAndData() {
super.initUiAndData() super.initUiAndData()
softLogoutViewModel softLogoutViewModel.subscribe(this) {
.subscribe(this) {
updateWithState(it) updateWithState(it)
} }
softLogoutViewModel.viewEvents softLogoutViewModel.observeViewEvents { handleSoftLogoutViewEvents(it) }
.observe()
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
handleSoftLogoutViewEvents(it)
}
.disposeOnDestroy()
} }
private fun handleSoftLogoutViewEvents(softLogoutViewEvents: SoftLogoutViewEvents) { private fun handleSoftLogoutViewEvents(softLogoutViewEvents: SoftLogoutViewEvents) {