Have you any idea if its possible to pick a folder to save to?
Not that I know of, I think the first "trip" goes to the temporary inbox no matter what, then you can move it from there. But on IOS there is no notion of "folders" where to save it
I got the android stuff working on my fork, I'll send a PR when its all tested. It seems in android, if you open a document that you've picked using the Linking api then the OS gives you the ability to save it where you like, which is great. I'm wondering if there's an iOS equivalent, or if we could write one. Being able to save a document would be really helpful to me
Can we clean this issue?
Just checking, you said you had it working on your fork. Is there a way to pick directories now?
I think this would be a completely different intent right? Like ACTION_OPEN_DOCUMENT_TREE
In fact I took a crack at it myself.
private static final int REQUEST_CODE_OPEN_DIRECTORY = 1;
@ReactMethod
public void pickDirectory(ReadableMap args, Promise promise) {
Activity currentActivity = getCurrentActivity();
if (currentActivity == null) {
promise.reject(E_ACTIVITY_DOES_NOT_EXIST, "Current activity does not exist");
return;
}
this.promise = promise;
try {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
intent.putExtra("android.content.extra.SHOW_ADVANCED", true);
currentActivity.startActivityForResult(intent, REQUEST_CODE_OPEN_DIRECTORY, Bundle.EMPTY);
} catch (Exception e) {
e.printStackTrace();
this.promise.reject(E_FAILED_TO_SHOW_PICKER, e.getLocalizedMessage());
this.promise = null;
}
}
Also replace in onActivityResult
if (requestCode == READ_REQUEST_CODE || requestCode == REQUEST_CODE_OPEN_DIRECTORY)
From there the actual handing of the uri in onShowActivityResult will need to be rewritten instead of grabbing metadata....
closing in favor of https://github.com/rnmods/react-native-document-picker/issues/302
Most helpful comment
I got the android stuff working on my fork, I'll send a PR when its all tested. It seems in android, if you open a document that you've picked using the
Linkingapi then the OS gives you the ability to save it where you like, which is great. I'm wondering if there's an iOS equivalent, or if we could write one. Being able to save a document would be really helpful to me