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