Commit 54918bf1 authored by Lucio Maciel's avatar Lucio Maciel

Update dagger

parent cf9c9165
...@@ -10,20 +10,22 @@ import dagger.Provides ...@@ -10,20 +10,22 @@ import dagger.Provides
import kotlinx.coroutines.experimental.Job import kotlinx.coroutines.experimental.Job
@Module @Module
@PerFragment
class LoginFragmentModule { class LoginFragmentModule {
@Provides @Provides
@PerFragment
fun loginView(frag: LoginFragment): LoginView { fun loginView(frag: LoginFragment): LoginView {
return frag return frag
} }
@Provides @Provides
@PerFragment
fun provideLifecycleOwner(frag: LoginFragment): LifecycleOwner { fun provideLifecycleOwner(frag: LoginFragment): LifecycleOwner {
return frag return frag
} }
@Provides @Provides
@PerFragment
fun provideCancelStrategy(owner: LifecycleOwner, jobs: Job): CancelStrategy { fun provideCancelStrategy(owner: LifecycleOwner, jobs: Job): CancelStrategy {
return CancelStrategy(owner, jobs) return CancelStrategy(owner, jobs)
} }
......
package chat.rocket.android.authentication.login.di package chat.rocket.android.authentication.login.di
import chat.rocket.android.authentication.login.ui.LoginFragment import chat.rocket.android.authentication.login.ui.LoginFragment
import chat.rocket.android.dagger.scope.PerFragment
import dagger.Module import dagger.Module
import dagger.android.ContributesAndroidInjector import dagger.android.ContributesAndroidInjector
@Module abstract class LoginFragmentProvider { @Module abstract class LoginFragmentProvider {
@ContributesAndroidInjector(modules = [LoginFragmentModule::class]) @ContributesAndroidInjector(modules = [LoginFragmentModule::class])
@PerFragment
abstract fun provideLoginFragment(): LoginFragment abstract fun provideLoginFragment(): LoginFragment
} }
\ No newline at end of file
...@@ -10,20 +10,22 @@ import dagger.Provides ...@@ -10,20 +10,22 @@ import dagger.Provides
import kotlinx.coroutines.experimental.Job import kotlinx.coroutines.experimental.Job
@Module @Module
@PerFragment
class RegisterUsernameFragmentModule { class RegisterUsernameFragmentModule {
@Provides @Provides
@PerFragment
fun registerUsernameView(frag: RegisterUsernameFragment): RegisterUsernameView { fun registerUsernameView(frag: RegisterUsernameFragment): RegisterUsernameView {
return frag return frag
} }
@Provides @Provides
@PerFragment
fun provideLifecycleOwner(frag: RegisterUsernameFragment): LifecycleOwner { fun provideLifecycleOwner(frag: RegisterUsernameFragment): LifecycleOwner {
return frag return frag
} }
@Provides @Provides
@PerFragment
fun provideCancelStrategy(owner: LifecycleOwner, jobs: Job): CancelStrategy { fun provideCancelStrategy(owner: LifecycleOwner, jobs: Job): CancelStrategy {
return CancelStrategy(owner, jobs) return CancelStrategy(owner, jobs)
} }
......
package chat.rocket.android.authentication.registerusername.di package chat.rocket.android.authentication.registerusername.di
import chat.rocket.android.authentication.registerusername.ui.RegisterUsernameFragment import chat.rocket.android.authentication.registerusername.ui.RegisterUsernameFragment
import chat.rocket.android.dagger.scope.PerFragment
import dagger.Module import dagger.Module
import dagger.android.ContributesAndroidInjector import dagger.android.ContributesAndroidInjector
...@@ -8,5 +9,6 @@ import dagger.android.ContributesAndroidInjector ...@@ -8,5 +9,6 @@ import dagger.android.ContributesAndroidInjector
abstract class RegisterUsernameFragmentProvider { abstract class RegisterUsernameFragmentProvider {
@ContributesAndroidInjector(modules = [RegisterUsernameFragmentModule::class]) @ContributesAndroidInjector(modules = [RegisterUsernameFragmentModule::class])
@PerFragment
abstract fun provideRegisterUsernameFragment(): RegisterUsernameFragment abstract fun provideRegisterUsernameFragment(): RegisterUsernameFragment
} }
\ No newline at end of file
...@@ -10,20 +10,22 @@ import dagger.Provides ...@@ -10,20 +10,22 @@ import dagger.Provides
import kotlinx.coroutines.experimental.Job import kotlinx.coroutines.experimental.Job
@Module @Module
@PerFragment
class ResetPasswordFragmentModule { class ResetPasswordFragmentModule {
@Provides @Provides
@PerFragment
fun resetPasswordView(frag: ResetPasswordFragment): ResetPasswordView { fun resetPasswordView(frag: ResetPasswordFragment): ResetPasswordView {
return frag return frag
} }
@Provides @Provides
@PerFragment
fun provideLifecycleOwner(frag: ResetPasswordFragment): LifecycleOwner { fun provideLifecycleOwner(frag: ResetPasswordFragment): LifecycleOwner {
return frag return frag
} }
@Provides @Provides
@PerFragment
fun provideCancelStrategy(owner: LifecycleOwner, jobs: Job): CancelStrategy { fun provideCancelStrategy(owner: LifecycleOwner, jobs: Job): CancelStrategy {
return CancelStrategy(owner, jobs) return CancelStrategy(owner, jobs)
} }
......
package chat.rocket.android.authentication.resetpassword.di package chat.rocket.android.authentication.resetpassword.di
import chat.rocket.android.authentication.resetpassword.ui.ResetPasswordFragment import chat.rocket.android.authentication.resetpassword.ui.ResetPasswordFragment
import chat.rocket.android.dagger.scope.PerFragment
import dagger.Module import dagger.Module
import dagger.android.ContributesAndroidInjector import dagger.android.ContributesAndroidInjector
...@@ -8,5 +9,6 @@ import dagger.android.ContributesAndroidInjector ...@@ -8,5 +9,6 @@ import dagger.android.ContributesAndroidInjector
abstract class ResetPasswordFragmentProvider { abstract class ResetPasswordFragmentProvider {
@ContributesAndroidInjector(modules = [ResetPasswordFragmentModule::class]) @ContributesAndroidInjector(modules = [ResetPasswordFragmentModule::class])
@PerFragment
abstract fun provideResetPasswordFragment(): ResetPasswordFragment abstract fun provideResetPasswordFragment(): ResetPasswordFragment
} }
\ No newline at end of file
...@@ -10,20 +10,22 @@ import dagger.Provides ...@@ -10,20 +10,22 @@ import dagger.Provides
import kotlinx.coroutines.experimental.Job import kotlinx.coroutines.experimental.Job
@Module @Module
@PerFragment
class SignupFragmentModule { class SignupFragmentModule {
@Provides @Provides
@PerFragment
fun signupView(frag: SignupFragment): SignupView { fun signupView(frag: SignupFragment): SignupView {
return frag return frag
} }
@Provides @Provides
@PerFragment
fun provideLifecycleOwner(frag: SignupFragment): LifecycleOwner { fun provideLifecycleOwner(frag: SignupFragment): LifecycleOwner {
return frag return frag
} }
@Provides @Provides
@PerFragment
fun provideCancelStrategy(owner: LifecycleOwner, jobs: Job): CancelStrategy { fun provideCancelStrategy(owner: LifecycleOwner, jobs: Job): CancelStrategy {
return CancelStrategy(owner, jobs) return CancelStrategy(owner, jobs)
} }
......
package chat.rocket.android.authentication.signup.di package chat.rocket.android.authentication.signup.di
import chat.rocket.android.authentication.signup.ui.SignupFragment import chat.rocket.android.authentication.signup.ui.SignupFragment
import chat.rocket.android.dagger.scope.PerFragment
import dagger.Module import dagger.Module
import dagger.android.ContributesAndroidInjector import dagger.android.ContributesAndroidInjector
...@@ -8,5 +9,6 @@ import dagger.android.ContributesAndroidInjector ...@@ -8,5 +9,6 @@ import dagger.android.ContributesAndroidInjector
abstract class SignupFragmentProvider { abstract class SignupFragmentProvider {
@ContributesAndroidInjector(modules = [SignupFragmentModule::class]) @ContributesAndroidInjector(modules = [SignupFragmentModule::class])
@PerFragment
abstract fun provideSignupFragment(): SignupFragment abstract fun provideSignupFragment(): SignupFragment
} }
\ No newline at end of file
...@@ -10,20 +10,22 @@ import dagger.Provides ...@@ -10,20 +10,22 @@ import dagger.Provides
import kotlinx.coroutines.experimental.Job import kotlinx.coroutines.experimental.Job
@Module @Module
@PerFragment
class TwoFAFragmentModule { class TwoFAFragmentModule {
@Provides @Provides
@PerFragment
fun loginView(frag: TwoFAFragment): TwoFAView { fun loginView(frag: TwoFAFragment): TwoFAView {
return frag return frag
} }
@Provides @Provides
@PerFragment
fun provideLifecycleOwner(frag: TwoFAFragment): LifecycleOwner { fun provideLifecycleOwner(frag: TwoFAFragment): LifecycleOwner {
return frag return frag
} }
@Provides @Provides
@PerFragment
fun provideCancelStrategy(owner: LifecycleOwner, jobs: Job): CancelStrategy { fun provideCancelStrategy(owner: LifecycleOwner, jobs: Job): CancelStrategy {
return CancelStrategy(owner, jobs) return CancelStrategy(owner, jobs)
} }
......
package chat.rocket.android.authentication.twofactor.di package chat.rocket.android.authentication.twofactor.di
import chat.rocket.android.authentication.twofactor.ui.TwoFAFragment import chat.rocket.android.authentication.twofactor.ui.TwoFAFragment
import chat.rocket.android.dagger.scope.PerFragment
import dagger.Module import dagger.Module
import dagger.android.ContributesAndroidInjector import dagger.android.ContributesAndroidInjector
@Module abstract class TwoFAFragmentProvider { @Module abstract class TwoFAFragmentProvider {
@ContributesAndroidInjector(modules = [TwoFAFragmentModule::class]) @ContributesAndroidInjector(modules = [TwoFAFragmentModule::class])
@PerFragment
abstract fun provideTwoFAFragment(): TwoFAFragment abstract fun provideTwoFAFragment(): TwoFAFragment
} }
...@@ -12,20 +12,22 @@ import dagger.Provides ...@@ -12,20 +12,22 @@ import dagger.Provides
import kotlinx.coroutines.experimental.Job import kotlinx.coroutines.experimental.Job
@Module @Module
@PerFragment
class ChatRoomFragmentModule { class ChatRoomFragmentModule {
@Provides @Provides
@PerFragment
fun chatRoomView(frag: ChatRoomFragment): ChatRoomView { fun chatRoomView(frag: ChatRoomFragment): ChatRoomView {
return frag return frag
} }
@Provides @Provides
@PerFragment
fun provideLifecycleOwner(frag: ChatRoomFragment): LifecycleOwner { fun provideLifecycleOwner(frag: ChatRoomFragment): LifecycleOwner {
return frag return frag
} }
@Provides @Provides
@PerFragment
fun provideCancelStrategy(owner: LifecycleOwner, jobs: Job): CancelStrategy { fun provideCancelStrategy(owner: LifecycleOwner, jobs: Job): CancelStrategy {
return CancelStrategy(owner, jobs) return CancelStrategy(owner, jobs)
} }
......
package chat.rocket.android.chatroom.di package chat.rocket.android.chatroom.di
import chat.rocket.android.chatroom.ui.ChatRoomFragment import chat.rocket.android.chatroom.ui.ChatRoomFragment
import chat.rocket.android.dagger.scope.PerFragment
import dagger.Module import dagger.Module
import dagger.android.ContributesAndroidInjector import dagger.android.ContributesAndroidInjector
...@@ -8,5 +9,6 @@ import dagger.android.ContributesAndroidInjector ...@@ -8,5 +9,6 @@ import dagger.android.ContributesAndroidInjector
abstract class ChatRoomFragmentProvider { abstract class ChatRoomFragmentProvider {
@ContributesAndroidInjector(modules = [ChatRoomFragmentModule::class]) @ContributesAndroidInjector(modules = [ChatRoomFragmentModule::class])
@PerFragment
abstract fun provideChatRoomFragment(): ChatRoomFragment abstract fun provideChatRoomFragment(): ChatRoomFragment
} }
\ No newline at end of file
...@@ -7,8 +7,8 @@ import dagger.Module ...@@ -7,8 +7,8 @@ import dagger.Module
import dagger.Provides import dagger.Provides
@Module @Module
@PerActivity
class ChatRoomModule { class ChatRoomModule {
@Provides @Provides
@PerActivity
fun provideChatRoomNavigator(activity: ChatRoomActivity) = ChatRoomNavigator(activity) fun provideChatRoomNavigator(activity: ChatRoomActivity) = ChatRoomNavigator(activity)
} }
\ No newline at end of file
package chat.rocket.android.chatrooms.di package chat.rocket.android.chatrooms.di
import chat.rocket.android.chatrooms.ui.ChatRoomsFragment import chat.rocket.android.chatrooms.ui.ChatRoomsFragment
import chat.rocket.android.dagger.scope.PerFragment
import dagger.Module import dagger.Module
import dagger.android.ContributesAndroidInjector import dagger.android.ContributesAndroidInjector
...@@ -8,5 +9,6 @@ import dagger.android.ContributesAndroidInjector ...@@ -8,5 +9,6 @@ import dagger.android.ContributesAndroidInjector
abstract class ChatRoomsFragmentProvider { abstract class ChatRoomsFragmentProvider {
@ContributesAndroidInjector(modules = [ChatRoomsFragmentModule::class]) @ContributesAndroidInjector(modules = [ChatRoomsFragmentModule::class])
@PerFragment
abstract fun provideChatRoomsFragment(): ChatRoomsFragment abstract fun provideChatRoomsFragment(): ChatRoomsFragment
} }
\ No newline at end of file
...@@ -12,23 +12,26 @@ import dagger.Provides ...@@ -12,23 +12,26 @@ import dagger.Provides
import kotlinx.coroutines.experimental.Job import kotlinx.coroutines.experimental.Job
@Module @Module
@PerFragment
class MembersFragmentModule { class MembersFragmentModule {
@Provides @Provides
@PerFragment
fun provideChatRoomNavigator(activity: ChatRoomActivity) = MembersNavigator(activity) fun provideChatRoomNavigator(activity: ChatRoomActivity) = MembersNavigator(activity)
@Provides @Provides
@PerFragment
fun membersView(frag: MembersFragment): MembersView { fun membersView(frag: MembersFragment): MembersView {
return frag return frag
} }
@Provides @Provides
@PerFragment
fun provideLifecycleOwner(frag: MembersFragment): LifecycleOwner { fun provideLifecycleOwner(frag: MembersFragment): LifecycleOwner {
return frag return frag
} }
@Provides @Provides
@PerFragment
fun provideCancelStrategy(owner: LifecycleOwner, jobs: Job): CancelStrategy { fun provideCancelStrategy(owner: LifecycleOwner, jobs: Job): CancelStrategy {
return CancelStrategy(owner, jobs) return CancelStrategy(owner, jobs)
} }
......
package chat.rocket.android.members.di package chat.rocket.android.members.di
import chat.rocket.android.dagger.scope.PerFragment
import chat.rocket.android.members.ui.MembersFragment import chat.rocket.android.members.ui.MembersFragment
import dagger.Module import dagger.Module
import dagger.android.ContributesAndroidInjector import dagger.android.ContributesAndroidInjector
...@@ -8,5 +9,6 @@ import dagger.android.ContributesAndroidInjector ...@@ -8,5 +9,6 @@ import dagger.android.ContributesAndroidInjector
abstract class MembersFragmentProvider { abstract class MembersFragmentProvider {
@ContributesAndroidInjector(modules = [MembersFragmentModule::class]) @ContributesAndroidInjector(modules = [MembersFragmentModule::class])
@PerFragment
abstract fun provideMembersFragment(): MembersFragment abstract fun provideMembersFragment(): MembersFragment
} }
\ No newline at end of file
...@@ -10,20 +10,22 @@ import dagger.Provides ...@@ -10,20 +10,22 @@ import dagger.Provides
import kotlinx.coroutines.experimental.Job import kotlinx.coroutines.experimental.Job
@Module @Module
@PerFragment
class PinnedMessagesFragmentModule { class PinnedMessagesFragmentModule {
@Provides @Provides
@PerFragment
fun provideLifecycleOwner(frag: PinnedMessagesFragment): LifecycleOwner { fun provideLifecycleOwner(frag: PinnedMessagesFragment): LifecycleOwner {
return frag return frag
} }
@Provides @Provides
@PerFragment
fun provideCancelStrategy(owner: LifecycleOwner, jobs: Job): CancelStrategy { fun provideCancelStrategy(owner: LifecycleOwner, jobs: Job): CancelStrategy {
return CancelStrategy(owner, jobs) return CancelStrategy(owner, jobs)
} }
@Provides @Provides
@PerFragment
fun providePinnedMessagesView(frag: PinnedMessagesFragment): PinnedMessagesView { fun providePinnedMessagesView(frag: PinnedMessagesFragment): PinnedMessagesView {
return frag return frag
} }
......
package chat.rocket.android.chatroom.di package chat.rocket.android.chatroom.di
import chat.rocket.android.dagger.scope.PerFragment
import chat.rocket.android.pinnedmessages.ui.PinnedMessagesFragment import chat.rocket.android.pinnedmessages.ui.PinnedMessagesFragment
import dagger.Module import dagger.Module
import dagger.android.ContributesAndroidInjector import dagger.android.ContributesAndroidInjector
...@@ -8,5 +9,6 @@ import dagger.android.ContributesAndroidInjector ...@@ -8,5 +9,6 @@ import dagger.android.ContributesAndroidInjector
abstract class PinnedMessagesFragmentProvider { abstract class PinnedMessagesFragmentProvider {
@ContributesAndroidInjector(modules = [PinnedMessagesFragmentModule::class]) @ContributesAndroidInjector(modules = [PinnedMessagesFragmentModule::class])
@PerFragment
abstract fun providePinnedMessageFragment(): PinnedMessagesFragment abstract fun providePinnedMessageFragment(): PinnedMessagesFragment
} }
\ No newline at end of file
...@@ -8,15 +8,16 @@ import dagger.Module ...@@ -8,15 +8,16 @@ import dagger.Module
import dagger.Provides import dagger.Provides
@Module @Module
@PerFragment
class ProfileFragmentModule { class ProfileFragmentModule {
@Provides @Provides
@PerFragment
fun profileView(frag: ProfileFragment): ProfileView { fun profileView(frag: ProfileFragment): ProfileView {
return frag return frag
} }
@Provides @Provides
@PerFragment
fun provideLifecycleOwner(frag: ProfileFragment): LifecycleOwner { fun provideLifecycleOwner(frag: ProfileFragment): LifecycleOwner {
return frag return frag
} }
......
package chat.rocket.android.profile.di package chat.rocket.android.profile.di
import chat.rocket.android.dagger.scope.PerFragment
import chat.rocket.android.profile.ui.ProfileFragment import chat.rocket.android.profile.ui.ProfileFragment
import dagger.Module import dagger.Module
import dagger.android.ContributesAndroidInjector import dagger.android.ContributesAndroidInjector
...@@ -8,5 +9,6 @@ import dagger.android.ContributesAndroidInjector ...@@ -8,5 +9,6 @@ import dagger.android.ContributesAndroidInjector
abstract class ProfileFragmentProvider { abstract class ProfileFragmentProvider {
@ContributesAndroidInjector(modules = [ProfileFragmentModule::class]) @ContributesAndroidInjector(modules = [ProfileFragmentModule::class])
@PerFragment
abstract fun provideProfileFragment(): ProfileFragment abstract fun provideProfileFragment(): ProfileFragment
} }
\ No newline at end of file
...@@ -10,19 +10,21 @@ import dagger.Provides ...@@ -10,19 +10,21 @@ import dagger.Provides
import kotlinx.coroutines.experimental.Job import kotlinx.coroutines.experimental.Job
@Module @Module
@PerFragment
class SettingsFragmentModule { class SettingsFragmentModule {
@Provides @Provides
@PerFragment
fun settingsView(frag: SettingsFragment): SettingsView { fun settingsView(frag: SettingsFragment): SettingsView {
return frag return frag
} }
@Provides @Provides
@PerFragment
fun settingsLifecycleOwner(frag: SettingsFragment): LifecycleOwner { fun settingsLifecycleOwner(frag: SettingsFragment): LifecycleOwner {
return frag return frag
} }
@Provides @Provides
@PerFragment
fun provideCancelStrategy(owner: LifecycleOwner, jobs: Job): CancelStrategy { fun provideCancelStrategy(owner: LifecycleOwner, jobs: Job): CancelStrategy {
return CancelStrategy(owner, jobs) return CancelStrategy(owner, jobs)
} }
......
...@@ -10,19 +10,21 @@ import dagger.Provides ...@@ -10,19 +10,21 @@ import dagger.Provides
import kotlinx.coroutines.experimental.Job import kotlinx.coroutines.experimental.Job
@Module @Module
@PerFragment
class PasswordFragmentModule { class PasswordFragmentModule {
@Provides @Provides
@PerFragment
fun passwordView(frag: PasswordFragment): PasswordView { fun passwordView(frag: PasswordFragment): PasswordView {
return frag return frag
} }
@Provides @Provides
@PerFragment
fun settingsLifecycleOwner(frag: PasswordFragment): LifecycleOwner { fun settingsLifecycleOwner(frag: PasswordFragment): LifecycleOwner {
return frag return frag
} }
@Provides @Provides
@PerFragment
fun provideCancelStrategy(owner: LifecycleOwner, jobs: Job): CancelStrategy { fun provideCancelStrategy(owner: LifecycleOwner, jobs: Job): CancelStrategy {
return CancelStrategy(owner, jobs) return CancelStrategy(owner, jobs)
} }
......
package chat.rocket.android.settings.password.di package chat.rocket.android.settings.password.di
import chat.rocket.android.dagger.scope.PerFragment
import chat.rocket.android.settings.password.ui.PasswordFragment import chat.rocket.android.settings.password.ui.PasswordFragment
import dagger.Module import dagger.Module
import dagger.android.ContributesAndroidInjector import dagger.android.ContributesAndroidInjector
...@@ -7,5 +8,6 @@ import dagger.android.ContributesAndroidInjector ...@@ -7,5 +8,6 @@ import dagger.android.ContributesAndroidInjector
@Module @Module
abstract class PasswordFragmentProvider { abstract class PasswordFragmentProvider {
@ContributesAndroidInjector(modules = [PasswordFragmentModule::class]) @ContributesAndroidInjector(modules = [PasswordFragmentModule::class])
@PerFragment
abstract fun providePasswordFragment(): PasswordFragment abstract fun providePasswordFragment(): PasswordFragment
} }
\ No newline at end of file
...@@ -45,3 +45,7 @@ fun String.parseColor(): Int { ...@@ -45,3 +45,7 @@ fun String.parseColor(): Int {
Color.parseColor("white") Color.parseColor("white")
} }
} }
fun String.userId(userId: String?): String? {
return userId?.let { this.replace(it, "") }
}
\ No newline at end of file
...@@ -94,3 +94,9 @@ var TextView.content: CharSequence? ...@@ -94,3 +94,9 @@ var TextView.content: CharSequence?
Markwon.scheduleDrawables(this) Markwon.scheduleDrawables(this)
Markwon.scheduleTableRows(this) Markwon.scheduleTableRows(this)
} }
var TextView.spanned: CharSequence?
get() = text
set(value) {
text = spanned
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment