2022-01-11 22:23:19 +08:00
|
|
|
use crate::{entities::NetworkState, ws::connection::FlowyWebSocketConnect};
|
2021-12-14 15:31:44 +08:00
|
|
|
use flowy_error::FlowyError;
|
2022-02-25 22:27:44 +08:00
|
|
|
use lib_dispatch::prelude::{AppData, Data};
|
2021-12-14 15:31:44 +08:00
|
|
|
use std::sync::Arc;
|
|
|
|
|
|
|
|
#[tracing::instrument(skip(data, ws_manager))]
|
2021-12-26 19:10:37 +08:00
|
|
|
pub async fn update_network_ty(
|
|
|
|
data: Data<NetworkState>,
|
2022-02-25 22:27:44 +08:00
|
|
|
ws_manager: AppData<Arc<FlowyWebSocketConnect>>,
|
2021-12-26 19:10:37 +08:00
|
|
|
) -> Result<(), FlowyError> {
|
2021-12-14 15:31:44 +08:00
|
|
|
let network_state = data.into_inner();
|
|
|
|
ws_manager.update_network_type(&network_state.ty);
|
|
|
|
Ok(())
|
|
|
|
}
|