Skip to content

Commit e186378

Browse files
committed
fix user receipt issue
1 parent f534148 commit e186378

File tree

4 files changed

+18
-20
lines changed

4 files changed

+18
-20
lines changed

chat/kit/src/main/java/cn/wildfire/chat/kit/conversation/message/viewholder/NormalMessageContentViewHolder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ protected void setSendStatus(Message item) {
289289
return;
290290
}
291291

292-
if (!ChatManager.Instance().isReceiptEnabled() && !ChatManager.Instance().isUserEnableReceipt()) {
292+
if (!ChatManager.Instance().isReceiptEnabled() || !ChatManager.Instance().isUserEnableReceipt()) {
293293
return;
294294
}
295295

chat/kit/src/main/java/cn/wildfire/chat/kit/settings/MessageNotifySettingActivity.java

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package cn.wildfire.chat.kit.settings;
22

3-
import android.widget.CompoundButton;
43
import android.widget.Toast;
54

65
import com.kyleduo.switchbutton.SwitchButton;
@@ -31,7 +30,6 @@ protected void afterViews() {
3130
switchMsgNotification.setChecked(!ChatManager.Instance().isGlobalSilent());
3231
switchShowMsgDetail.setChecked(!ChatManager.Instance().isHiddenNotificationDetail());
3332

34-
3533
switchMsgNotification.setOnCheckedChangeListener((buttonView, isChecked) -> {
3634
ChatManager.Instance().setGlobalSilent(!isChecked, new GeneralCallback() {
3735
@Override
@@ -60,21 +58,17 @@ public void onFail(int errorCode) {
6058
});
6159
});
6260

63-
switchUserReceipt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
61+
switchUserReceipt.setChecked(ChatManager.Instance().isUserEnableReceipt());
62+
switchUserReceipt.setOnCheckedChangeListener((compoundButton, b) -> ChatManager.Instance().setUserEnableReceipt(b, new GeneralCallback() {
6463
@Override
65-
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
66-
ChatManager.Instance().setUserEnableReceipt(b, new GeneralCallback() {
67-
@Override
68-
public void onSuccess() {
69-
70-
}
71-
72-
@Override
73-
public void onFail(int errorCode) {
74-
Toast.makeText(MessageNotifySettingActivity.this, "网络错误", Toast.LENGTH_SHORT);
75-
}
76-
});
64+
public void onSuccess() {
65+
7766
}
78-
});
67+
68+
@Override
69+
public void onFail(int errorCode) {
70+
Toast.makeText(MessageNotifySettingActivity.this, "网络错误", Toast.LENGTH_SHORT);
71+
}
72+
}));
7973
}
8074
}

chat/kit/src/main/res/layout/conversation_item_message_container_send.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
android:layout_gravity="bottom"
7373
android:layout_marginBottom="2dp"
7474
android:scaleType="center"
75+
android:tint="@color/gray"
7576
android:src="@mipmap/receipt"
7677
tools:visibility="visible"
7778
android:visibility="gone" />

client/src/main/java/cn/wildfirechat/remote/ChatManager.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2548,7 +2548,7 @@ public String getGroupMemberDisplayName(String groupId, String memberId) {
25482548
return "<" + memberId + ">";
25492549
}
25502550

2551-
public String getGroupMemberDisplayName(UserInfo userInfo){
2551+
public String getGroupMemberDisplayName(UserInfo userInfo) {
25522552
if (!TextUtils.isEmpty(userInfo.groupAlias)) {
25532553
return userInfo.groupAlias;
25542554
} else if (!TextUtils.isEmpty(userInfo.friendAlias)) {
@@ -4676,7 +4676,7 @@ public boolean isUserEnableReceipt() {
46764676

46774677
try {
46784678
boolean disable = "1".equals(mClient.getUserSetting(UserSettingScope.DisableReceipt, ""));
4679-
userReceiptStatus = disable ? 0 : 1;
4679+
userReceiptStatus = disable ? 0 : 1;
46804680
return !disable;
46814681
} catch (RemoteException e) {
46824682
e.printStackTrace();
@@ -4703,7 +4703,10 @@ public void setUserEnableReceipt(boolean enable, final GeneralCallback callback)
47034703
@Override
47044704
public void onSuccess() throws RemoteException {
47054705
if (callback != null) {
4706-
mainHandler.post(() -> callback.onSuccess());
4706+
mainHandler.post(() -> {
4707+
userReceiptStatus = enable ? 1 : 0;
4708+
callback.onSuccess();
4709+
});
47074710
}
47084711
}
47094712

0 commit comments

Comments
 (0)