ChatRoomFragmentModule.kt 1.02 KB
Newer Older
1 2 3
package chat.rocket.android.chatroom.di

import android.arch.lifecycle.LifecycleOwner
4
import chat.rocket.android.chatroom.presentation.ChatRoomNavigator
5
import chat.rocket.android.chatroom.presentation.ChatRoomView
6
import chat.rocket.android.chatroom.ui.ChatRoomActivity
7 8 9 10 11 12 13 14 15 16 17
import chat.rocket.android.chatroom.ui.ChatRoomFragment
import chat.rocket.android.core.lifecycle.CancelStrategy
import chat.rocket.android.dagger.scope.PerFragment
import dagger.Module
import dagger.Provides
import kotlinx.coroutines.experimental.Job

@Module
@PerFragment
class ChatRoomFragmentModule {

18 19 20
    @Provides
    fun provideChatRoomNavigator(activity: ChatRoomActivity) = ChatRoomNavigator(activity)

21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
    @Provides
    fun chatRoomView(frag: ChatRoomFragment): ChatRoomView {
        return frag
    }

    @Provides
    fun provideLifecycleOwner(frag: ChatRoomFragment): LifecycleOwner {
        return frag
    }

    @Provides
    fun provideCancelStrategy(owner: LifecycleOwner, jobs: Job): CancelStrategy {
        return CancelStrategy(owner, jobs)
    }
}