MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / shareInternalFiles

Function shareInternalFiles

src/AndroidJNICalls.cpp:83–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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);

Callers 1

share_selected_filesMethod · 0.85

Calls 6

jni_local_frameFunction · 0.85
string2jstringFunction · 0.85
logMethod · 0.80
getFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected