File tree 1 file changed +13
-2
lines changed
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -22,9 +22,20 @@ class UriHelper {
22
22
23
23
if ( "primary" === type . toLowerCase ( ) ) {
24
24
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
+ }
25
38
}
26
-
27
- // TODO handle non-primary volumes
28
39
}
29
40
// DownloadsProvider
30
41
else if ( UriHelper . isDownloadsDocument ( uri ) ) {
You can’t perform that action at this time.
0 commit comments