forked from upstream-mirrors/quik
Update Dagger and remove unnecessary Modules
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user