From c1ee03ccbd9a8e47aadd42d5d19b3b4ef80e6faf Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Wed, 24 Aug 2022 13:25:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=89=B9=E6=95=88=E7=9A=84=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/dialog/EffectsSettingsDialog.java | 13 +++++-------- .../yunbao/common/manager/IMLoginManager.java | 18 +++++++++--------- .../presenter/LiveEnterRoomAnimPresenter.java | 2 +- .../live/presenter/LiveGiftAnimPresenter.java | 2 +- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/dialog/EffectsSettingsDialog.java b/common/src/main/java/com/yunbao/common/dialog/EffectsSettingsDialog.java index d8436eee9..64db85b8b 100644 --- a/common/src/main/java/com/yunbao/common/dialog/EffectsSettingsDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/EffectsSettingsDialog.java @@ -7,7 +7,6 @@ import android.view.WindowManager; import android.widget.ImageView; import com.yunbao.common.R; -import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.views.weight.ViewClicksAntiShake; @@ -37,11 +36,10 @@ public class EffectsSettingsDialog extends AbsDialogFragment { @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); - IMLoginModel userInfo = IMLoginManager.get(getContext()).getUserInfo(); specialSwitch = (ImageView) findViewById(R.id.special_switch); specialMountSwitch = (ImageView) findViewById(R.id.special_mount_switch); - giftEffect = userInfo.isGiftEffect(); - mountEffect = userInfo.isMountEffect(); + giftEffect = IMLoginManager.get(getActivity()).isGiftEffect(); + mountEffect = IMLoginManager.get(getActivity()).isMountEffect(); if (giftEffect) { ImgLoader.display(getContext(), R.mipmap.special_icon_off, specialSwitch); } else { @@ -61,8 +59,8 @@ public class EffectsSettingsDialog extends AbsDialogFragment { ImgLoader.display(getContext(), R.mipmap.special_icon_on, specialSwitch); } //更新特效开关 - IMLoginManager.get(getContext()).setGiftEffect(giftEffect); - IMLoginManager.get(getContext()).upDataUserInfo(userInfo.setGiftEffect(giftEffect)); + IMLoginManager.get(getContext()).setGiftEffect(giftEffect); + } ); //坐骑特效开关 @@ -74,8 +72,7 @@ public class EffectsSettingsDialog extends AbsDialogFragment { ImgLoader.display(getContext(), R.mipmap.special_icon_on, specialMountSwitch); } //更新特效开关 - IMLoginManager.get(getContext()).setMountEffect(mountEffect); - IMLoginManager.get(getContext()).upDataUserInfo(userInfo.setMountEffect(mountEffect)); + IMLoginManager.get(getContext()).setMountEffect(mountEffect); } ); } diff --git a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java index b4d4c4add..84b5d37dc 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -84,10 +84,8 @@ public class IMLoginManager extends BaseCacheManager { if (null == userInfo) { userInfo = new Gson().fromJson( getString(KEY_USER_INFO), IMLoginModel.class); - if (userInfo != null){ + if (userInfo != null) { token = userInfo.getToken(); - userInfo.setGiftEffect(getBoolean(GiftEffect, false)); - userInfo.setMountEffect(getBoolean(MountEffect, false)); } } @@ -115,8 +113,6 @@ public class IMLoginManager extends BaseCacheManager { if (userInfo != null && !TextUtils.isEmpty(userInfo.getToken())) { token = userInfo.getToken(); } - userInfo.setGiftEffect(getBoolean(GiftEffect, false)); - userInfo.setMountEffect(getBoolean(MountEffect, false)); if (netHandler == null) { netHandler = new Handler(); } @@ -133,8 +129,6 @@ public class IMLoginManager extends BaseCacheManager { if (!TextUtils.isEmpty(token)) { userInfo.setToken(token); } - userInfo.setGiftEffect(getBoolean(GiftEffect, false)); - userInfo.setMountEffect(getBoolean(MountEffect, false)); put(KEY_USER_INFO, new Gson().toJson(userInfo)); //兼容老模块(之后要把用户维护的类更换掉) SpUtil.getInstance().setStringValue(SpUtil.USER_INFO, new Gson().toJson(userInfo)); @@ -150,8 +144,6 @@ public class IMLoginManager extends BaseCacheManager { if (!TextUtils.isEmpty(token)) { userInfo.setToken(token); } - userInfo.setGiftEffect(getBoolean(GiftEffect, false)); - userInfo.setMountEffect(getBoolean(MountEffect, false)); put(KEY_USER_INFO, new Gson().toJson(userInfo)); //兼容老模块(之后要把用户维护的类更换掉) SpUtil.getInstance().setStringValue(SpUtil.USER_INFO, new Gson().toJson(userInfo)); @@ -166,6 +158,14 @@ public class IMLoginManager extends BaseCacheManager { put(MountEffect, mountEffect); } + public boolean isMountEffect() { + return getBoolean(MountEffect, false); + } + + public boolean isGiftEffect() { + return getBoolean(GiftEffect, false); + } + /** * 重新请求管理员身份信息 */ diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveEnterRoomAnimPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveEnterRoomAnimPresenter.java index 46b6a4096..4442d32ba 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveEnterRoomAnimPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveEnterRoomAnimPresenter.java @@ -414,7 +414,7 @@ public class LiveEnterRoomAnimPresenter { colocNow = "#" + car.getCar_colour(); playText = car.getUser_nicename() + mContext.getResources().getString(R.string.enter_room); } - if (IMLoginManager.get(mContext).getUserInfo().isMountEffect()){ + if (IMLoginManager.get(mContext).isMountEffect()){ GifCacheUtil.getFile(Constants.GIF_CAR_PREFIX + id, url1, "0", mDownloadGifCallback); } diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java index dac8c0ccf..9e2dcb816 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java @@ -796,7 +796,7 @@ public class LiveGiftAnimPresenter { } } else { if ((bean.getGifUrl().contains("svga") || bean.getGifUrl().contains("gif")) && - IMLoginManager.get(mContext).getUserInfo().isGiftEffect()) { + IMLoginManager.get(mContext).isGiftEffect()) { //同一直播间,玩家自己送礼物,也能看到全服通知 //同一直播间,其他玩家也能看到全服通知