@@ -233,6 +233,18 @@ Java_com_github_yumelira_yumebox_core_bridge_Bridge_nativeHealthCheckAll(JNIEnv
233233 healthCheckAll ();
234234}
235235
236+ JNIEXPORT void JNICALL
237+ Java_com_github_yumelira_yumebox_core_bridge_Bridge_nativeHealthCheckProxy (JNIEnv * env , jobject thiz ,
238+ jobject completable ,
239+ jstring proxy_name ) {
240+ TRACE_METHOD ();
241+
242+ jobject _completable = new_global (completable );
243+ scoped_string _proxy_name = get_string (proxy_name );
244+
245+ healthCheckProxy (_completable , _proxy_name );
246+ }
247+
236248JNIEXPORT jboolean JNICALL
237249Java_com_github_yumelira_yumebox_core_bridge_Bridge_nativePatchSelector (JNIEnv * env , jobject thiz ,
238250 jstring selector , jstring name ) {
@@ -345,6 +357,7 @@ static jmethodID m_tun_interface_mark_socket;
345357static jmethodID m_tun_interface_query_socket_uid ;
346358static jmethodID m_completable_complete ;
347359static jmethodID m_completable_complete_exceptionally ;
360+ static jmethodID m_completable_complete_with_string ;
348361static jmethodID m_logcat_interface_received ;
349362static jmethodID m_clash_exception ;
350363static jmethodID m_fetch_callback_report ;
@@ -403,6 +416,17 @@ static void call_completable_complete_impl(void *completable, const char *except
403416 }
404417}
405418
419+ static void call_completable_complete_with_string_impl (void * completable , const char * result ) {
420+ TRACE_METHOD ();
421+
422+ ATTACH_JNI ();
423+
424+ (* env )-> CallBooleanMethod (env ,
425+ (jobject ) completable ,
426+ (jmethodID ) m_completable_complete_with_string ,
427+ (jstring ) new_string (result ));
428+ }
429+
406430static void call_fetch_callback_report_impl (void * fetch_callback , const char * status_json ) {
407431 TRACE_METHOD ();
408432
@@ -521,6 +545,8 @@ JNI_OnLoad(JavaVM *vm, void *reserved) {
521545 "(Ljava/lang/String;)V" );
522546 m_completable_complete_exceptionally = find_method (c_completable , "completeExceptionally" ,
523547 "(Ljava/lang/Throwable;)Z" );
548+ // Reuse complete(Object) for complete_with_string - String is an Object
549+ m_completable_complete_with_string = m_completable_complete ;
524550 m_logcat_interface_received = find_method (c_logcat_interface , "received" ,
525551 "(Ljava/lang/String;)V" );
526552 m_clash_exception = find_method (_c_clash_exception , "<init>" ,
@@ -541,6 +567,7 @@ JNI_OnLoad(JavaVM *vm, void *reserved) {
541567 mark_socket_func = & call_tun_interface_mark_socket_impl ;
542568 query_socket_uid_func = & call_tun_interface_query_socket_uid_impl ;
543569 complete_func = & call_completable_complete_impl ;
570+ complete_with_string_func = & call_completable_complete_with_string_impl ;
544571 fetch_report_func = & call_fetch_callback_report_impl ;
545572 fetch_complete_func = & call_fetch_callback_complete_impl ;
546573 logcat_received_func = & call_logcat_interface_received_impl ;
0 commit comments