Add: just commands for release build
This commit is contained in:
@@ -153,6 +153,8 @@ fn main() -> Result<(), AppError> {
|
||||
}
|
||||
|
||||
let command_rx = runtime_core.command_receiver();
|
||||
let runtime_core_for_commands = Arc::clone(&runtime_core);
|
||||
let app_handle_for_commands = app_handle.clone();
|
||||
runtime.spawn(async move {
|
||||
loop {
|
||||
let next = {
|
||||
@@ -163,24 +165,45 @@ fn main() -> Result<(), AppError> {
|
||||
break;
|
||||
};
|
||||
|
||||
if let Err(err) = runtime_core.apply_command(&envelope.command) {
|
||||
if let Err(err) = runtime_core_for_commands.apply_command(&envelope.command) {
|
||||
warn!(%err, "failed to apply command in tauri runtime");
|
||||
continue;
|
||||
}
|
||||
|
||||
let payload = {
|
||||
let snapshot = runtime_core.snapshot();
|
||||
let snapshot = runtime_core_for_commands.snapshot();
|
||||
match snapshot.read() {
|
||||
Ok(s) => Some(to_ui_snapshot(&s)),
|
||||
Err(_) => None,
|
||||
}
|
||||
};
|
||||
if let Some(value) = payload {
|
||||
let _ = app_handle.emit("runtime:snapshot", value);
|
||||
let _ = app_handle_for_commands.emit("runtime:snapshot", value);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
let runtime_core = Arc::clone(&runtime_core);
|
||||
let app_handle = app_handle.clone();
|
||||
window.on_window_event(move |event| {
|
||||
if let tauri::WindowEvent::Moved(position) = event {
|
||||
let command = sprimo_protocol::v1::FrontendCommand::SetTransform {
|
||||
x: Some(position.x as f32),
|
||||
y: Some(position.y as f32),
|
||||
anchor: None,
|
||||
scale: None,
|
||||
opacity: None,
|
||||
};
|
||||
if runtime_core.apply_command(&command).is_ok() {
|
||||
if let Ok(snapshot) = runtime_core.snapshot().read() {
|
||||
let _ = app_handle.emit("runtime:snapshot", to_ui_snapshot(&snapshot));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let _ = app;
|
||||
Ok(())
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user