|
51 | 51 | import static androidx.core.app.NotificationCompat.EXTRA_MESSAGES; |
52 | 52 | import static androidx.core.app.NotificationCompat.EXTRA_SELF_DISPLAY_NAME; |
53 | 53 | import static com.oasisfeng.nevo.decorators.wechat.WeChatMessage.SENDER_MESSAGE_SEPARATOR; |
| 54 | +import static java.util.Objects.requireNonNull; |
54 | 55 |
|
55 | 56 | /** |
56 | 57 | * Build the modernized {@link MessagingStyle} for WeChat conversation. |
@@ -143,13 +144,15 @@ class MessagingBuilder { |
143 | 144 | if (conversation.key == null) try { |
144 | 145 | if (on_reply != null) on_reply.send(mContext, 0, null, (p, intent, r, d, b) -> { |
145 | 146 | final String key = conversation.key = intent.getStringExtra(KEY_USERNAME); // setType() below will trigger rebuilding of conversation sender. |
| 147 | + if (key == null) return; |
146 | 148 | final int detected_type = key.endsWith("@chatroom") || key.endsWith("@im.chatroom"/* WeWork */) |
147 | 149 | ? Conversation.TYPE_GROUP_CHAT : key.startsWith("gh_") ? Conversation.TYPE_BOT_MESSAGE : Conversation.TYPE_DIRECT_MESSAGE; |
148 | 150 | final int previous_type = conversation.setType(detected_type); |
149 | 151 | if (BuildConfig.DEBUG && SDK_INT >= O && previous_type != Conversation.TYPE_UNKNOWN && detected_type != previous_type) { |
150 | 152 | 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()); |
153 | 156 | } |
154 | 157 | }, null); |
155 | 158 | } catch (final PendingIntent.CanceledException e) { |
|
0 commit comments