Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# react-native-file-picker
# GEOENGINEERS CUSTOMIZED - react-native-file-picker
A React Native module that allows you to use native UI to select a file from the device library
Based on [react-native-image-picker](https://github.com/marcshilling/react-native-image-picker)

Expand Down
19 changes: 17 additions & 2 deletions android/src/main/java/com/filepicker/FilePickerModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,11 @@ public static String getPath(final Context context, final Uri uri) {

final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;

if (isExternalSkydriveResourceUri(uri)) {
//DONT DO ANYTHING? THIS RETURNS THE PATH AS IS FOR ONEDRIVE
}
// DocumentProvider
if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
else if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {

// ExternalStorageProvider
if (isExternalStorageDocument(uri)) {
Expand All @@ -280,8 +283,12 @@ else if (isDownloadsDocument(uri)) {
return split[1];
} else {
String prefix = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ? "file:///" : "content://";
String contentId = split[0];
if(split.length > 1){
contentId = split[1];
}
final Uri contentUri = ContentUris.withAppendedId(
Uri.parse(prefix + "downloads/public_downloads"), Long.valueOf(split[1]));
Uri.parse(prefix + "downloads/public_downloads"), Long.valueOf(contentId));

return getDataColumn(context, contentUri, null, null);
}
Expand Down Expand Up @@ -326,6 +333,14 @@ else if ("file".equalsIgnoreCase(uri.getScheme())) {
return null;
}

/**
* @param uri The Uri to check.
* @return Whether the Uri authority is MediaProvider.
*/
public static boolean isExternalSkydriveResourceUri(Uri uri) {
return "com.microsoft.skydrive.content.external".equals(uri.getAuthority());
}

/**
* @param uri The Uri to check.
* @return Whether the Uri authority is ExternalStorageProvider.
Expand Down