@@ -44,10 +44,9 @@ import androidx.core.app.NotificationCompat
4444import androidx.core.app.Person
4545import com.oasisfeng.nevo.decorators.wechat.ConversationManager.Conversation
4646import com.oasisfeng.nevo.sdk.MutableStatusBarNotification
47- import java.util.*
4847
4948/* *
50- * Build the modernized [MessagingStyle] for WeChat conversation.
49+ * Build the modernized [MessagingStyle][NotificationCompat.MessagingStyle] for WeChat conversation.
5150 *
5251 * Refactored by Oasis on 2018-8-9.
5352 */
@@ -217,7 +216,7 @@ internal class MessagingBuilder(private val mContext: Context, private val mCont
217216 }
218217
219218 fun close () {
220- try { mContext.unregisterReceiver(mReplyReceiver) } catch (e : RuntimeException ) {}
219+ try { mContext.unregisterReceiver(mReplyReceiver) } catch (_ : RuntimeException ) {}
221220 }
222221
223222 init {
@@ -257,16 +256,14 @@ internal class MessagingBuilder(private val mContext: Context, private val mCont
257256 }
258257
259258 private fun buildMessage (conversation : Conversation , `when `: Long , ticker : CharSequence? , text : CharSequence ,
260- sender : String? ): NotificationCompat .MessagingStyle .Message {
261- var sender = sender
259+ senderArg : String? ): NotificationCompat .MessagingStyle .Message {
260+ var sender = senderArg
262261 var actualText: CharSequence? = text
263262 if (sender == null ) {
264263 sender = text.extractSenderFromText()
265264 if (sender != null ) {
266- actualText =
267- text.subSequence(sender.length + SENDER_MESSAGE_SEPARATOR .length, text.length)
268- if (TextUtils .equals(conversation.title, sender)) sender =
269- null // In this case, the actual sender is user itself.
265+ actualText = text.subSequence(sender.length + SENDER_MESSAGE_SEPARATOR .length, text.length)
266+ if (conversation.title == sender) sender = null // In this case, the actual sender is user itself.
270267 }
271268 }
272269 actualText = EmojiTranslator .translate(actualText)
0 commit comments