mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
refactor: rename flowy-dispatch structs
This commit is contained in:
@ -4,10 +4,10 @@ use lib_dispatch::prelude::*;
|
||||
use std::sync::Arc;
|
||||
use strum_macros::Display;
|
||||
|
||||
pub fn create(ws_conn: Arc<FlowyWebSocketConnect>) -> Module {
|
||||
Module::new()
|
||||
pub fn init(ws_conn: Arc<FlowyWebSocketConnect>) -> AFPlugin {
|
||||
AFPlugin::new()
|
||||
.name("Flowy-Network")
|
||||
.data(ws_conn)
|
||||
.state(ws_conn)
|
||||
.event(NetworkEvent::UpdateNetworkType, update_network_ty)
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
use crate::{entities::NetworkState, ws::connection::FlowyWebSocketConnect};
|
||||
use flowy_error::FlowyError;
|
||||
use lib_dispatch::prelude::{AppData, Data};
|
||||
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: Data<NetworkState>,
|
||||
ws_manager: AppData<Arc<FlowyWebSocketConnect>>,
|
||||
data: AFPluginData<NetworkState>,
|
||||
ws_manager: AFPluginState<Arc<FlowyWebSocketConnect>>,
|
||||
) -> Result<(), FlowyError> {
|
||||
let network_state = data.into_inner();
|
||||
ws_manager.update_network_type(&network_state.ty);
|
||||
|
Reference in New Issue
Block a user