Skip to content

Commit 5f98d2d

Browse files
committed
Remove INTERNAL_STORAGE const from utils
1 parent c17719b commit 5f98d2d

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

filepicker/src/main/java/dev/arkbuilders/components/filepicker/ArkRootPickerFragment.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import androidx.core.os.bundleOf
44
import androidx.fragment.app.setFragmentResult
55
import androidx.lifecycle.lifecycleScope
66
import dev.arkbuilders.arklib.data.folders.FoldersRepo
7+
import dev.arkbuilders.arklib.utils.INTERNAL_STORAGE
78
import dev.arkbuilders.components.utils.hasNestedRoot
8-
import dev.arkbuilders.components.utils.isInternalStorage
99
import kotlinx.coroutines.Dispatchers
1010
import kotlinx.coroutines.launch
1111
import java.nio.file.Path
@@ -18,7 +18,7 @@ class ArkRootPickerFragment : ArkFilePickerFragment() {
1818
val folders = FoldersRepo.instance.provideFolders()
1919
val roots = folders.keys
2020

21-
if (currentFolder.isInternalStorage() || currentFolder.hasNestedRoot(roots)) {
21+
if (currentFolder == INTERNAL_STORAGE || currentFolder.hasNestedRoot(roots)) {
2222
rootNotFavorite = true
2323
binding.btnPick.text = getString(R.string.ark_file_picker_root)
2424
binding.btnPick.isEnabled = false
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package dev.arkbuilders.components.utils
22

33
import java.nio.file.Path
4-
import kotlin.io.path.Path
5-
6-
val INTERNAL_STORAGE = Path("/storage/emulated/0")
74

85
fun Path.hasNestedOrParentalRoot(roots: Iterable<Path>): Boolean {
96
val hasNestedRoot = roots.any { path ->
@@ -12,6 +9,4 @@ fun Path.hasNestedOrParentalRoot(roots: Iterable<Path>): Boolean {
129
return hasNestedRoot
1310
}
1411

15-
fun Path.hasNestedRoot(roots: Iterable<Path>) = roots.any { it.startsWith(this) }
16-
17-
fun Path.isInternalStorage() = this == INTERNAL_STORAGE
12+
fun Path.hasNestedRoot(roots: Iterable<Path>) = roots.any { it.startsWith(this) }

0 commit comments

Comments
 (0)