|
| 1 | +## 0.3.0 |
| 2 | + |
| 3 | +Major release focused on support for `Storage Access Framework`. |
| 4 | + |
| 5 | +### Breaking Changes |
| 6 | + |
| 7 | +- `minSdkVersion` set to `19`. |
| 8 | +- `getMediaStoreContentDirectory` return type changed to `Uri`. |
| 9 | +- Import package directive path is now modular. Which means you need to import the modules you are using: |
| 10 | + - `import 'package:shared_storage/saf.dart' as saf;` to enable **Storage Access Framework** API. |
| 11 | + - `import 'package:shared_storage/environment.dart' as environment;` to enable **Environment** API. |
| 12 | + - `import 'package:shared_storage/media_store.dart' as mediastore;` to enable **Media Store** API. |
| 13 | + - `import 'package:shared_storage/shared_storage' as sharedstorage;` if you want to import all above and as a single module (Not recommended because can conflict/override names/methods). |
| 14 | + |
| 15 | +### New Features |
| 16 | + |
| 17 | +See the label [reference here](/docs/Usage/API%20Labeling.md). |
| 18 | + |
| 19 | +- <samp>Original</samp> `listFiles`. This API does the same thing as `DocumentFile.listFiles` but through Android queries and not calling directly the `DocumentFile.listFiles` API for performance reasons. |
| 20 | + |
| 21 | +- <samp>Internal</samp> `DocumentFile` from [`DocumentFile`](https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile) SAF class. |
| 22 | + |
| 23 | +- <samp>Internal</samp> `QueryMetadata` metadata of the queries used by `listFiles` API. |
| 24 | + |
| 25 | +- <samp>Internal</samp> `PartialDocumentFile`. Represents a partial document file returned by `listFiles` API. |
| 26 | + |
| 27 | +- `openDocumentTree` now accepts `grantWritePermission` and `initialUri` params which, respectively, sets whether or not grant write permission level and the initial uri location of the folder authorization picker. |
| 28 | + |
| 29 | +- <samp>Mirror</samp> `DocumentFileColumn` from [`DocumentsContract.Document.<Column>`](https://developer.android.com/reference/android/provider/DocumentsContract.Document) SAF class. |
| 30 | + |
| 31 | +- <samp>Mirror</samp> `canRead` from [`DocumentFile.canRead`](<https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile#canRead()>). Returns `true` if the caller can read the given `uri`. |
| 32 | + |
| 33 | +- <samp>Mirror</samp> `canWrite` from [`DocumentFile.canWrite`](<https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile#canWrite()>). Returns `true` if the caller can write to the given `uri`. |
| 34 | + |
| 35 | +- <samp>Mirror</samp> `getDocumentThumbnail` from [`DocumentsContract.getDocumentThumbnail`](<https://developer.android.com/reference/android/provider/DocumentsContract#getDocumentThumbnail(android.content.ContentResolver,%20android.net.Uri,%20android.graphics.Point,%20android.os.CancellationSignal)>). Returns the image thumbnail of a given `uri`, if any (e.g documents that can show a preview, like image or pdf, otherwise `null`). |
| 36 | + |
| 37 | +- <samp>Mirror</samp> `exists` from [`DocumentsContract.exists`](<https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile#exists()>). Returns `true` if a given `uri` exists. |
| 38 | + |
| 39 | +- <samp>Mirror</samp> `buildDocumentUriUsingTree` from [`DocumentsContract.buildDocumentUriUsingTree`](<https://developer.android.com/reference/android/provider/DocumentsContract#buildDocumentUriUsingTree(android.net.Uri,%20java.lang.String)>). |
| 40 | + |
| 41 | +- <samp>Mirror</samp> `buildDocumentUri` from [`DocumentsContract.buildDocumentUri`](<https://developer.android.com/reference/android/provider/DocumentsContract#buildDocumentUri(java.lang.String,%20java.lang.String)>). |
| 42 | + |
| 43 | +- <samp>Mirror</samp> `buildTreeDocumentUri` from [`DocumentsContract.buildTreeDocumentUri`](<https://developer.android.com/reference/android/provider/DocumentsContract#buildTreeDocumentUri(java.lang.String,%20java.lang.String)>). |
| 44 | + |
| 45 | +- <samp>Mirror</samp> `delete` from [`DocumentFile.delete`](<https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile#delete()>). Self explanatory. |
| 46 | + |
| 47 | +- <samp>Mirror</samp> `createDirectory` from [`DocumentFile.createDirectory`](<https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile#createDirectory(java.lang.String)>). Creates a new child document file that represents a directory given the `displayName` (folder name). |
| 48 | + |
| 49 | +- <samp>Alias</samp> `createFile`. Alias for `createFileAsBytes` or `createFileAsString` depending which params are provided. |
| 50 | + |
| 51 | +- <samp>Mirror</samp> `createFileAsBytes` from [`DocumentFile.createFile`](<https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile#createFile(java.lang.String,%20java.lang.String)>). Given the parent uri, creates a new child document file that represents a single file given the `displayName`, `mimeType` and its `content` in bytes (file name, file type and file content in raw bytes, respectively). |
| 52 | + |
| 53 | +- <samp>Alias</samp> `createFileAsString`. Alias for `createFileAsBytes(bytes: Uint8List.fromList('file content...'.codeUnits))`. |
| 54 | + |
| 55 | +- <samp>Mirror</samp> `documentLength` from [`DocumentFile.length`](<https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile#length()>). Returns the length of the given file (uri) in bytes. Returns 0 if the file does not exist, or if the length is unknown. |
| 56 | + |
| 57 | +- <samp>Mirror</samp> `lastModified` from [`DocumentFile.lastModified`](<https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile#lastModified()>). Returns the time when the given file (uri) was last modified, measured in milliseconds since January 1st, 1970, midnight. Returns 0 if the file does not exist, or if the modified time is unknown. |
| 58 | + |
| 59 | +- <samp>Mirror</samp> `findFile` from [`DocumentFile.findFile`](<https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile#findFile(java.lang.String)>). Search through listFiles() for the first document matching the given display name, this method has a really poor performance for large data sets, prefer using `child` instead. |
| 60 | + |
| 61 | +- <samp>Mirror</samp> `fromTreeUri` from [`DocumentFile.fromTreeUri`](<https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile#fromTreeUri(android.content.Context,%20android.net.Uri)>). |
| 62 | + |
| 63 | +- <samp>Mirror</samp> `renameTo` from [`DocumentFile.renameTo`](<https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile#renameTo(java.lang.String)>). Rename a document file given its `uri` to the given `displayName`. |
| 64 | + |
| 65 | +- <samp>Mirror</samp> `parentFile` from [`DocumentFile.parentFile`](<https://developer.android.com/reference/androidx/documentfile/provider/DocumentFile#getParentFile()>). Get the parent document of the given document file from its uri. |
| 66 | + |
| 67 | +- <samp>Mirror</samp> `copy` from [`DocumentsContract.copyDocument`](<https://developer.android.com/reference/android/provider/DocumentsContract#copyDocument(android.content.ContentResolver,%20android.net.Uri,%20android.net.Uri)>). Copies the given document to the given `destination`. |
| 68 | + |
| 69 | +- <samp>Original</samp> `getDocumentContent`. Read a document file from its uri by opening a input stream and returning its bytes. |
| 70 | + |
| 71 | +- <samp>External</samp> `child` from [`com.anggrayudi.storage.file.DocumentFile.child`](https://github.com/anggrayudi/SimpleStorage/blob/551fae55641dc58a9d3d99cb58fdf51c3d312b2d/storage/src/main/java/com/anggrayudi/storage/file/DocumentFileExt.kt#L270). Find the child file of a given parent uri and child name, null if doesn't exists (faster than `findFile`). |
| 72 | + |
| 73 | +- <samp>Original `UNSTABLE`</samp> `openDocumentFile`. Open a file uri in a external app, by starting a new activity with `ACTION_VIEW` Intent. |
| 74 | + |
| 75 | +- <samp>Original `UNSTABLE`</samp> `getRealPathFromUri`. Return the real path to work with native old `File` API instead Uris, be aware this approach is no longer supported on Android 10+ (API 29+) and though new, this API is **marked as deprecated** and should be migrated to a _scoped-storage_ approach. |
| 76 | + |
| 77 | +- <samp>Alias</samp> `getDocumentContentAsString`. Alias for `getDocumentContent`. Convert all bytes returned by the original method into a `String`. |
| 78 | + |
| 79 | +- <samp>Internal</samp> `DocumentBitmap` class added. Commonly used as thumbnail image/bitmap of a `DocumentFile`. |
| 80 | + |
| 81 | +- <samp>Extension</samp> `UriDocumentFileUtils` on `Uri` (Accesible by `uri.extensionMethod(...)`). |
| 82 | + |
| 83 | + - <samp>Alias</samp> `toDocumentFile`. Alias for `DocumentFile.fromTreeUri(this)` which is an alias for `fromTreeUri`. method: convert `this` to the respective `DocumentFile` (if exists, otherwise `null`). |
| 84 | + - <samp>Alias</samp> `openDocumentFile`. Alias for `openDocumentFile`. |
| 85 | + |
| 86 | +- <samp>Mirror</samp> `getDownloadCacheDirectory` from [`Environment.getDataDirectory`](https://developer.android.com/reference/android/os/Environment#getDownloadCacheDirectory%28%29). |
| 87 | + |
| 88 | +- <samp>Mirror</samp> `getStorageDirectory` from [`Environment.getStorageDirectory`](https://developer.android.com/reference/android/os/Environment#getStorageDirectory%28%29). |
| 89 | + |
| 90 | +### Deprecation Notices |
| 91 | + |
| 92 | +- `getExternalStoragePublicDirectory` was marked as deprecated and should be replaced with an equivalent API depending on your use-case, see [how to migrate `getExternalStoragePublicDirectory`](https://stackoverflow.com/questions/56468539/getexternalstoragepublicdirectory-deprecated-in-android-q). This deprecation is originated from official Android documentation and not by the plugin itself. |
| 93 | + |
1 | 94 | ## 0.2.0 |
2 | 95 |
|
3 | | -Add basic support for `Storage Access Framework` and `targetSdk 31` |
| 96 | +Add basic support for `Storage Access Framework` and `targetSdk 31`. |
4 | 97 |
|
5 | | -- The package now supports basic intents from `Storage Access Framework` |
6 | | -- Your App needs update the `build.gradle` by targeting the current sdk to `31` |
| 98 | +- The package now supports basic intents from `Storage Access Framework`. |
| 99 | +- Your App needs update the `build.gradle` by targeting the current sdk to `31`. |
7 | 100 |
|
8 | 101 | ## 0.1.1 |
9 | 102 |
|
10 | | -Minor improvements on `pub.dev` documentation |
| 103 | +Minor improvements on `pub.dev` documentation. |
11 | 104 |
|
12 | | -- Add `example/` folder |
13 | | -- Add missing `pubspec.yaml` properties |
| 105 | +- Add `example/` folder. |
| 106 | +- Add missing `pubspec.yaml` properties. |
14 | 107 |
|
15 | 108 | ## 0.1.0 |
16 | 109 |
|
17 | | -Initial release |
| 110 | +Initial release. |
0 commit comments