Compare commits

...

7 Commits

Author SHA1 Message Date
Amr Bashir 13e6268448 tauri 2.0.0-alpha.12 2023-08-15 03:15:45 +03:00
Amr Bashir 7a605d402b fix fs plugin 2023-08-15 03:12:43 +03:00
Amr Bashir 18635c2200 Merge branch 'v2' into feat/window/dnd-position 2023-08-15 03:11:01 +03:00
Lucas Fernandes Nogueira d0c0084859 fix(example): build on macOS (#557) 2023-08-14 15:54:29 -07:00
Lucas Fernandes Nogueira 265dbc02e3 chore(shell): remove outdated todo (#559) 2023-08-14 15:54:17 -07:00
Lucas Fernandes Nogueira aec17a90fc feat(http): improve performance (#558) 2023-08-14 15:53:55 -07:00
Amr Bashir cdae07afe6 feat(window): add drag and drop position 2023-08-14 06:34:55 +03:00
9 changed files with 44 additions and 24 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"http": patch
---
Improve response performance by using the new IPC streaming data.
+5
View File
@@ -0,0 +1,5 @@
---
"window-js": "minor"
---
Add position information to file drop events.
+1 -1
View File
@@ -5,7 +5,7 @@ resolver = "2"
[workspace.dependencies]
serde = { version = "1", features = ["derive"] }
log = "0.4"
tauri = "2.0.0-alpha.11"
tauri = "2.0.0-alpha.12"
tauri-build = "2.0.0-alpha.8"
serde_json = "1"
thiserror = "1"
+1 -1
View File
@@ -124,7 +124,7 @@ pub fn run() {
#[cfg(target_os = "macos")]
{
builder = builder.menu(tauri::Menu::os_default("Tauri API Validation"));
builder = builder.menu(tauri::menu::Menu::default);
}
#[allow(unused_mut)]
+1 -1
View File
@@ -83,7 +83,7 @@ pub fn init<R: Runtime>() -> TauriPlugin<R, Option<Config>> {
.on_event(|app, event| {
if let RunEvent::WindowEvent {
label: _,
event: WindowEvent::FileDrop(FileDropEvent::Dropped(paths)),
event: WindowEvent::FileDrop(FileDropEvent::Dropped { paths, .. }),
..
} = event
{
+2 -3
View File
@@ -163,16 +163,15 @@ pub async fn fetch_send<R: Runtime>(
})
}
// TODO: change return value to tauri::ipc::Response on next alpha
#[command]
pub(crate) async fn fetch_read_body<R: Runtime>(
app: AppHandle<R>,
rid: RequestId,
) -> crate::Result<Vec<u8>> {
) -> crate::Result<tauri::ipc::Response> {
let mut response_table = app.http().responses.lock().await;
let res = response_table
.remove(&rid)
.ok_or(Error::InvalidRequestId(rid))?;
Ok(res.bytes().await?.to_vec())
Ok(tauri::ipc::Response::new(res.bytes().await?.to_vec()))
}
-3
View File
@@ -242,8 +242,6 @@ impl Command {
let child_ = child.clone();
let guard = Arc::new(RwLock::new(()));
//TODO commands().lock().unwrap().insert(child.id(), child.clone());
let (tx, rx) = channel(1);
spawn_pipe_reader(
@@ -263,7 +261,6 @@ impl Command {
let _ = match child_.wait() {
Ok(status) => {
let _l = guard.write().unwrap();
//TODO commands().lock().unwrap().remove(&child_.id());
block_on_task(async move {
tx.send(CommandEvent::Terminated(TerminatedPayload {
code: status.code(),
+28 -14
View File
@@ -63,8 +63,8 @@ interface ScaleFactorChanged {
/** The file drop event types. */
type FileDropEvent =
| { type: "hover"; paths: string[] }
| { type: "drop"; paths: string[] }
| { type: "hover"; paths: string[]; position: PhysicalPosition }
| { type: "drop"; paths: string[]; position: PhysicalPosition }
| { type: "cancel" };
/**
@@ -1901,19 +1901,33 @@ class Window {
async onFileDropEvent(
handler: EventCallback<FileDropEvent>,
): Promise<UnlistenFn> {
const unlistenFileDrop = await this.listen<string[]>(
TauriEvent.WINDOW_FILE_DROP,
(event) => {
handler({ ...event, payload: { type: "drop", paths: event.payload } });
},
);
const unlistenFileDrop = await this.listen<{
paths: string[];
position: PhysicalPosition;
}>(TauriEvent.WINDOW_FILE_DROP, (event) => {
handler({
...event,
payload: {
type: "drop",
paths: event.payload.paths,
position: mapPhysicalPosition(event.payload.position),
},
});
});
const unlistenFileHover = await this.listen<string[]>(
TauriEvent.WINDOW_FILE_DROP_HOVER,
(event) => {
handler({ ...event, payload: { type: "hover", paths: event.payload } });
},
);
const unlistenFileHover = await this.listen<{
paths: string[];
position: PhysicalPosition;
}>(TauriEvent.WINDOW_FILE_DROP_HOVER, (event) => {
handler({
...event,
payload: {
type: "hover",
paths: event.payload.paths,
position: mapPhysicalPosition(event.payload.position),
},
});
});
const unlistenCancel = await this.listen<null>(
TauriEvent.WINDOW_FILE_DROP_CANCELLED,
File diff suppressed because one or more lines are too long