storing chats

This commit is contained in:
2025-07-03 21:43:49 -04:00
parent e22cc7cf5c
commit 50d1aae039
9 changed files with 169 additions and 9 deletions

View File

@@ -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()
}
}