Merge branch 'development' into timers
This commit is contained in:
		
						commit
						bf93428fdc
					
				
					 20 changed files with 226 additions and 71 deletions
				
			
		| 
						 | 
				
			
			@ -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)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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")
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in a new issue