11111
This commit is contained in:
@@ -112,18 +112,6 @@
|
||||
<meta-data
|
||||
android:name="TencentMapSDK"
|
||||
android:value="${txMapAppKey}" />
|
||||
<!-- <meta-data-->
|
||||
<!-- android:name="TencentMapAppSecret"-->
|
||||
<!-- android:value="${txMapAppSecret}" /> <!– 腾讯bugly –>-->
|
||||
<!-- <meta-data-->
|
||||
<!-- android:name="BUGLY_APPID"-->
|
||||
<!-- android:value="${buglyAppId}" />-->
|
||||
<!-- <meta-data-->
|
||||
<!-- android:name="BUGLY_APP_CHANNEL"-->
|
||||
<!-- android:value="com.chihu.phonelive" />-->
|
||||
<!-- <meta-data-->
|
||||
<!-- android:name="BUGLY_ENABLE_DEBUG"-->
|
||||
<!-- android:value="true" /> <!– 腾讯bugly end –>-->
|
||||
<!-- 百度语音识别 -->
|
||||
<meta-data
|
||||
android:name="com.baidu.speech.APP_ID"
|
||||
@@ -135,16 +123,6 @@
|
||||
android:name="com.baidu.speech.SECRET_KEY"
|
||||
android:value="${baiduAppSecretKey}" />
|
||||
|
||||
<!-- <service-->
|
||||
<!-- android:name="com.baidu.speech.VoiceRecognitionService"-->
|
||||
<!-- android:exported="false" /> <!– 百度语音识别end –>-->
|
||||
<!-- 友盟统计 -->
|
||||
<!-- <meta-data-->
|
||||
<!-- android:name="UMENG_APPKEY"-->
|
||||
<!-- android:value="${umengAppKey}" />-->
|
||||
<!-- <meta-data-->
|
||||
<!-- android:name="UMENG_CHANNEL"-->
|
||||
<!-- android:value="com.chihu.phonelive" /> <!– 友盟统计 end –>-->
|
||||
<!-- 服务器地址 -->
|
||||
<meta-data
|
||||
android:name="SERVER_HOST"
|
||||
|
||||
@@ -26,20 +26,15 @@ 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.RongcloudIMManager;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.live.socket.SocketRyClient;
|
||||
import com.yunbao.live.utils.LiveImDeletUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.message.TextMessage;
|
||||
|
||||
import static com.adjust.sdk.AdjustConfig.ENVIRONMENT_PRODUCTION;
|
||||
import static com.yunbao.live.socket.SocketClient.mSocketHandler;
|
||||
|
||||
//import cn.tillusory.sdk.TiSDK;
|
||||
@@ -151,85 +146,12 @@ public class AppContext extends CommonAppContext {
|
||||
//初始化 AndroidUtilCode
|
||||
Utils.init(this);
|
||||
liveImDeletUtil = new LiveImDeletUtil();
|
||||
// 融云
|
||||
RongIMClient.getInstance().setOnReceiveMessageListener(new RongIMClient.OnReceiveMessageWrapperListener() {
|
||||
/**
|
||||
* 接收实时或者离线消息。
|
||||
* 注意:
|
||||
* 1. 针对接收离线消息时,服务端会将 200 条消息打成一个包发到客户端,客户端对这包数据进行解析。
|
||||
* 2. hasPackage 标识是否还有剩余的消息包,left 标识这包消息解析完逐条抛送给 App 层后,剩余多少条。
|
||||
* 如何判断离线消息收完:
|
||||
* 1. hasPackage 和 left 都为 0;
|
||||
* 2. hasPackage 为 0 标识当前正在接收最后一包(200条)消息,left 为 0 标识最后一包的最后一条消息也已接收完毕。
|
||||
*
|
||||
* @param message 接收到的消息对象
|
||||
* @param left 每个数据包数据逐条上抛后,还剩余的条数
|
||||
* @param hasPackage 是否在服务端还存在未下发的消息包
|
||||
* @param offline 消息是否离线消息
|
||||
* @return 是否处理消息。 如果 App 处理了此消息,返回 true; 否则返回 false 由 SDK 处理。
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean onReceived(io.rong.imlib.model.Message message, int left, boolean hasPackage, boolean offline) {
|
||||
Log.e("rytest", message.getContent() + "");
|
||||
if (message.getConversationType() == Conversation.ConversationType.CHATROOM) {
|
||||
//群聊
|
||||
Message msg = Message.obtain();
|
||||
msg.what = Constants.SOCKET_WHAT_BROADCAST;
|
||||
if (!"".equals(message.getContent()) && message.getContent() != null) {
|
||||
if (message.getObjectName().equals("RC:TxtMsg")) {
|
||||
TextMessage content = (TextMessage) message.getContent();
|
||||
msg.obj = content.getContent();
|
||||
if (SocketRyClient.mSocketHandler != null && Ingroup == 1) {
|
||||
SocketRyClient.mSocketHandler.sendMessage(msg);
|
||||
}
|
||||
TextMessage rongMsg = (TextMessage) message.getContent();
|
||||
String firstIndexRM = "";
|
||||
if (rongMsg.getContent().length() > 4) {
|
||||
firstIndexRM = rongMsg.getContent().substring(0, 5);
|
||||
}
|
||||
String firstIndexRM2 = "";
|
||||
if (rongMsg.getContent().length() > 9) {
|
||||
firstIndexRM2 = rongMsg.getContent().substring(0, 10);
|
||||
}
|
||||
if ("{\"msg".equals(firstIndexRM) || "{\"retcode\"".equals(firstIndexRM2)) {
|
||||
liveImDeletUtil.deleteMessages(message.getTargetId(), message.getMessageId());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
//私聊
|
||||
Message msg = Message.obtain();
|
||||
msg.what = Constants.SOCKET_WHAT_BROADCAST;
|
||||
if (!"".equals(message.getContent()) && message.getContent() != null) {
|
||||
if (message.getObjectName().equals("RC:TxtMsg")) {
|
||||
TextMessage content = (TextMessage) message.getContent();
|
||||
msg.obj = content.getContent();
|
||||
if (content.getContent().contains("_method_")) {
|
||||
if (SocketRyClient.mSocketHandler != null) {
|
||||
CommonAppContext.Ingroup = 1;
|
||||
SocketRyClient.mSocketHandler.sendMessage(msg);
|
||||
}
|
||||
}
|
||||
TextMessage rongMsg = (TextMessage) message.getContent();
|
||||
String firstIndexRM = "";
|
||||
if (rongMsg.getContent().length() > 4) {
|
||||
firstIndexRM = rongMsg.getContent().substring(0, 5);
|
||||
}
|
||||
String firstIndexRM2 = "";
|
||||
if (rongMsg.getContent().length() > 9) {
|
||||
firstIndexRM2 = rongMsg.getContent().substring(0, 10);
|
||||
}
|
||||
if ("{\"msg".equals(firstIndexRM) || "{\"retcode\"".equals(firstIndexRM2)) {
|
||||
liveImDeletUtil.deleteMessages(message.getTargetId(), message.getMessageId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
//
|
||||
RongcloudIMManager.addRongcloudIMOnReceiveMessageListener();
|
||||
//初始化融云
|
||||
RongcloudIMManager.initRongIM(this);
|
||||
//添加融云连接状态监听
|
||||
RongcloudIMManager.setIMStatusListener();
|
||||
|
||||
|
||||
});
|
||||
@@ -275,4 +197,9 @@ public class AppContext extends CommonAppContext {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTerminate() {
|
||||
RongcloudIMManager.removeRongcloudIMOnReceiveMessageListener();
|
||||
super.onTerminate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,10 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
@@ -32,12 +34,15 @@ import com.tencent.ugc.TXUGCBase;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.bean.AdBean;
|
||||
import com.yunbao.common.bean.ConfigBean;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.custom.CircleProgress;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.CommonHttpConsts;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||
import com.yunbao.common.utils.DownloadUtil;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.MD5Util;
|
||||
@@ -94,10 +99,6 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setStatusBar();
|
||||
// if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) {
|
||||
// finish();
|
||||
// return;
|
||||
// }
|
||||
setContentView(R.layout.activity_launcher);
|
||||
//开屏
|
||||
AdjustEvent adjustEvent = new AdjustEvent("vjqk8g");
|
||||
@@ -230,20 +231,11 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
|
||||
mHandler.removeCallbacksAndMessages(null);
|
||||
mHandler = null;
|
||||
}
|
||||
String[] uidAndToken = SpUtil.getInstance().getMultiStringValue(
|
||||
new String[]{SpUtil.UID, SpUtil.TOKEN});
|
||||
final String uid = uidAndToken[0];
|
||||
final String token = uidAndToken[1];
|
||||
if (!TextUtils.isEmpty(uid) && !TextUtils.isEmpty(token)) {
|
||||
MainHttpUtil.getBaseInfo(uid, token, new CommonCallback<UserBean>() {
|
||||
@Override
|
||||
public void callback(UserBean bean) {
|
||||
if (bean != null) {
|
||||
CommonAppConfig.getInstance().setLoginInfo(uid, token, false);
|
||||
forwardMainActivity();
|
||||
}
|
||||
}
|
||||
});
|
||||
IMLoginModel model = IMLoginManager.get(this).getUserInfo();
|
||||
if (model != null) {
|
||||
//融云连接服务器
|
||||
RongcloudIMManager.connectIM(this);
|
||||
forwardMainActivity();
|
||||
} else {
|
||||
releaseVideo();
|
||||
this.startActivity(new Intent(this, EntryActivity.class));
|
||||
@@ -258,7 +250,6 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
|
||||
private void forwardMainActivity() {
|
||||
releaseVideo();
|
||||
MainActivity.forward(mContext);
|
||||
// this.startActivity(new Intent(this, TestActivity.class));
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user