diff --git a/.all-contributorsrc b/.all-contributorsrc index 016a4dd..84cba1a 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1,7 +1,7 @@ { "files": [ "README.md", - "docs/Getting Started.md" + "docs/index.md" ], "imageSize": 100, "contributorsPerLine": 7, @@ -58,6 +58,15 @@ "bug", "ideas" ] + }, + { + "login": "EternityForest", + "name": "Daniel Dunn", + "avatar_url": "https://avatars.githubusercontent.com/u/758047?v=4", + "profile": "https://eternityforest.com", + "contributions": [ + "bug" + ] } ], "projectName": "shared-storage", diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index b6bda89..0888702 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -3,7 +3,7 @@ name: Bug report about: Create a report to help us improve title: '' labels: bug -assignees: lakscastro +assignees: '' --- diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f1d1d0..6d69bb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 0.3.1 + +Minor improvements and bug fixes: + +- Crash when ommiting `DocumentFileColumn.id` column on `listFiles` API. Thanks to @EternityForest. +- Updated docs to info that now `DocumentFileColumn.id` column is optional when calling `listFiles`. + ## 0.3.0 Major release focused on support for `Storage Access Framework`. diff --git a/README.md b/README.md index ee3f807..363751c 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ These are the brilliant minds behind the development of this plugin!
www.bibliotecaortodoxa.ro

💻 🐛 🤔
dangilbert

💻 🐛
dhaval-k-simformsolutions

🐛 🤔 +
Daniel Dunn

🐛 diff --git a/android/src/main/kotlin/io/lakscastro/sharedstorage/storageaccessframework/lib/DocumentCommon.kt b/android/src/main/kotlin/io/lakscastro/sharedstorage/storageaccessframework/lib/DocumentCommon.kt index ee7083c..8e49462 100644 --- a/android/src/main/kotlin/io/lakscastro/sharedstorage/storageaccessframework/lib/DocumentCommon.kt +++ b/android/src/main/kotlin/io/lakscastro/sharedstorage/storageaccessframework/lib/DocumentCommon.kt @@ -8,14 +8,12 @@ import android.os.Build import android.provider.DocumentsContract import android.util.Base64 import androidx.annotation.RequiresApi -import androidx.annotation.RestrictTo import androidx.documentfile.provider.DocumentFile import io.lakscastro.sharedstorage.plugin.API_19 import io.lakscastro.sharedstorage.plugin.API_21 import io.lakscastro.sharedstorage.plugin.API_24 import java.io.ByteArrayOutputStream import java.io.Closeable -import java.io.File /** * Helper class to make more easy to handle callbacks using Kotlin syntax @@ -174,12 +172,17 @@ fun traverseDirectoryEntries( while (dirNodes.isNotEmpty()) { val (parent, children) = dirNodes.removeAt(0) - val requiredColumns = if (rootOnly) emptyArray() else arrayOf( - DocumentsContract.Document.COLUMN_MIME_TYPE, - DocumentsContract.Document.COLUMN_DOCUMENT_ID - ) + val requiredColumns = + if (rootOnly) emptyArray() else arrayOf(DocumentsContract.Document.COLUMN_MIME_TYPE) + + val intrinsicColumns = + arrayOf(DocumentsContract.Document.COLUMN_DOCUMENT_ID) - val projection = arrayOf(*columns, *requiredColumns).toSet().toTypedArray() + val projection = arrayOf( + *columns, + *requiredColumns, + *intrinsicColumns + ).toSet().toTypedArray() val cursor = contentResolver.query( children, @@ -198,7 +201,7 @@ fun traverseDirectoryEntries( while (cursor.moveToNext()) { val data = mutableMapOf() - for (column in columns) { + for (column in projection) { data[column] = cursorHandlerOf(typeOfColumn(column)!!)( cursor, cursor.getColumnIndexOrThrow(column) @@ -220,7 +223,7 @@ fun traverseDirectoryEntries( ) ) - if (isDirectory != null && isDirectory && !rootOnly) { + if (isDirectory == true && !rootOnly) { val nextChildren = DocumentsContract.buildChildDocumentsUriUsingTree(rootUri, id) diff --git a/docs/Usage/Storage Access Framework.md b/docs/Usage/Storage Access Framework.md index 7596ef0..41cd5d7 100644 --- a/docs/Usage/Storage Access Framework.md +++ b/docs/Usage/Storage Access Framework.md @@ -68,6 +68,8 @@ if (grantedUri != null) { This method list files lazily **over a granted uri:** +> **Note** `DocumentFileColumn.id` is optional. It is required to fetch the file list from native API. So it is enabled regardless if you include this column or not. And this applies only to this API (`listFiles`). + ```dart /// *Must* be a granted uri from `openDocumentTree` final Uri myGrantedUri = ... @@ -83,7 +85,7 @@ const List columns = [ DocumentFileColumn.displayName, DocumentFileColumn.size, DocumentFileColumn.lastModified, - DocumentFileColumn.id, + DocumentFileColumn.id, // Optional column, will be available/queried regardless if is or not included here DocumentFileColumn.mimeType, ]; diff --git a/docs/index.md b/docs/index.md index 58914ce..6b04301 100644 --- a/docs/index.md +++ b/docs/index.md @@ -70,7 +70,6 @@ Most Flutter plugins use Android API's under the hood. So this plugin does the s These are the brilliant minds behind the development of this plugin! - @@ -80,6 +79,7 @@ These are the brilliant minds behind the development of this plugin! +

www.bibliotecaortodoxa.ro

💻 🐛 🤔

dangilbert

💻 🐛

dhaval-k-simformsolutions

🐛 🤔

Daniel Dunn

🐛
diff --git a/example/lib/screens/folder_files/folder_file_list.dart b/example/lib/screens/folder_files/folder_file_list.dart index b869d64..292e35f 100644 --- a/example/lib/screens/folder_files/folder_file_list.dart +++ b/example/lib/screens/folder_files/folder_file_list.dart @@ -159,6 +159,7 @@ class _FolderFileListState extends State { DocumentFileColumn.displayName, DocumentFileColumn.size, DocumentFileColumn.lastModified, + // Optional column (this can't be removed because it's required to list files) DocumentFileColumn.id, DocumentFileColumn.mimeType, ]; diff --git a/pubspec.yaml b/pubspec.yaml index 65191f4..ccb99ff 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: shared_storage description: "Flutter plugin to get Android shared folders like DCIM, Downloads, Video, Audio. Works with Android 4.1 (API Level 16+)" -version: 0.3.0 +version: 0.3.1 homepage: https://github.com/lakscastro/shared-storage repository: https://github.com/lakscastro/shared-storage issue_tracker: https://github.com/lakscastro/shared-storage/issues