From 02a81dd9e1f50cc3da57b607624a43270d62f11c Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 27 May 2019 16:03:53 +0200 Subject: [PATCH] Fix issue --- .../riotredesign/features/home/HomeModule.kt | 9 +++++---- .../features/home/group/GroupListViewModel.kt | 17 +++++++---------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/vector/src/main/java/im/vector/riotredesign/features/home/HomeModule.kt b/vector/src/main/java/im/vector/riotredesign/features/home/HomeModule.kt index c5779816d7..8e06637ff3 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/home/HomeModule.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/home/HomeModule.kt @@ -70,12 +70,13 @@ class HomeModule { val eventHtmlRenderer = EventHtmlRenderer(GlideApp.with(fragment), fragment.requireContext(), get()) val noticeEventFormatter = get(parameters = { parametersOf(fragment) }) val timelineMediaSizeProvider = TimelineMediaSizeProvider() - val colorProvider = get() + val colorProvider = ColorProvider(fragment.requireContext()) val timelineDateFormatter = get() - val timelineItemFactory = TimelineItemFactory(messageItemFactory = MessageItemFactory(colorProvider, timelineMediaSizeProvider, timelineDateFormatter, eventHtmlRenderer), - noticeItemFactory = NoticeItemFactory(noticeEventFormatter), - defaultItemFactory = DefaultItemFactory() + val timelineItemFactory = TimelineItemFactory( + messageItemFactory = MessageItemFactory(colorProvider, timelineMediaSizeProvider, timelineDateFormatter, eventHtmlRenderer), + noticeItemFactory = NoticeItemFactory(noticeEventFormatter), + defaultItemFactory = DefaultItemFactory() ) TimelineEventController(timelineDateFormatter, timelineItemFactory, timelineMediaSizeProvider) } diff --git a/vector/src/main/java/im/vector/riotredesign/features/home/group/GroupListViewModel.kt b/vector/src/main/java/im/vector/riotredesign/features/home/group/GroupListViewModel.kt index 47534b8b81..38fff5c5cd 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/home/group/GroupListViewModel.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/home/group/GroupListViewModel.kt @@ -85,16 +85,13 @@ class GroupListViewModel(initialState: GroupListViewState, session .rx().liveGroupSummaries() .map { - if (it.isEmpty()) { - it - } else { - val myUser = session.getUser(session.sessionParams.credentials.userId) - val allCommunityGroup = GroupSummary( - groupId = ALL_COMMUNITIES_GROUP_ID, - displayName = "All Communities", - avatarUrl = myUser?.avatarUrl ?: "") - listOf(allCommunityGroup) + it - } + val myUser = session.getUser(session.sessionParams.credentials.userId) + val allCommunityGroup = GroupSummary( + groupId = ALL_COMMUNITIES_GROUP_ID, + // TODO i18n + displayName = "All Communities", + avatarUrl = myUser?.avatarUrl ?: "") + listOf(allCommunityGroup) + it } .execute { async -> val newSelectedGroup = selectedGroup ?: async()?.firstOrNull()