修复 更新问题

修复 删除聊天内容会恢复问题
This commit is contained in:
zlzw 2024-04-08 16:34:14 +08:00
parent ed20df63eb
commit dbebb942e3
3 changed files with 49 additions and 30 deletions

View File

@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
>
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission
android:name="android.permission.CALL_PHONE"
tools:node="remove" />

View File

@ -120,7 +120,20 @@ public class MessageLongClickPopuwindow implements View.OnClickListener {
IMCenter.getInstance().deleteMessages(message.getConversationType(), message.getTargetId(), new int[]{message.getMessageId()}, new RongIMClient.ResultCallback<Boolean>() {
@Override
public void onSuccess(Boolean aBoolean) {
if(aBoolean){
IMCenter.getInstance().deleteRemoteMessages(message.getConversationType(), message.getTargetId(), new Message[]{message}, new RongIMClient.OperationCallback() {
@Override
public void onSuccess() {
}
@Override
public void onError(RongIMClient.ErrorCode errorCode) {
}
});
}
}
@Override

View File

@ -7,8 +7,11 @@ import android.os.Looper;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextWatcher;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@ -34,6 +37,7 @@ import io.rong.imkit.conversation.MessageListAdapter;
import io.rong.imkit.conversation.extension.InputMode;
import io.rong.imkit.conversation.extension.RongExtensionViewModel;
import io.rong.imkit.conversation.extension.component.inputpanel.InputPanel;
import io.rong.imkit.utils.RongUtils;
import io.rong.imkit.widget.refresh.api.RefreshLayout;
import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation;
@ -77,39 +81,41 @@ public class PDLiveConversationFragment extends ConversationFragment {
});
super.onViewCreated(view, savedInstanceState);
view.setBackgroundColor(Color.parseColor("#00000000"));
//TODO 下面片段是尝试修复模拟器emoji无法唤起的bug后续版本解决该问题
//TODO 模拟器聊天框无法切换emoji表情复现步骤 1.点开语音 2.+ 直到弹出插件栏 3.点emoji
/* View emoji = mRongExtension.getInputPanel().getRootView().findViewById(R.id.input_panel_emoji_btn);
emoji.setOnClickListener(click -> {
mRongExtension.getInputPanel().getEditText().clearFocus();
if (mRongExtensionViewModel.getInputModeLiveData().getValue() != null && ((InputMode) mRongExtensionViewModel.getInputModeLiveData().getValue()).equals(InputMode.EmoticonMode)) {
mRongExtension.getInputPanel().getEditText().requestFocus();
mRongExtensionViewModel.getInputModeLiveData().postValue(InputMode.TextInput);
} else {
ToastUtil.showDebug("切换到恶魔及");
mRongExtensionViewModel.getInputModeLiveData().observe(getViewLifecycleOwner(), new Observer<InputMode>() {
RelativeLayout mBoardContainer;
public void onChanged(InputMode inputMode) {
//TODO 以下是修复在雷电模拟器中点表情无法显示bug的代码移除注释即可修复
/*int saveKeyboardHeight = RongUtils.getSaveKeyBoardHeight(getContext(), getContext().getResources().getConfiguration().orientation);
boolean isShow=false;
int lph=-1;
int pix=-1;
try {
Field mBoardContainerField = mRongExtension.getClass().getDeclaredField("mBoardContainer");
mBoardContainerField.setAccessible(true);
View mBoardContainer = (View) mBoardContainerField.get(mRongExtension);
assert mBoardContainer != null;
if (mBoardContainer.getVisibility() == View.VISIBLE) {
mRongExtensionViewModel.getInputModeLiveData().postValue(InputMode.EmoticonMode);
} else {
mRongExtensionViewModel.getInputModeLiveData().postValue(InputMode.PluginMode);
new Handler(Looper.getMainLooper())
.postDelayed(() -> mRongExtensionViewModel.getInputModeLiveData().postValue(InputMode.EmoticonMode), 100L);
}
Field field = mRongExtension.getClass().getDeclaredField("mBoardContainer");
field.setAccessible(true);
mBoardContainer = (RelativeLayout) field.get(mRongExtension);
ViewGroup.LayoutParams layoutParams = mBoardContainer.getLayoutParams();
lph=layoutParams.height;
pix=getContext().getResources().getDimensionPixelSize(io.rong.imkit.R.dimen.rc_extension_board_height);
isShow = saveKeyboardHeight <= 0 && layoutParams.height != getContext().getResources().getDimensionPixelSize(io.rong.imkit.R.dimen.rc_extension_board_height);
layoutParams.height=0;
mBoardContainer.setLayoutParams(layoutParams);
}catch (Exception e){
e.printStackTrace();
}
//EventBus.getDefault().post(new InputPanelViewHolderEvent());
}
});
*/
mRongExtensionViewModel.getInputModeLiveData().observe(getViewLifecycleOwner(), new Observer<InputMode>() {
*//* Log.i("表情", "onChanged: 安全键高度:"+saveKeyboardHeight+" 判断通过:"+isShow+" 布局height = "+lph+" pix = "+pix);
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void onChanged(InputMode inputMode) {
public void run() {
try {
Log.i("表情", "onChanged: "+inputMode+"|"+mBoardContainer.getVisibility()+"|"+mBoardContainer.getHeight());
}catch (Exception e){
e.printStackTrace();
}
}
},300L);*//*
*/
}
});
mRongExtension.getInputPanel().getEditText().setOnClickListener(new View.OnClickListener() {