Skip to content

Commit

Permalink
mark saved messages
Browse files Browse the repository at this point in the history
  • Loading branch information
r10s committed Oct 14, 2024
1 parent b420e0e commit c9a833a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
6 changes: 6 additions & 0 deletions jni/dc_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -1735,6 +1735,12 @@ JNIEXPORT jint Java_com_b44t_messenger_DcMsg_getOriginalChatId(JNIEnv *env, jobj
}


JNIEXPORT jint Java_com_b44t_messenger_DcMsg_getSavedMsgId(JNIEnv *env, jobject obj)
{
return (jint)dc_msg_get_saved_msg_id(get_dc_msg(env, obj));
}


JNIEXPORT jstring Java_com_b44t_messenger_DcMsg_getError(JNIEnv *env, jobject obj)
{
char* temp = dc_msg_get_error(get_dc_msg(env, obj));
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/com/b44t/messenger/DcMsg.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,15 @@ public DcMsg getParent() {
return cPtr != 0 ? new DcMsg(cPtr) : null;
}

public boolean hasOriginal () { return getOriginalChatId() != 0; }
public native int getOriginalChatId ();
public native int getSavedMsgId ();

public DcMsg getOriginalMsg() {
long cPtr = getOriginalMsgCPtr();
return cPtr != 0 ? new DcMsg(cPtr) : null;
}

public native int getOriginalChatId ();
public boolean hasOriginal () { return getOriginalChatId() != 0; }

public File getFileAsFile() {
if(getFile()==null)
throw new AssertionError("expected a file to be present.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ private void setTextColor(int color) {

private void presentDate(@NonNull DcMsg messageRecord) {
dateView.forceLayout();
dateView.setText(DateUtils.getExtendedRelativeTimeSpanString(getContext(), messageRecord.getTimestamp()));
String text = DateUtils.getExtendedRelativeTimeSpanString(getContext(), messageRecord.getTimestamp());
if (messageRecord.getSavedMsgId() != 0) {
text += " ★";
}
dateView.setText(text);
}

private void presentDeliveryStatus(@NonNull DcMsg messageRecord) {
Expand Down

0 comments on commit c9a833a

Please sign in to comment.