chore: cargo fmt
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
|
lock_w,
|
||||||
services::client_config_manager::{
|
services::client_config_manager::{
|
||||||
load_app_config, open_config_manager_window, save_app_config, AppConfig,
|
load_app_config, open_config_manager_window, save_app_config, AppConfig,
|
||||||
},
|
},
|
||||||
state::FDOLL,
|
state::FDOLL,
|
||||||
lock_w,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
|
lock_r,
|
||||||
remotes::{
|
remotes::{
|
||||||
dolls::{CreateDollDto, DollDto, DollsRemote, UpdateDollDto},
|
dolls::{CreateDollDto, DollDto, DollsRemote, UpdateDollDto},
|
||||||
user::UserRemote,
|
user::UserRemote,
|
||||||
},
|
},
|
||||||
state::{init_app_data_scoped, AppDataRefreshScope, FDOLL},
|
state::{init_app_data_scoped, AppDataRefreshScope, FDOLL},
|
||||||
lock_r,
|
|
||||||
};
|
};
|
||||||
use tauri::async_runtime;
|
use tauri::async_runtime;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
use crate::{
|
use crate::{models::interaction::SendInteractionDto, services::interaction::send_interaction};
|
||||||
models::interaction::SendInteractionDto,
|
|
||||||
services::interaction::send_interaction,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub async fn send_interaction_cmd(dto: SendInteractionDto) -> Result<(), String> {
|
pub async fn send_interaction_cmd(dto: SendInteractionDto) -> Result<(), String> {
|
||||||
|
|||||||
@@ -2,10 +2,7 @@ use serde_json::json;
|
|||||||
use tracing::{error, info};
|
use tracing::{error, info};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
lock_r,
|
lock_r, models::interaction::SendInteractionDto, services::ws::WS_EVENT, state::FDOLL,
|
||||||
models::interaction::SendInteractionDto,
|
|
||||||
services::ws::WS_EVENT,
|
|
||||||
state::FDOLL,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub async fn send_interaction(dto: SendInteractionDto) -> Result<(), String> {
|
pub async fn send_interaction(dto: SendInteractionDto) -> Result<(), String> {
|
||||||
@@ -49,7 +46,8 @@ pub async fn send_interaction(dto: SendInteractionDto) -> Result<(), String> {
|
|||||||
// but we are in an async context. Ideally we spawn_blocking.
|
// but we are in an async context. Ideally we spawn_blocking.
|
||||||
let spawn_result = tauri::async_runtime::spawn_blocking(move || {
|
let spawn_result = tauri::async_runtime::spawn_blocking(move || {
|
||||||
socket.emit(WS_EVENT::CLIENT_SEND_INTERACTION, payload)
|
socket.emit(WS_EVENT::CLIENT_SEND_INTERACTION, payload)
|
||||||
}).await;
|
})
|
||||||
|
.await;
|
||||||
|
|
||||||
match spawn_result {
|
match spawn_result {
|
||||||
Ok(emit_result) => match emit_result {
|
Ok(emit_result) => match emit_result {
|
||||||
|
|||||||
@@ -379,7 +379,8 @@ fn on_interaction_received(payload: Payload, _socket: RawClient) {
|
|||||||
|
|
||||||
match interaction_data {
|
match interaction_data {
|
||||||
Ok(data) => {
|
Ok(data) => {
|
||||||
if let Err(e) = get_app_handle().emit(WS_EVENT::INTERACTION_RECEIVED, data) {
|
if let Err(e) = get_app_handle().emit(WS_EVENT::INTERACTION_RECEIVED, data)
|
||||||
|
{
|
||||||
error!("Failed to emit interaction-received event: {:?}", e);
|
error!("Failed to emit interaction-received event: {:?}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -399,14 +400,19 @@ fn on_interaction_delivery_failed(payload: Payload, _socket: RawClient) {
|
|||||||
match payload {
|
match payload {
|
||||||
Payload::Text(values) => {
|
Payload::Text(values) => {
|
||||||
if let Some(first_value) = values.first() {
|
if let Some(first_value) = values.first() {
|
||||||
info!("Received interaction-delivery-failed event: {:?}", first_value);
|
info!(
|
||||||
|
"Received interaction-delivery-failed event: {:?}",
|
||||||
|
first_value
|
||||||
|
);
|
||||||
|
|
||||||
let failure_data: Result<InteractionDeliveryFailedDto, _> =
|
let failure_data: Result<InteractionDeliveryFailedDto, _> =
|
||||||
serde_json::from_value(first_value.clone());
|
serde_json::from_value(first_value.clone());
|
||||||
|
|
||||||
match failure_data {
|
match failure_data {
|
||||||
Ok(data) => {
|
Ok(data) => {
|
||||||
if let Err(e) = get_app_handle().emit(WS_EVENT::INTERACTION_DELIVERY_FAILED, data) {
|
if let Err(e) =
|
||||||
|
get_app_handle().emit(WS_EVENT::INTERACTION_DELIVERY_FAILED, data)
|
||||||
|
{
|
||||||
error!("Failed to emit interaction-delivery-failed event: {:?}", e);
|
error!("Failed to emit interaction-delivery-failed event: {:?}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user