Directly show error on msg tap

fix #1749
This commit is contained in:
Hocuri
2020-12-12 15:20:54 +01:00
parent 827cd4092a
commit 45aa3e5b82
3 changed files with 22 additions and 0 deletions
+9
View File
@@ -1424,6 +1424,15 @@ JNIEXPORT jlong Java_com_b44t_messenger_DcMsg_getQuotedMsgCPtr(JNIEnv *env, jobj
}
JNIEXPORT jstring Java_com_b44t_messenger_DcMsg_getError(JNIEnv *env, jobject obj)
{
char* temp = dc_msg_get_error(get_dc_msg(env, obj));
jstring ret = JSTRING_NEW(temp);
dc_str_unref(temp);
return ret;
}
/*******************************************************************************
* DcContact
+1
View File
@@ -125,6 +125,7 @@ public class DcMsg {
public native void setLocation (float latitude, float longitude);
public void setQuote (DcMsg quote) { setQuoteCPtr(quote.msgCPtr); }
public native String getQuotedText ();
public native String getError ();
public DcMsg getQuotedMsg () {
long cPtr = getQuotedMsgCPtr();
@@ -781,6 +781,18 @@ public class ConversationItem extends LinearLayout
handleDeadDropClick();
} else if (!shouldInterceptClicks(messageRecord) && parent != null) {
parent.onClick(v);
} else if (messageRecord.isFailed()) {
AlertDialog d = new AlertDialog.Builder(context)
.setMessage(messageRecord.getError())
.setTitle(R.string.error)
.create();
d.show();
try {
//noinspection ConstantConditions
Linkify.addLinks((TextView) d.findViewById(android.R.id.message), Linkify.WEB_URLS | Linkify.EMAIL_ADDRESSES);
} catch(NullPointerException e) {
e.printStackTrace();
}
}
}
}