Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
796f67fe
Commit
796f67fe
authored
Jan 25, 2021
by
霍志良
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/4.1.66' into 4.1.66
parents
b9863cc1
4eea9523
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
7 deletions
+95
-7
ServiceBean.kt
m-im/src/main/java/com/yidianling/im/bean/ServiceBean.kt
+18
-0
SessionHelper.java
m-im/src/main/java/com/yidianling/im/session/SessionHelper.java
+1
-1
YDLBaseMessageActivity.java
m-im/src/main/java/com/yidianling/uikit/business/session/activity/YDLBaseMessageActivity.java
+1
-1
YDLP2PMessageActivity.java
m-im/src/main/java/com/yidianling/uikit/business/session/activity/YDLP2PMessageActivity.java
+75
-5
No files found.
m-im/src/main/java/com/yidianling/im/bean/ServiceBean.kt
0 → 100644
View file @
796f67fe
package
com.yidianling.im.bean
/**
* Created by Ykai on 2021/1/25.
*
* 转接客服bean
*/
data class
ServiceBean
(
var
data
:
DataBean
?,
var
business
:
String
=
""
)
data class
DataBean
(
var
toUid
:
Long
,
var
fromUid
:
Long
,
var
name
:
String
?,
var
chatType
:
String
?
)
\ No newline at end of file
m-im/src/main/java/com/yidianling/im/session/SessionHelper.java
View file @
796f67fe
...
...
@@ -237,7 +237,7 @@ public class SessionHelper {
//====================Get Customization====================
p
rivate
static
SessionCustomization
getP2pCustomization
(
int
user_type
)
{
p
ublic
static
SessionCustomization
getP2pCustomization
(
int
user_type
)
{
if
(
last_user_type
!=
user_type
)
{
last_user_type
=
user_type
;
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/activity/YDLBaseMessageActivity.java
View file @
796f67fe
...
...
@@ -111,7 +111,7 @@ public abstract class YDLBaseMessageActivity extends UI {
@SuppressLint
(
"CheckResult"
)
public
void
setToolBar
(
int
toolBarId
)
{
tb
=
(
TitleBarBottom
)
findViewById
(
toolBarId
);
tb
=
findViewById
(
toolBarId
);
if
(
ActionHandlerStorage
.
getL
(
sessionId
)
!=
null
&&
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
()
!=
null
)
{
tb
.
setTitle
(
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
().
name
);
}
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/activity/YDLP2PMessageActivity.java
View file @
796f67fe
...
...
@@ -4,10 +4,12 @@ import android.content.Context;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.util.DisplayMetrics
;
import
android.view.View
;
import
android.view.WindowManager
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.gson.Gson
;
import
com.netease.nimlib.sdk.NIMClient
;
import
com.netease.nimlib.sdk.Observer
;
import
com.netease.nimlib.sdk.msg.MsgService
;
...
...
@@ -17,6 +19,12 @@ import com.netease.nimlib.sdk.msg.model.CustomNotification;
import
com.netease.nimlib.sdk.msg.model.IMMessage
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.im.R
;
import
com.yidianling.im.api.bean.IMRegisterObserverCustomNotificationCallBack
;
import
com.yidianling.im.bean.ServiceBean
;
import
com.yidianling.im.bridge.P2PCustomActionHandlerImpl
;
import
com.yidianling.im.config.constants.ImConstants
;
import
com.yidianling.im.helper.ImObserversHelper
;
import
com.yidianling.im.session.SessionHelper
;
import
com.yidianling.nimbase.api.model.session.SessionCustomization
;
import
com.yidianling.nimbase.api.model.user.UserInfoObserver
;
import
com.yidianling.nimbase.business.session.constant.Extras
;
...
...
@@ -27,6 +35,8 @@ import com.yidianling.uikit.business.session.fragment.YDLMessageFragment;
import
com.yidianling.uikit.custom.bridge.ActionHandlerStorage
;
import
com.yidianling.uikit.custom.bridge.IP2PCustomActionHandler
;
import
org.jetbrains.annotations.NotNull
;
import
java.util.List
;
...
...
@@ -41,6 +51,7 @@ public class YDLP2PMessageActivity extends YDLBaseMessageActivity {
private
int
screenWidth
;
private
int
screenHeight
;
protected
YDLMessageFragment
messageFragment
;
private
boolean
isChangeDoctor
=
false
;
/**
* @param context
...
...
@@ -54,11 +65,33 @@ public class YDLP2PMessageActivity extends YDLBaseMessageActivity {
intent
.
putExtra
(
Extras
.
EXTRA_ACCOUNT
,
contactId
);
intent
.
putExtra
(
Extras
.
EXTRA_CUSTOMIZATION
,
customization
);
if
(
ActionHandlerStorage
.
getL
(
contactId
)
!=
null
)
{
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
|
Intent
.
FLAG_ACTIVITY_SINGLE_TOP
);
if
(
ActionHandlerStorage
.
getL
(
contactId
)
!=
null
)
{
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
|
Intent
.
FLAG_ACTIVITY_SINGLE_TOP
);
}
else
if
(
contactId
.
equals
(
ImConstants
.
KEFUXIAOYI
))
{
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
|
Intent
.
FLAG_ACTIVITY_SINGLE_TOP
);
}
ActionHandlerStorage
.
setL
(
contactId
,
l
);
ActionHandlerStorage
.
setL
(
contactId
,
l
);
if
(
anchor
!=
null
)
{
intent
.
putExtra
(
Extras
.
EXTRA_ANCHOR
,
anchor
);
}
intent
.
setClass
(
context
,
YDLP2PMessageActivity
.
class
);
context
.
startActivity
(
intent
);
}
/**
* 切换到客服界面
*
*/
public
static
void
startChangeDoctor
(
Context
context
,
String
contactId
,
SessionCustomization
customization
,
IMMessage
anchor
,
IP2PCustomActionHandler
l
){
Intent
intent
=
new
Intent
();
intent
.
putExtra
(
Extras
.
EXTRA_ACCOUNT
,
contactId
);
intent
.
putExtra
(
Extras
.
EXTRA_CUSTOMIZATION
,
customization
);
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
|
Intent
.
FLAG_ACTIVITY_SINGLE_TOP
);
ActionHandlerStorage
.
setL
(
contactId
,
l
);
if
(
anchor
!=
null
)
{
intent
.
putExtra
(
Extras
.
EXTRA_ANCHOR
,
anchor
);
...
...
@@ -67,6 +100,15 @@ public class YDLP2PMessageActivity extends YDLBaseMessageActivity {
context
.
startActivity
(
intent
);
}
@Override
protected
void
onNewIntent
(
Intent
intent
)
{
super
.
onNewIntent
(
intent
);
// 如果isChangeDoctor为true表示切换客服
if
(
isChangeDoctor
)
{
messageFragment
=
(
YDLMessageFragment
)
switchContent
(
switchServiceFragment
(
intent
));
isChangeDoctor
=
false
;
}
}
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
@@ -85,6 +127,20 @@ public class YDLP2PMessageActivity extends YDLBaseMessageActivity {
registerObservers
(
true
);
NIMClient
.
getService
(
MsgService
.
class
).
clearUnreadCount
(
sessionId
,
SessionTypeEnum
.
P2P
);
// 转客服通知监听
ImObserversHelper
.
Companion
.
getInstance
().
setImCustomNotificationCallBack
(
new
IMRegisterObserverCustomNotificationCallBack
()
{
@Override
public
void
onObserverCustomNotification
(
@NotNull
String
fromUid
,
@NotNull
String
toUid
,
@NotNull
String
content
)
{
ServiceBean
serviceBean
=
new
Gson
().
fromJson
(
content
,
ServiceBean
.
class
);
// 切换到客服
if
(
serviceBean
!=
null
&&
serviceBean
.
getData
()
!=
null
&&
serviceBean
.
getBusiness
().
equals
(
"change_doctor"
))
{
isChangeDoctor
=
true
;
String
serviceUid
=
String
.
valueOf
(
serviceBean
.
getData
().
getToUid
());
tb
.
setTitle
(
serviceBean
.
getData
().
getName
());
YDLP2PMessageActivity
.
startChangeDoctor
(
YDLP2PMessageActivity
.
this
,
serviceUid
,
SessionHelper
.
getP2pCustomization
(-
1
),
null
,
new
P2PCustomActionHandlerImpl
(
serviceUid
,
serviceBean
.
getData
().
getName
(),
serviceUid
));
}
}
});
}
@Override
...
...
@@ -110,7 +166,7 @@ public class YDLP2PMessageActivity extends YDLBaseMessageActivity {
messageFragment
.
getInputPanel
().
setInputContent
(
ActionHandlerStorage
.
getL
(
sessionId
).
getImTempData
(
sessionId
));
}
if
(
ActionHandlerStorage
.
needLoadNewMsg
)
{
((
BaseFetchLoadAdapter
.
RequestFetchMoreListener
)
messageFragment
.
getMessageListPanelEx
().
getMessageLoder
(
null
)).
onFetchMoreRequested
();
((
BaseFetchLoadAdapter
.
RequestFetchMoreListener
)
messageFragment
.
getMessageListPanelEx
().
getMessageLoder
(
null
)).
onFetchMoreRequested
();
ActionHandlerStorage
.
needLoadNewMsg
=
false
;
}
}
...
...
@@ -183,7 +239,7 @@ public class YDLP2PMessageActivity extends YDLBaseMessageActivity {
protected
YDLMessageFragment
fragment
()
{
Bundle
arguments
=
getIntent
().
getExtras
();
arguments
.
putSerializable
(
Extras
.
EXTRA_TYPE
,
SessionTypeEnum
.
P2P
);
if
(
messageFragment
==
null
)
{
if
(
messageFragment
==
null
)
{
messageFragment
=
new
YDLMessageFragment
();
messageFragment
.
setArguments
(
arguments
);
messageFragment
.
setContainerId
(
R
.
id
.
message_fragment_container
);
...
...
@@ -191,6 +247,20 @@ public class YDLP2PMessageActivity extends YDLBaseMessageActivity {
return
messageFragment
;
}
/**
* 切换到客服fragment
*
* @return
*/
private
YDLMessageFragment
switchServiceFragment
(
Intent
intent
)
{
Bundle
arguments
=
intent
.
getExtras
();
arguments
.
putSerializable
(
Extras
.
EXTRA_TYPE
,
SessionTypeEnum
.
P2P
);
messageFragment
=
new
YDLMessageFragment
();
messageFragment
.
setArguments
(
arguments
);
messageFragment
.
setContainerId
(
R
.
id
.
message_fragment_container
);
return
messageFragment
;
}
@Override
protected
int
getContentViewId
()
{
return
R
.
layout
.
im_ydl_nim_message_activity
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment