Fix issue

This commit is contained in:
Benoit Marty 2019-05-27 16:03:53 +02:00
parent 02555fcbac
commit 02a81dd9e1
2 changed files with 12 additions and 14 deletions

View File

@ -70,12 +70,13 @@ class HomeModule {
val eventHtmlRenderer = EventHtmlRenderer(GlideApp.with(fragment), fragment.requireContext(), get()) val eventHtmlRenderer = EventHtmlRenderer(GlideApp.with(fragment), fragment.requireContext(), get())
val noticeEventFormatter = get<NoticeEventFormatter>(parameters = { parametersOf(fragment) }) val noticeEventFormatter = get<NoticeEventFormatter>(parameters = { parametersOf(fragment) })
val timelineMediaSizeProvider = TimelineMediaSizeProvider() val timelineMediaSizeProvider = TimelineMediaSizeProvider()
val colorProvider = get<ColorProvider>() val colorProvider = ColorProvider(fragment.requireContext())
val timelineDateFormatter = get<TimelineDateFormatter>() val timelineDateFormatter = get<TimelineDateFormatter>()
val timelineItemFactory = TimelineItemFactory(messageItemFactory = MessageItemFactory(colorProvider, timelineMediaSizeProvider, timelineDateFormatter, eventHtmlRenderer), val timelineItemFactory = TimelineItemFactory(
noticeItemFactory = NoticeItemFactory(noticeEventFormatter), messageItemFactory = MessageItemFactory(colorProvider, timelineMediaSizeProvider, timelineDateFormatter, eventHtmlRenderer),
defaultItemFactory = DefaultItemFactory() noticeItemFactory = NoticeItemFactory(noticeEventFormatter),
defaultItemFactory = DefaultItemFactory()
) )
TimelineEventController(timelineDateFormatter, timelineItemFactory, timelineMediaSizeProvider) TimelineEventController(timelineDateFormatter, timelineItemFactory, timelineMediaSizeProvider)
} }

View File

@ -85,16 +85,13 @@ class GroupListViewModel(initialState: GroupListViewState,
session session
.rx().liveGroupSummaries() .rx().liveGroupSummaries()
.map { .map {
if (it.isEmpty()) { val myUser = session.getUser(session.sessionParams.credentials.userId)
it val allCommunityGroup = GroupSummary(
} else { groupId = ALL_COMMUNITIES_GROUP_ID,
val myUser = session.getUser(session.sessionParams.credentials.userId) // TODO i18n
val allCommunityGroup = GroupSummary( displayName = "All Communities",
groupId = ALL_COMMUNITIES_GROUP_ID, avatarUrl = myUser?.avatarUrl ?: "")
displayName = "All Communities", listOf(allCommunityGroup) + it
avatarUrl = myUser?.avatarUrl ?: "")
listOf(allCommunityGroup) + it
}
} }
.execute { async -> .execute { async ->
val newSelectedGroup = selectedGroup ?: async()?.firstOrNull() val newSelectedGroup = selectedGroup ?: async()?.firstOrNull()