Skip to content

Commit c568844

Browse files
guangyaoguangyao
authored andcommitted
2 parents cbec584 + c7c0960 commit c568844

File tree

4 files changed

+19
-11
lines changed

4 files changed

+19
-11
lines changed

android/src/main/java/com/netease/im/FileCacheUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public void onGetStatsCompleted(PackageStats pStats, boolean succeeded) throws R
7979
result += pStats.externalCacheSize;
8080
// LogUtil.i(TAG, "result" + ":" + FileUtil.formatFileSize(result));
8181
if (observer != null) {
82-
observer.onGetCacheSize(FileUtil.formatFileSize(result));
82+
observer.onGetCacheSize(Long.toString(result / (1024 * 1024)));
8383
}
8484
}
8585
});

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 && (m.getAttachment() instanceof RedPacketAttachement)) {
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 && (m.getAttachment() instanceof RedPacketOpenAttachement);
158+
}
151159

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

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,14 @@ public static void receiver(NotificationManager manager, CustomNotification cust
118118
String hasRedPacket = dict.getString("hasRedPacket");
119119
String serialNo = dict.getString("serialNo");
120120

121-
String timestamp = data.getString("timestamp");
122-
long t = 0L;
123-
try {
124-
t = Long.parseLong(timestamp);
125-
} catch (NumberFormatException e) {
126-
t = System.currentTimeMillis() / 1000;
127-
e.printStackTrace();
128-
}
121+
// String timestamp = data.getString("timestamp");
122+
long t = customNotification.getTime() / 1000;
123+
// try {
124+
// t = Long.parseLong(timestamp);
125+
// } catch (NumberFormatException e) {
126+
// t = System.currentTimeMillis() / 1000;
127+
// e.printStackTrace();
128+
// }
129129
// LogUtil.i("timestamp","timestamp:"+timestamp);
130130
// LogUtil.i("timestamp","t:"+t);
131131
// LogUtil.i("timestamp",""+data);

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

68.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)