Skip to content

Commit b729203

Browse files
fix(upload): fix download() locks main thread on Android (#2838)
Co-authored-by: Fabian-Lars <github@fabianlars.de>
1 parent 2f9c71a commit b729203

File tree

11 files changed

+553
-74
lines changed

11 files changed

+553
-74
lines changed

.changes/upload-locks-main-thread.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
upload: patch
3+
upload-js: patch
4+
---
5+
6+
Fix `download` and `upload` locks main thread on Android.
7+
Use Tokio to spawn task when invoking commands.

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ This repo and all plugins require a Rust version of at least **1.77.2**
3333
| [store](plugins/store) | Persistent key value storage. ||||||
3434
| [stronghold](plugins/stronghold) | Encrypted, secure database. |||| ? | ? |
3535
| [updater](plugins/updater) | In-app updates for Tauri applications. ||||||
36-
| [upload](plugins/upload) | Tauri plugin for file uploads through HTTP. |||| ? | ? |
36+
| [upload](plugins/upload) | Tauri plugin for file uploads through HTTP. |||| | |
3737
| [websocket](plugins/websocket) | Open a WebSocket connection using a Rust client in JS. |||| ? | ? |
3838
| [window-state](plugins/window-state) | Persist window sizes and positions. ||||||
3939

examples/api/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@tauri-apps/plugin-shell": "^2.3.0",
3030
"@tauri-apps/plugin-store": "^2.3.0",
3131
"@tauri-apps/plugin-updater": "^2.9.0",
32+
"@tauri-apps/plugin-upload": "^2.3.0",
3233
"@zerodevx/svelte-json-view": "1.0.11"
3334
},
3435
"devDependencies": {

examples/api/src-tauri/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ tauri-plugin-process = { path = "../../../plugins/process", version = "2.3.0" }
3838
tauri-plugin-opener = { path = "../../../plugins/opener", version = "2.4.0" }
3939
tauri-plugin-shell = { path = "../../../plugins/shell", version = "2.3.0" }
4040
tauri-plugin-store = { path = "../../../plugins/store", version = "2.3.0" }
41+
tauri-plugin-upload = { path = "../../../plugins/upload", version = "2.3.0" }
4142

4243
[dependencies.tauri]
4344
workspace = true

examples/api/src-tauri/capabilities/base.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
{
9696
"identifier": "opener:allow-open-path",
9797
"allow": [{ "path": "$APPDATA" }, { "path": "$APPDATA/**" }]
98-
}
98+
},
99+
"upload:default"
99100
]
100101
}

examples/api/src-tauri/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ pub fn run() {
3939
.plugin(tauri_plugin_opener::init())
4040
.plugin(tauri_plugin_shell::init())
4141
.plugin(tauri_plugin_store::Builder::default().build())
42+
.plugin(tauri_plugin_upload::init())
4243
.setup(move |app| {
4344
#[cfg(desktop)]
4445
{

examples/api/src/App.svelte

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import Opener from './views/Opener.svelte'
1717
import Store from './views/Store.svelte'
1818
import Updater from './views/Updater.svelte'
19+
import Upload from './views/Upload.svelte'
1920
import Clipboard from './views/Clipboard.svelte'
2021
import WebRTC from './views/WebRTC.svelte'
2122
import Scanner from './views/Scanner.svelte'
@@ -107,6 +108,11 @@
107108
component: Updater,
108109
icon: 'i-codicon-cloud-download'
109110
},
111+
{
112+
label: 'Upload',
113+
component: Upload,
114+
icon: 'i-codicon-cloud-upload'
115+
},
110116
{
111117
label: 'Clipboard',
112118
component: Clipboard,

0 commit comments

Comments
 (0)