Skip to content

Commit

Permalink
Allow more types when choosing user.js
Browse files Browse the repository at this point in the history
- text/plain: scripts from github
- application/octet-stream: files not from Downloads
  • Loading branch information
modos189 authored and johndoe committed Oct 6, 2019
1 parent 1257414 commit c6d1cdc
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,13 @@ public boolean onOptionsItemSelected(final MenuItem item) {
if (mFileManager.checkWriteStoragePermissionGranted()) {
// create the chooser Intent
final Intent target = new Intent(Intent.ACTION_GET_CONTENT);

target.setType("*/*");
// iitcm only parses *.user.js scripts
target.setType("application/javascript");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
String[] mimeTypes = {"application/javascript", "application/octet-stream", "text/plain"};
target.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes);
}
target.addCategory(Intent.CATEGORY_OPENABLE);

try {
Expand Down

0 comments on commit c6d1cdc

Please sign in to comment.