mirror of
https://github.com/KokaKiwi/BarInsta
synced 2026-03-14 08:21:35 +00:00
Update ProfileFragmentViewModel
This commit is contained in:
parent
1ebf7a2e4b
commit
976c9a86b6
3 changed files with 80 additions and 15 deletions
|
|
@ -41,7 +41,7 @@ class ProfileFragmentViewModel(
|
|||
value = currentUser to stateUsername
|
||||
}
|
||||
addSource(state.getLiveData<String?>("username")) { username ->
|
||||
this.stateUsername = Resource.success(username)
|
||||
this.stateUsername = Resource.success(username.substringAfter('@'))
|
||||
value = user to this.stateUsername
|
||||
}
|
||||
// trigger currentUserAndStateUsernameLiveData switch map with a state username success resource
|
||||
|
|
@ -87,6 +87,7 @@ class ProfileFragmentViewModel(
|
|||
Resource.Status.SUCCESS -> it.data?.username ?: ""
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
// Log.d(TAG, "${state.keys()} $userRepository $friendshipRepository $storiesRepository $mediaRepository")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@ import awais.instagrabber.repositories.responses.UserSearchResponse
|
|||
import awais.instagrabber.webservices.RetrofitFactory.retrofit
|
||||
import java.util.*
|
||||
|
||||
class UserRepository(private val service: UserService) {
|
||||
open class UserRepository(private val service: UserService) {
|
||||
|
||||
suspend fun getUserInfo(uid: Long): User {
|
||||
val response = service.getUserInfo(uid)
|
||||
return response.user
|
||||
}
|
||||
|
||||
suspend fun getUsernameInfo(username: String): User {
|
||||
open suspend fun getUsernameInfo(username: String): User {
|
||||
val response = service.getUsernameInfo(username)
|
||||
return response.user
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue