Archi pour viewmodel de profil

pull/51/head
Leni BEAULATON 1 month ago
parent 197ea96cd2
commit 4489ca930e

@ -0,0 +1,6 @@
package com.example.what_the_fantasy.repository
import com.example.what_the_fantasy.data.services.IServices
import okhttp3.Request
class AuthRepository {}

@ -0,0 +1,12 @@
package com.example.what_the_fantasy.ui.states
import com.example.what_the_fantasy.data.model.SrcLanguage
data class InfoUserState (
val imagePath : String ="",
val username :String="",
val email : String="",
val password : String="",
val confirmPassword : String="",
val langue : SrcLanguage = SrcLanguage.vo
)

@ -0,0 +1,20 @@
package com.example.what_the_fantasy.ui.viewModels
import androidx.lifecycle.ViewModel
import com.example.what_the_fantasy.data.services.ServicesStub
import com.example.what_the_fantasy.ui.states.InfoUserState
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.update
class InfoUserViewModel : ViewModel(){
private val services = ServicesStub() // faire repository qui gère les services Stub et API
private val _userInfoState = MutableStateFlow(InfoUserState())
val InfoUserState : StateFlow<InfoUserState> = _userInfoState.asStateFlow()
fun setUsername(username : String){
_userInfoState.update { it.copy(username=username) }
}
}
Loading…
Cancel
Save