Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/wildfirechat/android-chat:
  fix build error
  update proto
  添加按时间点清除消息的接口
  • Loading branch information
siqiii committed Dec 16, 2019
2 parents c6637ff + 2dcfd83 commit 0731e29
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 4 deletions.
4 changes: 2 additions & 2 deletions chat/src/main/java/cn/wildfire/chat/app/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ public interface Config {
// 仅仅是host,没有http开头,不可配置为127.0.0.1 或者 192.168.0.1
// host可以是IP,可以是域名,如果是域名的话只支持主域名或www域名,二级域名不支持!
// 例如:example.com或www.example.com是支持的;xx.example.com或xx.yy.example.com是不支持的。
String IM_SERVER_HOST = "wildfirechat.cn";
String IM_SERVER_HOST = "192.168.31.113";

//客户端强制使用80端口,不能使用其它端口。需要确保服务器运行在在国内时处于备案状态,确保运营IM服务处在监管之下。
//int IM_SERVER_PORT = 80;

//正式商用时,建议用https,确保token安全
String APP_SERVER_ADDRESS = "http://wildfirechat.cn:8888";
String APP_SERVER_ADDRESS = "http://192.168.31.113:9888";

String ICE_ADDRESS = "turn:turn.wildfirechat.cn:3478";
String ICE_USERNAME = "wfchat";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.util.Log;
import android.widget.Toast;

import butterknife.BindView;
Expand All @@ -16,6 +17,11 @@
import cn.wildfire.chat.kit.settings.PrivacySettingActivity;
import cn.wildfire.chat.kit.widget.OptionItemView;
import cn.wildfirechat.chat.R;
import cn.wildfirechat.message.MessageContent;
import cn.wildfirechat.message.TextMessageContent;
import cn.wildfirechat.message.core.MessageStatus;
import cn.wildfirechat.model.Conversation;
import cn.wildfirechat.remote.ChatManager;

public class SettingActivity extends WfcBaseActivity {
@BindView(R.id.diagnoseOptionItemView)
Expand Down Expand Up @@ -66,7 +72,26 @@ public void onUiFailure(int code, String msg) {

@OnClick(R.id.aboutOptionItemView)
void about() {
Intent intent = new Intent(this, AboutActivity.class);
startActivity(intent);
// Intent intent = new Intent(this, AboutActivity.class);
// startActivity(intent);
String groupId = "q4Yuru44";
new Thread(new Runnable() {
@Override
public void run() {
Conversation conversation = new Conversation(Conversation.ConversationType.Group, groupId, 0);
String sender = ChatManager.Instance().getUserId();
for (int i = 0; i < 300; i++) {
ChatManager.Instance().begainTransaction();
Log.d("jyj", "start insert " + i);
for (int j = 0; j < 1000; j++) {
String text = "hello " + (i * 300 + j);
MessageContent content = new TextMessageContent(text);
ChatManager.Instance().insertMessage(conversation, sender, content, MessageStatus.Unread, false, System.currentTimeMillis());
}
ChatManager.Instance().commitTransaction();
}

}
}).start();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ interface IRemoteClient {
oneway void clearUnreadStatusEx(in int[] conversationTypes, in int[] lines);
oneway void clearAllUnreadStatus();
oneway void clearMessages(in int conversationType, in String target, in int line);
oneway void clearMessagesEx(in int conversationType, in String target, in int line, in long before);
oneway void setMediaMessagePlayed(in long messageId);
oneway void removeConversation(in int conversationType, in String target, in int line, in boolean clearMsg);
oneway void setConversationTop(in int conversationType, in String target, in int line, in boolean top);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,11 @@ public void clearMessages(int conversationType, String target, int line) throws
ProtoLogic.clearMessages(conversationType, target, line);
}

@Override
public void clearMessagesEx(int conversationType, String target, int line, long before) throws RemoteException {
ProtoLogic.clearMessagesEx(conversationType, target, line, before);
}

@Override
public void setMediaMessagePlayed(long messageId) {
try {
Expand Down
24 changes: 24 additions & 0 deletions client/src/main/java/cn/wildfirechat/remote/ChatManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1824,6 +1824,30 @@ public void clearMessages(Conversation conversation) {
}
}

public void clearMessages(Conversation conversation, long beforeTime) {
if (!checkRemoteService()) {
return;
}

try {
int convType = 0;
String target = "";
int line = 0;
if (conversation != null) {
convType = conversation.type.getValue();
target = conversation.target;
line = conversation.line;
}
mClient.clearMessagesEx(convType, target, line, beforeTime);

for (OnClearMessageListener listener : clearMessageListeners) {
listener.onClearMessage(conversation);
}
} catch (RemoteException e) {
e.printStackTrace();
}
}

/**
* 删除会话
*
Expand Down

0 comments on commit 0731e29

Please sign in to comment.