21 lines
678 B
Kotlin
21 lines
678 B
Kotlin
package fr.sanchezm.attestationsCovid19.data.repository
|
|
|
|
import fr.sanchezm.attestationsCovid19.data.db.dao.ProfileDao
|
|
import fr.sanchezm.attestationsCovid19.data.db.entity.Profile
|
|
|
|
class ProfileRepository private constructor(private val profileDao: ProfileDao) {
|
|
|
|
fun getProfile() = profileDao.getProfile()
|
|
|
|
fun insertProfile(profile: Profile) = profileDao.insert(profile)
|
|
|
|
companion object {
|
|
@Volatile
|
|
private var instance: ProfileRepository? = null
|
|
|
|
fun getInstance(profileDao: ProfileDao) =
|
|
instance ?: synchronized(this) {
|
|
instance ?: ProfileRepository(profileDao).also { instance = it }
|
|
}
|
|
}
|
|
} |