Skip to content

Commit bf5759f

Browse files
committed
消息划掉后标记已读(依赖Auto/假Auto)
1 parent 8f271dc commit bf5759f

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/main/java/com/oasisfeng/nevo/decorators/wechat/MessagingBuilder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ public static int guessType(String key) {
157157
return messaging;
158158
}
159159

160+
/**
161+
* 从车载扩展信息重建会话
162+
*/
160163
@Nullable MessagingStyle buildFromExtender(final Conversation conversation, final int id, final Notification n, final CharSequence title, final List<Notification> archive) {
161164
final Notification.CarExtender extender = new Notification.CarExtender(n);
162165
final CarExtender.UnreadConversation convs = extender.getUnreadConversation();

src/main/java/com/oasisfeng/nevo/decorators/wechat/WeChatDecorator.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import android.app.Notification;
2020
import android.app.NotificationChannel;
2121
import android.app.NotificationManager;
22+
import android.app.PendingIntent;
2223
import android.content.BroadcastReceiver;
2324
import android.content.Context;
2425
import android.content.Intent;
@@ -287,7 +288,16 @@ protected void afterHookedMethod(MethodHookParam param) {
287288
if (BuildConfig.DEBUG) Log.d(TAG, "apply tag " + tag + " id " + id);
288289
cache(id, n);
289290

290-
final Bundle extras = n.extras;
291+
// Log.d(TAG, "deleteIntent " + n.deleteIntent);
292+
final Bundle extras = n.extras,
293+
extensions = extras.getBundle("android.car.EXTENSIONS");
294+
if (extensions != null) {
295+
Bundle conversation = extensions.getBundle("car_conversation");
296+
PendingIntent onRead = (PendingIntent)conversation.get("on_read");
297+
// Log.d(TAG, "on_read " + onRead);
298+
n.deleteIntent = onRead;
299+
}
300+
// Log.d(TAG, "deleteIntent " + n.deleteIntent);
291301
CharSequence title = extras.getCharSequence(Notification.EXTRA_TITLE);
292302
if (title == null || title.length() == 0) {
293303
Log.e(TAG, "Title is missing: " + n);

0 commit comments

Comments
 (0)