From dec62a893ea76870a30fc1209a712528d49f9ebd Mon Sep 17 00:00:00 2001 From: onurays Date: Mon, 24 Feb 2020 18:06:59 +0300 Subject: [PATCH] Code review fixes. --- .../roommemberprofile/RoomMemberProfileFragment.kt | 2 +- .../roommemberprofile/RoomMemberProfileViewModel.kt | 4 ++-- .../riotx/features/roomprofile/RoomProfileViewModel.kt | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/vector/src/main/java/im/vector/riotx/features/roommemberprofile/RoomMemberProfileFragment.kt b/vector/src/main/java/im/vector/riotx/features/roommemberprofile/RoomMemberProfileFragment.kt index f261da2da9..c62e8ce226 100644 --- a/vector/src/main/java/im/vector/riotx/features/roommemberprofile/RoomMemberProfileFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/roommemberprofile/RoomMemberProfileFragment.kt @@ -224,7 +224,7 @@ class RoomMemberProfileFragment @Inject constructor( vectorBaseActivity.notImplemented("Mention") } - private fun handleShareRoomMemberProfile(permalink: String) = withState(viewModel) { + private fun handleShareRoomMemberProfile(permalink: String) { startSharePlainTextIntent(fragment = this, chooserTitle = null, text = permalink) } } diff --git a/vector/src/main/java/im/vector/riotx/features/roommemberprofile/RoomMemberProfileViewModel.kt b/vector/src/main/java/im/vector/riotx/features/roommemberprofile/RoomMemberProfileViewModel.kt index e4fbe85806..44c214bc99 100644 --- a/vector/src/main/java/im/vector/riotx/features/roommemberprofile/RoomMemberProfileViewModel.kt +++ b/vector/src/main/java/im/vector/riotx/features/roommemberprofile/RoomMemberProfileViewModel.kt @@ -237,8 +237,8 @@ class RoomMemberProfileViewModel @AssistedInject constructor(@Assisted private v } } - private fun handleShareRoomMemberProfile() = withState { state -> - PermalinkFactory.createPermalink(state.userId)?.let { permalink -> + private fun handleShareRoomMemberProfile() { + PermalinkFactory.createPermalink(initialState.userId)?.let { permalink -> _viewEvents.post(RoomMemberProfileViewEvents.ShareRoomMemberProfile(permalink)) } } diff --git a/vector/src/main/java/im/vector/riotx/features/roomprofile/RoomProfileViewModel.kt b/vector/src/main/java/im/vector/riotx/features/roomprofile/RoomProfileViewModel.kt index 261e5f04d0..d49727d12d 100644 --- a/vector/src/main/java/im/vector/riotx/features/roomprofile/RoomProfileViewModel.kt +++ b/vector/src/main/java/im/vector/riotx/features/roomprofile/RoomProfileViewModel.kt @@ -31,7 +31,7 @@ import im.vector.riotx.R import im.vector.riotx.core.platform.VectorViewModel import im.vector.riotx.core.resources.StringProvider -class RoomProfileViewModel @AssistedInject constructor(@Assisted initialState: RoomProfileViewState, +class RoomProfileViewModel @AssistedInject constructor(@Assisted private val initialState: RoomProfileViewState, private val stringProvider: StringProvider, private val session: Session) : VectorViewModel(initialState) { @@ -67,7 +67,7 @@ class RoomProfileViewModel @AssistedInject constructor(@Assisted initialState: R override fun handle(action: RoomProfileAction) = when (action) { RoomProfileAction.LeaveRoom -> handleLeaveRoom() is RoomProfileAction.ChangeRoomNotificationState -> handleChangeNotificationMode(action) - is RoomProfileAction.ShareRoomProfile -> handleShareRoomProfile() + is RoomProfileAction.ShareRoomProfile -> handleShareRoomProfile() } private fun handleChangeNotificationMode(action: RoomProfileAction.ChangeRoomNotificationState) { @@ -91,8 +91,8 @@ class RoomProfileViewModel @AssistedInject constructor(@Assisted initialState: R }) } - private fun handleShareRoomProfile() = withState { state -> - PermalinkFactory.createPermalink(state.roomId)?.let { permalink -> + private fun handleShareRoomProfile() { + PermalinkFactory.createPermalink(initialState.roomId)?.let { permalink -> _viewEvents.post(RoomProfileViewEvents.ShareRoomProfile(permalink)) } }