Skip to content

Commit e202c7e

Browse files
skysky
authored andcommitted
1 parent 7f5651d commit e202c7e

File tree

17 files changed

+120
-188
lines changed

17 files changed

+120
-188
lines changed

.DS_Store

6 KB
Binary file not shown.

.gitignore

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Xcode
2+
#
3+
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4+
5+
.idea
6+
7+
## Build generated
8+
build/
9+
DerivedData/
10+
11+
## Various settings
12+
*.pbxuser
13+
!default.pbxuser
14+
*.mode1v3
15+
!default.mode1v3
16+
*.mode2v3
17+
!default.mode2v3
18+
*.perspectivev3
19+
!default.perspectivev3
20+
xcuserdata/
21+
22+
## Other
23+
*.moved-aside
24+
*.xcuserstate
25+
26+
## Obj-C/Swift specific
27+
*.hmap
28+
*.ipa
29+
*.dSYM.zip
30+
*.dSYM
31+
32+
# CocoaPods
33+
#
34+
# We recommend against adding the Pods directory to your .gitignore. However
35+
# you should judge for yourself, the pros and cons are mentioned at:
36+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
37+
#
38+
# Pods/
39+
40+
# Carthage
41+
#
42+
# Add this line if you want to avoid checking in source code from Carthage dependencies.
43+
# Carthage/Checkouts
44+
45+
Carthage/Build
46+
47+
# fastlane
48+
#
49+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
50+
# screenshots whenever they are needed.
51+
# For more information about the recommended setup visit:
52+
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
53+
54+
fastlane/report.xml
55+
fastlane/screenshots
56+
57+
#Code Injection
58+
#
59+
# After new code Injection tools there's a generated folder /iOSInjectionProject
60+
# https://github.com/johnno1962/injectionforxcode
61+
62+
iOSInjectionProject/
63+
node_modules/**/*

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2016 Elyx0
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

android/build.gradle

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ android {
1414
buildToolsVersion '25.0.1'
1515

1616
defaultConfig {
17-
minSdkVersion 19
17+
minSdkVersion 16
1818
targetSdkVersion 22
1919
}
2020

android/src/main/AndroidManifest.xml

100644100755
File mode changed.

android/src/main/java/com/reactnativedocumentpicker/DocumentPicker.java

100644100755
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import android.database.Cursor;
77
import android.net.Uri;
88
import android.os.Bundle;
9-
import android.provider.MediaStore;
109
import android.provider.OpenableColumns;
1110
import android.util.Log;
1211
import android.webkit.MimeTypeMap;
@@ -36,7 +35,6 @@ public class DocumentPicker extends ReactContextBaseJavaModule implements Activi
3635
private static final int READ_REQUEST_CODE = 41;
3736

3837
private static class Fields {
39-
//private static final String FILE_PATH = "filepath";
4038
private static final String FILE_SIZE = "fileSize";
4139
private static final String FILE_NAME = "fileName";
4240
private static final String TYPE = "type";
@@ -126,7 +124,7 @@ private WritableMap metaDataFromUri(Uri uri) {
126124
File outputDir = getReactApplicationContext().getCacheDir();
127125
try {
128126
File downloaded = download(uri, outputDir);
129-
//map.putString(Fields.FILE_PATH, downloaded.getAbsolutePath());
127+
130128
map.putInt(Fields.FILE_SIZE, (int) downloaded.length());
131129
map.putString(Fields.FILE_NAME, downloaded.getName());
132130
map.putString(Fields.TYPE, mimeTypeFromName(uri.toString()));
@@ -142,15 +140,14 @@ private WritableMap metaDataFromFile(File file) {
142140

143141
if(!file.exists())
144142
return map;
145-
//map.putString(Fields.FILE_PATH, file.getAbsolutePath());
143+
146144
map.putInt(Fields.FILE_SIZE, (int) file.length());
147145
map.putString(Fields.FILE_NAME, file.getName());
148146
map.putString(Fields.TYPE, mimeTypeFromName(file.getAbsolutePath()));
149147

150148
return map;
151149
}
152150

153-
154151
private WritableMap metaDataFromContentResolver(Uri uri) {
155152
WritableMap map = Arguments.createMap();
156153

@@ -163,8 +160,6 @@ private WritableMap metaDataFromContentResolver(Uri uri) {
163160
try {
164161
if (cursor != null && cursor.moveToFirst()) {
165162

166-
//map.putString(Fields.FILE_PATH, cursor.getString(cursor.getColumnIndex(MediaStore.MediaColumns.DATA)));
167-
//map.putString(Fields.FILE_PATH, "");
168163
map.putString(Fields.FILE_NAME, cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)));
169164

170165
int sizeIndex = cursor.getColumnIndex(OpenableColumns.SIZE);

android/src/main/java/com/reactnativedocumentpicker/ReactNativeDocumentPicker.java

100644100755
File mode changed.

index.js

100644100755
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ class DocumentPickerUtil {
1717
return (Platform.OS === 'android') ? "image/*" : "public.image";
1818
}
1919

20-
static videos() {
21-
return (Platform.OS === 'android') ? "video/*" : "public.movie";
22-
}
23-
2420
static plainText() {
2521
return (Platform.OS === 'android') ? "text/plain" : "public.plain-text";
2622
}
2723

2824
static audio() {
2925
return (Platform.OS === 'android') ? "audio/*" : "public.audio";
3026
}
27+
28+
static video() {
29+
return (Platform.OS === 'android') ? "video/*" : "public.video";
30+
}
3131

3232
static pdf() {
3333
return (Platform.OS === 'android') ? "application/pdf" : "com.adobe.pdf";
3434
}
3535
}
3636

37-
module.exports = {DocumentPickerUtil, DocumentPicker};
37+
module.exports = {DocumentPickerUtil, DocumentPicker};

ios/RNDocumentPicker.xcodeproj/project.pbxproj

100644100755
File mode changed.

ios/RNDocumentPicker.xcodeproj/project.xcworkspace/contents.xcworkspacedata

100644100755
File mode changed.

0 commit comments

Comments
 (0)