@@ -87,14 +87,14 @@ public class WeChatDecorator extends NevoDecoratorService {
8787 static final String ACTION_SETTINGS_CHANGED = "SETTINGS_CHANGED" ;
8888 static final String ACTION_DEBUG_NOTIFICATION = "DEBUG" ;
8989
90- @ Override public void apply (final MutableStatusBarNotification evolving ) {
90+ @ Override public boolean apply (final MutableStatusBarNotification evolving ) {
9191 final MutableNotification n = evolving .getNotification ();
9292 final Bundle extras = n .extras ;
9393
9494 CharSequence title = extras .getCharSequence (EXTRA_TITLE );
9595 if (title == null || title .length () == 0 ) {
9696 Log .e (TAG , "Title is missing: " + evolving );
97- return ;
97+ return false ;
9898 }
9999 if (title != (title = EmojiTranslator .translate (title ))) extras .putCharSequence (EXTRA_TITLE , title );
100100 n .color = PRIMARY_COLOR ; // Tint the small icon
@@ -105,10 +105,10 @@ public class WeChatDecorator extends NevoDecoratorService {
105105 n .setGroup (GROUP_MISC ); // Avoid being auto-grouped
106106 if (! mOngoingCallTweaker .apply (this , evolving .getOriginalKey (), n ))
107107 Log .d (TAG , "Skip further process for non-conversation notification: " + title ); // E.g. web login confirmation notification.
108- return ;
108+ return true ;
109109 }
110110 final CharSequence content_text = extras .getCharSequence (EXTRA_TEXT );
111- if (content_text == null ) return ;
111+ if (content_text == null ) return true ;
112112
113113 // WeChat previously uses dynamic counter starting from 4097 as notification ID, which is reused after cancelled by WeChat itself,
114114 // causing conversation duplicate or overwritten notifications.
@@ -140,16 +140,17 @@ public class WeChatDecorator extends NevoDecoratorService {
140140 MessagingStyle messaging = mMessagingBuilder .buildFromExtender (conversation , evolving );
141141 if (messaging == null ) // EXTRA_TEXT will be written in buildFromArchive()
142142 messaging = mMessagingBuilder .buildFromArchive (conversation , n , title , getArchivedNotifications (evolving .getOriginalKey (), MAX_NUM_ARCHIVED ));
143- if (messaging == null ) return ;
143+ if (messaging == null ) return true ;
144144 final List <MessagingStyle .Message > messages = messaging .getMessages ();
145- if (messages .isEmpty ()) return ;
145+ if (messages .isEmpty ()) return true ;
146146
147147 if (is_group_chat ) messaging .setGroupConversation (true ).setConversationTitle (title );
148148 MessagingBuilder .flatIntoExtras (messaging , extras );
149149 extras .putString (Notification .EXTRA_TEMPLATE , TEMPLATE_MESSAGING );
150150
151151 if (SDK_INT >= N && extras .getCharSequenceArray (Notification .EXTRA_REMOTE_INPUT_HISTORY ) != null )
152152 n .flags |= Notification .FLAG_ONLY_ALERT_ONCE ; // No more alert for direct-replied notification.
153+ return true ;
153154 }
154155
155156 private boolean isDistinctId (final Notification n , final String pkg ) {
@@ -168,15 +169,16 @@ private boolean isDistinctId(final Notification n, final String pkg) {
168169 }
169170 private Boolean mDistinctIdSupported ;
170171
171- @ Override protected void onNotificationRemoved (final String key , final int reason ) {
172- if (reason == REASON_APP_CANCEL ) { // Only if "Removal-Aware" of Nevolution is activated
172+ @ Override protected boolean onNotificationRemoved (final String key , final int reason ) {
173+ if (reason == REASON_APP_CANCEL ) { // For ongoing notification, or if "Removal-Aware" of Nevolution is activated
173174 Log .d (TAG , "Cancel notification: " + key );
174175 mOngoingCallTweaker .onNotificationRemoved (key );
175176 } else if (reason == REASON_CHANNEL_BANNED ) { // In case WeChat deleted our notification channel for group conversation in Insider delivery mode
176177 mHandler .post (() -> reviveNotification (key ));
177178 } else if (SDK_INT < O || reason == REASON_CANCEL ) { // Exclude the removal request by us in above case. (Removal-Aware is only supported on Android 8+)
178179 mMessagingBuilder .markRead (key );
179180 }
181+ return false ;
180182 }
181183
182184 @ Override protected void onConnected () {
0 commit comments