From d917070d989929394b3bc20b1391f2c398ec5bdc Mon Sep 17 00:00:00 2001 From: HuanCheng65 <22636177+HuanCheng65@users.noreply.github.com> Date: Sat, 11 Feb 2023 12:12:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E2=80=9C=E6=88=91?= =?UTF-8?q?=E7=9A=84=E2=80=9D=E7=95=8C=E9=9D=A2=E9=97=AA=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tieba/post/api/models/Profile.kt | 6 ++++-- .../tieba/post/fragments/MyInfoFragment.kt | 4 +++- .../post/ui/page/main/user/UserViewModel.kt | 16 +++++++++++++--- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/huanchengfly/tieba/post/api/models/Profile.kt b/app/src/main/java/com/huanchengfly/tieba/post/api/models/Profile.kt index 0266a27d..73538ba4 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/api/models/Profile.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/api/models/Profile.kt @@ -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") diff --git a/app/src/main/java/com/huanchengfly/tieba/post/fragments/MyInfoFragment.kt b/app/src/main/java/com/huanchengfly/tieba/post/fragments/MyInfoFragment.kt index f280bf0d..00aa2db5 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/fragments/MyInfoFragment.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/fragments/MyInfoFragment.kt @@ -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 diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/user/UserViewModel.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/user/UserViewModel.kt index de303ef9..b1b1d409 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/user/UserViewModel.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/user/UserViewModel.kt @@ -41,7 +41,9 @@ class UserViewModel @Inject constructor() : BaseViewModel { 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