Use substring over replaceFirst (#4707)

This commit is contained in:
Miguel Alatzar
2020-08-20 11:55:09 -07:00
committed by GitHub
parent ea4e21de93
commit 68457c5e7e

View File

@@ -534,7 +534,12 @@ public class CustomPushNotification extends PushNotification {
}
private String removeSenderNameFromMessage(String message, String senderName) {
return message.replaceFirst(senderName, "").replaceFirst(": ", "").trim();
Integer index = message.indexOf(senderName);
if (index == 0) {
message = message.substring(senderName.length());
}
return message.replaceFirst(": ", "").trim();
}
private void notificationReceiptDelivery(String ackId, String postId, String type, boolean isIdLoaded, ResolvePromise promise) {