remove veilid-wasm project, too out of date

refactor state updates and formalize a VeilidState object
work on veilid-flutter api
This commit is contained in:
John Smith
2022-01-18 12:33:14 -05:00
parent e39835d51f
commit 1b6864bf22
36 changed files with 512 additions and 3963 deletions
+6 -22
View File
@@ -7,27 +7,14 @@ use crate::xx::*;
cfg_if! {
if #[cfg(target_arch = "wasm32")] {
pub type StateChangeCallback = Arc<dyn Fn(VeilidStateChange) -> SystemPinBoxFuture<()>>;
pub type UpdateCallback = Arc<dyn Fn(VeilidUpdate) -> SystemPinBoxFuture<()>>;
} else {
pub type StateChangeCallback = Arc<dyn Fn(VeilidStateChange) -> SystemPinBoxFuture<()> + Send + Sync>;
pub type UpdateCallback = Arc<dyn Fn(VeilidUpdate) -> SystemPinBoxFuture<()> + Send + Sync>;
}
}
#[derive(Debug)]
pub enum VeilidStateChange {
Attachment {
old_state: AttachmentState,
new_state: AttachmentState,
},
}
#[derive(Debug)]
pub enum VeilidState {
Attachment(AttachmentState),
}
pub struct VeilidCoreSetup {
pub state_change_callback: StateChangeCallback,
pub update_callback: UpdateCallback,
pub config_callback: ConfigCallback,
}
@@ -139,16 +126,13 @@ impl VeilidCore {
// Set up attachment manager
trace!("VeilidCore::internal_startup init attachment manager");
let cb = setup.state_change_callback;
let cb = setup.update_callback;
let attachment_manager =
AttachmentManager::new(config.clone(), table_store.clone(), crypto.clone());
attachment_manager
.init(Arc::new(
move |old_state: AttachmentState, new_state: AttachmentState| {
cb(VeilidStateChange::Attachment {
old_state,
new_state,
})
move |_old_state: AttachmentState, new_state: AttachmentState| {
cb(VeilidUpdate::Attachment(new_state))
},
))
.await?;