Skip to content

Commit f0efc8f

Browse files
authored
feat: document required configuration for filesystem plugin on mobile (#2764)
1 parent e67e092 commit f0efc8f

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

src/content/docs/plugin/file-system.mdx

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,46 @@ Install the fs plugin to get started.
7474

7575
</Tabs>
7676

77+
## Configuration
78+
79+
### Android
80+
81+
When using the audio, cache, documents, downloads, picture, public or video directories your app must have access to the external storage.
82+
83+
Include the following permissions to the `manifest` tag in the `gen/android/app/src/main/AndroidManifest.xml` file:
84+
85+
```xml
86+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
87+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
88+
```
89+
90+
### iOS
91+
92+
Apple requires app developers to specify approved reasons for API usage to enhance user privacy.
93+
94+
You must create a `PrivacyInfo.xcprivacy` file in the `src-tauri/gen/apple` folder
95+
with the required [NSPrivacyAccessedAPICategoryFileTimestamp] key and the [C617.1] recommended reason.
96+
97+
```xml
98+
<?xml version="1.0" encoding="UTF-8"?>
99+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
100+
<plist version="1.0">
101+
<dict>
102+
<key>NSPrivacyAccessedAPITypes</key>
103+
<array>
104+
<dict>
105+
<key>NSPrivacyAccessedAPIType</key>
106+
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
107+
<key>NSPrivacyAccessedAPITypeReasons</key>
108+
<array>
109+
<string>C617.1</string>
110+
</array>
111+
</dict>
112+
</array>
113+
</dict>
114+
</plist>
115+
```
116+
77117
## Usage
78118

79119
The fs plugin is available in both JavaScript and Rust.
@@ -670,6 +710,8 @@ use the the object form of permissions `{ "identifier": string, "allow"?: [], "d
670710
In the above example you can use the [`exists`](#exists) API using any `$APPDATA` sub path (does not include sub-directories)
671711
and the [`rename`](#rename)
672712

713+
[NSPrivacyAccessedAPICategoryFileTimestamp]: https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api#4278393
714+
[C617.1]: https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api#4278393
673715
[base directory]: /reference/javascript/api/namespacepath/#basedirectory
674716
[path API]: reference/javascript/api/namespacepath
675717
[@tauri-apps/plugin-fs - Security]: /reference/javascript/fs/#security

0 commit comments

Comments
 (0)