@@ -51,10 +51,8 @@ internal interface DeviceFS {
5151 fun explore (query : Query , fileTree : FileTree ): Flow <DeviceDirectory >
5252
5353 companion object {
54- fun from (
55- context : Context ,
56- withHidden : Boolean
57- ): DeviceFS = DeviceFSImpl (context.contentResolverSafe, withHidden)
54+ fun from (context : Context , withHidden : Boolean ): DeviceFS =
55+ DeviceFSImpl (context.contentResolverSafe, withHidden)
5856 }
5957}
6058
@@ -65,9 +63,15 @@ private class DeviceFSImpl(
6563 private val explorationScope = CoroutineScope (Dispatchers .IO + SupervisorJob ())
6664
6765 override fun explore (query : Query , fileTree : FileTree ) =
68- query.source.asFlow().mapNotNull { location -> queryRoot(location, fileTree, query.exclude) }
66+ query.source.asFlow().mapNotNull { location ->
67+ queryRoot(location, fileTree, query.exclude)
68+ }
6969
70- private suspend fun queryRoot (location : OpenedLocation , fileTree : FileTree , exclude : List <Location >): DeviceDirectory ? {
70+ private suspend fun queryRoot (
71+ location : OpenedLocation ,
72+ fileTree : FileTree ,
73+ exclude : List <Location >
74+ ): DeviceDirectory ? {
7175 val treeDocumentId = DocumentsContract .getTreeDocumentId(location.uri)
7276 val uri = DocumentsContract .buildDocumentUriUsingTree(location.uri, treeDocumentId)
7377 val modifiedMs =
@@ -82,7 +86,8 @@ private class DeviceFSImpl(
8286 if (modifiedMs == null ) {
8387 return null
8488 }
85- return query(location.uri, treeDocumentId, location.path, modifiedMs, null , fileTree, exclude)
89+ return query(
90+ location.uri, treeDocumentId, location.path, modifiedMs, null , fileTree, exclude)
8691 }
8792
8893 private suspend fun query (
@@ -159,7 +164,7 @@ private class DeviceFSImpl(
159164 // Check if the current path matches the excluded path
160165 // exactly
161166 excluded.path.volume == newPath.volume &&
162- excluded.path.components == newPath.components
167+ excluded.path.components == newPath.components
163168 }
164169 if (shouldExclude) {
165170 continue
@@ -250,15 +255,17 @@ private class DeviceFSImpl(
250255 val shouldExclude =
251256 exclude.any { excluded ->
252257 excluded.path.volume == subdirPath.volume &&
253- excluded.path.components ==
258+ excluded.path.components ==
254259 subdirPath.components
255260 }
256261
257262 if (shouldExclude) {
258263 return @transform
259264 }
260265
261- emit(hydrateCached(cachedSubdir, dir, subdirPath, fileTree, exclude))
266+ emit(
267+ hydrateCached(
268+ cachedSubdir, dir, subdirPath, fileTree, exclude))
262269 }
263270 .filterNotNull(),
264271 cached.fileUris.asFlow().map {
0 commit comments