From 5130579361312b7906aa9b25663ecc2148c011cd Mon Sep 17 00:00:00 2001 From: exclamation Date: Thu, 7 May 2020 01:36:55 +0530 Subject: [PATCH 1/2] support for audio and multiple file type When you select multiple files and they are in a different format (eg image and video), it shows "Type is not support". Adding 'type.startsWith("*/")' fix this issue. --- .../src/main/java/com/ajithab/RNFileShareIntentModule.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/android/src/main/java/com/ajithab/RNFileShareIntentModule.java b/android/src/main/java/com/ajithab/RNFileShareIntentModule.java index ec00b52..84989c5 100644 --- a/android/src/main/java/com/ajithab/RNFileShareIntentModule.java +++ b/android/src/main/java/com/ajithab/RNFileShareIntentModule.java @@ -49,7 +49,7 @@ public void getFilepath(Callback successCallback) { if ("text/plain".equals(type)) { String input = intent.getStringExtra(Intent.EXTRA_TEXT); successCallback.invoke(input); - } else if (type.startsWith("image/") || type.startsWith("video/") || type.startsWith("application/")) { + } else if (type.startsWith("image/") || type.startsWith("video/") || type.startsWith("application/") || type.startsWith("audio/")) { Uri fileUri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM); if (fileUri != null) { successCallback.invoke(fileUri.toString()); @@ -58,7 +58,7 @@ public void getFilepath(Callback successCallback) { Toast.makeText(reactContext, "Type is not support", Toast.LENGTH_SHORT).show(); } } else if (Intent.ACTION_SEND_MULTIPLE.equals(action) && type != null) { - if (type.startsWith("image/") || type.startsWith("video/") || type.startsWith("application/")) { + if (type.startsWith("image/") || type.startsWith("video/") || type.startsWith("application/") || type.startsWith("*/") || type.startsWith("audio/")) { ArrayList fileUris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM); if (fileUris != null) { String completeString = new String(); @@ -91,4 +91,4 @@ public void clearFilePath() { public String getName() { return "RNFileShareIntent"; } -} \ No newline at end of file +} From 81bf707c609fc9ec41d7b899c2cf7caeebfd1b9e Mon Sep 17 00:00:00 2001 From: exclamation Date: Thu, 7 May 2020 01:43:41 +0530 Subject: [PATCH 2/2] Multiple file support --- android/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/android/README.md b/android/README.md index 6edb656..9ad20cf 100644 --- a/android/README.md +++ b/android/README.md @@ -47,6 +47,15 @@ Add What ever Want to share MIME Type so only include you want to share your App + + + + + + + + + ```