From 9aa4693ee7381201d4f95b07cb76830babef5c09 Mon Sep 17 00:00:00 2001 From: tuancoltech Date: Mon, 4 Mar 2024 22:55:07 +0700 Subject: [PATCH] Disallow File pinning: https://github.com/ARK-Builders/ark-android/issues/76 --- .../components/filepicker/ArkFilePickerViewModel.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/filepicker/src/main/java/dev/arkbuilders/components/filepicker/ArkFilePickerViewModel.kt b/filepicker/src/main/java/dev/arkbuilders/components/filepicker/ArkFilePickerViewModel.kt index 27c2abb..f8dde7f 100644 --- a/filepicker/src/main/java/dev/arkbuilders/components/filepicker/ArkFilePickerViewModel.kt +++ b/filepicker/src/main/java/dev/arkbuilders/components/filepicker/ArkFilePickerViewModel.kt @@ -1,5 +1,6 @@ package dev.arkbuilders.components.filepicker +import android.util.Log import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.viewModelScope @@ -180,6 +181,9 @@ internal class ArkFilePickerViewModel( } fun pinFile(file: Path) = intent { + Log.d("tuancoltech", "pinFile isDirectory: " + file.isDirectory()) + if (!file.isDirectory()) return@intent + val rootsWithFavorites = container.stateFlow.value.rootsWithFavs val roots = rootsWithFavorites.keys val root = roots.find { root -> file.startsWith(root) }