From f14258a6a9e07ef1ff8a364109f5f7a57ead3162 Mon Sep 17 00:00:00 2001 From: HuanCheng65 <22636177+HuanCheng65@users.noreply.github.com> Date: Mon, 17 Jul 2023 12:01:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=97=A0=E6=B3=95=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tieba/post/utils/AccountUtil.kt | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/huanchengfly/tieba/post/utils/AccountUtil.kt b/app/src/main/java/com/huanchengfly/tieba/post/utils/AccountUtil.kt index 15b3aa84..0058074c 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/utils/AccountUtil.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/utils/AccountUtil.kt @@ -151,18 +151,28 @@ object AccountUtil { return TiebaApi.getInstance() .initNickNameFlow(bduss, sToken) .zip(TiebaApi.getInstance().loginFlow(bduss, sToken)) { initNickNameBean, loginBean -> - getAccountInfoByUid(loginBean.user.id) ?: Account( - loginBean.user.id, - loginBean.user.name, - bduss, - loginBean.anti.tbs, - loginBean.user.portrait, - sToken, - cookie ?: getBdussCookie(bduss), - initNickNameBean.userInfo.nameShow, - "", - "0" - ) + getAccountInfoByUid(loginBean.user.id)?.apply { + this.bduss = bduss + this.sToken = sToken + this.tbs = loginBean.anti.tbs + this.name = loginBean.user.name + this.nameShow = initNickNameBean.userInfo.nameShow + this.portrait = loginBean.user.portrait + this.cookie = cookie ?: getBdussCookie(bduss) + saveOrUpdate("uid = ?", loginBean.user.id) + } + ?: Account( + loginBean.user.id, + loginBean.user.name, + bduss, + loginBean.anti.tbs, + loginBean.user.portrait, + sToken, + cookie ?: getBdussCookie(bduss), + initNickNameBean.userInfo.nameShow, + "", + "0" + ) } }