2023-01-30 11:11:19 +08:00
|
|
|
use crate::handlers::*;
|
|
|
|
use flowy_client_ws::FlowyWebSocketConnect;
|
2022-02-16 10:00:31 +08:00
|
|
|
use flowy_derive::{Flowy_Event, ProtoBuf_Enum};
|
|
|
|
use lib_dispatch::prelude::*;
|
|
|
|
use std::sync::Arc;
|
|
|
|
use strum_macros::Display;
|
|
|
|
|
2022-12-01 08:35:50 +08:00
|
|
|
pub fn init(ws_conn: Arc<FlowyWebSocketConnect>) -> AFPlugin {
|
2023-02-13 09:29:49 +08:00
|
|
|
AFPlugin::new()
|
|
|
|
.name("Flowy-Network")
|
|
|
|
.state(ws_conn)
|
|
|
|
.event(NetworkEvent::UpdateNetworkType, update_network_ty)
|
2022-02-16 10:00:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Copy, PartialEq, Eq, Debug, Display, Hash, ProtoBuf_Enum, Flowy_Event)]
|
|
|
|
#[event_err = "FlowyError"]
|
|
|
|
pub enum NetworkEvent {
|
2023-02-13 09:29:49 +08:00
|
|
|
#[event(input = "NetworkStatePB")]
|
|
|
|
UpdateNetworkType = 0,
|
2022-02-16 10:00:31 +08:00
|
|
|
}
|