set up contactrepository to inflate phone number in contact

This commit is contained in:
Moez Bhatti
2017-08-28 15:13:27 -07:00
parent 7996048658
commit 22489af4c3
10 changed files with 80 additions and 33 deletions
@@ -6,7 +6,7 @@ import dagger.Component
import javax.inject.Singleton
@Singleton
@Component(modules = arrayOf(AppModule::class, ConversationsModule::class))
@Component(modules = arrayOf(AppModule::class, ContactModule::class, ConversationsModule::class))
interface AppComponent {
fun inject(fragment: ConversationListFragment)
@@ -2,6 +2,7 @@ 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.sync.SyncManager
import dagger.Module
import dagger.Provides
@@ -18,8 +19,8 @@ class AppModule(var application: Application) {
@Provides
@Singleton
fun provideSyncManager(context: Context): SyncManager {
return SyncManager(context)
fun provideSyncManager(context: Context, contacts: ContactRepository): SyncManager {
return SyncManager(context, contacts)
}
}
@@ -0,0 +1,18 @@
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)
}
}