Skip to content

Commit b806fbd

Browse files
committed
(#111) Add CHANGELOG.md and docs for new and deprecated APIs
1 parent e3ed468 commit b806fbd

File tree

5 files changed

+76
-2
lines changed

5 files changed

+76
-2
lines changed

CHANGELOG.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
1+
## 0.7.0
2+
3+
- New APIs and options.
4+
- There's no major breaking changes when updating to `v0.7.0` but there are deprecation notices over Media Store and Environment API.
5+
6+
### New
7+
8+
- `openDocument` API with single and multiple files support @honjow.
9+
- `openDocumentTree` it now also supports `persistablePermission` option which flags an one-time operation to avoid unused permission issues.
10+
11+
### Deprecation notices
12+
13+
- All non SAF APIs are deprecated (Media Store and Environment APIs), if you are using them, let us know by [opening an issue](https://github.com/alexrintt/shared-storage/issues/new) with your use-case so we can implement a new compatible API using a cross-platform approach.
14+
15+
### Example project
16+
17+
- Added a new button that implements `openDocument` API.
18+
119
## 0.6.0
220

321
This release contains a severe API fixes and some minor doc changes:
422

523
### Breaking changes
624

7-
- Unused arguments in `DocumentFile.getContent` and `DocumentFile.getContentAsString`. [#107](https://github.com/alexrintt/shared-storage/issues/107).
25+
- Unused arguments in `DocumentFile.getContent` and `DocumentFile.getContentAsString`. [#107](https://github.com/alexrintt/shared-storage/issues/107) @clragon.
826
- Package import it's now done through a single import.
927

1028
## 0.5.0
@@ -170,7 +188,7 @@ See the label [reference here](/docs/Usage/API%20Labeling.md).
170188

171189
- <samp>Mirror</samp> `getStorageDirectory` from [`Environment.getStorageDirectory`](https://developer.android.com/reference/android/os/Environment#getStorageDirectory%28%29).
172190

173-
### Deprecation Notices
191+
### Deprecation notices
174192

175193
- `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.
176194

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
There's no major breaking changes when updating to `v0.7.0` but there are deprecation notices if you are using Media Store and Environment API.
2+
3+
Update your `pubspec.yaml`:
4+
5+
```yaml
6+
dependencies:
7+
shared_storage: ^0.7.0
8+
```
9+
10+
## Deprecation notices
11+
12+
All non SAF APIs are deprecated, if you are using them, let us know by [opening an issue](https://github.com/alexrintt/shared-storage/issues/new) with your use-case so we can implement a new compatible API using a cross-platform approach.

docs/Usage/Environment.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
> **WARNING** This API is deprecated and will be removed soon. If you need it, please open an issue with your use-case to include in the next release as part of the new original cross-platform API.
2+
13
## Import package
24

35
```dart

docs/Usage/Media Store.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
> **WARNING** This API is deprecated and will be removed soon. If you need it, please open an issue with your use-case to include in the next release as part of the new original cross-platform API.
2+
13
## Import package
24

35
```dart

docs/Usage/Storage Access Framework.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,46 @@ if (grantedUri != null) {
6464
}
6565
```
6666

67+
### <samp>openDocument</samp>
68+
69+
Same as `openDocumentTree` but for file URIs, you can request user to select a file and filter by:
70+
71+
- Single or multiple files.
72+
- Mime type.
73+
74+
You can also specify if you want a one-time operation (`persistablePermission` = false) and if you don't need write access (`grantWritePermission` = false).
75+
76+
```dart
77+
const kDownloadsFolder =
78+
'content://com.android.externalstorage.documents/tree/primary%3ADownloads/document/primary%3ADownloads';
79+
80+
final List<Uri>? selectedDocumentUris = await openDocument(
81+
// if you have a previously saved URI,
82+
// you can use the specify the tree you user will see at startup of the file picker.
83+
initialUri: Uri.parse(kDownloadsFolder),
84+
85+
// whether or not allow the user select multiple files.
86+
multiple: true,
87+
88+
// whether or not the selected URIs should be persisted across app and device reboots.
89+
persistablePermission: true,
90+
91+
// whether or not grant write permission required to edit file metadata (name) and it's contents.
92+
grantWritePermission: true,
93+
94+
// whether or not filter by mime type.
95+
mimeType: 'image/*' // default '*/*'
96+
);
97+
98+
if (selectedDocumentUris == null) {
99+
return print('User cancelled the operation.');
100+
}
101+
102+
// If [selectedDocumentUris] are [persistablePermission]s then it will be returned by this function
103+
// along with any another URIs you've got permission over.
104+
final List<UriPermission> persistedUris = await persistedUriPermissions();
105+
```
106+
67107
### <samp>listFiles</samp>
68108

69109
This method list files lazily **over a granted uri:**

0 commit comments

Comments
 (0)