-
Notifications
You must be signed in to change notification settings - Fork 505
Rework the "picker" results to correctly manage files #1555
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks good, I have just one comment, but is more a suggestion than a request.
return resolved; | ||
} | ||
else if (uri.Scheme.Equals("file", StringComparison.OrdinalIgnoreCase)) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about moving those strings to constants?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. You got me. I am always pestering people abut these magic strings. I will hang my head in shame and walk to the nearest corner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's ok that you like to type the same string over and over again 🤣
- Mime types - Extensions - Changed property type of ShareMultipleFilesRequest.Files to be a List<T> for consistency
<intent> | ||
<action android:name="android.intent.action.DIAL" /> | ||
<data android:scheme="tel" /> | ||
</intent> | ||
<!-- MediaPicker --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be added to documentation :)
Description of Change
This PR solves a few issues.
Because we use an intermediate activity, this means that the URI almost immediately becomes invalid.
To solve for this, we have to resolve the physical path of the picked file. Many providers have a way to retrieve the physical path, or the path is known based on the type of content URI.
This might be because there are no permissions, or the file only exists as a stream from a file provider.
In this case, we need to copy the file to a local location.
This might be a Google docs spreadsheet which is not a real file format.
To solve this, we detect the virtual and then ask the provider what formats are supported. We then use that format and open the stream.
This PR also changes a few things in the code that overlap with the fixes.
IsIntentSupported
method on Android.List<T>
forShareMultipleFilesRequest.Files
for consistency.Bugs Fixed
API Changes
None visible.
Behavioral Changes
This PR will make sure all the
FileResult
instances point to a physical file location after a picker operation.PR Checklist
main
at time of PR