| 81 | } |
| 82 | |
| 83 | void shareInternalFiles(const std::vector<std::string>& filePaths, const std::string& mimeType) { |
| 84 | if(filePaths.empty()) |
| 85 | return; |
| 86 | Logger::get().log(Logger::LogType::INFO, "[AndroidJNICalls::shareInternalFile] Share internal files"); |
| 87 | JNIEnv* env = static_cast<JNIEnv*>(SDL_GetAndroidJNIEnv()); |
| 88 | jni_local_frame(env, 16, [&] { |
| 89 | jobject activity = (jobject) SDL_GetAndroidActivity(); |
| 90 | jclass clazz = env->GetObjectClass(activity); |
| 91 | jclass jStrClass = env->FindClass("java/lang/String"); |
| 92 | jobjectArray jFilePathArray = env->NewObjectArray(static_cast<jsize>(filePaths.size()), |
| 93 | jStrClass, nullptr); |
| 94 | for (jsize i = 0; i < static_cast<jsize>(filePaths.size()); i++) { |
| 95 | jstring s = string2jstring(env, filePaths[i]); |
| 96 | env->SetObjectArrayElement(jFilePathArray, i, s); |
| 97 | env->DeleteLocalRef(s); |
| 98 | } |
| 99 | |
| 100 | jmethodID method_id = env->GetStaticMethodID(clazz, "shareInternalFiles", |
| 101 | "([Ljava/lang/String;Ljava/lang/String;)V"); |
| 102 | env->CallStaticVoidMethod(clazz, method_id, jFilePathArray, |
| 103 | string2jstring(env, mimeType)); |
| 104 | }); |
| 105 | } |
| 106 | |
| 107 | void shareText(const std::string& str) { |
| 108 | Logger::get().log(Logger::LogType::INFO, "[AndroidJNICalls::shareText] Share text " + str); |
no test coverage detected