File tree Expand file tree Collapse file tree
app/src/main/java/com/nextcloud/utils/extensions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,17 +11,17 @@ import com.owncloud.android.datamodel.SyncedFolder
1111import com.owncloud.android.datamodel.SyncedFolderDisplayItem
1212import java.io.File
1313
14-
1514fun List<SyncedFolderDisplayItem>.filterEnabledOrWithoutEnabledParent (): List <SyncedFolderDisplayItem > {
1615 return filter { it.isEnabled || ! hasEnabledParent(it.localPath) }
1716}
1817
18+ @Suppress(" ReturnCount" )
1919fun List<SyncedFolder>.hasEnabledParent (localPath : String? ): Boolean {
2020 localPath ? : return false
2121
2222 val localFile = File (localPath).takeIf { it.exists() } ? : return false
2323 val parent = localFile.parentFile ? : return false
2424
25- return any { it.isEnabled && File (it.localPath).exists() && File (it.localPath) == parent }
26- || hasEnabledParent(parent.absolutePath)
25+ return any { it.isEnabled && File (it.localPath).exists() && File (it.localPath) == parent } ||
26+ hasEnabledParent(parent.absolutePath)
2727}
You can’t perform that action at this time.
0 commit comments