File tree Expand file tree Collapse file tree
main/java/com/anggrayudi/storage
test/java/com/anggrayudi/storage/file Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,4 +19,4 @@ android.useAndroidX=true
1919android.enableJetifier =true
2020# Kotlin code style for this project: "official" or "obsolete":
2121kotlin.code.style =official
22- STORAGE_VERSION =0.4.0
22+ STORAGE_VERSION =0.4.1
Original file line number Diff line number Diff line change @@ -360,9 +360,9 @@ class SimpleStorage private constructor(private val wrapper: ComponentWrapper) {
360360 .filter { it.isReadPermission && it.isWritePermission && it.uri.isExternalStorageDocument }
361361 .map { it.uri }
362362 val writeFlags = Intent .FLAG_GRANT_READ_URI_PERMISSION or Intent .FLAG_GRANT_WRITE_URI_PERMISSION
363- val uniqueUriParents = DocumentFileCompat .findUniqueParents(persistedUris.mapNotNull { it.path })
363+ val uniqueUriParents = DocumentFileCompat .findUniqueParents(persistedUris.mapNotNull { it.path?.substringAfter( " /tree/ " ) })
364364 persistedUris.forEach {
365- if (it.path !in uniqueUriParents) {
365+ if (DocumentFileCompat .buildAbsolutePath( it.path.orEmpty().substringAfter( " /tree/ " )) !in uniqueUriParents) {
366366 resolver.releasePersistableUriPermission(it, writeFlags)
367367 Timber .d(" Removed redundant URI permission => $it " )
368368 }
Original file line number Diff line number Diff line change @@ -59,9 +59,9 @@ class DocumentFileCompatTest {
5959 " /storage/9016-4EF8/Music/Favorites/Pop" ,
6060 " /storage/emulated/0/Music" ,
6161 " /storage/emulated/0/Music Indo" ,
62- " /tree/primary /b/c" ,
63- " /tree/primary /b" ,
64- " /tree/primary /b/d" ,
62+ " /folder/subFolder /b/c" ,
63+ " /folder/subFolder /b" ,
64+ " /folder/subFolder /b/d" ,
6565 " primary:Alarm/Morning" ,
6666 " primary:Alarm" ,
6767 )
@@ -72,7 +72,7 @@ class DocumentFileCompatTest {
7272 " /storage/9016-4EF8/Music" ,
7373 " /storage/emulated/0/Music" ,
7474 " /storage/emulated/0/Music Indo" ,
75- " /tree/primary /b" ,
75+ " /folder/subFolder /b" ,
7676 " /storage/emulated/0/Alarm" ,
7777 )
7878
You can’t perform that action at this time.
0 commit comments