Code review fixes.

This commit is contained in:
onurays 2020-02-24 18:06:59 +03:00
parent 1124aa25fd
commit dec62a893e
3 changed files with 7 additions and 7 deletions

View File

@ -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)
}
}

View File

@ -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))
}
}

View File

@ -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<RoomProfileViewState, RoomProfileAction, RoomProfileViewEvents>(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))
}
}