File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -22,9 +22,20 @@ class UriHelper {
2222
2323 if ( "primary" === type . toLowerCase ( ) ) {
2424 return android . os . Environment . getExternalStorageDirectory ( ) + "/" + id ;
25+ } else {
26+ if ( android . os . Build . VERSION . SDK_INT > 23 ) {
27+ ( this . getContentResolver ( ) as any ) . takePersistableUriPermission (
28+ uri ,
29+ android . content . Intent . FLAG_GRANT_READ_URI_PERMISSION | android . content . Intent . FLAG_GRANT_WRITE_URI_PERMISSION ,
30+ ) ;
31+ const externalMediaDirs = application . android . context . getExternalMediaDirs ( ) ;
32+ if ( externalMediaDirs . length > 1 ) {
33+ let filePath = externalMediaDirs [ 1 ] . getAbsolutePath ( ) ;
34+ filePath = filePath . substring ( 0 , filePath . indexOf ( "Android" ) ) + id ;
35+ return filePath ;
36+ }
37+ }
2538 }
26-
27- // TODO handle non-primary volumes
2839 }
2940 // DownloadsProvider
3041 else if ( UriHelper . isDownloadsDocument ( uri ) ) {
You can’t perform that action at this time.
0 commit comments