diff --git a/CHANGELOG.md b/CHANGELOG.md index a41fcf3..6b0f975 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ Change Log ========== +Version 4.0.12、4.0.13 *(2024-06-13)* +---------------------------- +- 修复 从排队创建的对话,不会弹出评价弹出的问题 +- 优化 判断对话的分配以及排队状态 + Version 4.0.10、4.0.11 *(2024-05-09)* ---------------------------- - 新增 根据工作台配置,动态显示发图入口 diff --git a/README.md b/README.md index c00e4bb..1085871 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ ### AndroidStudio [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.meiqia/androidx/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.meiqia/androidx) ``` -implementation 'com.meiqia:androidx:4.0.11' +implementation 'com.meiqia:androidx:4.0.13' implementation 'com.github.bumptech.glide:glide:4.9.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0' ``` diff --git a/demo/build.gradle b/demo/build.gradle index e33e6a5..ab38a9c 100644 --- a/demo/build.gradle +++ b/demo/build.gradle @@ -39,7 +39,7 @@ dependencies { implementation 'androidx.constraintlayout:constraintlayout:2.1.4' // implementation project(path: ':meiqiasdk') - implementation 'com.meiqia:androidx:4.0.11' + implementation 'com.meiqia:androidx:4.0.13' implementation 'com.github.bumptech.glide:glide:4.9.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0' } \ No newline at end of file diff --git a/meiqiasdk/libs/meiqia-4.0.11.jar b/meiqiasdk/libs/meiqia-4.0.11.jar deleted file mode 100644 index 970d874..0000000 Binary files a/meiqiasdk/libs/meiqia-4.0.11.jar and /dev/null differ diff --git a/meiqiasdk/libs/meiqia-4.0.13.jar b/meiqiasdk/libs/meiqia-4.0.13.jar new file mode 100644 index 0000000..b94f680 Binary files /dev/null and b/meiqiasdk/libs/meiqia-4.0.13.jar differ diff --git a/meiqiasdk/src/main/java/com/meiqia/meiqiasdk/activity/MQConversationActivity.java b/meiqiasdk/src/main/java/com/meiqia/meiqiasdk/activity/MQConversationActivity.java index b12e816..bacd658 100644 --- a/meiqiasdk/src/main/java/com/meiqia/meiqiasdk/activity/MQConversationActivity.java +++ b/meiqiasdk/src/main/java/com/meiqia/meiqiasdk/activity/MQConversationActivity.java @@ -23,6 +23,7 @@ import android.provider.MediaStore; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.annotation.StringRes; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; @@ -57,6 +58,7 @@ import com.meiqia.core.bean.MQAgent; import com.meiqia.core.bean.MQMessage; import com.meiqia.core.callback.OnClientPositionInQueueCallback; +import com.meiqia.core.callback.OnGetActiveConvCallback; import com.meiqia.core.callback.OnGetMessageListCallback; import com.meiqia.core.callback.SuccessCallback; import com.meiqia.meiqiasdk.R; @@ -251,6 +253,29 @@ protected void onCreate(final Bundle savedInstanceState) { MQConfig.getActivityLifecycleCallback().onActivityCreated(this, savedInstanceState); + MQManager.getInstance(getApplicationContext()).getActiveConv(new OnGetActiveConvCallback() { + @Override + public void onSuccess(boolean isConvActive, boolean queueing, int position) { + if (queueing) { + getMessageDataFromDatabaseAndLoad(() -> changeToQueueingState()); + } else { + refreshConfig(isConvActive); + } + } + + @Override + public void onFailure(int code, String message) { + refreshConfig(false); + } + }); + } + + private void refreshConfig(boolean isConvActive) { + // 已经分配了对话的情况下,不再显示询前表单 + if (isConvActive) { + applyAfterRefreshConfig(); + return; + } // 刷新配置,然后决定是否跳转到询前表单或者其它界面 mController.refreshEnterpriseConfig(new SimpleCallback() { @Override @@ -1176,7 +1201,7 @@ public void run() { } // 如果没有加载数据,则加载数据 if (!mHasLoadData) { - getMessageDataFromDatabaseAndLoad(); + getMessageDataFromDatabaseAndLoad(null); } if (ErrorCode.NO_AGENT_ONLINE == code) { // 发送待发送的消息 @@ -1269,12 +1294,12 @@ public void onFinish() { MQManager.getInstance(MQConversationActivity.this).getUnreadMessages(new OnGetMessageListCallback() { @Override public void onSuccess(List messageList) { - getMessageDataFromDatabaseAndLoad(); + getMessageDataFromDatabaseAndLoad(null); } @Override public void onFailure(int code, String message) { - getMessageDataFromDatabaseAndLoad(); + getMessageDataFromDatabaseAndLoad(null); } }); } @@ -1284,7 +1309,7 @@ public void onFailure(int code, String message) { /** * 从数据库获取消息并加载 */ - private void getMessageDataFromDatabaseAndLoad() { + private void getMessageDataFromDatabaseAndLoad(@Nullable OnFinishCallback onFinishCallback) { // 从数据库获取数据 mController.getMessagesFromDatabase(System.currentTimeMillis(), MESSAGE_PAGE_COUNT, new OnGetMessageListCallBack() { @@ -1297,10 +1322,16 @@ public void onSuccess(List messageList) { } mChatMessageList.addAll(messageList); loadData(); + if (onFinishCallback != null) { + onFinishCallback.onFinish(); + } } @Override public void onFailure(int code, String responseString) { + if (onFinishCallback != null) { + onFinishCallback.onFinish(); + } } }); } @@ -2339,8 +2370,7 @@ public void onFailure(BaseMessage failureMessage, int code, String failureInfo) addBlacklistTip(R.string.mq_blacklist_tips); } else if (code == ErrorCode.QUEUEING) { changeToQueueingState(); - } - if (code == ErrorCode.NO_AGENT_ONLINE) { + } else if (code == ErrorCode.NO_AGENT_ONLINE) { // 关闭留言功能的情况下,直接跳转到留言界面:如果当前客服是机器人就例外 if (isEnableGoToMessageFormActivity()) { Intent intent = new Intent(MQConversationActivity.this, MQMessageFormActivity.class); @@ -2350,6 +2380,8 @@ public void onFailure(BaseMessage failureMessage, int code, String failureInfo) } else { addLeaveMessageTip(); } + } else { + Toast.makeText(MQConversationActivity.this, "code = " + code + "\n" + "message = " + message, Toast.LENGTH_SHORT).show(); } mChatMsgAdapter.notifyDataSetChanged(); } @@ -2895,6 +2927,7 @@ public void removeQueue() { @Override public void queueingInitConv(long convId) { mConversationId = String.valueOf(convId); + mMessageReceiver.setConversationId(mConversationId); removeQueue(); setCurrentAgent(mController.getCurrentAgent()); sendDelayMessages(); diff --git a/meiqiasdk/src/main/java/com/meiqia/meiqiasdk/controller/MessageReceiver.java b/meiqiasdk/src/main/java/com/meiqia/meiqiasdk/controller/MessageReceiver.java index 2a4672c..e85b997 100644 --- a/meiqiasdk/src/main/java/com/meiqia/meiqiasdk/controller/MessageReceiver.java +++ b/meiqiasdk/src/main/java/com/meiqia/meiqiasdk/controller/MessageReceiver.java @@ -82,7 +82,7 @@ else if (MQMessageManager.ACTION_AGENT_CHANGE_EVENT.equals(action)) { } } else if (MQMessageManager.ACTION_INVITE_EVALUATION.equals(action)) { String conversationId = intent.getStringExtra("conversation_id"); - if (conversationId.equals(mConversationId)) { + if (TextUtils.equals(conversationId, mConversationId)) { inviteEvaluation(); } } else if (MQMessageManager.ACTION_AGENT_STATUS_UPDATE_EVENT.equals(action)) { @@ -135,11 +135,11 @@ else if (MQMessageManager.ACTION_AGENT_CHANGE_EVENT.equals(action)) { public abstract void socketReconnect(); - protected void noAgentStatus(){ + protected void noAgentStatus() { } - protected void queueingState(){ + protected void queueingState() { } }