Skip to content

Commit

Permalink
Store user replies(#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xf104a committed Jan 5, 2024
1 parent 1fab387 commit 41ba837
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ static private PendingIntent getReplyIntent(Context context,
}
}

private Person getUserPerson(){
Person.Builder builder = new Person.Builder();
builder.setName("You");
return builder.build();
}

@NonNull
private Person getPersonFromNotification(@NonNull NotificationController controller,
@NonNull JSONObject rawNotification) throws Exception {
Expand Down Expand Up @@ -332,7 +338,14 @@ private void appendQuickReply(NotificationController controller,
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, notification);
NotificationCompat.MessagingStyle style = NotificationCompat
.MessagingStyle.extractMessagingStyleFromNotification(notification);
style.addMessage(text, CommonUtil.getTimestamp(), "You");
if(style == null){
Log.wtf(TAG, "appendQuickReply: got null style");
return;
}
style.addMessage(text, CommonUtil.getTimestamp(), getUserPerson());
final String room = mChatController.getChatByNotificationId(notification_id).room;
mChatController.onNewMessageReceived(room, text, getUserPerson(),
CommonUtil.getTimestamp(), -1);
notification = builder.setStyle(style).build();
controller.postNotification(notification_id, notification);
}
Expand Down

0 comments on commit 41ba837

Please sign in to comment.