Skip to content

Commit 43aa404

Browse files
author
lask
authored
Merge pull request #46 from lakscastro/master
`v0.3.0` Release Merge
2 parents 4c94208 + 888bc6c commit 43aa404

File tree

78 files changed

+5134
-1032
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+5134
-1032
lines changed

.all-contributorsrc

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"files": [
3+
"README.md",
4+
"docs/Getting Started.md"
5+
],
6+
"imageSize": 100,
7+
"contributorsPerLine": 7,
8+
"contributorsSortAlphabetically": false,
9+
"skipCi": true,
10+
"contributors": [
11+
{
12+
"login": "lakscastro",
13+
"name": "lask",
14+
"avatar_url": "https://avatars.githubusercontent.com/u/51419598?v=4",
15+
"profile": "https://lakscastro.github.io",
16+
"contributions": [
17+
"code",
18+
"maintenance",
19+
"doc"
20+
]
21+
},
22+
{
23+
"login": "ankitparmar007",
24+
"name": "ankitparmar007",
25+
"avatar_url": "https://avatars.githubusercontent.com/u/73648141?v=4",
26+
"profile": "https://github.com/ankitparmar007",
27+
"contributions": [
28+
"bug"
29+
]
30+
},
31+
{
32+
"login": "aplicatii-romanesti",
33+
"name": "www.bibliotecaortodoxa.ro",
34+
"avatar_url": "https://avatars.githubusercontent.com/u/1148228?v=4",
35+
"profile": "https://www.bibliotecaortodoxa.ro",
36+
"contributions": [
37+
"code",
38+
"bug",
39+
"ideas"
40+
]
41+
},
42+
{
43+
"login": "dangilbert",
44+
"name": "dangilbert",
45+
"avatar_url": "https://avatars.githubusercontent.com/u/6799566?v=4",
46+
"profile": "https://github.com/dangilbert",
47+
"contributions": [
48+
"code",
49+
"bug"
50+
]
51+
},
52+
{
53+
"login": "dhaval-k-simformsolutions",
54+
"name": "dhaval-k-simformsolutions",
55+
"avatar_url": "https://avatars.githubusercontent.com/u/90894202?v=4",
56+
"profile": "https://github.com/dhaval-k-simformsolutions",
57+
"contributions": [
58+
"bug",
59+
"ideas"
60+
]
61+
}
62+
],
63+
"projectName": "shared-storage",
64+
"projectOwner": "lakscastro",
65+
"repoType": "github",
66+
"repoHost": "https://github.com"
67+
}

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[*.{kt,kts}]
2+
# possible values: number (e.g. 2), "unset" (makes ktlint ignore indentation completely)
3+
indent_size=2
4+
# true (recommended) / false
5+
insert_final_newline=true
6+
# possible values: number (e.g. 120) (package name, imports & comments are ignored), "off"
7+
# it's automatically set to 100 on `ktlint --android ...` (per Android Kotlin Style Guide)
8+
max_line_length=80
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: lakscastro
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior
15+
16+
**Expected behavior**
17+
A clear and concise description of what you expected to happen.
18+
19+
**Screenshots**
20+
If applicable, add screenshots to help explain your problem.
21+
22+
**Desktop (please complete the following information):**
23+
- OS: [e.g. iOS]
24+
- Browser [e.g. chrome, safari]
25+
- Version [e.g. 22]
26+
27+
**Smartphone (please complete the following information):**
28+
- Device: [e.g. iPhone6]
29+
- OS: [e.g. iOS8.1]
30+
- Browser [e.g. stock browser, safari]
31+
- Version [e.g. 22]
32+
33+
**Additional context**
34+
Add any other context about the problem here.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Secret Vault . . .

.github/workflows/build-docs.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Build MkDocs
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- release
7+
8+
jobs:
9+
sync:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Checkout to documentation branch
15+
run: |
16+
git fetch
17+
git checkout ${{ github.ref_name }}
18+
19+
- name: Deploy docs
20+
uses: mhausenblas/mkdocs-deploy-gh-pages@master
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
CONFIG_FILE: mkdocs.yaml
24+
EXTRA_PACKAGES: build-base

.github/workflows/publish.yaml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
on:
1+
name: Publish new plugin version
2+
on:
3+
workflow_dispatch:
24
push:
35
branches:
46
- release
@@ -11,5 +13,24 @@ jobs:
1113
- uses: actions/checkout@v2
1214
- uses: dart-lang/setup-dart@v1
1315

14-
- name: Run Pub Publish
16+
- name: Checkout to release branch
17+
run: |
18+
git fetch
19+
git checkout ${{ github.ref_name }}
20+
21+
- name: Create credentials file
22+
run: echo $PUB_CREDENTIALS > ~/pub-credentials.json
23+
env:
24+
PUB_CREDENTIALS: ${{ secrets.PUB_CREDENTIALS }}
25+
26+
- name: Add credentials to Dart folder
27+
run: |
28+
mkdir -p ${XDG_CONFIG_HOME:-${HOME:-default}}/dart
29+
touch ${XDG_CONFIG_HOME:-${HOME:-default}}/dart/pub-credentials.json
30+
cp ~/pub-credentials.json ${XDG_CONFIG_HOME:-${HOME:-default}}/dart/pub-credentials.json
31+
env:
32+
PUB_CREDENTIALS: ${{ secrets.PUB_CREDENTIALS }}
33+
34+
- name: Publish
1535
run: dart pub publish --force
36+

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
.svn/
1111

1212
*/**/pubspec.lock
13+
pubspec.lock
14+
venv/
15+
site/
1316

1417
# IntelliJ related
1518
*.iml

.pubignore

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
.buildlog/
99
.history
1010
.svn/
11+
.github/
1112

1213
# IntelliJ related
1314
*.iml
@@ -16,10 +17,11 @@
1617
.idea/
1718
*/**/local.properties
1819
loca.properties
19-
# The .vscode folder contains launch configuration and tasks you configure in
20-
# VS Code which you may wish to be included in version control, so this line
21-
# is commented out by default.
22-
#.vscode/
20+
.vscode/
21+
site/
22+
docs/
23+
*venv/
24+
mkdocs.yaml
2325

2426
*/**/.metadata
2527
.metadata

CHANGELOG.md

Lines changed: 100 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,110 @@
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+
194
## 0.2.0
295

3-
Add basic support for `Storage Access Framework` and `targetSdk 31`
96+
Add basic support for `Storage Access Framework` and `targetSdk 31`.
497

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`.
7100

8101
## 0.1.1
9102

10-
Minor improvements on `pub.dev` documentation
103+
Minor improvements on `pub.dev` documentation.
11104

12-
- Add `example/` folder
13-
- Add missing `pubspec.yaml` properties
105+
- Add `example/` folder.
106+
- Add missing `pubspec.yaml` properties.
14107

15108
## 0.1.0
16109

17-
Initial release
110+
Initial release.

0 commit comments

Comments
 (0)