mirror of
https://github.com/bitwarden/android.git
synced 2026-05-05 23:38:51 -05:00
[PM-24411] Add MIME type parameter to file chooser intent (#5661)
This commit is contained in:
@@ -95,8 +95,12 @@ interface IntentManager {
|
||||
|
||||
/**
|
||||
* Creates an intent for choosing a file saved to disk.
|
||||
*
|
||||
* @param withCameraIntents Whether to include camera intents in the chooser.
|
||||
* @param mimeType The MIME type of the files to be selected. Defaults to wildcard to allow all
|
||||
* types.
|
||||
*/
|
||||
fun createFileChooserIntent(withCameraIntents: Boolean): Intent
|
||||
fun createFileChooserIntent(withCameraIntents: Boolean, mimeType: String = "*/*"): Intent
|
||||
|
||||
/**
|
||||
* Creates an intent to use when selecting to save an item with [fileName] to disk.
|
||||
|
||||
@@ -228,11 +228,11 @@ class IntentManagerImpl(
|
||||
}
|
||||
}
|
||||
|
||||
override fun createFileChooserIntent(withCameraIntents: Boolean): Intent {
|
||||
override fun createFileChooserIntent(withCameraIntents: Boolean, mimeType: String): Intent {
|
||||
val chooserIntent = Intent.createChooser(
|
||||
Intent(Intent.ACTION_OPEN_DOCUMENT)
|
||||
.addCategory(Intent.CATEGORY_OPENABLE)
|
||||
.setType("*/*"),
|
||||
.setType(mimeType),
|
||||
ContextCompat.getString(context, BitwardenString.file_source),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user