2019-01-18 10:12:08 +00:00
|
|
|
/*
|
2019-01-25 13:04:59 +00:00
|
|
|
* Copyright 2019 New Vector Ltd
|
2019-01-18 10:12:08 +00:00
|
|
|
*
|
2019-01-25 13:04:59 +00:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2019-01-18 10:12:08 +00:00
|
|
|
*
|
2019-01-25 13:04:59 +00:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2019-01-18 10:12:08 +00:00
|
|
|
*/
|
|
|
|
|
2018-10-28 18:18:14 +00:00
|
|
|
package im.vector.riotredesign.features.home
|
|
|
|
|
2019-03-01 20:44:26 +00:00
|
|
|
import androidx.fragment.app.Fragment
|
|
|
|
import im.vector.riotredesign.core.glide.GlideApp
|
2019-02-28 17:50:30 +00:00
|
|
|
import im.vector.riotredesign.features.home.group.GroupSummaryController
|
2019-02-26 18:35:47 +00:00
|
|
|
import im.vector.riotredesign.features.home.room.detail.timeline.TimelineEventController
|
2019-03-21 19:21:45 +00:00
|
|
|
import im.vector.riotredesign.features.home.room.detail.timeline.factory.*
|
|
|
|
import im.vector.riotredesign.features.home.room.detail.timeline.helper.TimelineDateFormatter
|
2019-01-24 17:04:55 +00:00
|
|
|
import im.vector.riotredesign.features.home.room.detail.timeline.helper.TimelineMediaSizeProvider
|
2019-01-29 13:16:22 +00:00
|
|
|
import im.vector.riotredesign.features.home.room.list.RoomSummaryController
|
2019-02-26 18:35:47 +00:00
|
|
|
import im.vector.riotredesign.features.html.EventHtmlRenderer
|
2018-10-28 18:18:14 +00:00
|
|
|
import org.koin.dsl.module.module
|
|
|
|
|
2019-03-01 20:44:26 +00:00
|
|
|
class HomeModule {
|
2018-10-28 18:18:14 +00:00
|
|
|
|
2019-02-28 17:50:30 +00:00
|
|
|
companion object {
|
|
|
|
const val HOME_SCOPE = "HOME_SCOPE"
|
|
|
|
const val ROOM_DETAIL_SCOPE = "ROOM_DETAIL_SCOPE"
|
|
|
|
const val ROOM_LIST_SCOPE = "ROOM_LIST_SCOPE"
|
|
|
|
const val GROUP_LIST_SCOPE = "GROUP_LIST_SCOPE"
|
|
|
|
}
|
2018-10-28 18:18:14 +00:00
|
|
|
|
2019-02-28 17:50:30 +00:00
|
|
|
val definition = module {
|
|
|
|
|
|
|
|
// Activity scope
|
2019-02-26 18:35:47 +00:00
|
|
|
|
2019-02-28 17:50:30 +00:00
|
|
|
scope(HOME_SCOPE) {
|
|
|
|
HomeNavigator()
|
2019-02-25 14:18:36 +00:00
|
|
|
}
|
|
|
|
|
2019-02-28 17:50:30 +00:00
|
|
|
scope(HOME_SCOPE) {
|
|
|
|
HomePermalinkHandler(get())
|
2018-11-02 16:37:37 +00:00
|
|
|
}
|
|
|
|
|
2019-02-28 17:50:30 +00:00
|
|
|
// Fragment scopes
|
2018-12-29 18:57:38 +00:00
|
|
|
|
2019-03-21 19:21:45 +00:00
|
|
|
factory { (fragment: Fragment) ->
|
2019-03-01 20:44:26 +00:00
|
|
|
val eventHtmlRenderer = EventHtmlRenderer(GlideApp.with(fragment), fragment.requireContext(), get())
|
|
|
|
val timelineDateFormatter = TimelineDateFormatter(get())
|
|
|
|
val timelineMediaSizeProvider = TimelineMediaSizeProvider()
|
|
|
|
val messageItemFactory = MessageItemFactory(get(), timelineMediaSizeProvider, timelineDateFormatter, eventHtmlRenderer)
|
|
|
|
|
|
|
|
val timelineItemFactory = TimelineItemFactory(messageItemFactory = messageItemFactory,
|
2019-03-21 19:21:45 +00:00
|
|
|
roomNameItemFactory = RoomNameItemFactory(get()),
|
|
|
|
roomTopicItemFactory = RoomTopicItemFactory(get()),
|
|
|
|
roomMemberItemFactory = RoomMemberItemFactory(get()),
|
|
|
|
roomHistoryVisibilityItemFactory = RoomHistoryVisibilityItemFactory(get()),
|
|
|
|
callItemFactory = CallItemFactory(get()),
|
|
|
|
defaultItemFactory = DefaultItemFactory()
|
2019-03-01 20:44:26 +00:00
|
|
|
)
|
|
|
|
TimelineEventController(timelineDateFormatter, timelineItemFactory, timelineMediaSizeProvider)
|
2019-01-11 11:07:38 +00:00
|
|
|
}
|
|
|
|
|
2019-03-21 19:21:45 +00:00
|
|
|
factory {
|
2019-02-28 17:50:30 +00:00
|
|
|
RoomSummaryController(get())
|
2019-01-03 20:26:39 +00:00
|
|
|
}
|
|
|
|
|
2019-03-21 19:21:45 +00:00
|
|
|
factory {
|
2019-02-28 17:50:30 +00:00
|
|
|
GroupSummaryController()
|
2019-01-29 15:02:42 +00:00
|
|
|
}
|
|
|
|
|
2019-01-11 11:07:38 +00:00
|
|
|
|
2018-12-20 14:44:01 +00:00
|
|
|
}
|
2018-10-28 18:18:14 +00:00
|
|
|
}
|