From 123ffe9f9c7c7dfb0ca65c5103d67df4b957b55a Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 18 Dec 2019 17:00:18 +0100 Subject: [PATCH] Cleanup --- .../riotx/features/home/group/GroupListViewModel.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vector/src/main/java/im/vector/riotx/features/home/group/GroupListViewModel.kt b/vector/src/main/java/im/vector/riotx/features/home/group/GroupListViewModel.kt index bbeda127fc..24318bc508 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/group/GroupListViewModel.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/group/GroupListViewModel.kt @@ -68,14 +68,14 @@ class GroupListViewModel @AssistedInject constructor(@Assisted initialState: Gro } private fun observeSelectionState() { - selectSubscribe(GroupListViewState::selectedGroup) { - if (it != null) { + selectSubscribe(GroupListViewState::selectedGroup) { groupSummary -> + if (groupSummary != null) { val selectedGroup = _openGroupLiveData.value?.peekContent() - // We only wan to open group if the updated selectedGroup is a different one. - if (selectedGroup?.groupId != it.groupId) { - _openGroupLiveData.postLiveEvent(it) + // We only want to open group if the updated selectedGroup is a different one. + if (selectedGroup?.groupId != groupSummary.groupId) { + _openGroupLiveData.postLiveEvent(groupSummary) } - val optionGroup = Option.fromNullable(it) + val optionGroup = Option.just(groupSummary) selectedGroupStore.post(optionGroup) } }