Update Dagger and remove unnecessary Modules

This commit is contained in:
Moez Bhatti
2017-09-22 03:02:38 -04:00
parent e9b4d05e7f
commit 43f5ed27f0
8 changed files with 23 additions and 64 deletions
+2 -2
View File
@@ -39,7 +39,7 @@ dependencies {
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.bugsnag:bugsnag-android:3.9.0'
compile "com.google.dagger:dagger:2.9"
compile "com.google.dagger:dagger:2.11"
compile 'com.jakewharton.rxbinding2:rxbinding:2.0.0'
compile 'com.jakewharton.timber:timber:4.5.1'
compile 'com.karumi:dexter:4.1.0'
@@ -49,7 +49,7 @@ dependencies {
compile 'io.realm:android-adapters:1.3.0'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
kapt "android.arch.lifecycle:compiler:1.0.0-alpha9-1"
kapt "com.google.dagger:dagger-compiler:2.9"
kapt "com.google.dagger:dagger-compiler:2.11"
kapt 'io.realm:realm-annotations:3.7.0'
kapt 'io.realm:realm-annotations-processor:3.7.0'
provided 'javax.annotation:jsr250-api:1.0'
@@ -1,6 +0,0 @@
package com.moez.QKSMS.dagger
import javax.inject.Scope
@Scope
annotation class ActivityScope
@@ -9,7 +9,7 @@ import dagger.Component
import javax.inject.Singleton
@Singleton
@Component(modules = arrayOf(AppModule::class, ContactModule::class, ConversationsModule::class, MessagesModule::class))
@Component(modules = arrayOf(AppModule::class))
interface AppComponent {
fun inject(receiver: SmsReceiver)
@@ -10,8 +10,6 @@ internal object AppComponentManager {
fun init(application: QKApplication) {
appComponent = DaggerAppComponent.builder()
.appModule(AppModule(application))
.contactModule(ContactModule())
.conversationsModule(ConversationsModule())
.build()
}
@@ -3,6 +3,8 @@ package com.moez.QKSMS.dagger
import android.app.Application
import android.content.Context
import com.moez.QKSMS.data.repository.ContactRepository
import com.moez.QKSMS.data.repository.ConversationRepository
import com.moez.QKSMS.data.repository.MessageRepository
import com.moez.QKSMS.data.sync.SyncManager
import com.moez.QKSMS.util.DateFormatter
import com.moez.QKSMS.util.NotificationHelper
@@ -37,4 +39,22 @@ class AppModule(var application: Application) {
return NotificationHelper(context)
}
@Provides
@Singleton
fun provideConversationRepository(): ConversationRepository {
return ConversationRepository()
}
@Singleton
@Provides
fun provideMessageRepository(context: Context): MessageRepository {
return MessageRepository(context)
}
@Provides
@Singleton
fun provideContactRepository(context: Context): ContactRepository {
return ContactRepository(context)
}
}
@@ -1,18 +0,0 @@
package com.moez.QKSMS.dagger
import android.content.Context
import com.moez.QKSMS.data.repository.ContactRepository
import dagger.Module
import dagger.Provides
import javax.inject.Singleton
@Module
class ContactModule {
@Provides
@Singleton
fun provideContactRepository(context: Context): ContactRepository {
return ContactRepository(context)
}
}
@@ -1,17 +0,0 @@
package com.moez.QKSMS.dagger
import com.moez.QKSMS.data.repository.ConversationRepository
import dagger.Module
import dagger.Provides
import javax.inject.Singleton
@Module
class ConversationsModule {
@Provides
@Singleton
fun provideRepository(): ConversationRepository {
return ConversationRepository()
}
}
@@ -1,18 +0,0 @@
package com.moez.QKSMS.dagger
import android.content.Context
import com.moez.QKSMS.data.repository.MessageRepository
import dagger.Module
import dagger.Provides
import javax.inject.Singleton
@Module
class MessagesModule {
@Singleton
@Provides
fun provideRepository(context: Context): MessageRepository {
return MessageRepository(context)
}
}