diff --git a/common/src/main/java/com/yunbao/common/adapter/DebugDialogAdapter.java b/common/src/main/java/com/yunbao/common/adapter/DebugDialogAdapter.java index 478007151..420111425 100644 --- a/common/src/main/java/com/yunbao/common/adapter/DebugDialogAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/DebugDialogAdapter.java @@ -5,24 +5,28 @@ import android.graphics.Color; import android.util.Log; import android.view.View; import android.view.ViewGroup; +import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; +import com.yunbao.common.utils.StringUtil; + import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.TreeMap; public class DebugDialogAdapter extends RecyclerView.Adapter { - TreeMap paramMap = new TreeMap<>(); + HashMap paramMap = new HashMap<>(); private Context mContext; public DebugDialogAdapter(Context mContext) { this.mContext = mContext; } - public void setParamMap(TreeMap paramMap) { + public void setParamMap(HashMap paramMap) { Log.i("debug弹窗", "setParamMap: 添加值到view " + paramMap.size()); this.paramMap = paramMap; notifyDataSetChanged(); @@ -31,7 +35,8 @@ public class DebugDialogAdapter extends RecyclerView.Adapter params; + HashMap params; DebugDialogAdapter adapter; private static DebugDialog debugDialog; Context mContext; + private ShowPattern showPattern = ShowPattern.CURRENT_ACTIVITY; - public static DebugDialog getInstance() { + private DebugDialogRunnable runnable; + + public static void getInstance(DebugDialogRunnable runnable) { if (debugDialog == null) { - debugDialog = new DebugDialog(); + debugDialog = new DebugDialog(runnable); + } else { + runnable.run(debugDialog); } - return debugDialog; + debugDialog.showPattern = ShowPattern.CURRENT_ACTIVITY; + } + + public static boolean checkShow() { + return EasyFloat.isShow("debug"); } public DebugDialog clear() { @@ -44,25 +53,59 @@ public class DebugDialog { } public void setParams(String tag, String msg) { - Log.i("debug弹窗", "setParams: "+tag+"|"+msg); - params.put(tag, msg); - if (adapter != null) + Log.i("debug弹窗", "setParams: " + tag + "|" + msg); + if (params.containsKey(tag)) { + ((TextView) params.get(tag)).setText(tag + ":" + msg); + } else { + TextView textView = new TextView(mContext); + textView.setText(tag + ":" + msg); + params.put(tag, textView); adapter.setParamMap(params); + } + EasyFloat.updateFloat("debug"); } - private DebugDialog() { - if(params==null) { + private DebugDialog(DebugDialogRunnable runnable) { + this.runnable = runnable; + if (params == null) { Log.i("debug弹窗", "DebugDialog: 初始化参数"); - params = new TreeMap<>(); + params = new HashMap<>(); } init(); } - private void init(){ + + private void init() { this.mContext = AppManager.getInstance().getMainActivity(); if (mContext == null) { startWaitMainActivity(); return; } + runnable.run(this); + // createView(); + } + + private void startWaitMainActivity() { + new Timer().schedule(new TimerTask() { + @Override + public void run() { + Log.i("debug弹窗", "run: " + AppManager.getInstance().getMainActivity()); + if (AppManager.getInstance().getMainActivity() != null) { + init(); + cancel(); + } + } + }, 0, 1000); + } + + public void close() { + EasyFloat.dismiss("debug"); + } + + public void show() { + if (showPattern == ShowPattern.CURRENT_ACTIVITY) { + createView(); + return; + } if (PermissionUtils.checkPermission(mContext)) { createView(); } else { @@ -76,44 +119,51 @@ public class DebugDialog { } }); } - // createView(); - } - - private void startWaitMainActivity() { - new Timer().schedule(new TimerTask() { - @Override - public void run() { - Log.i("debug弹窗", "run: "+AppManager.getInstance().getMainActivity()); - if (AppManager.getInstance().getMainActivity() != null) { - init(); - cancel(); - } - } - }, 0,1000); } protected void createView() { recyclerView = new RecyclerView(mContext); adapter = new DebugDialogAdapter(mContext); recyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); - recyclerView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT)); + recyclerView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); recyclerView.setAdapter(adapter); recyclerView.setBackgroundColor(Color.WHITE); + TextView textView = new TextView(mContext); + textView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + ToastUtil.show("debug弹窗:" + params.size()); + EasyFloat.updateFloat("debug"); + } + }); + params.put("debug弹窗", textView); + adapter.setParamMap(params); + EasyFloat.with(mContext) .setTag("debug") - .setShowPattern(ShowPattern.FOREGROUND) + .setShowPattern(this.showPattern) .setLayout(recyclerView) .show(); - if(!params.isEmpty()){ - - new Handler(Looper.getMainLooper()).postDelayed(new Runnable() { - @Override - public void run() { - adapter.setParamMap(params); - } - },1000); - Log.i("debug弹窗", "createView: 有值"); - } + runnable.run(this); Log.i("debug弹窗", "createView: 创建"); } + + public void setView(String value, View view, View.OnClickListener onClickListener) { + if (params.containsKey(value)) { + params.get(value).setOnClickListener(onClickListener); + } else { + view.setOnClickListener(onClickListener); + params.put(value, view); + } + adapter.setParamMap(params); + EasyFloat.updateFloat("debug"); + } + + public void setShowPattern(ShowPattern showPattern) { + this.showPattern = showPattern; + } + + public interface DebugDialogRunnable { + void run(DebugDialog dialog); + } } diff --git a/common/src/main/java/com/yunbao/common/manager/imrongcloud/GameMicManager.java b/common/src/main/java/com/yunbao/common/manager/imrongcloud/GameMicManager.java index 3273793e8..83d0bccb2 100644 --- a/common/src/main/java/com/yunbao/common/manager/imrongcloud/GameMicManager.java +++ b/common/src/main/java/com/yunbao/common/manager/imrongcloud/GameMicManager.java @@ -484,7 +484,7 @@ public class GameMicManager { Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM; TextMessage messageContent = TextMessage.obtain(new Gson().toJson(sudGameSocketImEvent)); Message message = Message.obtain("v" + mRoomID, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { diff --git a/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java b/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java index 10dc380c8..8feb19b11 100644 --- a/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java +++ b/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java @@ -15,10 +15,14 @@ import com.bumptech.glide.request.RequestOptions; import com.iflytek.cloud.SpeechConstant; import com.iflytek.cloud.SpeechUtility; import com.yunbao.common.CommonAppConfig; +import com.yunbao.common.R; import com.yunbao.common.bean.IMLoginModel; +import com.yunbao.common.dialog.DebugDialog; import com.yunbao.common.event.RongIMConnectionStatusEvent; import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.AppManager; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import org.greenrobot.eventbus.EventBus; @@ -26,6 +30,7 @@ import io.rong.imkit.GlideKitImageEngine; import io.rong.imkit.IMCenter; import io.rong.imkit.RongIM; import io.rong.imkit.config.RongConfigCenter; +import io.rong.imlib.IRongCallback; import io.rong.imlib.RongIMClient; import io.rong.imlib.model.Conversation; import io.rong.imlib.model.Message; @@ -113,14 +118,33 @@ public class RongcloudIMManager { } + public static void connectIM(Context context) { + connectIM(context, new RongIMClient.ConnectCallback() { + @Override + public void onSuccess(String t) { + + } + + @Override + public void onError(RongIMClient.ConnectionErrorCode e) { + + } + + @Override + public void onDatabaseOpened(RongIMClient.DatabaseOpenStatus code) { + + } + }); + } + /** * 连接融云服务器 * * @param context */ - public static void connectIM(Context context) { - // MessageIMManager.get(context).addImRongCloudObserver(); - // MessageIMManager.get(context).getSystemMessages(); + public static void connectIM(Context context, RongIMClient.ConnectCallback callback) { + MessageIMManager.get(context).addImRongCloudObserver(); + MessageIMManager.get(context).getSystemMessages(); IMLoginModel userInfo = IMLoginManager.get(context).getUserInfo(); String IMToken = userInfo.getTokenRong(); Log.e(CLASSNAME, "connectIM:" + IMToken); @@ -130,6 +154,7 @@ public class RongcloudIMManager { RongIM.connect(IMToken, 0, new RongIMClient.ConnectCallback() { @Override public void onSuccess(String s) { + callback.onSuccess(s); //连接成功,如果 onDatabaseOpened() 时没有页面跳转,也可在此时进行跳转。 Log.e(CLASSNAME, "onSuccess:" + s); isReady = true; @@ -139,7 +164,7 @@ public class RongcloudIMManager { @Override public void onError(RongIMClient.ConnectionErrorCode connectionErrorCode) { - + callback.onError(connectionErrorCode); if (connectionErrorCode.equals(RongIMClient.ConnectionErrorCode.RC_CONN_TOKEN_EXPIRE)) { //从 APP 服务请求新 token,获取到新 token 后重新 connect() Log.e(CLASSNAME, "onError:(从 APP 服务请求新 token)" + RongIMClient.ConnectionErrorCode.RC_CONN_TOKEN_EXPIRE); @@ -154,13 +179,11 @@ public class RongcloudIMManager { @Override public void onDatabaseOpened(RongIMClient.DatabaseOpenStatus databaseOpenStatus) { - + callback.onDatabaseOpened(databaseOpenStatus); if (RongIMClient.DatabaseOpenStatus.DATABASE_OPEN_SUCCESS.equals(databaseOpenStatus)) { //本地数据库打开,跳转到会话列表页面 - Log.e(CLASSNAME, "onDatabaseOpened:(本地数据库打开)" + databaseOpenStatus); } else { - //数据库打开失败,可以弹出 toast 提示。 Log.e(CLASSNAME, "onDatabaseOpened:(数据库打开失败)" + databaseOpenStatus); } @@ -191,14 +214,13 @@ public class RongcloudIMManager { break; //用户账号在其它设备登录,此设备被踢下线 case KICKED_OFFLINE_BY_OTHER_CLIENT: - EventBus.getDefault().post(new RongIMConnectionStatusEvent().setStatus(-1)); + EventBus.getDefault().post(new RongIMConnectionStatusEvent()); break; //连接暂时挂起(多是由于网络问题导致),SDK 会在合适时机进行自动重连 case SUSPEND: break; //连接成功 case CONNECTED: - EventBus.getDefault().post(new RongIMConnectionStatusEvent().setStatus(1)); break; //连接超时,SDK 将停止连接,用户需要做超时处理,再自行调用连接接口进行连接 case TIMEOUT: @@ -231,4 +253,66 @@ public class RongcloudIMManager { } + /** + * 发送消息失败重连次数,超过3就重新登录 + */ + private static int reconnectIndex = 0; + + public static void sendMessage(final Message message, final String pushContent, final String pushData, final IRongCallback.ISendMessageCallback callback) { + + RongIMClient.getInstance().sendMessage(message, pushContent, pushData, new IRongCallback.ISendMessageCallback() { + + @Override + public void onAttached(Message message) { + if (callback != null) { + callback.onAttached(message); + } + } + + @Override + public void onSuccess(Message message) { + reconnectIndex = 0; + if (callback != null) { + callback.onSuccess(message); + } + } + + @Override + public void onError(Message message, RongIMClient.ErrorCode errorCode) { + if (reconnectIndex > 2) { + reconnectIndex = 0; + ToastUtil.show(WordUtil.getNewString(R.string.login_invalid)); + EventBus.getDefault().post(new RongIMConnectionStatusEvent()); + return; + } + if (errorCode.code == 33000) { + reconnectIndex++; + connectIM(AppManager.getInstance().getMainActivity(), new RongIMClient.ConnectCallback() { + @Override + public void onSuccess(String t) { + sendMessage(message, pushContent, pushData, callback); + } + + @Override + public void onError(RongIMClient.ConnectionErrorCode e) { + sendMessage(message, pushContent, pushData, callback); + } + + @Override + public void onDatabaseOpened(RongIMClient.DatabaseOpenStatus code) { + if (RongIMClient.DatabaseOpenStatus.DATABASE_OPEN_ERROR.equals(code)) { + sendMessage(message, pushContent, pushData, callback); + } + + } + }); + } else { + if (callback != null) { + callback.onError(message, errorCode); + } + } + } + }); + } + } diff --git a/config.gradle b/config.gradle index e96013cb5..d00aa4f91 100644 --- a/config.gradle +++ b/config.gradle @@ -22,11 +22,11 @@ ext { // true表示谷歌支付 false // isGooglePlay : false, // true表示谷歌支付 false 0 链接包 1 谷歌包 2华为包 - isGooglePlay : 1, + isGooglePlay : 0, //是否上报异常日志 isUploadLog : true, //是否打包成插件包模式 - isPluginModel : false, + isPluginModel : true, ] } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java index cbb84123a..fc6fcaec2 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -70,6 +70,7 @@ import com.yunbao.common.manager.IMRTCManager; import com.yunbao.common.manager.MicUserManager; import com.yunbao.common.manager.MicedUserManager; import com.yunbao.common.manager.RandomPkManager; +import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.utils.BitmapUtil; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DateFormatUtil; @@ -429,7 +430,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString()); Message message = Message.obtain("g" + mLiveUid, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -1873,7 +1874,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { diff --git a/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java b/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java index 05b04fc0d..4340432d0 100644 --- a/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java @@ -30,6 +30,7 @@ import com.yunbao.common.http.API; import com.yunbao.common.http.ResponseModel; import com.yunbao.common.manager.MicUserManager; import com.yunbao.common.manager.MicedUserManager; +import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.ToastUtil; @@ -181,7 +182,7 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter { Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE; TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(bean.getId(), conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(io.rong.imlib.model.Message message) { diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveMicUserDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveMicUserDialogFragment.java index 0922fa572..d41a0b83c 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveMicUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveMicUserDialogFragment.java @@ -25,6 +25,7 @@ import com.yunbao.common.custom.CommonRefreshView; import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; +import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ToastUtil; @@ -204,7 +205,7 @@ public class LiveMicUserDialogFragment extends AbsDialogFragment implements View TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString()); io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(io.rong.imlib.model.Message message) { @@ -253,7 +254,7 @@ public class LiveMicUserDialogFragment extends AbsDialogFragment implements View TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(io.rong.imlib.model.Message message) { diff --git a/live/src/main/java/com/yunbao/live/dialog/PDLiveMessageListAdapter.java b/live/src/main/java/com/yunbao/live/dialog/PDLiveMessageListAdapter.java index 48ff2a689..3d7251dc8 100644 --- a/live/src/main/java/com/yunbao/live/dialog/PDLiveMessageListAdapter.java +++ b/live/src/main/java/com/yunbao/live/dialog/PDLiveMessageListAdapter.java @@ -14,6 +14,7 @@ import androidx.annotation.NonNull; import com.alibaba.fastjson.JSON; import com.yunbao.common.bean.LiveBean; +import com.yunbao.common.dialog.DebugDialog; import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.message.content.MessageChatTipsContent; import com.yunbao.common.utils.DateFormatUtil; @@ -162,6 +163,15 @@ public class PDLiveMessageListAdapter extends MessageListAdapter { holder.getView(R.id.right_liveStatus).setVisibility(View.GONE); } } + /* if (messageDirection == Message.MessageDirection.RECEIVE) { + holder.setText(R.id.left_time, DateFormatUtil.formatDate(new Date(mDataList.get(position).getSentTime()), "MM-dd hh:mm:ss")); + holder.getView(R.id.left_time).setVisibility(View.VISIBLE); + holder.getView(R.id.right_time).setVisibility(View.INVISIBLE); + } else if (messageDirection == Message.MessageDirection.SEND) { + holder.setText(R.id.right_time, DateFormatUtil.formatDate(new Date(mDataList.get(position).getSentTime()), "MM-dd hh:mm:ss")); + holder.getView(R.id.right_time).setVisibility(View.VISIBLE); + holder.getView(R.id.left_time).setVisibility(View.INVISIBLE); + }*/ } diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java index 60325da49..4c4f563ed 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java @@ -49,6 +49,7 @@ import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMRTCManager; import com.yunbao.common.manager.RandomPkManager; +import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DpUtil; @@ -805,7 +806,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString()); io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain("g" + CommonAppConfig.getInstance().getUid(), conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(io.rong.imlib.model.Message message) { @@ -1068,7 +1069,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString()); io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(io.rong.imlib.model.Message message) { @@ -1343,7 +1344,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString()); io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(io.rong.imlib.model.Message message) { @@ -1439,7 +1440,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString()); io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(io.rong.imlib.model.Message message) { @@ -1543,7 +1544,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString()); io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(io.rong.imlib.model.Message message) { @@ -1585,7 +1586,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString()); io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(io.rong.imlib.model.Message message) { diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java index be8a115f3..9e619c162 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java @@ -13,6 +13,7 @@ import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; @@ -55,7 +56,7 @@ public class SocketRyChatUtil { TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -121,7 +122,7 @@ public class SocketRyChatUtil { TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -192,7 +193,7 @@ public class SocketRyChatUtil { Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM; TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -257,7 +258,7 @@ public class SocketRyChatUtil { TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -396,7 +397,7 @@ public class SocketRyChatUtil { TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -466,7 +467,7 @@ public class SocketRyChatUtil { TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -513,7 +514,7 @@ public class SocketRyChatUtil { TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -550,7 +551,7 @@ public class SocketRyChatUtil { TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -593,7 +594,7 @@ public class SocketRyChatUtil { TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -630,7 +631,7 @@ public class SocketRyChatUtil { TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -670,7 +671,7 @@ public class SocketRyChatUtil { TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -776,7 +777,7 @@ public class SocketRyChatUtil { TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyLinkMicPkUtil.java b/live/src/main/java/com/yunbao/live/socket/SocketRyLinkMicPkUtil.java index a7f947d55..2e392ad05 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyLinkMicPkUtil.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyLinkMicPkUtil.java @@ -7,6 +7,7 @@ import com.yunbao.common.Constants; import com.yunbao.common.bean.UserBean; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; +import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.live.activity.LiveRyAnchorActivity; import io.rong.imlib.IRongCallback; @@ -73,7 +74,7 @@ public class SocketRyLinkMicPkUtil { TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString()); Message message1 = Message.obtain("g" + CommonAppConfig.getInstance().getUid(), conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message1, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message1, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { @@ -136,7 +137,7 @@ public class SocketRyLinkMicPkUtil { TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); Message message = Message.obtain(pkUid, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) { diff --git a/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java index 9b50cfc7f..f849d6d3d 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java @@ -46,6 +46,7 @@ import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMRTCManager; import com.yunbao.common.manager.RandomPkManager; +import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DpUtil; @@ -258,7 +259,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX TextMessage messageContent = TextMessage.obtain(msg1.mResult.toString()); io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(io.rong.imlib.model.Message message) { diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index 9858a4446..206f8deeb 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -29,6 +29,7 @@ import com.blankj.utilcode.util.GsonUtils; import com.lzf.easyfloat.EasyFloat; import com.lzf.easyfloat.permission.PermissionUtils; import com.lzf.easyfloat.utils.LifecycleUtils; +import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; @@ -1005,7 +1006,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(liveID, conversationType, messageContent); - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(io.rong.imlib.model.Message message) { diff --git a/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java b/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java index 380099102..8234d581c 100644 --- a/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/SystemMessageViewHolder.java @@ -59,6 +59,7 @@ import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.interfaces.OnItemLongClickListener; +import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.SpUtil; @@ -589,7 +590,7 @@ public class SystemMessageViewHolder extends AbsViewHolder implements View.OnCli messagesList.remove(position); setDellPosition(position); } - RongIMClient.getInstance().sendMessage(inMessage, null, null, new IRongCallback.ISendMessageCallback() { + RongcloudIMManager.sendMessage(inMessage, null, null, new IRongCallback.ISendMessageCallback() { @Override public void onAttached(Message message) {