| 10 | namespace AndroidShareHelper { |
| 11 | |
| 12 | void shareFile(const QString& filePath, const QString& mimeType, const QString& chooserTitle) |
| 13 | { |
| 14 | if (filePath.isEmpty()) { |
| 15 | qWarning() << "AndroidShareHelper::shareFile: Empty file path"; |
| 16 | return; |
| 17 | } |
| 18 | |
| 19 | QJniObject activity = QNativeInterface::QAndroidApplication::context(); |
| 20 | if (!activity.isValid()) { |
| 21 | qWarning() << "AndroidShareHelper::shareFile: Failed to get Android context"; |
| 22 | return; |
| 23 | } |
| 24 | |
| 25 | QJniObject::callStaticMethod<void>( |
| 26 | "org/speedynote/app/ShareHelper", |
| 27 | "shareFileWithTitle", |
| 28 | "(Landroid/app/Activity;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", |
| 29 | activity.object<jobject>(), |
| 30 | QJniObject::fromString(filePath).object<jstring>(), |
| 31 | QJniObject::fromString(mimeType).object<jstring>(), |
| 32 | QJniObject::fromString(chooserTitle).object<jstring>() |
| 33 | ); |
| 34 | |
| 35 | QJniEnvironment env; |
| 36 | if (env.checkAndClearExceptions()) { |
| 37 | qWarning() << "AndroidShareHelper::shareFile: JNI exception occurred"; |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | void shareMultipleFiles(const QStringList& filePaths, const QString& mimeType, const QString& chooserTitle) |
| 42 | { |
no test coverage detected