diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index 9547beea3..0e1efa7ba 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -26,6 +26,7 @@ import com.tencent.imsdk.v2.V2TIMUserInfo; import com.yunbao.common.BuildConfig; import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; +import com.yunbao.common.manager.imrongcloud.MessageIMManager; import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; @@ -160,6 +161,7 @@ public class AppContext extends CommonAppContext { @Override public boolean onReceived(io.rong.imlib.model.Message message, int i, boolean b, boolean b1) { Log.e("wewe", message.getConversationType() + "112121"); + MessageIMManager.get(sInstance).getSystemForRongcloud(message); //融云直播间聊天 Message msg = Message.obtain(); msg.what = Constants.SOCKET_WHAT_BROADCAST; 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 c69a2ae99..e4dd0a116 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -131,13 +131,14 @@ public class IMLoginManager extends BaseCacheManager { String[] uidAndToken = SpUtil.getInstance().getMultiStringValue(new String[]{SpUtil.UID, SpUtil.TOKEN}); String uid = uidAndToken[0]; String token = uidAndToken[1]; + if (TextUtils.isEmpty(token)) return; HttpClient.getInstance().get("User.getBaseInfos", "getBaseInfo") .params("uid", uid) .params("token", token) .execute(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { - if (code == 0 && info.length > 0) { + if (code == 0 && info.length > 0 ) { userInfo = new Gson().fromJson(info[0], IMLoginModel.class); EventBus.getDefault().post(new DataUserInfoEvent().setUpDataSuccess(true)); } else { diff --git a/config.gradle b/config.gradle index 53e2161f5..eddca7244 100644 --- a/config.gradle +++ b/config.gradle @@ -9,9 +9,9 @@ ext { ] manifestPlaceholders = [ //正式 -// serverHost : "https://napi.yaoulive.com", + serverHost : "https://napi.yaoulive.com", //測試 - serverHost : "https://ceshi.yaoulive.com", +// serverHost : "https://ceshi.yaoulive.com", //腾讯地图 txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index abfdb9f74..d42666369 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -42,9 +42,9 @@ import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.adapter.ViewPagerAdapter; import com.yunbao.common.bean.ChatRemarksBean; import com.yunbao.common.bean.ConfigBean; +import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.LiveSvgGiftBean; import com.yunbao.common.bean.UpdataListBean; -import com.yunbao.common.bean.UserBean; import com.yunbao.common.custom.TabButtonGroup; import com.yunbao.common.event.MessageIMEvent; import com.yunbao.common.event.RongIMConnectionStatusEvent; @@ -66,11 +66,7 @@ import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.VersionUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.AbsMainViewHolder; -import com.yunbao.live.LiveConfig; -import com.yunbao.live.activity.LiveAnchorActivity; -import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.bean.LiveBean; -import com.yunbao.live.bean.LiveKsyConfigBean; import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.utils.LiveStorge; @@ -83,7 +79,6 @@ import com.yunbao.main.event.PDLiveConversationListEvent; import com.yunbao.main.http.MainHttpConsts; import com.yunbao.main.http.MainHttpUtil; import com.yunbao.main.interfaces.MainAppBarLayoutListener; -import com.yunbao.main.interfaces.MainStartChooseCallback; import com.yunbao.main.manager.imrongcloud.ConversationIMListManager; import com.yunbao.main.presenter.CheckLivePresenter; import com.yunbao.main.utils.GenerateTestUserSig; @@ -361,9 +356,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene //初始化腾讯im private void initTXIM() { //登录腾讯云服务器 - final CommonAppConfig appConfig = CommonAppConfig.getInstance(); - final UserBean u = appConfig.getUserBean(); - + CommonAppConfig.getInstance(); + IMLoginModel userInfo = IMLoginManager.get(this).getUserInfo(); // 1. 从 IM 控制台获取应用 SDKAppID,详情请参考 SDKAppID。 // 2. 初始化 config 对象 V2TIMSDKConfig config = new V2TIMSDKConfig(); @@ -405,7 +399,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene super.onUserSigExpired(); Log.i("tx", "登录过期了"); - V2TIMManager.getInstance().login(u.getId(), GenerateTestUserSig.genTestUserSig(u.getId()), new V2TIMCallback() { + V2TIMManager.getInstance().login(userInfo.getId() + "", GenerateTestUserSig.genTestUserSig(userInfo.getId() + ""), new V2TIMCallback() { @Override public void onSuccess() { Log.i("tx", "登录成功"); @@ -423,13 +417,13 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene }); //登录腾讯云服务器 - V2TIMManager.getInstance().login(u.getId(), GenerateTestUserSig.genTestUserSig(u.getId()), new V2TIMCallback() { + V2TIMManager.getInstance().login(userInfo.getId() + "", GenerateTestUserSig.genTestUserSig(userInfo.getId() + ""), new V2TIMCallback() { @Override public void onSuccess() { Log.i("tx", "登录成功"); V2TIMUserFullInfo v2TIMUserFullInfo = new V2TIMUserFullInfo(); - v2TIMUserFullInfo.setNickname(u.getUserNiceName()); - v2TIMUserFullInfo.setFaceUrl(u.getAvatarThumb()); + v2TIMUserFullInfo.setNickname(userInfo.getUserNicename()); + v2TIMUserFullInfo.setFaceUrl(userInfo.getAvatarThumb()); V2TIMManager.getInstance().setSelfInfo(v2TIMUserFullInfo, new V2TIMCallback() { @Override public void onError(int code, String desc) { @@ -474,7 +468,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene private void showStartDialog() { if (isReady == true) { MainStartDialogFragment dialogFragment = new MainStartDialogFragment(); - dialogFragment.setMainStartChooseCallback(true,this); + dialogFragment.setMainStartChooseCallback(true, this); dialogFragment.show(getSupportFragmentManager(), "MainStartDialogFragment"); } else { ToastUtil.show("正在初始化,請稍等...."); @@ -483,9 +477,6 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene } - - - /** * 检查版本更新 */ diff --git a/main/src/main/java/com/yunbao/main/adapter/MainHomeLiveAdapter.java b/main/src/main/java/com/yunbao/main/adapter/MainHomeLiveAdapter.java index 1addefd09..a7001f77d 100644 --- a/main/src/main/java/com/yunbao/main/adapter/MainHomeLiveAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/MainHomeLiveAdapter.java @@ -138,16 +138,6 @@ public class MainHomeLiveAdapter extends RefreshAdapter { super.onViewDetachedFromWindow(holder); } -// @Override -// public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) { -// //局部刷新周星榜svaga -// if (holder instanceof MainHomeLiveWeekItemViewHolder) { -// if (((MainHomeLiveWeekItemViewHolder) holder).weekSvga.isAnimating()) { -// ((MainHomeLiveWeekItemViewHolder) holder).weekSvga.stopAnimation(); -// } -// } -// super.onViewRecycled(holder); -// } @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {