消息提醒自定义消息增加跳转私聊处理

This commit is contained in:
huangjian
2021-09-09 18:11:01 +08:00
parent 08f2f84f76
commit be939662b7

View File

@@ -51,7 +51,7 @@ public class NimMiddleActivity extends BaseActivity {
/**
* 用于点击动态通知栏跳转到CommunityNoticeAct
* openCommunity:打开CommunityNoticeAct
*
* <p>
* delayOpenCommunity:控制CommunityNoticeAct打开时机
* 原因部分机型可以直接打开NimMiddleActivity; 可以直接调用MainActivity.openCommunityNotice启动CommunityNoticeAct;
* 部分机型魅蓝Note5(android7.0,Flyme7.3.0.0A)会先打开Splash再打开NimMiddleActivity; 会导致Splash启动MainActivity.onNewIntent;
@@ -69,7 +69,7 @@ public class NimMiddleActivity extends BaseActivity {
Intent intent = getIntent();
if (intent != null) {
try {
Map<String, String> payload= (Map<String, String>) intent.getSerializableExtra(PushMessageHandler.PAYLOAD_DATA);
Map<String, String> payload = (Map<String, String>) intent.getSerializableExtra(PushMessageHandler.PAYLOAD_DATA);
if (intent.hasExtra(NimIntent.EXTRA_NOTIFY_CONTENT)) {
parseNotifyIntent(intent);
} else if (intent.hasExtra(EXTRA_FROM_NOTIFICATION) || intent.hasExtra(INTENT_ACTION_AVCHAT)) {
@@ -79,17 +79,18 @@ public class NimMiddleActivity extends BaseActivity {
} else {
parseNormalIntent(null);
}
if (NIMClient.getService(MixPushService.class).isFCMIntent(intent)){
if (NIMClient.getService(MixPushService.class).isFCMIntent(intent)) {
}
}catch (Exception e){
LogUtils.e("NimMiddleActivity:"+e);
} catch (Exception e) {
LogUtils.e("NimMiddleActivity:" + e);
}
}
}
/**
* 推送通知栏点击
*
* @param intent
*/
private void parseNotifyIntent(Intent intent) {
@@ -101,10 +102,10 @@ public class NimMiddleActivity extends BaseActivity {
ArrayList<IMMessage> messages = (ArrayList<IMMessage>) intent.getSerializableExtra(NimIntent.EXTRA_NOTIFY_CONTENT);
if (messages != null && messages.size() > 0) {
IMMessage imMessage = messages.get(messages.size() - 1);
LogUtils.i( "getMsgType:"+imMessage.getMsgType() );
LogUtils.i("getMsgType:" + imMessage.getMsgType());
if (imMessage.getMsgType() == MsgTypeEnum.custom) {
CustomAttachment attachment = (CustomAttachment) imMessage.getAttachment();
if (attachment != null){
if (attachment != null) {
if (attachment.getFirst() == CustomAttachment.CUSTOM_MSG_HEADER_TYPE_OPEN_ROOM_NOTI) {
OpenRoomNotiAttachment noticeAttachment = (OpenRoomNotiAttachment) attachment;
if (noticeAttachment.getUid() > 0) {
@@ -115,25 +116,27 @@ public class NimMiddleActivity extends BaseActivity {
&& !UIUtils.isTopActivity(this, SignInActivity.class.getSimpleName())) {
SignInActivity.start(this);
}
} else if (attachment.getFirst() == CustomAttachment.CUSTOM_MSG_RED_PACKAGE){
if (attachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ALL_DIAMOND){
} else if (attachment.getFirst() == CustomAttachment.CUSTOM_MSG_RED_PACKAGE) {
if (attachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ALL_DIAMOND) {
RedPackageAttachment redPackageAttachment = (RedPackageAttachment) attachment;
AVRoomActivity.start(this, redPackageAttachment.getRedPackageNotifyInfo().getRoomUid());
}
} else if (attachment.getFirst() == CustomAttachment.CUSTOM_MSG_PUSH_NOTIFIFICATION){
if (attachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_ROOM){
} else if (attachment.getFirst() == CustomAttachment.CUSTOM_MSG_PUSH_NOTIFIFICATION) {
if (attachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_PUSH_NOTIFICATION_IN_ROOM) {
RoomInviteFansAttachment noticeAttachment = (RoomInviteFansAttachment) attachment;
if (noticeAttachment.getRoomInviteFansInfo() == null){
if (noticeAttachment.getRoomInviteFansInfo() == null) {
return;
}
AVRoomActivity.start(this, noticeAttachment.getRoomInviteFansInfo().getData().getData().getRoomUid());
}
} else {
NimP2PMessageActivity.start(this, imMessage.getFromAccount() + "");
}
}
}else if (imMessage.getMsgType() == MsgTypeEnum.notification){
LogUtils.i( "MsgTypeEnum.notification");
}else if (imMessage.getMsgType() == MsgTypeEnum.text){
LogUtils.i( "MsgTypeEnum.text");
} else if (imMessage.getMsgType() == MsgTypeEnum.notification) {
LogUtils.i("MsgTypeEnum.notification");
} else if (imMessage.getMsgType() == MsgTypeEnum.text) {
LogUtils.i("MsgTypeEnum.text");
NimP2PMessageActivity.start(this, imMessage.getFromAccount() + "");
}
}
@@ -157,10 +160,10 @@ public class NimMiddleActivity extends BaseActivity {
skipType = skiptype;
if (AuthModel.get().getCurrentUid() > 0 || !TextUtils.isEmpty(url)) {
if (!firstEnter) {
LogUtils.e("rev pushMessage payload true:"+uid);
switch (skiptype){
LogUtils.e("rev pushMessage payload true:" + uid);
switch (skiptype) {
case PushMessageHandler.PAYLOAD_SKIPTYPE_INVITE_FANS:
AVRoomActivity.start(this,uid);
AVRoomActivity.start(this, uid);
finish();
break;