()
| 73 | } |
| 74 | |
| 75 | export function pickFiles() { |
| 76 | if (!global.isAndroid) { |
| 77 | return; |
| 78 | } |
| 79 | const Intent = android.content.Intent; |
| 80 | Application.android.on('activityResult', (args) => { |
| 81 | if (args.requestCode === 1000) { |
| 82 | const intent: android.content.Intent = args.intent; |
| 83 | const clip = intent.getClipData(); |
| 84 | if (clip) { |
| 85 | const count = clip.getItemCount(); |
| 86 | for (let i = 0; i < count; i++) { |
| 87 | const item = clip.getItemAt(i); |
| 88 | readFile(item.getUri().toString()); |
| 89 | } |
| 90 | } else { |
| 91 | readFile(intent.getData().toString()); |
| 92 | } |
| 93 | } |
| 94 | }); |
| 95 | const picker = new Intent(Intent.ACTION_OPEN_DOCUMENT); |
| 96 | picker.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); |
| 97 | picker.addCategory(Intent.CATEGORY_OPENABLE); |
| 98 | picker.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); |
| 99 | picker.setType('*/*'); |
| 100 | Application.android.foregroundActivity.startActivityForResult(picker, 1000); |
| 101 | } |
| 102 | |
| 103 | export function pickFile() { |
| 104 | if (!global.isAndroid) { |
nothing calls this directly
no test coverage detected