Skip to content

Commit 94aebbd

Browse files
committed
红包提示音
红包提示音
1 parent 2ebc270 commit 94aebbd

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

android/src/main/java/com/netease/im/session/SessionService.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,12 @@ public void onIncomingMessage(@NonNull List<IMMessage> messages) {
138138
if (r.size() > 0) {
139139
IMMessage m = messages.get(0);
140140
if (!this.mute && m.getDirect() == MsgDirectionEnum.In) {
141-
if(!(m.getMsgType() == MsgTypeEnum.notification||m.getMsgType() == MsgTypeEnum.tip)){
142-
AudioPlayService.getInstance().playAudio(handler, ReactCache.getReactContext(), AudioManager.STREAM_RING, "raw", "msg");
141+
if (showMsg(m)) {
142+
if (m.getAttachment() != null && ((CustomAttachment) m.getAttachment()).getType() == CustomAttachmentType.RedPacket) {
143+
AudioPlayService.getInstance().playAudio(handler, ReactCache.getReactContext(), AudioManager.STREAM_RING, "raw", "rp");
144+
} else {
145+
AudioPlayService.getInstance().playAudio(handler, ReactCache.getReactContext(), AudioManager.STREAM_RING, "raw", "msg");
146+
}
143147
}
144148

145149
}
@@ -148,6 +152,10 @@ public void onIncomingMessage(@NonNull List<IMMessage> messages) {
148152

149153
}
150154

155+
boolean showMsg(IMMessage m) {
156+
return !(m.getMsgType() == MsgTypeEnum.notification || m.getMsgType() == MsgTypeEnum.tip
157+
|| (m.getAttachment() != null && ((CustomAttachment) m.getAttachment()).getType() == CustomAttachmentType.RedPacketOpen));
158+
}
151159

152160
public boolean isMyMessage(IMMessage message) {
153161
return message.getSessionType() == sessionTypeEnum

android/src/main/res/raw/rp.wav

68.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)