storing chats
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package com.mattintech.lchat.di
|
||||
|
||||
import android.content.Context
|
||||
import androidx.room.Room
|
||||
import com.mattintech.lchat.data.db.LChatDatabase
|
||||
import com.mattintech.lchat.data.db.dao.MessageDao
|
||||
import com.mattintech.lchat.network.WifiAwareManager
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
@@ -20,4 +23,21 @@ object AppModule {
|
||||
): WifiAwareManager {
|
||||
return WifiAwareManager(context)
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideLChatDatabase(
|
||||
@ApplicationContext context: Context
|
||||
): LChatDatabase {
|
||||
return Room.databaseBuilder(
|
||||
context,
|
||||
LChatDatabase::class.java,
|
||||
"lchat_database"
|
||||
).build()
|
||||
}
|
||||
|
||||
@Provides
|
||||
fun provideMessageDao(database: LChatDatabase): MessageDao {
|
||||
return database.messageDao()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user