1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-11 18:24:43 +02:00

Android: Fixes #7791: Fixed duplicate sharing issue (#7799)

This commit is contained in:
javad mnjd 2023-02-18 20:00:56 +03:30 committed by GitHub
parent 9aa5df7790
commit d5d57aa360
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 8 deletions

View File

@ -82,11 +82,11 @@
<!-- SHARE EXTENSION -->
<activity
android:noHistory="true"
android:name=".share.ShareActivity"
android:name=".ShareActivity"
android:configChanges="orientation"
android:launchMode="singleTask"
android:label="@string/app_name"
android:excludeFromRecents="true"
android:launchMode="singleTask"
android:theme="@style/AppTheme"
android:exported="true">
<intent-filter>

View File

@ -1,4 +1,4 @@
package net.cozic.joplin.share;
package net.cozic.joplin;
import com.facebook.react.ReactActivity;

View File

@ -91,6 +91,10 @@ public class SharePackage implements ReactPackage {
return null;
}
if (intent.getBooleanExtra("is_processed", false)) {
return null;
}
String type = intent.getType() == null ? "" : intent.getType();
map.putString("type", type);
map.putString("title", getTitle(intent));
@ -112,6 +116,7 @@ public class SharePackage implements ReactPackage {
}
map.putArray("resources", resources);
intent.putExtra("is_processed", true);
return map;
}

View File

@ -1,5 +1,3 @@
import debounce from './debounce';
const { NativeModules, Platform } = require('react-native');
export interface SharedData {
@ -11,9 +9,7 @@ export interface SharedData {
const ShareExtension = (NativeModules.ShareExtension) ?
{
data: () => NativeModules.ShareExtension.data(),
// we debounce the `close` method, to keep alive permissions of Uris received from the share activity
// this is to prevent getting permission denied error while sharing the same file to joplin multiple times in a row
close: () => debounce(() => NativeModules.ShareExtension.close(), 3 * 60 * 1000), // close it after 3 minutes
close: () => NativeModules.ShareExtension.close(),
shareURL: (Platform.OS === 'ios') ? NativeModules.ShareExtension.getConstants().SHARE_EXTENSION_SHARE_URL : '',
} :
{