Skip to content

Commit 442157a

Browse files
committed
UPDATE: Minor tweaks.
1 parent c39fc98 commit 442157a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/main/AndroidManifest.xml

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
android:name=".WeChatDecoratorSettingsActivity"
4545
android:label="@string/decorator_wechat_title"
4646
android:theme="@android:style/Theme.Material.Light"
47+
android:excludeFromRecents="true"
4748
android:process=":ui">
4849
<intent-filter>
4950
<action android:name="android.intent.action.MAIN" />

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
import static androidx.core.app.NotificationCompat.EXTRA_MESSAGES;
5252
import static androidx.core.app.NotificationCompat.EXTRA_SELF_DISPLAY_NAME;
5353
import static com.oasisfeng.nevo.decorators.wechat.WeChatMessage.SENDER_MESSAGE_SEPARATOR;
54+
import static java.util.Objects.requireNonNull;
5455

5556
/**
5657
* Build the modernized {@link MessagingStyle} for WeChat conversation.
@@ -143,13 +144,15 @@ class MessagingBuilder {
143144
if (conversation.key == null) try {
144145
if (on_reply != null) on_reply.send(mContext, 0, null, (p, intent, r, d, b) -> {
145146
final String key = conversation.key = intent.getStringExtra(KEY_USERNAME); // setType() below will trigger rebuilding of conversation sender.
147+
if (key == null) return;
146148
final int detected_type = key.endsWith("@chatroom") || key.endsWith("@im.chatroom"/* WeWork */)
147149
? Conversation.TYPE_GROUP_CHAT : key.startsWith("gh_") ? Conversation.TYPE_BOT_MESSAGE : Conversation.TYPE_DIRECT_MESSAGE;
148150
final int previous_type = conversation.setType(detected_type);
149151
if (BuildConfig.DEBUG && SDK_INT >= O && previous_type != Conversation.TYPE_UNKNOWN && detected_type != previous_type) {
150152
final Notification clone = n.clone();
151-
final Notification.Builder dn = Notification.Builder.recoverBuilder(mContext, clone).setStyle(null).setSubText(clone.tickerText);
152-
mContext.getSystemService(NotificationManager.class).notify(key.hashCode(), dn.setChannelId(n.getChannelId()).build());
153+
final Notification.Builder dn = Notification.Builder.recoverBuilder(mContext, clone)
154+
.setStyle(new Notification.BigTextStyle().bigText(clone.tickerText)).setSubText("Type " + detected_type + " << " + previous_type);
155+
requireNonNull(mContext.getSystemService(NotificationManager.class)).notify(key.hashCode(), dn.setChannelId(n.getChannelId()).build());
153156
}
154157
}, null);
155158
} catch (final PendingIntent.CanceledException e) {

0 commit comments

Comments
 (0)