fix: 修复“我的”界面闪退
This commit is contained in:
parent
b2c2e9f920
commit
d917070d98
|
|
@ -6,7 +6,7 @@ import com.google.gson.annotations.SerializedName
|
|||
|
||||
@Keep
|
||||
data class Profile(
|
||||
val anti: Anti,
|
||||
val anti: Anti?,
|
||||
@SerializedName("anti_stat")
|
||||
val antiStat: AntiStat,
|
||||
@SerializedName("block_info")
|
||||
|
|
@ -21,7 +21,7 @@ data class Profile(
|
|||
) {
|
||||
@Keep
|
||||
data class Anti(
|
||||
val tbs: String
|
||||
val tbs: String?
|
||||
)
|
||||
|
||||
@Keep
|
||||
|
|
@ -91,6 +91,8 @@ data class Profile(
|
|||
val friendNum: String,
|
||||
@SerializedName("gift_num")
|
||||
val giftNum: String,
|
||||
@SerializedName("has_concerned")
|
||||
val hasConcerned: String,
|
||||
val id: String,
|
||||
var intro: String?,
|
||||
@SerializedName("ip_address")
|
||||
|
|
|
|||
|
|
@ -205,7 +205,9 @@ class MyInfoFragment : BaseFragment(), View.OnClickListener, CompoundButton.OnCh
|
|||
|
||||
private fun updateAccount(profile: Profile) {
|
||||
AccountUtil.getLoginInfo()?.apply {
|
||||
tbs = profile.anti.tbs
|
||||
profile.anti?.tbs?.let {
|
||||
tbs = it
|
||||
}
|
||||
portrait = profile.user.portrait
|
||||
intro = profile.user.intro
|
||||
sex = profile.user.sex
|
||||
|
|
|
|||
|
|
@ -41,7 +41,9 @@ class UserViewModel @Inject constructor() : BaseViewModel<UserUiIntent, UserPart
|
|||
.profileFlow(account.uid)
|
||||
.map<Profile, UserPartialChange> { profile ->
|
||||
account.apply {
|
||||
tbs = profile.anti.tbs
|
||||
profile.anti?.tbs?.let {
|
||||
tbs = it
|
||||
}
|
||||
portrait = profile.user.portrait
|
||||
intro = profile.user.intro
|
||||
sex = profile.user.sex
|
||||
|
|
@ -62,10 +64,18 @@ class UserViewModel @Inject constructor() : BaseViewModel<UserUiIntent, UserPart
|
|||
.onStart {
|
||||
emit(UserPartialChange.Refresh.Start)
|
||||
if (account.loadSuccess) {
|
||||
emit(UserPartialChange.Refresh.Success(account = account, isLocal = true))
|
||||
emit(
|
||||
UserPartialChange.Refresh.Success(
|
||||
account = account,
|
||||
isLocal = true
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
.catch { emit(UserPartialChange.Refresh.Failure(errorMessage = it.getErrorMessage())) }
|
||||
.catch {
|
||||
it.printStackTrace()
|
||||
emit(UserPartialChange.Refresh.Failure(errorMessage = it.getErrorMessage()))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue