Merge branch 'development' into timers

This commit is contained in:
lbarraga 2023-04-17 10:48:48 +02:00 committed by GitHub Enterprise
commit bf93428fdc
20 changed files with 226 additions and 71 deletions

View file

@ -1,10 +1,7 @@
package be.ugent.sel.studeez.domain
import kotlinx.coroutines.flow.Flow
interface UserDAO {
suspend fun getUserName(): String?
suspend fun getUsername(): String?
suspend fun save(newUsername: String)
}

View file

@ -1,18 +1,26 @@
package be.ugent.sel.studeez.domain.implementation
import androidx.compose.runtime.rememberCoroutineScope
import be.ugent.sel.studeez.domain.AccountDAO
import be.ugent.sel.studeez.domain.UserDAO
import com.google.firebase.firestore.DocumentReference
import com.google.firebase.firestore.FirebaseFirestore
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.callbackFlow
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.tasks.await
import javax.inject.Inject
import kotlin.coroutines.coroutineContext
class FirebaseUserDAO @Inject constructor(
private val firestore: FirebaseFirestore,
private val auth: AccountDAO
) : UserDAO {
override suspend fun getUserName(): String? {
override suspend fun getUsername(): String? {
return currentUserDocument().get().await().getString("username")
}