#14 temporary update does not work

This commit is contained in:
Tibo De Peuter 2023-04-15 13:32:38 +02:00
parent e4066dedd7
commit b790b55ab2
9 changed files with 79 additions and 10 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")
}