AppFlowy/frontend/rust-lib/flowy-net/src/handlers/mod.rs
Nathan.fooo 6bb1c4e89c
feat: run rustfmt with custom defined fmt configuration (#1848)
* chore: update rustfmt

* chore: apply rustfmt format
2023-02-13 09:29:49 +08:00

16 lines
547 B
Rust

use crate::entities::NetworkStatePB;
use flowy_client_ws::{FlowyWebSocketConnect, NetworkType};
use flowy_error::FlowyError;
use lib_dispatch::prelude::{AFPluginData, AFPluginState};
use std::sync::Arc;
#[tracing::instrument(level = "debug", skip(data, ws_manager))]
pub async fn update_network_ty(
data: AFPluginData<NetworkStatePB>,
ws_manager: AFPluginState<Arc<FlowyWebSocketConnect>>,
) -> Result<(), FlowyError> {
let network_type: NetworkType = data.into_inner().ty.into();
ws_manager.update_network_type(network_type);
Ok(())
}