diff --git a/.gitignore b/.gitignore index 51c97530fa..60c54c2e46 100644 --- a/.gitignore +++ b/.gitignore @@ -477,3 +477,6 @@ app/src/main/assets/checksums.json app/boost-*.tar.xz app/src/main/jni/boost/ +# kotlin +.kotlin + diff --git a/app/src/main/jni/librime b/app/src/main/jni/librime index 527fbcc750..13228c2d40 160000 --- a/app/src/main/jni/librime +++ b/app/src/main/jni/librime @@ -1 +1 @@ -Subproject commit 527fbcc750ee18006e9cce8b72ae29294f4d28c4 +Subproject commit 13228c2d40e21e47b0a588fd595c765b2e7edf2b diff --git a/app/src/main/jni/librime-lua b/app/src/main/jni/librime-lua index 20ddea907e..7be6974b6d 160000 --- a/app/src/main/jni/librime-lua +++ b/app/src/main/jni/librime-lua @@ -1 +1 @@ -Subproject commit 20ddea907e0b0c9c60d1dcb6b102bee38697cb5c +Subproject commit 7be6974b6d81c116bba39f6707dc640f6636fa4e diff --git a/app/src/main/jni/librime_jni/objconv.h b/app/src/main/jni/librime_jni/objconv.h index 22e147d294..9d98696f4d 100644 --- a/app/src/main/jni/librime_jni/objconv.h +++ b/app/src/main/jni/librime_jni/objconv.h @@ -86,7 +86,7 @@ inline jobject rimeConfigListToJObject(JNIEnv *env, RimeConfig *config, auto obj = env->NewObject(GlobalRef->ArrayList, GlobalRef->ArrayListInit, size); int i = 0; - while (RimeConfigNext(&iter)) { + while (rime->config_next(&iter)) { auto e = JRef<>(env, rimeConfigValueToJObject(env, config, iter.path)); env->CallVoidMethod(obj, GlobalRef->ArrayListAdd, i++, *e); } diff --git a/app/src/main/jni/librime_jni/rime_jni.cc b/app/src/main/jni/librime_jni/rime_jni.cc index ae2435f06f..da159b79ec 100644 --- a/app/src/main/jni/librime_jni/rime_jni.cc +++ b/app/src/main/jni/librime_jni/rime_jni.cc @@ -275,24 +275,25 @@ Java_com_osfans_trime_core_Rime_getRimeStatus(JNIEnv *env, jclass /* thiz */) { } static bool is_save_option(const char *p) { + auto rime = rime_get_api(); bool is_save = false; std::string option_name(p); if (option_name.empty()) return is_save; RimeConfig config = {nullptr}; - bool b = RimeConfigOpen("default", &config); + bool b = rime->config_open("default", &config); if (!b) return is_save; const char *key = "switcher/save_options"; RimeConfigIterator iter = {nullptr}; - RimeConfigBeginList(&iter, &config, key); - while (RimeConfigNext(&iter)) { - std::string item(RimeConfigGetCString(&config, iter.path)); + rime->config_begin_list(&iter, &config, key); + while (rime->config_next(&iter)) { + std::string item(rime->config_get_cstring(&config, iter.path)); if (option_name == item) { is_save = true; break; } } - RimeConfigEnd(&iter); - RimeConfigClose(&config); + rime->config_end(&iter); + rime->config_close(&config); return is_save; } @@ -439,16 +440,17 @@ Java_com_osfans_trime_core_Rime_getRimeConfigMap(JNIEnv *env, jclass clazz, extern "C" JNIEXPORT jboolean JNICALL Java_com_osfans_trime_core_Rime_runRimeTask(JNIEnv *env, jclass /* thiz */, jstring task_name) { + auto rime = rime_get_api(); const char *s = env->GetStringUTFChars(task_name, nullptr); RimeConfig config = {nullptr}; - Bool b = RimeRunTask(s); + Bool b = rime->run_task(s); env->ReleaseStringUTFChars(task_name, s); return b; } extern "C" JNIEXPORT jstring JNICALL Java_com_osfans_trime_core_Rime_getRimeSharedDataDir(JNIEnv *env, jclass /* thiz */) { - return env->NewStringUTF(RimeGetSharedDataDir()); + return env->NewStringUTF(rime_get_api()->get_shared_data_dir()); } extern "C" JNIEXPORT jstring JNICALL @@ -459,12 +461,12 @@ Java_com_osfans_trime_core_Rime_getRimeUserDataDir(JNIEnv *env, extern "C" JNIEXPORT jstring JNICALL Java_com_osfans_trime_core_Rime_getRimeSyncDir(JNIEnv *env, jclass /* thiz */) { - return env->NewStringUTF(RimeGetSyncDir()); + return env->NewStringUTF(rime_get_api()->get_sync_dir()); } extern "C" JNIEXPORT jstring JNICALL Java_com_osfans_trime_core_Rime_getRimeUserId(JNIEnv *env, jclass /* thiz */) { - return env->NewStringUTF(RimeGetUserId()); + return env->NewStringUTF(rime_get_api()->get_user_id()); } extern "C" JNIEXPORT jstring JNICALL